Add a parallel MCP v2 sidecar to OmniRoute without touching the existing v1 server. The plan below is sorted by how likely you are to change each part — the judgment calls come first, the mechanical plumbing sinks to the bottom.
Write an implementation plan for adding a parallel MCP v2 sidecar to OmniRoute, but lead with the decisions I'm most likely to tweak: protocol boundaries, scope enforcement, and the tool surface. Bury the mechanical refactoring at the bottom — I trust you on that part.
branben/OmniRoute · add opt-in native sidecar with legacy compatibility · branch feat/mcp-v2-sidecar
Four areas where I made a judgment call you might disagree with. Each flagged choice shows the alternative I considered — toggle to compare.
MCP-Protocol-Version: 2026-07-28 and hits /api/mcp/v2; legacy clients continue hitting /api/mcp. The paths never cross.
Cost: one extra route handler + feature-flag gate.
MCP-Protocol-Version header and routed inside one handler.
Pick this if: you want one route to rule them both. One line to tell me: “single route, branch on header.”
_meta from the client is never consulted — scopes come only from the authenticated request.Caller=, source=) before they reach the client.omniRouteFetch() against real OmniRoute endpoints.
Cost: v2 is not a drop-in replacement for v1's 37 tools. Clients that need tools outside the 8 stay on v1.
Pick this if: the sidecar is the only MCP surface. One line to tell me: “port all 37.”
guardEnabled() checks settings.mcpEnabled and isMcpV2Enabled(). If either is off, the route returns 503 before any protocol work.requireManagementAuth(request, { acceptMcpConnectScope: true }). Same management auth as v1.handleMcpV2Http creates a new server per request. No session state survives between calls.server/discover returns only capabilities.tools. No unregistered resources or prompts.Why step 3 is weak: a fresh server per request means no connection-level caching. For the 8 tools we ship, that is fine — cacheTtlMs on each tool handles the hot paths. If the tool surface grows, revisit.
The order I'd actually build it in. Every step lands green on CI; nothing user-visible ships until step 5 flips the flag.
open-sse/mcp-server/v2/server.ts, wire V2_TOOLS array, register server/discover.0.5d/api/mcp/v2 route, register OMNIROUTE_MCP_V2 (slot 85), gate on mcpEnabled + flag.0.5dwithScopeEnforcement, route through v1's resolveCallerScopeContext, add buildScopeDenialMessage (D3/D4/D5).0.5domniRouteFetch() handlers against real endpoints. Add outputSchema to each tool def.1.5dRefactors and plumbing the feature needs. No judgment calls here — collapsed on purpose.
withScopeEnforcement + buildScopeDenialMessage into v2. Same gate, shared implementation — tested in v1 for months.OMNIROUTE_MCP_V2 to featureFlagDefinitions.ts (slot 85), DB-overridable, off by default, requiresRestart: true.vitest.mcp.config.ts) with empty plugin dir and repo-root isolation fixture.resultType and structuredContent to all tool responses so the 2026-07-28 client can skip re-serialization._meta passthrough on tool responses where the upstream spec requires it.CACHE_TTL.health, CACHE_TTL.combos) onto list tools; health is cacheable, combos are cacheable, mutations are not.changelog.d/features/mcp-v2-2026-07-28.md with the 12 decisions summarized in three bullets.The highest-leverage replies you could send. Copy one, edit, send — I'll revise the plan.