You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The folder-set constraint rests on two assumptions that can only be checked
against live traffic: that mcp-remote expands ${WORKSPACE_FOLDER_PATHS}, and
that the active folder is always a member of the resulting set (212/212 in the
probe). Both now report failure instead of degrading quietly.
Adds warns for an unexpanded template on either header, a pinned root absent
from the reported set (the invariant the constraint depends on), an ambiguous
multi-folder session, and a refused set_workspace_root call. The candidate
store is now idempotent so these audit once per change rather than per request.
Also drops unexpanded ${...} entries during parsing. Keeping one would have
matched no real folder and turned the membership check into a blanket refusal
of every legitimate root, so this closes a real failure mode rather than only
reporting it.
Docs corrected where they still blamed the Agents window or called
${workspaceFolder}-via-args reliable: it fails 21% overall, and editor windows
(29%) are worse than Agents windows (4%). Records the ruled-out alternatives so
the first-entry heuristic doesn't get proposed again, and flags that the
per-repo installer writes a bearer token into the repo with no gitignore entry.
Signed-off-by: crimsonsunset <jsangio1@gmail.com>
|`X-Mcpmux-Workspace-Set arrived unexpanded`| Cursor mangled `${WORKSPACE_FOLDER_PATHS}` instead of passing it to `mcp-remote`. No candidate set, so routing degrades to pre-set-header behavior. |
62
+
|`pinned root is absent from X-Mcpmux-Workspace-Set`| The active folder isn't a member of the reported set. This violates the invariant the constraint rests on; `set_workspace_root` will start refusing valid roots. |
63
+
|`no pinned root and multiple folders open`| The 16% case. Expected occasionally; the session needs one `mcpmux_set_workspace_root` call. |
64
+
51
65
## 4. Bridge flags sanity check
52
66
53
67
Confirm the generated config includes:
54
68
55
69
-`--allow-http` (gateway is loopback HTTP, not TLS).
56
70
-`--header` with **no space** after the colon:
57
71
`X-Mcpmux-Workspace:${workspaceFolder}`.
72
+
-`--header X-Mcpmux-Workspace-Set:${WORKSPACE_FOLDER_PATHS}`. Not a Cursor
73
+
variable, so it passes through untouched and `mcp-remote` expands it from the
74
+
child environment. Carries every folder open in the calling window.
58
75
-`Authorization:Bearer ${MCPMUX_API_KEY}` with the key in `env.MCPMUX_API_KEY`.
59
76
60
77
To verify `mcp-remote` accepts these flags outside Cursor:
**Symptom:** Cursor Agents window (and some other spawn paths) send `X-Mcpmux-Workspace` present but empty. `set_pinned` no-ops. Session falls through to multi-folder `roots/list` → `PendingRoots` or the wrong space.
35
-
**Evidence:** 477 empty-header warns in ~40 min of new-binary uptime. Session `896e45f3…` fires it on every `tools/list` / `prompts/list` / `resources/list`.
36
-
**Likely cause:** Cursor leaves `${workspaceFolder}` unresolved; `mcp-remote` then treats `${…}` as an env var and substitutes empty.
37
-
**Related:**[`cursor-workspace-routing-bridge.md`](./cursor-workspace-routing-bridge.md) Open question (Aug 14). Fallback is per-repo static header in [`cursor-workspace-bridge.md`](../manual/cursor-workspace-bridge.md).
38
-
**Decision already made:** no auto-disambiguation, no agent-facing UI, no client workaround this pass. Dig is "when/why + is the warn too loud."
33
+
**Status:** Root-caused and bounded (`efabe48`); residual ~16% is inherent
34
+
**Symptom:** Cursor sends `X-Mcpmux-Workspace` present but empty. `set_pinned` no-ops. Session falls through to multi-folder `roots/list` → `PendingRoots` or the wrong space.
35
+
**Evidence:** 477 empty-header warns in ~40 min of new-binary uptime. Session `896e45f3…` fires it on every `tools/list` / `prompts/list` / `resources/list`. A later 282-spawn `env-probe` put the substitution failure at 21% overall.
36
+
**Cause (confirmed):** Cursor leaves `${workspaceFolder}` unresolved; `mcp-remote` treats `${…}` as an env var and substitutes empty.
37
+
**Correction:** this was filed as an Agents-window bug. It isn't. Editor windows fail at 29%, Agents windows at 4%. The `oauth_middleware` warn that blamed the Agents window has been reworded.
38
+
**Related:**[`cursor-workspace-routing-bridge.md`](./cursor-workspace-routing-bridge.md) resolved question (Aug 20) and [`resilience-routing-leftovers.md`](./resilience-routing-leftovers.md) item 1. Fully immune path is the per-repo static header in [`cursor-workspace-bridge.md`](../manual/cursor-workspace-bridge.md).
39
+
**Decision:** still no auto-disambiguation — a first-entry heuristic on `WORKSPACE_FOLDER_PATHS` would misroute 30% of the time. The window's folder set is now carried as a constraint instead, which bounds `set_workspace_root` rather than guessing.
39
40
40
41
### B2. Empty-header warn is per-request, not per-session
**Inbound 404 after gateway rebuild:** process death drops `LocalSessionManager`. `POST /mcp` with a stale `Mcp-Session-Id` is a spec-correct 404. [`mcp-remote`](https://www.npmjs.com/package/mcp-remote) and the [TypeScript SDK](https://github.com/modelcontextprotocol/typescript-sdk/issues/1708) do **not** re-`initialize` on that 404. Do not persist sessions. Recovery is Reload MCP once. `/health` staying 200 means the gateway is up.
24
24
25
-
**Header pin after reload:** a non-empty `X-Mcpmux-Workspace` is held across initialize and applied when `mcp-session-id` appears. Empty `${workspaceFolder}` is still the Agents-window hole.
25
+
**Header pin after reload:** a non-empty `X-Mcpmux-Workspace` is held across initialize and applied when `mcp-session-id` appears. An empty `${workspaceFolder}` is a ~21% flake in Cursor's substitution, not an Agents-window-specific hole (editor windows are the worse offender at 29%); the window's folder set now arrives separately as `X-Mcpmux-Workspace-Set` and collapses the single-folder case. See [`cursor-workspace-routing-bridge.md`](./cursor-workspace-routing-bridge.md).
0 commit comments