Deployment
Deploy your MCP Proxy Wrapper applications to production environments.
Production Checklist
Before deploying to production, ensure you've completed these essential items.
Security
- ✅ Secure API keys and authentication tokens
- ✅ Secure environment variables (never commit secrets)
- ✅ Use HTTPS for all endpoints
- ✅ Enable proper input validation
Configuration
- ✅ Set NODE_ENV=production
- ✅ Configure proper logging level
- ✅ Set up database connection (if using persistent storage)
- ✅ Test authentication and rate limiting
Environment Variables
Required Environment Variables
# Application
NODE_ENV=production
PORT=3000
LOG_LEVEL=info
# Authentication
AUTH_ENDPOINT=https://your-auth-service.com/validate
API_KEY_CACHE_TTL=3600
# Rate Limiting
RATE_LIMIT_WINDOW_MS=60000
RATE_LIMIT_MAX_REQUESTS=100
# Optional: Database (if using persistent storage)
DATABASE_URL=postgresql://user:password@host:5432/database
# Optional: Security
JWT_SECRET=your_secure_jwt_secret
Important: Never commit these values to your repository. Use your deployment platform's secret management.
Basic Docker Deployment
Simple Dockerfile
FROM node:18-alpine
WORKDIR /app
# Copy package files
COPY package*.json ./
RUN npm ci --only=production
# Copy built application
COPY dist/ ./dist/
EXPOSE 3000
CMD ["node", "dist/index.js"]
Docker Compose
version: '3.8'
services:
mcp-server:
build: .
ports:
- "3000:3000"
environment:
- NODE_ENV=production
- AUTH_ENDPOINT=${AUTH_ENDPOINT}
- RATE_LIMIT_WINDOW_MS=60000
- RATE_LIMIT_MAX_REQUESTS=100
restart: unless-stopped
Platform Deployments
Railway
Connect Repository
Connect your GitHub repository to Railway.
Set Environment Variables
Add your production environment variables in the Railway dashboard.
Deploy
Railway will automatically build and deploy your application.
# Railway CLI deployment
npm install -g @railway/cli
railway login
railway init
railway up
Heroku
Install Heroku CLI
Download and install the Heroku CLI.
Create Application
heroku create your-app-name
Set Environment Variables
heroku config:set NODE_ENV=production
heroku config:set AUTH_ENDPOINT=https://your-auth-service.com/validate
heroku config:set RATE_LIMIT_WINDOW_MS=60000
heroku config:set RATE_LIMIT_MAX_REQUESTS=100
Deploy
git push heroku main
Vercel
Create a vercel.json
file:
{
"version": 2,
"builds": [
{
"src": "dist/index.js",
"use": "@vercel/node"
}
],
"routes": [
{
"src": "/(.*)",
"dest": "/dist/index.js"
}
]
}
Deploy:
npm install -g vercel
vercel --prod
DigitalOcean App Platform
Create an app spec file:
name: mcp-proxy-wrapper
services:
- name: api
source_dir: /
github:
repo: your-username/your-repo
branch: main
run_command: node dist/index.js
environment_slug: node-js
instance_count: 1
instance_size_slug: basic-xxs
envs:
- key: NODE_ENV
value: production
- key: AUTH_ENDPOINT
value: https://your-auth-service.com/validate
type: SECRET
- key: RATE_LIMIT_WINDOW_MS
value: "60000"
Health Checks
Basic Health Endpoint
// Add to your server
import express from 'express';
const app = express();
app.get('/health', (req, res) => {
res.status(200).json({
status: 'healthy',
timestamp: new Date().toISOString()
});
});
app.get('/ready', async (req, res) => {
// Check dependencies (database, external APIs, etc.)
try {
// Add your health checks here
res.status(200).json({ status: 'ready' });
} catch (error) {
res.status(503).json({
status: 'not ready',
error: error.message
});
}
});
API Endpoint Configuration
Production API Setup
Configure Authentication Endpoint
Set up your authentication service endpoint for API key validation.
Set Rate Limiting
Configure appropriate rate limits for your production environment:
- Free tier: 10 requests/minute
- Premium tier: 100 requests/minute
- Enterprise tier: 1000 requests/minute
Database Setup
If using persistent storage for analytics or caching, ensure your database is properly configured.
Health Checks
Implement health check endpoints to monitor your service status.
Monitoring and Logging
Basic Logging
// Production logging configuration
const LOG_LEVEL = process.env.LOG_LEVEL || 'info';
// Simple logging helper
const log = {
info: (message: string, data?: any) => {
if (['debug', 'info'].includes(LOG_LEVEL)) {
console.log(`[${new Date().toISOString()}] INFO: ${message}`, data || '');
}
},
error: (message: string, error?: any) => {
if (['debug', 'info', 'warn', 'error'].includes(LOG_LEVEL)) {
console.error(`[${new Date().toISOString()}] ERROR: ${message}`, error || '');
}
}
};
// Log important events
log.info('Server started', { port: process.env.PORT });
log.info('Plugin loaded', { plugin: 'llm-summarization' });
Error Tracking
// Basic error handling
process.on('uncaughtException', (error) => {
console.error(`[${new Date().toISOString()}] ERROR: Uncaught exception:`, error);
process.exit(1);
});
process.on('unhandledRejection', (reason, promise) => {
console.error(`[${new Date().toISOString()}] ERROR: Unhandled rejection at:`, promise, 'reason:', reason);
process.exit(1);
});
Plugin Configuration Examples
LLM Summarization Plugin
import { LLMSummarizationPlugin } from 'mcp-proxy-wrapper';
const summaryPlugin = new LLMSummarizationPlugin();
summaryPlugin.updateConfig({
options: {
provider: 'openai',
openaiApiKey: process.env.OPENAI_API_KEY,
model: 'gpt-4o-mini',
maxTokens: 150,
temperature: 0.3
}
});
Chat Memory Plugin
import { ChatMemoryPlugin } from 'mcp-proxy-wrapper';
const memoryPlugin = new ChatMemoryPlugin();
memoryPlugin.updateConfig({
options: {
saveResponses: true,
maxEntries: 1000,
enableChat: true,
persistToDisk: process.env.NODE_ENV === 'production'
}
});
Backup Strategy
Database Backups
# PostgreSQL backup
pg_dump $DATABASE_URL > backup-$(date +%Y%m%d).sql
# SQLite backup
cp ./data/production.db ./backups/backup-$(date +%Y%m%d).db
Environment Variables Backup
Keep a secure record of your environment variables configuration (without the actual secrets).
Troubleshooting
Common Issues
Environment variables not loading:
# Check if variables are set
echo $AUTH_ENDPOINT
# Should not be empty in production
Authentication not working:
# Test auth endpoint
curl -X POST https://your-domain.com/api/test \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-api-key" \
-d '{"test": "auth"}'
Application not starting:
# Check logs
docker logs your-container-name
# or
heroku logs --tail --app your-app-name
Database connection issues:
# Test database connection
node -e "console.log(require('pg').parse(process.env.DATABASE_URL))"
Debug Mode
Enable debug logging temporarily:
# Set LOG_LEVEL to debug
LOG_LEVEL=debug node dist/index.js
Ready for production: Your MCP Proxy Wrapper application is now deployed and ready to handle real users with enhanced plugin functionality.
Security Best Practices
- Never commit secrets to your repository
- Use HTTPS for all API endpoints
- Validate all inputs and sanitize data
- Rotate API keys regularly
- Monitor for unusual activity and implement alerts
- Keep dependencies updated with
npm audit
- Implement proper rate limiting to prevent abuse
- Use secure authentication mechanisms
Next Steps
- Getting Started: Review setup guide
- Examples: See real-world implementations
- API Reference: Complete API documentation
- Plugins: Explore available plugins
Need help with deployment? Check the troubleshooting section above or open an issue on GitHub.