Remote Deployment (HTTP/SSE)
Remote mode runs ByteMCP as an HTTP server with Server-Sent Events (SSE) for MCP communication.
How Remote Mode Works
Section titled “How Remote Mode Works”AI Assistant ←→ HTTP/SSE ←→ ByteMCP Server ←→ Database │ └── https://mcp.example.com/sse1. Configure Environment
Section titled “1. Configure Environment”DB_HOST=your_db_hostDB_DATABASE=bytefederalDB_USER=your_userDB_PASSWORD=your_passwordMCP_MODE=remotePORT=30002. Start the Server
Section titled “2. Start the Server”npm run start:remote
# Or with environment variableMCP_MODE=remote npm start3. Verify
Section titled “3. Verify”curl http://localhost:3000/healthResponse:
{ "status": "ok", "version": "1.0.0", "mode": "remote"}API Endpoints
Section titled “API Endpoints”| Endpoint | Method | Description |
|---|---|---|
/health | GET | Health check |
/sse | GET | SSE connection endpoint |
/sse | POST | JSON-RPC tool calls |
/mcp | POST | Alternative JSON-RPC endpoint |
/.well-known/mcp-server | GET | MCP discovery |
/api/docs | GET | OpenAPI documentation |
SSE Connection
Section titled “SSE Connection”MCP clients connect via SSE for real-time communication:
const eventSource = new EventSource('https://mcp.example.com/sse');
eventSource.onmessage = (event) => { const data = JSON.parse(event.data); console.log('Received:', data);};CORS Configuration
Section titled “CORS Configuration”The server allows requests from:
https://bytefederal.comhttp://localhost:3000http://localhost:4321*.anthropic.com*.claude.ai
To add additional origins, modify remoteServer.ts.
Rate Limiting
Section titled “Rate Limiting”Default limits:
- General: 10 requests/second
- SSE: 5 connections/second
Configured in nginx or application level.
Running with PM2
Section titled “Running with PM2”For production process management:
# Start with PM2pm2 start ecosystem.config.js
# Or manuallyMCP_MODE=remote PORT=3000 pm2 start dist/index.js --name bytemcp
# Save configurationpm2 savepm2 startupecosystem.config.js
Section titled “ecosystem.config.js”module.exports = { apps: [{ name: 'bytemcp', script: 'dist/index.js', env: { MCP_MODE: 'remote', PORT: 3000 }, error_file: './logs/err.log', out_file: './logs/out.log' }]};SSL/TLS
Section titled “SSL/TLS”For production, always use HTTPS. Options:
1. Reverse Proxy (Recommended)
Section titled “1. Reverse Proxy (Recommended)”Use nginx with Let’s Encrypt:
sudo ./scripts/setup-nginx.sh2. Node.js Direct
Section titled “2. Node.js Direct”Configure SSL certificates in the application:
SSL_CERT=/path/to/cert.pemSSL_KEY=/path/to/key.pemTesting Remote Mode
Section titled “Testing Remote Mode”Health Check
Section titled “Health Check”curl https://mcp.example.com/healthTool Call
Section titled “Tool Call”curl -X POST https://mcp.example.com/mcp \ -H "Content-Type: application/json" \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "find_nearest_bitcoin_atm", "arguments": { "location": "Miami, FL", "limit": 5 } } }'Next Steps
Section titled “Next Steps”- Docker Deployment - Container deployment
- Production - Full production setup
- AI Assistants - Connect remote clients