Skip to main content
Deploying your MCP server lets others access its tools and resources beyond your local machine. Depending on your requirements for scalability, reliability, and ease of management, you can choose from local execution, containerized deployment, or a fully managed cloud service.

Learning objectives

By the end of this lesson you will be able to:
  • Evaluate different deployment strategies for MCP servers
  • Run an MCP server locally for end-user distribution
  • Deploy an MCP server to Azure Container Apps

Deployment strategies

Local

Distribute the server binary or source code. Users run it on their own machines. Best for developer tools and CLI integrations.

Containers

Package the server as a Docker image. Deploy to any container runtime — Docker Desktop, Kubernetes, or a cloud container service.

Cloud

Use a managed cloud service like Azure Container Apps, AWS ECS, or Google Cloud Run. Best for multi-user or always-on scenarios.

Local deployment

If your server is meant to run on users’ machines:
1

Distribute the server

Share the server source code, a compiled binary, or a package on npm/PyPI.
2

Start the server process

The user (or a host application like VS Code) runs the server:
# stdio server (no networking needed)
node build/index.js

# or Python
python server.py
3

Connect a client

For HTTP-based servers, configure the client with a local URL:
http://localhost:3000
For stdio servers, the client starts the server as a subprocess automatically.
For stdio servers, no networking configuration is needed. The client manages the server process lifecycle.

Azure Container Apps deployment

Azure Container Apps is a fully managed serverless container platform that works well for MCP servers.
1

Clone the sample

git clone https://github.com/anthonychu/azure-container-apps-mcp-sample.git
cd azure-container-apps-mcp-sample
2

Test locally

uv venv
uv sync

# Linux/macOS
export API_KEYS=<your_api_key>

# Windows
set API_KEYS=<your_api_key>

uv run fastapi dev main.py
Create .vscode/mcp.json to connect VS Code to the local server:
{
  "inputs": [
    {
      "type": "promptString",
      "id": "weather-api-key",
      "description": "Weather API Key",
      "password": true
    }
  ],
  "servers": {
    "weather-sse": {
      "type": "sse",
      "url": "http://localhost:8000/sse",
      "headers": {
        "x-api-key": "${input:weather-api-key}"
      }
    }
  }
}
Click the play icon in the JSON file. You should see server tools picked up by GitHub Copilot.
3

Deploy to Azure Container Apps

Make sure you have the Azure CLI installed and are logged in.
az containerapp up \
  -g <RESOURCE_GROUP_NAME> \
  -n weather-mcp \
  --environment mcp \
  -l westus \
  --env-vars API_KEYS=<your_api_key> \
  --source .
Azure Container Apps builds the container image, pushes it to a registry, and deploys it. The command returns a public URL for your server.

Other cloud options

PlatformNotes
Azure FunctionsServerless; good for infrequent workloads. See Remote MCP with Azure Functions.
AWS ECS / FargateManaged container service; similar workflow to Azure Container Apps.
Google Cloud RunFully managed; scales to zero.
KubernetesHigh availability and fine-grained control; more operational overhead.

Additional resources

Azure Functions + MCP

Deploy a .NET MCP server as an Azure Function.

Azure Container Apps blog post

Detailed walkthrough of hosting MCP servers in Azure Container Apps.

Azure Container Apps MCP sample

Reference implementation used in this lesson.

Build Agents with MCP on Azure

End-to-end guide for building agents using MCP on Azure.

Key takeaways

  • Choose local deployment for developer tools and CLI integrations; choose cloud for always-on, multi-user scenarios.
  • For stdio servers, no port configuration is needed — the client manages the process.
  • Azure Container Apps provides a straightforward path from local testing to cloud deployment with a single az containerapp up command.
  • Serverless options (Azure Functions, Cloud Run) are ideal for infrequent workloads that benefit from scale-to-zero.

Build docs developers (and LLMs) love