Skip to content

fix: add production rewrite for /api/mcp to mcp.tempo.xyz#635

Closed
jxom wants to merge 1 commit into
mainfrom
fix/mcp-explorer-prod-rewrite
Closed

fix: add production rewrite for /api/mcp to mcp.tempo.xyz#635
jxom wants to merge 1 commit into
mainfrom
fix/mcp-explorer-prod-rewrite

Conversation

@jxom

@jxom jxom commented Jul 1, 2026

Copy link
Copy Markdown
Member

Problem

The Try the MCP server explorer on /developers/docs/guide/using-tempo-with-ai#connect-to-tempos-mcp-server fails in production.

TempoMcpExplorer POSTs to /api/mcp. This works locally because vite.config.ts proxies /api/mcphttps://mcp.tempo.xyz, but production has no equivalent rewrite. The request falls through to the marketing app, which 308-redirects /api/mcp/api/mcp/, which then 404s.

POST /api/mcp  →  308  →  /api/mcp/  →  404.html

Fix

Add a Vercel reverse-proxy rewrite mirroring the dev proxy:

{ "source": "/api/mcp", "destination": "https://mcp.tempo.xyz/" }

A same-origin reverse proxy is required (rather than calling mcp.tempo.xyz directly from the browser) because mcp.tempo.xyz does not return access-control-allow-origin on POST responses, so a direct cross-origin fetch is blocked by CORS.

Verification

  • Root-path rewrites from this vercel.json are confirmed live in prod (the sibling /ingest/* → PostHog rewrite returns 200), so this rewrite will take effect.
  • Full end-to-end verification requires a deploy/preview.

The Try the MCP server explorer POSTs to /api/mcp, which works in dev via
the vite proxy but 404s in production (falls through to the marketing app,
308 -> /api/mcp/ -> 404.html). Add a Vercel reverse-proxy rewrite mirroring
the dev proxy so the same-origin request reaches mcp.tempo.xyz (which omits
CORS headers on POST, so a direct browser call cannot work).

Amp-Thread-ID: https://ampcode.com/threads/T-019f1f40-08bd-7053-a2d5-23abf34e3323
@vercel

vercel Bot commented Jul 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tempo-docs Ready Ready Preview, Comment Jul 1, 2026 8:10pm

Request Review

@jxom

jxom commented Jul 1, 2026

Copy link
Copy Markdown
Member Author

Wrong repo: tempo.xyz/api/mcp is served by the tempo-web project, so a rewrite in the docs repo's vercel.json never runs for that root path. The playground's fetch('/api/mcp') is root-absolute and hits tempo-web. Moving the fix to tempo-web/vercel.json (alongside the existing /ingest proxy).

@jxom jxom closed this Jul 1, 2026
@jxom jxom deleted the fix/mcp-explorer-prod-rewrite branch July 1, 2026 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant