From fd5c1d12e96104ff748893f9b831b00260a5b5e5 Mon Sep 17 00:00:00 2001 From: Tom Flux Date: Tue, 23 Jun 2026 21:50:31 +0100 Subject: nginx: match the MCP location with or without a trailing slash claude.ai strips the trailing slash from the connector URL, so a location of /mcp// missed and fell to the 301 catch-all. Use a regex (^/mcp//?(.*)$) that matches both and normalises onto the FastMCP root. Co-Authored-By: Claude Opus 4.8 --- deploy/food.tomflux.xyz.nginx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/deploy/food.tomflux.xyz.nginx b/deploy/food.tomflux.xyz.nginx index 87172cc..400f7f1 100644 --- a/deploy/food.tomflux.xyz.nginx +++ b/deploy/food.tomflux.xyz.nginx @@ -33,10 +33,11 @@ server { } # --- MCP server (claude.ai cooking-mode connector) --- - # Trailing slashes on both sides strip the secret prefix, so the FastMCP - # service (serving at "/") sees clean paths. - location /mcp/REPLACE_WITH_LONG_SECRET/ { - proxy_pass http://127.0.0.1:8765/; + # Regex so it matches with OR without a trailing slash — claude.ai stores + # the connector URL without one. Whatever follows the secret is normalised + # onto the FastMCP root (the service serves at "/"). + location ~ ^/mcp/REPLACE_WITH_LONG_SECRET/?(?.*)$ { + proxy_pass http://127.0.0.1:8765/$mcp_rest$is_args$args; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; -- cgit v1.2.3