Repository navigation
Done
Labels
Description
Goal
URL (kind: "https") MCP servers from the Extension Library work for agents on every runtime (Docker, Sprites, Fly Machines) with stateless and stateful servers, and with no auth, Bearer and OAuth. The Fly smoke workflow proves each combination live.
Current state (epic 3758-epic-runtime-abstraction-sc0, after #3818)
- The URL-server gateway (
packages/core/src/extensions/mcpGateway.ts) forwards each JSON-RPC call independently. It says "Stateful upstream MCP is intentionally unsupported": no upstreamMcp-Session-Id, cookies or server-to-client requests. - So stateful (2025-era) servers fail. https://mcptest.io/fixtures/echo/mcp answers
tools/callwith HTTP 400, "Mcp-Session-Id header is required; send initialize first, or server/discover for the stateless revision". - Stateless servers already answer
tools/listwithout a session:https://mcp.deepwiki.com/mcpandhttps://learn.microsoft.com/api/mcp. - OAuth (
authentication: "oauth", scopes, clientId, token refresh through Core) is implemented, but it has never been tested live, and never from a Sprite or a Fly Machine. - The smoke workflow skips URL servers:
urlServers=0, and the step summary says "URL MCP server: skipped".
Required
1. Stateful upstream sessions in the gateway
- The gateway owns the upstream session. It forwards
initialize(andnotifications/initialized), keeps the returnedMcp-Session-Idon the gateway side, keyed by (run grant, server), and sends it on later calls. It never returns it to the agent. The agent-facing side stays as it is today, so nothing upstream can widen a run's grant. - Pin the connection per upstream session (keep-alive agent pinned to the already-vetted address). The mcptest echo fixture loses the session when a request arrives on a new connection ("Session not found"), and other servers with sticky sessions behave the same way.
- Handle upstream 404 "Session not found" by re-initializing once, then replaying the call (idempotent read tools only; for
write-capability servers, fail the call instead). - Supporting both protocol eras: on the 2025 revision, sessions as above. On the stateless 2026-07-28 revision,
server/discoverwith no session. Pick per server from the upstream's answer, not from configuration. - End of run (grant revoked or expired):
DELETEeach upstream session, best effort, and drop it from memory. Sessions never outlive the grant. Cap sessions per grant and in total, with idle expiry. - Server-to-client requests (sampling, elicitation, roots) stay unsupported: answer them with a JSON-RPC error and don't relay them to the agent. Upstream notifications on the call's own SSE stream are fine to drop. Keep the existing per-tool allowlist, capability (
read/write) checks, egress policy, byte accounting and OAuth token redaction unchanged. - Response formats: both
application/jsonandtext/event-stream, with the existing size limits.
2. OAuth, verified end to end
- Keep the current design: the user signs in once, and Core holds and refreshes tokens, so the agent never sees one. Make sure it works when the run is on Sprites (calls through the [3813 by Claude Opus 5.5] Remote runtimes: reach ProPR MCP from Sprites via a per-run SSH reverse forward (no public URL) #3817 reverse forward) and on Fly Machines.
- Refresh: with a short access-token lifetime, a run that lasts longer than the token must keep working (refresh through Core, then retry once on 401, as
ExtensionUpstreamUnauthorizedErrorintends).
3. Live coverage in .github/workflows/fly-e2e.yml (extensions mode)
The agent's output file gets one line per server, each with a run-unique token where the server can echo one:
- Stateful, no auth:
https://mcptest.io/fixtures/echo/mcp, toolechowith argumentmessage(nottext). Expected line: the exact echoedURL-STATEFUL-OK-<run>. - Stateless, no auth: one stateless public server, either DeepWiki or Microsoft Learn (
tools/listwithout a session works for both). The check is that the tool call succeeds (e.g. a non-empty result), since the content isn't deterministic. Alternatively, mcptest echo on its stateless 2026 revision, if the gateway negotiates it. - Bearer:
https://mcptest.io/fixtures/auth-bearer/mcp, with the fixture's published token stored as the server's Bearer secret. Also check that a wrong token gives a clean tool error, not a hang. - OAuth: mcptest.io has no OAuth fixture, so the smoke run brings its own. A minimal OAuth 2.1 authorization server plus MCP endpoint (PKCE, protected resource metadata, auto-approving consent, a deterministic
echo, an access-token lifetime of about 60 s to force a refresh mid-run).- Host it on something public over HTTPS that the run creates and tears down. Stay within the Fly Free Plan: 3 Machines per org, stopped ones included (the smoke run already uses the ProPR Machine and the agent Machines). A Sprite with its public URL, or the ProPR app's own Machine count, are the options to weigh. Delete it in the teardown step even on failure.
- The workflow drives the sign-in through the same API that Settings → Extensions uses, with no browser.
- Run the extensions mode on both
agent_runtime=spritesandagent_runtime=fly-machines. The step summary listsurlServers=4and each server's session mode (stateful/stateless), auth mode, and number of token refreshes.
4. Settings and docs
- Settings → Extensions shows, after "Check", whether a URL server is stateful or stateless, and which auth it uses. The "intentionally unsupported" note in the docs is replaced with the new behaviour and its limits (no sampling or elicitation).
Acceptance
- Unit tests:
- a gateway session is created, reused, re-initialized after a 404, and deleted at grant end;
- nothing upstream can reach the agent (no session id, no server-to-client requests);
writeservers are never replayed;- both eras;
- OAuth refresh and retry on 401.
- The smoke extensions mode passes on Sprites and on Fly Machines with all four URL servers. The agent's file has the stateful echo token and the OAuth echo token. Teardown is clean: no leftover apps, Sprites or fixture branches.
- Evidence (run links, each server's session and auth mode, refresh count) goes in the PR description.
Activity
propr-dev commentedon Nov 26, 2026
🤖 AI processing has started for this issue using claude agent with claude-opus-5-5 model.
I'll analyze the problem and work on a solution. This may take a few minutes.
Processing Details:
claudeclaude-opus-5-53824/claude-opus-5-5-extension-library-url-mcp-20261126-2350-bz13758-epic-runtime-abstraction-sc0issue-3824-20261126-2350-claude-opus-5-5-bz1🔍 Track Task Execution
integry commentedon Dec 1, 2026
Done in #3826, which merged into the runtime epic; the epic merged into
mainwith #3774 and ships in 0.9.4.