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-useserver that exports itsMCPServerinstance as the default export. - An npm lockfile (
package-lock.json).
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 thisDockerfile 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:Deploy the image
Push the image to your container registry, then configure your container platform to run it. Set its public URL inMCP_URL and supply application
secrets through the platform’s secret manager rather than baking them into the
image.
/mcp path. Terminate TLS at your platform or reverse proxy and use
the resulting HTTPS URL in every MCP client.