Build the Docker Image
First, clone the repository and build the Docker image:- Build stage: Uses
node:lts-alpineto compile TypeScript - Production stage: Creates a minimal production image with only necessary dependencies
- Health check: Automatically monitors the service when running in HTTP mode
Transport Modes
Stdio Mode (Default)
Stdio mode is ideal for MCP clients like Claude Desktop, VS Code, Cursor, and other desktop applications.- Direct process communication via stdin/stdout
- Interactive mode with
-itflag - Automatically removed after exit with
--rm
HTTP Mode
HTTP mode exposes the server via HTTP/HTTPS, supporting both modern Streamable HTTP (MCP 2025-03-26) and legacy SSE (MCP 2024-11-05) protocols.- POST /mcp - Client-to-server requests
- GET /mcp - Server-to-client notifications
- DELETE /mcp - Session termination
- GET /health - Health check endpoint
- GET /sse - Legacy SSE stream (backwards compatibility)
- POST /messages - Legacy client messages
- Internal port:
3000(fixed) - External port: Configurable via
-pflag (e.g.,-p 8080:3000)
Docker Compose Deployment
For production deployments, use the provideddocker-compose.yml:
Start the HTTP Service
Environment Variables
Create a.env file in the same directory as docker-compose.yml:
MCP Client Configuration
Stdio Mode (Claude Desktop, VS Code, etc.)
Add this to your MCP client configuration (e.g.,claude_desktop_config.json):
Note the
-i flag (not -it) in the args array - MCP clients handle the tty, so only stdin needs to be open.HTTP Mode (Web Applications)
First, start the HTTP server using Docker Compose or manual Docker command. Then connect your application tohttp://localhost:3000/mcp.
Modern MCP clients automatically use the Streamable HTTP endpoints, while legacy clients connect using the SSE endpoints at /sse and /messages.
Health Check and Monitoring
The Docker image includes a built-in health check for HTTP mode:Check Container Health
View Logs
Production Best Practices
Use Docker Compose
Always use Docker Compose for production deployments:- Manages service lifecycle
- Handles automatic restarts
- Simplifies configuration with
.envfiles - Provides networking isolation
Secure Environment Variables
Resource Limits
Add resource limits to prevent overconsumption:Enable Logging
Configure logging drivers for centralized log management:Network Security
For HTTP mode in production:- Use HTTPS: Place behind a reverse proxy (nginx, Traefik)
- Firewall rules: Restrict access to authorized clients only
- API key rotation: Regularly rotate
DOKPLOY_API_KEY
Update Strategy
Next Steps
- Learn about Local Development for contributing
- Check Troubleshooting if you encounter issues
- Explore all 67 available tools for Dokploy management