Production Checklist (Python)
Skip the checklist: Deploy to NitroCloud and it handles HTTPS, scaling, monitoring and the container build for you. See Cloud Platforms.
Pre-Deployment
Code
- All tests passing (
pytest) - Linter and type checker passing
- No stray
print()calls. Use the logger, and never write to stdout if you also use stdio - Error handling implemented
- Input validation on all tools (Pydantic models)
Security
-
JWT_SECRETis strong and unique - API keys are not hardcoded
- Secrets only in env or a secret manager, never in the wheel
-
OAUTH_REQUIRED/API_KEYset if the server is not public - Rate limiting configured
- Guards on sensitive tools
- HTTPS enabled (terminate TLS at the platform or proxy)
Configuration
- Python 3.10+ in the image
-
MCP_TRANSPORT_TYPEset (httpordual) -
HOST=0.0.0.0in containers -
PORTmatches what the platform expects -
MCP_MAX_SESSIONSand session timeout set for HTTP - Logging level set to
infoorwarn - CORS configured if browsers call the server
Validate and Build
Bash
nitrostack-py validate
nitrostack-py pack --dry-run # review what goes into the wheel
nitrostack-py pack
pack never includes .env. Python has no dist/index.js build step.
Deployment
Option 1: NitroCloud (recommended)
Connect your repo or upload your project and NitroCloud builds and runs it. See Cloud Platforms.
Option 2: Plain process
Bash
HOST=0.0.0.0 MCP_TRANSPORT_TYPE=http PORT=3000 nitrostack-py start
Option 3: Docker
Bash
docker build -t my-mcp-server .
docker run --rm -p 3000:3000 --env-file .env my-mcp-server
Option 4: systemd
Ini
# /etc/systemd/system/mcp-server.service
[Unit]
Description=MCP server
After=network.target
[Service]
WorkingDirectory=/opt/mcp-server
EnvironmentFile=/etc/mcp-server.env
ExecStart=/opt/mcp-server/.venv/bin/nitrostack-py start --port 3000
Restart=on-failure
User=mcp
[Install]
WantedBy=multi-user.target
Post-Deployment
-
GET /mcp/healthresponding - Tools list correctly from the MCP endpoint (
/mcp, no trailing slash) - Authentication working
- Logs being written
- Error tracking configured
Monitoring
- Check logs regularly
- Monitor error rates
- Track tool usage
- Set up alerts on the health endpoint