Deploying your MCP server enables others to access its tools and resources beyond your local setup. There are multiple deployment strategies depending on your needs for scalability, reliability, and ease of management. Below you’ll find guidance on deploying MCP servers locally, in containers, and to the cloud.
This lesson explains how to deploy your MCP Server app.
By the end of this lesson, you will be able to:
- Assess different deployment methods.
- Deploy your app.
If your server is intended to run on users' machines, you can follow these steps:
- Download the server. If you didn’t write the server, download it first to your machine.
- Start the server process: Launch your MCP server application.
For SSE (not required for stdio type server):
- Configure networking: Make sure the server is accessible on the expected port.
- Connect clients: Use local connection URLs like
http://localhost:3000.
MCP servers can be deployed on various cloud platforms:
- Serverless Functions: Deploy lightweight MCP servers as serverless functions.
- Container Services: Use services like Azure Container Apps, AWS ECS, or Google Cloud Run.
- Kubernetes: Deploy and manage MCP servers in Kubernetes clusters for high availability.
Azure Container Apps support deploying MCP Servers. This feature is still evolving and currently supports SSE servers.
Here’s how to do it:
- Clone a repo:
git clone https://github.com/anthonychu/azure-container-apps-mcp-sample.git- Run it locally to test:
uv venv
uv sync
# linux/macOS
export API_KEYS=<AN_API_KEY>
# windows
set API_KEYS=<AN_API_KEY>
uv run fastapi dev main.py- To test locally, create a mcp.json file in a .vscode folder and add the following content:
{
"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}"
}
}
}
}Once the SSE server is running, click the play icon in the JSON file. You should now see the server’s tools picked up by GitHub Copilot, indicated by the Tool icon.
- To deploy, run the following command:
az containerapp up -g <RESOURCE_GROUP_NAME> -n weather-mcp --environment mcp -l westus --env-vars API_KEYS=<AN_API_KEY> --source .That’s it — deploy locally or to Azure by following these steps.
- Next: Practical Implementation
Penafian:
Dokumen ini telah diterjemahkan menggunakan perkhidmatan terjemahan AI Co-op Translator. Walaupun kami berusaha untuk ketepatan, sila ambil perhatian bahawa terjemahan automatik mungkin mengandungi kesilapan atau ketidaktepatan. Dokumen asal dalam bahasa asalnya hendaklah dianggap sebagai sumber yang sahih. Untuk maklumat penting, terjemahan profesional oleh manusia adalah disyorkan. Kami tidak bertanggungjawab atas sebarang salah faham atau tafsiran yang salah yang timbul daripada penggunaan terjemahan ini.