summaryrefslogtreecommitdiff
path: root/deploy
diff options
context:
space:
mode:
authorTom Flux <tom@tomflux.xyz>2026-06-23 21:50:31 +0100
committerTom Flux <tom@tomflux.xyz>2026-06-23 21:50:31 +0100
commitfd5c1d12e96104ff748893f9b831b00260a5b5e5 (patch)
treeed707a94fb6b276af56f0f136e54e0974caa2b3e /deploy
parent9928a4a09766d994a7497d3a6152315c52fece90 (diff)
nginx: match the MCP location with or without a trailing slashmcp-api
claude.ai strips the trailing slash from the connector URL, so a location of /mcp/<secret>/ missed and fell to the 301 catch-all. Use a regex (^/mcp/<secret>/?(.*)$) that matches both and normalises onto the FastMCP root. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'deploy')
-rw-r--r--deploy/food.tomflux.xyz.nginx9
1 files 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/?(?<mcp_rest>.*)$ {
+ 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;