home / mcp / remote mcp functions mcp server
This is a quickstart template to easily build and deploy a custom remote MCP server to the cloud using Azure functions. You can clone/restore/run on your local machine with debugging, and azd up to have it in the cloud in a couple minutes. The MCP server is secured by design.
Configuration
View docs{
"mcpServers": {
"azure-samples-remote-mcp-functions-typescript": {
"url": "https://<funcappname>.azurewebsites.net/runtime/webhooks/mcp"
}
}
}You can run a remote MCP server in the cloud with Azure Functions or test locally on your machine. This setup supports HTTP remote access and an local, testable runtime, letting you connect MCP clients and tools to either environment with secure keys and optional OAuth/networking options.
Connect your MCP client to either the remote HTTP endpoint or the local Functions runtime. For the remote server, you will use the hosted endpoint and a system key to authorize requests. For local testing, you will run the Functions host on your machine and point your client to the local MCP endpoint. Use the following two modes to interact with the MCP server:
Prerequisites you need before installing and running the MCP server:
Node.js version 18 or higher
Azure Functions Core Tools >= 4.0.7030
Azure Developer CLI
Optional: Visual Studio Code with Azure Functions extension for local debugging
Optional: Docker to run Azurite, the Azure Storage Emulator for local blob storage
Follow these steps to run locally and then deploy to Azure:
# 1) Start the local storage emulator (Azurite) in a separate terminal
# (optional, for local blob storage)
docker run -p 10000:10000 -p 10001:10001 -p 10002:10002 \
mcr.microsoft.com/azure-storage/azurite
# 2) Install dependencies for the MCP server
npm install
# 3) Build the project
npm run build
# 4) Start the Functions host locally
func startYou can connect to a remote MCP server hosted in Azure Functions via the following endpoint. You also obtain a system key named mcp_extension to authorize calls. Use the function app URL with the MCP path and include your key in the request headers or URL as shown.
# Remote HTTP MCP endpoint (example)
https://<funcappname>.azurewebsites.net/runtime/webhooks/mcpRun the local Functions host and point your client to the local MCP endpoint. The local endpoint is typically http://0.0.0.0:7071/runtime/webhooks/mcp when running via the Functions host.
# Local endpoint when running the Functions host locally
http://0.0.0.0:7071/runtime/webhooks/mcpYou can redeploy updates to the remote MCP server using the deployment tool. Each deployment overwrites the deployed code package to ensure the latest changes are active.
azd deployWhen you are finished, remove all resources to avoid ongoing costs. This deletes the function app and related resources from Azure.
azd downIf you use Copilot in VS Code to work with MCP, you can configure a remote server entry with the hosted endpoint and the system key. The example below shows how to reference the remote endpoint and include the system key in requests.
{
"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 Functions 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}"
}
},
"local-mcp-function": {
"type": "http",
"url": "http://0.0.0.0:7071/runtime/webhooks/mcp"
}
}
}The remote MCP endpoint requires a system key for access. Use the key from the Azure portal or your deployment CLI to authorize calls. Consider enabling API Management or built-in auth for enhanced security, and enable VNET isolation if needed.
Connect to the remote MCP server from your client using the hosted endpoint, or run the local server for testing. You can extend security with API Management, add built-in authentication, and opt into VNET for network isolation as your use case requires.
The MCP server can expose several tools to operate on snippets and strings. Example tools include a simple hello function, a getSnippet tool to retrieve stored snippets, and a saveSnippet tool to persist new snippets. Each tool has a defined handler to process input and return results.
Simple hello world MCP Tool that responds with a hello message.
Retrieves a snippet by name from blob storage and returns its content.
Saves a snippet to blob storage with a given name and content.