Skip to main content
Glama
by any4ai
nginx.conf•3.82 kB
# PID file location pid /tmp/nginx.pid; events {} http { upstream app_mcp { server 127.0.0.1:3000; } upstream app_sse { server 127.0.0.1:3001; } gzip off; server { listen 80; # API Key based routes (higher priority) # Map /{API_KEY}/sse -> /sse (SSE upstream) location ~ ^/(?<apikey>[^/]+)/sse$ { proxy_set_header x-anycrawl-api-key $apikey; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; proxy_buffering off; proxy_read_timeout 620s; proxy_send_timeout 620s; rewrite ^/.*/sse$ /sse break; proxy_pass http://app_sse; } # Map /{API_KEY}/mcp -> /mcp (MCP upstream) location ~ ^/(?<apikey>[^/]+)/mcp$ { proxy_set_header x-anycrawl-api-key $apikey; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; proxy_buffering off; proxy_read_timeout 620s; proxy_send_timeout 620s; rewrite ^/.*/mcp$ /mcp break; proxy_pass http://app_mcp; } # Generic API Key route for other endpoints location ~ ^/(?<apikey>[^/]+)/(.*)$ { proxy_set_header x-anycrawl-api-key $apikey; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; proxy_buffering off; proxy_read_timeout 620s; proxy_send_timeout 620s; rewrite ^/[^/]+/(.*)$ /$1 break; proxy_pass http://app_mcp; } # Direct header-based paths location /mcp { proxy_buffering off; proxy_read_timeout 620s; proxy_send_timeout 620s; proxy_pass http://app_mcp/mcp; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; } location /messages { proxy_http_version 1.1; proxy_request_buffering off; proxy_buffering off; chunked_transfer_encoding off; proxy_read_timeout 620s; proxy_send_timeout 620s; proxy_set_header Connection ""; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://app_sse/messages; } # SSE upstream location /sse { proxy_http_version 1.1; proxy_request_buffering off; proxy_buffering off; chunked_transfer_encoding off; proxy_read_timeout 620s; proxy_send_timeout 620s; proxy_set_header Connection ""; proxy_set_header Accept "text/event-stream"; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://app_sse/sse; } location /health { proxy_buffering off; proxy_read_timeout 5s; proxy_send_timeout 5s; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://app_mcp/health; } # Dedicated health check for MCP upstream location /health_mcp { proxy_buffering off; proxy_read_timeout 5s; proxy_send_timeout 5s; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://app_mcp/health; } # Dedicated health check for SSE upstream location /health_sse { proxy_buffering off; proxy_read_timeout 5s; proxy_send_timeout 5s; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://app_sse/health; } } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/any4ai/anycrawl-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server