# nginx configuration for Letta MCP Rust Server proxy
# Proxy from :3001 to letta-mcp-rust:6507
upstream letta_mcp {
server letta-mcp-rust:6507;
keepalive 32;
}
server {
listen 3001;
listen [::]:3001;
server_name _;
# Logging
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log warn;
# Health check endpoint - returns OK if nginx can reach upstream
location /health {
access_log off;
return 200 '{"status":"ok","service":"letta-mcp-nginx"}';
add_header Content-Type application/json;
}
# MCP endpoint with SSE support
location /mcp {
proxy_pass http://letta_mcp/mcp;
proxy_http_version 1.1;
# SSE-specific headers
proxy_set_header Connection "";
proxy_set_header Cache-Control "no-cache";
proxy_set_header X-Accel-Buffering "no";
proxy_buffering off;
# Standard proxy headers
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Origin $http_origin;
# Timeouts for long-lived connections
proxy_connect_timeout 60s;
proxy_send_timeout 300s;
proxy_read_timeout 300s;
# CORS headers
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization' always;
if ($request_method = 'OPTIONS') {
return 204;
}
}
# Catch-all for other endpoints
location / {
proxy_pass http://letta_mcp;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}