MCP Prompts

June 1, 2026 · View on GitHub

This project is a TypeScript 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 mcp-tools project, and the MCP App weather sample is in mcp-weather-app.

Prompts included

PromptFileDescription
code_review_checklistsrc/functions/codeReviewChecklist.tsReturns a structured code review checklist. No arguments
summarize_contentsrc/functions/summarizeContent.tsSummarizes a body of text
generate_documentationsrc/functions/generateDocumentation.tsGenerates documentation for code

Prerequisites

Prepare your local environment

Start Azurite, the Azure Storage emulator required by the Functions host:

docker run -d -p 10000:10000 -p 10001:10001 -p 10002:10002 \
    mcr.microsoft.com/azure-storage/azurite

If you use the Azurite VS Code extension instead, run Azurite: Start from the command palette.

Run locally

From this directory (mcp-prompts/), start the Functions host:

func start

The MCP endpoint will be available at http://localhost:7071/runtime/webhooks/mcp.

Connect to the MCP server

Option A: VS Code with GitHub Copilot

  1. Open .vscode/mcp.json in the workspace root. Find the server called local-mcp-function and click Start above the name. It points to:

    http://localhost:7071/runtime/webhooks/mcp
    
  2. Once connected, prompts appear as / slash commands in the Chat panel. Type / to see them, prefixed with the server name:

    /mcp.local-mcp-function.code_review_checklist
    /mcp.local-mcp-function.summarize_content
    /mcp.local-mcp-function.generate_documentation
    
  3. Select a prompt. If it has arguments, VS Code will ask you to fill them in.

Option B: MCP Inspector

  1. In a new terminal, install and run MCP Inspector:

    npx @modelcontextprotocol/inspector
    
  2. Open the Inspector URL (e.g. http://0.0.0.0:5173/#resources).

  3. Set the transport type to HTTP.

  4. Set the URL to http://0.0.0.0:7071/runtime/webhooks/mcp and click Connect.

  5. Click List Prompts, select a prompt, and Run Prompt.

Deploy to Azure

Step 1: Sign in

az login
azd auth login

Step 2: Create an environment

azd env new <environment-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:

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.

By default, OAuth-based authentication is enabled using the built-in MCP auth feature with Microsoft Entra as the identity provider. VS Code will prompt you to sign in with your Microsoft account. Sign in with the same account you used to deploy the app.

Tip: A successful connection shows the number of prompts the server exposes. Click More... → Show Output above the server name to see request/response details.

Redeploy and clean up

  • Redeploy: azd deploy
  • Clean up all resources: azd down

Examining the code

Each prompt is a function with an app.mcpPrompt registration. Here's how to define a new prompt:

import { app, PromptInvocationContext, InvocationContext } from '@azure/functions';

app.mcpPrompt('myPrompt', {
    promptName: 'my_prompt',
    title: 'Human-friendly title',
    description: 'What this prompt does.',
    promptArguments: [
        { name: 'topic', description: 'Subject matter', required: true },
    ],
    handler: (prompt: PromptInvocationContext, ctx: InvocationContext) => {
        return {
            description: 'Describe the topic in one paragraph.',
            messages: [
                {
                    role: 'user',
                    content: { type: 'text', text: `Describe: ${prompt.arguments.topic}` },
                },
            ],
        };
    },
});

Troubleshooting

ProblemSolution
Prompts not showing in VS CodeEnsure the server is started in MCP: List Servers and that you're using agent mode in Chat
403 error or "Cannot force new registration for a non-dynamic authentication provider"Ensure host.json has extensions.mcp.system.webhookAuthorizationLevel set to "Anonymous". Without this, EasyAuth validates the token but the Functions host still requires a system key — resulting in 403. Also verify that VS Code's client ID (aebc6443-996d-45c2-90f0-388ff96faa56) is in the allowedApplications list in EasyAuth config.

Next Steps