Getting Started with Remote MCP Servers using Azure Container Apps (Node.js/TypeScript)
@Azure-Samples
This is a quick start guide that provides the basic building blocks to set up a remote Model Context Protocol (MCP) server using Azure Container Apps. The MCP server is built using Node.js and TypeScript, and it can be used to run various tools and services in a serverless enviro
概览
What is Getting Started with Remote MCP Servers using Azure Container Apps (Node.js/TypeScript)?
This is a quick start guide that provides the basic building blocks to set up a remote Model Context Protocol (MCP) server using Azure Container Apps, built with Node.js and TypeScript. It implements a multi-layered security architecture combining JWT-based authentication with role-based access control (RBAC) to secure MCP server endpoints and tools. The server runs tools in a serverless environment and stores state in an in-memory SQLite database.
How to use Getting Started with Remote MCP Servers using Azure Container Apps (Node.js/TypeScript)?
To run locally, clone the repo, run npm install, generate a JWT token with npm run generate-token -- --admin (or with --user or --readonly flags), and start the dev server with npm run dev. To deploy to Azure, install the Azure Developer CLI, run azd auth login, then azd up. After deployment, the MCP server URL is provided in the output. Use the provided .vscode/mcp.json configuration or the client examples in the examples/ directory to connect and use the server.
Key features of Getting Started with Remote MCP Servers using Azure Container Apps (Node.js/TypeScript)
- Fully managed, serverless container platform with Azure Container Apps
- Autoscaling – scales to zero when idle, scales out with usage
- Pay-per-second billing – only pay for compute used
- JWT authentication with role-based access control (admin, user, readonly)
- In-memory SQLite database for tool state storage
- Tools include add_todo, list_todos, complete_todo, delete_todo
Use cases of Getting Started with Remote MCP Servers using Azure Container Apps (Node.js/TypeScript)
- Deploy a remote MCP server in a serverless environment to expose tools to LLMs
- Demo a multi-layered security architecture for MCP server endpoints and tools
- Run MCP tools with autoscaling and pay-per-second billing on Azure Container Apps
- Use as a starting point for building production-ready remote MCP servers
FAQ from Getting Started with Remote MCP Servers using Azure Container Apps (Node.js/TypeScript)
What are the prerequisites to run this project?
You need VS Code, GitHub Copilot and GitHub Copilot Chat extensions. For local run, you need git, Node.js (>=22), and npm. For Azure deployment, you need the Azure Developer CLI and an Azure account.
How do I generate a JWT token and what roles are available?
Run npm run generate-token with the flags --admin, --user, or --readonly to generate a token with corresponding permissions (admin, user, or readonly). The token is appended to the .env file. In production, use a more secure method for managing secrets.
Where is data stored and what database is used?
When the server starts, it creates an in-memory SQLite database. This database stores the state of tools and their interactions with the MCP server.
How do I clean up deployed resources after testing?
Run azd down --purge --force to remove and clean up all deployed resources and avoid incurring any costs.
What transport and authentication does the server use?
The server uses Streamable HTTP (authenticated) transport. Authentication is handled via JWT tokens, and authorization is role-based (RBAC) with admin, user, and readonly roles.