v2.1.5 — fix /mcp redirect stripping auth + Cowork sandbox blind spot#9
Merged
mrdulasolutions merged 1 commit intomainfrom Apr 21, 2026
Merged
v2.1.5 — fix /mcp redirect stripping auth + Cowork sandbox blind spot#9mrdulasolutions merged 1 commit intomainfrom
mrdulasolutions merged 1 commit intomainfrom
Conversation
Two bugs turned every non-technical install into a 40-minute debugging
session:
1. **Starlette auto-redirect.** `app.mount("/mcp", ...)` makes Starlette
307-redirect any POST to /mcp → /mcp/. mcp-remote drops the POST
body when following a 307, so the router reported "Missing session
ID" on every initialize.
2. **HTTPS → HTTP protocol downgrade.** Behind Railway's TLS-terminating
proxy, uvicorn wasn't trusting X-Forwarded-Proto, so the 307's
Location header came back http:// instead of https://. Clients that
did follow the redirect correctly stripped the Authorization header
on protocol downgrade — silent 401s everywhere.
Fixes:
- **`services/mcp-router/Dockerfile`**: add `--proxy-headers
--forwarded-allow-ips='*'` to uvicorn. Starlette now sees the real
scheme and any redirect stays HTTPS.
- **`services/mcp-router/router/main.py`**: add ASGI middleware that
rewrites `/mcp` → `/mcp/` IN-PLACE. No redirect issued at all —
clients can POST to either URL and both work.
- **Client defaults updated to `/mcp/` (trailing slash)** so even on
older router versions the redirect is bypassed:
- `plugin/bin/reva-mcp-launch.sh` default URL
- `plugin/scripts/desktop-install.sh` `DEFAULT_MCP_URL`
- `plugin/skills/revmyengine/SKILL.md` /connect default
Also in this commit — fix the `/connect` Cowork sandbox blind spot:
When the engine runs inside Claude Cowork, the `Bash` tool writes to
an ephemeral sandbox filesystem, NOT the user's real Mac. Credentials
written via Bash in Cowork never reach Claude Desktop's launcher, so
the plugin stays disconnected while the PM watches us "succeed."
Fix: `/connect` now runs the same capability-detection dance as
`/heal`. If `mcp__Control_your_Mac__osascript` is present, prefer it
over `Bash` — osascript punches through the sandbox and lands the
creds on the real Mac's `~/.reva-turbo/state/mcp-credentials.env`.
Bumps plugin to v2.1.5 (VERSION, plugin.json, SKILL.md frontmatter,
signup footer).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
/mcp→ 307 redirect to/mcp/was dropping the POST body AND downgrading HTTPS→HTTP, which stripped the Authorization header. Fixed with--proxy-headerson uvicorn plus ASGI middleware that rewrites the path in-place (no redirect issued)./mcp/(trailing slash) so installs work even before the router redeploys./connectCowork fix — detectmcp__Control_your_Mac__osascriptand use it to write credentials to the real Mac, not the Cowork sandbox.Test plan
curl -s -o /dev/null -w '%{http_code}' -X POST https://mcp-router-production-460a.up.railway.app/mcp ...returns 200 (not 307) after deploy/signup→ paste key →/connectlands creds on real Mac when run in Cowork/reva-turbo:revmyengineshowscrm_*/mem_*/reva_*tools on next restart🤖 Generated with Claude Code