fix: add production rewrite for /api/mcp to mcp.tempo.xyz#635
Closed
jxom wants to merge 1 commit into
Closed
Conversation
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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Member
Author
|
Wrong repo: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Try the MCP server explorer on /developers/docs/guide/using-tempo-with-ai#connect-to-tempos-mcp-server fails in production.
TempoMcpExplorerPOSTs to/api/mcp. This works locally becausevite.config.tsproxies/api/mcp→https://mcp.tempo.xyz, but production has no equivalent rewrite. The request falls through to the marketing app, which308-redirects/api/mcp→/api/mcp/, which then404s.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.xyzdirectly from the browser) becausemcp.tempo.xyzdoes not returnaccess-control-allow-originon POST responses, so a direct cross-origin fetch is blocked by CORS.Verification
vercel.jsonare confirmed live in prod (the sibling/ingest/*→ PostHog rewrite returns200), so this rewrite will take effect.