Remote MCP with Azure Functions
A quickstart template for building and deploying secure, remote MCP servers to the cloud using Azure Functions and Node.js/TypeScript. It features integrated blob storage for snippet management and supports advanced security options like OAuth and VNET isolation.
README
Prerequisites
- Node.js version 18 or higher
- Azure Functions Core Tools >=
4.0.7030 - Azure Developer CLI
- Visual Studio Code (recommended)
- Azure Functions extension
- GitHub Copilot (optional, for testing with Copilot Chat)
Prepare your local environment
- Clone or navigate to your project directory
- Install dependencies:
npm install
Available MCP Tools
This MCP server provides three tools for managing project contributions:
list_projects- Enumerate all projects with contribution counts and team member informationget_contributions- Filter and retrieve contributions by project name or team memberadd_contribution- Record a new contribution with project, member, summary, and optional attachments
Run your MCP Server locally from the terminal
-
Install dependencies (if not already done)
npm install -
Build the project
npm run build -
Start the Functions host locally:
func start
The local MCP endpoint will be available at: http://0.0.0.0:7071/runtime/webhooks/mcp
Note: In Azure, the endpoint includes authentication:
/runtime/webhooks/mcp?code=<system_key>
Test the MCP Server locally
Using MCP Inspector
-
In a new terminal window, install and run MCP Inspector
npx @modelcontextprotocol/inspector node build/index.js -
CTRL+Click the displayed URL (typically
http://0.0.0.0:5173/#resources) to open MCP Inspector -
Set the transport type to
http -
Set the URL to your local MCP endpoint:
http://0.0.0.0:7071/runtime/webhooks/mcp -
Click Connect and then List Tools to see all available tools
-
Test each tool by clicking it and providing sample parameters:
- list_projects - No parameters needed, returns all projects
- get_contributions - Optional: filter by
project_nameorauthor_name - add_contribution - Required:
MemberId,ProjectId,Summary,Description; Optional:AttachmentUrl
When finished, press Ctrl+C in both terminal windows to stop the processes.
Using VS Code GitHub Copilot
- Start the Functions host locally (as shown above)
- In VS Code, open the Chat panel with GitHub Copilot
- Ask Copilot to use the MCP tools:
List all the projects we haveShow me all contributions from Marcus ThorneAdd a new contribution to the Sorsogon Community Innovation Labs project - When prompted, click Continue to allow the tool execution
- Copilot will execute the MCP tool and display the results
Deploy to Azure for Remote MCP
Optionally, enable VNet for additional network isolation before deployment:
azd env set VNET_ENABLED true
Run these azd commands to provision Azure resources and deploy your code:
azd provision
Wait a few minutes for access permissions to take effect, then deploy:
azd deploy
This will:
- Create an Azure Function App with your MCP server
- Set up all required infrastructure (App Service plan, Storage, etc.)
- Deploy your TypeScript code to Azure
- Configure the MCP system key for secure access
Note API Management and App Service built-in authentication can be used for enhanced security and OAuth provider integration.
Get your MCP System Key
After azd deploy completes, you need the MCP system key to authenticate requests.
Option 1: Get from Azure CLI (Recommended)
# Get your function app name from azd
FUNCTION_APP_NAME=$(azd env get-values | grep AZURE_FUNCTION_APP_NAME | cut -d'=' -f2)
RESOURCE_GROUP=$(azd env get-values | grep AZURE_RESOURCE_GROUP | cut -d'=' -f2)
# Retrieve the mcp_extension system key
MCP_KEY=$(az functionapp keys list \
--resource-group $RESOURCE_GROUP \
--name $FUNCTION_APP_NAME \
--query "systemKeys.mcp_extension" -o tsv)
echo "MCP Extension Key: $MCP_KEY"
Option 2: Get from Azure Portal
- Go to Azure Portal
- Search for your Function App (name from
azd env get-values) - Navigate to Functions → App Keys
- Copy the
mcp_extensionkey from the System Keys section
Connect to your remote MCP server in Azure
After deployment, your MCP server is accessible at:
https://<funcappname>.azurewebsites.net/runtime/webhooks/mcp?code=<your-mcp-extension-system-key>
Example with actual values:
https://mcp-scil-aegccgcze5bsdkez.azurewebsites.net/runtime/webhooks/mcp?code=X9kL2mN5pQ8rT3vW6xY1zA4bC7dE0fG9hI2jK5mL8nO1pR4sT7uV0wX3yZ6aB9cD==
Test in MCP Inspector
Use the key in the URL:
https://<funcappname>.azurewebsites.net/runtime/webhooks/mcp?code=<your-mcp-extension-system-key>
Connect in Azure AI Foundry
- Go to Azure AI Foundry
- Create or open your AI project
- Navigate to Tools → MCP Servers
- Add your remote MCP server with:
- URL:
https://<funcappname>.azurewebsites.net/runtime/webhooks/mcp - Headers:
x-functions-key: <your-mcp-extension-system-key>
- URL:
- Your AI models can now call the
list_projects,get_contributions, andadd_contributiontools
Configure Agent with Context
To help your AI agent understand how to use the MCP tools effectively:
-
Create a new Agent in your project
-
In the Configuration panel, set:
- Display name: "Contribution Manager"
- Description:
A contribution tracking assistant that helps manage project contributions across the Sorsogon Community Innovation Labs ecosystem. I can help you: - List all available projects and see who's contributing - Search for specific contributions by project or team member - Record new contributions with details like summary, description, and attachments Use me to track community engagement, project progress, and team member activities. - Starter prompts (optional examples):
- "List all projects and show me the contribution counts"
- "Show me all contributions from Marcus Thorne"
- "Add a new contribution to the Sorsogon Community Innovation Labs project"
-
Enable the MCP tools in your agent's Tools configuration
-
Test the agent with your starter prompts
Connect in VS Code GitHub Copilot
Set up in your mcp.json:
{
"inputs": [
{
"type": "promptString",
"id": "functions-mcp-extension-system-key",
"description": "Azure Functions MCP Extension System Key",
"password": true
},
{
"type": "promptString",
"id": "functionapp-name",
"description": "Azure Function App Name"
}
],
"servers": {
"remote-mcp-function": {
"type": "http",
"url": "https://${input:functionapp-name}.azurewebsites.net/runtime/webhooks/mcp",
"headers": {
"x-functions-key": "${input:functions-mcp-extension-system-key}"
}
}
}
}
Redeploy your code updates
After making changes to your MCP tools or handlers, rebuild and redeploy:
npm run build
azd deploy
Note: Your function app code is always updated with the latest deployment package. No manual file replacement needed.
Clean up resources
When you're done working with your function app and related resources, you can use this command to delete the function app and its related resources from Azure and avoid incurring any further costs:
azd down
Source Code Structure
The MCP server is organized with Azure Functions' native decorator pattern:
src/
├── index.ts # Entry point - imports all tools
├── functions/
│ ├── data/
│ │ └── contributionData.ts # Shared mock data (projects, contributions, members)
│ └── tools/
│ ├── listProjectsTool.ts # list_projects MCP tool handler
│ ├── addContributionTool.ts # add_contribution MCP tool handler
│ └── getContributionsTool.ts# get_contributions MCP tool handler
Next Steps
- Enhance Functionality: Add more tools for project management or analytics
- Persist Data: Replace in-memory mock data with a database (Cosmos DB, SQL, etc.)
- Add Security: Enable Azure API Management or App Service authentication
- Enable VNet: Use
azd env set VNET_ENABLED truefor network isolation - Monitor & Log: Check Azure Application Insights for tool usage patterns
- Scale: Optimize performance with higher tier App Service plans
- Learn more: Explore MCP documentation and Azure Functions with MCP
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
E2B
Using MCP to run code via e2b.