diff --git a/nginx/gnexus-book.conf b/nginx/gnexus-book.conf index a263ee8..749f475 100644 --- a/nginx/gnexus-book.conf +++ b/nginx/gnexus-book.conf @@ -36,8 +36,26 @@ proxy_set_header X-Forwarded-Proto $scheme; } + location /mcp-protocol/ { + proxy_pass http://127.0.0.1:8001; + proxy_http_version 1.1; + 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_buffering off; + proxy_cache off; + proxy_read_timeout 86400; + } + + location = /mcp { + return 308 /mcp-protocol/; + } + + # Historical alias kept for clients that used /mcp/. location /mcp/ { - proxy_pass http://127.0.0.1:8001/; + rewrite ^/mcp/(.*)$ /mcp-protocol/$1 break; + proxy_pass http://127.0.0.1:8001; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; diff --git a/systemd/gnexus-book-mcp.service b/systemd/gnexus-book-mcp.service index cf1afea..c947ca4 100644 --- a/systemd/gnexus-book-mcp.service +++ b/systemd/gnexus-book-mcp.service @@ -1,15 +1,15 @@ [Unit] -Description=Gnexus Book MCP Server (SSE) +Description=Gnexus Book MCP Server (streamable HTTP) After=network.target [Service] Type=simple WorkingDirectory=/home/ubuntu/gnexus-book/server Environment="GNEXUS_BOOK_REPO_ROOT=/home/ubuntu/gnexus-book" -Environment="GNEXUS_BOOK_MCP_TRANSPORT=sse" +Environment="GNEXUS_BOOK_MCP_TRANSPORT=streamable-http" Environment="GNEXUS_BOOK_MCP_HOST=0.0.0.0" Environment="GNEXUS_BOOK_MCP_PORT=8001" -ExecStart=/home/ubuntu/gnexus-book/server/.venv/bin/python -m app.mcp_server +ExecStart=/home/ubuntu/gnexus-book/server/.venv/bin/python -m app.mcp_http Restart=on-failure RestartSec=5