FunctionsMcpPrompts
May 26, 2026 · View on GitHub
This project is a Python Azure Function app that exposes MCP (Model Context Protocol) prompts as a remote MCP server. Prompts are reusable prompt templates that MCP clients can discover and invoke, optionally with arguments.
Note: MCP tools are in the FunctionsMcpTool project.
Prompts included
| Prompt | Arguments | Description |
|---|---|---|
code_review_checklist | (none) | Returns a structured code review checklist for evaluating code changes. |
summarize_content | topic (required), audience (optional) | Generates a summarization prompt tailored to a given topic and audience. |
generate_documentation | function_name (optional), style (optional) | Generates API documentation for a function. |
Key concepts
- Simple prompts (like
code_review_checklist) take no arguments and return static prompt text. - Parameterized prompts use
prompt_argumentsto accept arguments from the client. - Prompts can define arguments as required or optional, and read them from
context.arguments.
Prerequisites
- Python version 3.13 or higher
- Azure Functions Core Tools >=
4.8.0 azure-functionsPython package version 2.2.0b2 or greater (pre-release)
Important: This project uses the preview extension bundle (
Microsoft.Azure.Functions.ExtensionBundle.Preview) configured inhost.json. Theazure-functionsPython package must also be version2.2.0b2+to expose themcp_prompt_triggerdecorator.
Run locally
1. Start Azurite
An Azure Storage Emulator is needed for the function app to run locally:
docker run -p 10000:10000 -p 10001:10001 -p 10002:10002 \
mcr.microsoft.com/azure-storage/azurite
Note: If using the Azurite VS Code extension, run
Azurite: Startfrom the command palette.
2. Install Dependencies
Create and activate a virtual environment, then install dependencies:
python3 -m venv .venv
# macOS/Linux
source .venv/bin/activate
# Windows
.venv\Scripts\activate
pip install -r requirements.txt
3. Start the Functions host
func start
The MCP endpoint will be available at http://localhost:7071/runtime/webhooks/mcp.
Using the MCP Server
Connect from VS Code - GitHub Copilot
- Open .vscode/mcp.json
- Find the server called
local-mcp-functionand click Start. The server uses the endpoint:http://localhost:7071/runtime/webhooks/mcp - In Copilot chat agent mode, access prompts using the slash command format:
/mcp.local-mcp-function.code_review_checklist/mcp.local-mcp-function.summarize_content/mcp.local-mcp-function.generate_documentation
For remote servers, replace the server name accordingly (e.g., /mcp.remote-mcp-function.code_review_checklist).
Connect from MCP Inspector
- Install and run MCP Inspector:
npx @modelcontextprotocol/inspector - Open the URL displayed (e.g., http://0.0.0.0:5173/#resources)
- Set transport type to
Streamable HTTP - Set URL to
http://0.0.0.0:7071/runtime/webhooks/mcpand Connect - List Prompts, select a prompt, and Get Prompt
Deploy to Azure
Step 1: Sign in
az login
azd auth login
Step 2: Create an environment
azd env new <environment-name>
This also becomes the resource group name.
Step 3: Provision and deploy
By default, OAuth-based authentication is enabled using the built-in MCP auth feature with Microsoft Entra as the identity provider.
Configure VS Code as an allowed client application for Microsoft Entra:
azd env set PRE_AUTHORIZED_CLIENT_IDS aebc6443-996d-45c2-90f0-388ff96faa56
Optionally enable VNet isolation:
azd env set VNET_ENABLED true
Deploy the project. When prompted, pick your subscription and an Azure region.
azd up
Step 4: Connect to the remote MCP server
Open .vscode/mcp.json and click Start above remote-mcp-function. You'll be prompted for functionapp-name — find it in your azd command output or the .azure/<env>/.env file. Since authentication is enabled, you'll also be prompted to sign in with Microsoft.
Redeploy and clean up
- Redeploy:
azd deploy - Clean up all resources:
azd down
Examining the code
Prompts are defined in function_app.py. Each prompt is a Python function with the @app.mcp_prompt_trigger decorator:
@app.mcp_prompt_trigger(
arg_name="context",
prompt_name="summarize_content",
prompt_arguments=[
func.PromptArgument("topic", "The topic or content to summarize.", required=True),
func.PromptArgument("audience", "Target audience (e.g., 'executive', 'developer', 'beginner').", required=False)
],
description="Generates a summarization prompt tailored to a given topic and audience."
)
def summarize_content(context: func.PromptInvocationContext) -> str:
topic = context.arguments.get("topic", "")
audience = context.arguments.get("audience")
# Returns a formatted prompt string
The prompt_arguments parameter defines the arguments that MCP clients see when they list available prompts.