Security
HTTPS Configuration
Always use HTTPS in production to encrypt traffic:1
Obtain SSL Certificates
Use a trusted Certificate Authority:
2
Configure Auto-Renewal
Set up automatic certificate renewal:
3
Use Strong TLS Settings
Ensure your SSL configuration uses modern TLS:
Authentication
Implement authentication to protect your MCP server:Environment Variables
Never hardcode secrets:.env file (never commit to git):
.env
.gitignore:
.gitignore
Rate Limiting
Protect against abuse:Health Checks and Monitoring
Health Check Endpoints
Configure health and readiness checks:Structured Logging
Implement comprehensive logging:Error Tracking
Integrate with error tracking services:Performance Optimization
Connection Pooling
Reuse database and HTTP connections:Caching
Implement caching for expensive operations:Timeout Configuration
Set appropriate timeouts:Ping Configuration
Optimize ping behavior for your transport:Process Management
Using PM2
Keep your server running with PM2:ecosystem.config.js
Using systemd
Create a systemd service:/etc/systemd/system/fastmcp.service
Production Checklist
1
Security
- HTTPS enabled with valid SSL certificates
- Authentication configured (OAuth or API keys)
- Secrets stored in environment variables (not in code)
- Rate limiting implemented
- Input validation on all tools
- CORS configured appropriately
2
Monitoring
- Health check endpoint configured
- Structured logging implemented
- Error tracking service integrated
- Performance metrics collected
- Alerts configured for critical errors
3
Performance
- Connection pooling for databases
- Caching for expensive operations
- Appropriate timeout values set
- Stateless mode for serverless deployments
- Ping behavior optimized
4
Reliability
- Process manager configured (PM2 or systemd)
- Auto-restart on failure
- Graceful shutdown handling
- Load balancing if needed
- Backup and disaster recovery plan
5
Documentation
- API documentation updated
- Deployment runbook created
- Incident response plan documented
- Team trained on operations
Next Steps
- Authentication - Comprehensive authentication guide
- Custom Routes - Add REST APIs and webhooks
- Serverless Deployments - AWS Lambda, Google Cloud Functions
- Cloudflare Workers - Edge deployment