Skip to main content
Run a built mcp-use server in Docker when you want to operate the server on your own infrastructure. Your platform is responsible for TLS, a public domain, authentication, and routing requests to the container.

Prerequisites

  • Docker installed locally, or a container platform that can build and run a Docker image.
  • An mcp-use server that exports its MCPServer instance as the default export.
  • An npm lockfile (package-lock.json).
The generated mcp-server template already has the required build and start scripts. mcp-use start serves the production build at .mcp-use/build/.

Create a Dockerfile

Add this Dockerfile at the project root:
HOST=0.0.0.0 lets the container receive traffic through Docker’s network. PORT can be changed to the port required by your container platform. Add a .dockerignore so the build context excludes local and secret files:

Build and run locally

Build the image and publish the container port locally:
The MCP endpoint is available at:
Verify it with the bundled client:

Deploy the image

Push the image to your container registry, then configure your container platform to run it. Set its public URL in MCP_URL and supply application secrets through the platform’s secret manager rather than baking them into the image.
Configure the platform’s health check and reverse proxy to forward requests to the same /mcp path. Terminate TLS at your platform or reverse proxy and use the resulting HTTPS URL in every MCP client.