Skip to content

Add MCP sessions, SSE streaming, and interactive passthrough - #15

Merged
tawAsh1 merged 1 commit into
mainfrom
feat/sessions-sse-interactive
Jul 5, 2026
Merged

Add MCP sessions, SSE streaming, and interactive passthrough#15
tawAsh1 merged 1 commit into
mainfrom
feat/sessions-sse-interactive

Conversation

@tawAsh1

@tawAsh1 tawAsh1 commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Summary

The big fidelity pack: catches the local gateway up with the real gateway's May-2026 protocol capabilities (sessions, progress, logging, elicitation, sampling). Nothing punted.

⚠️ Breaking default: sessions + SSE

The gateway now serves stateful MCP sessions with SSE streaming by default (Mcp-Session-Id on initialize, text/event-stream responses) — matching the modern real gateway instead of its pre-May-2026 buffered behavior. server.stateless: true restores the old mode. All integration behavior is tested in both modes (parametrized matrix), including the contract-checks SDK-bypass pin.

Progress + logging passthrough

An MCP target's mid-call progress and logging notifications now re-emit live to the calling client (previously they died at our upstream client). Progress is keyed to the caller's progressToken by the SDK; log levels/logger names are preserved. Outside a gateway request (lcgw invoke, direct target calls) they drop silently.

Elicitation + sampling passthrough

A downstream server can now ask OUR caller mid-tool-execution:

  • Elicitation (form mode): the raw requestedSchema is forwarded 1:1 via the SDK ServerSession (no Python re-typing), the answer travels back down. URL mode is a documented limitation (clear error).
  • Sampling: relayed with all params (system prompt, temperature, stop sequences, model preferences).
  • Both require sessions; in stateless mode the downstream gets a clear "requires sessions" error that surfaces as the standard envelope. aws-gateway targets inherit everything.

Documented caveats

Concurrent calls through one MCP target route upstream-initiated traffic to the most recent in-flight caller (the real gateway scopes per user session; we have no inbound identity). No per-user scoping or 1-hour timeout emulation. Prompt/resource reads don't carry the interactive relay (tools only, like invocation history).

Test plan

  • 12 new tests: stateless×sessions mode matrix (tool calls, admin routes/lifespan, MCP round trip, contract-bypass pin), wire-level session-id/content-type assertions, progress+log streaming over real HTTP, dropped-not-crashing without context, elicitation and sampling end-to-end round trips, stateless rejection.
  • Full suite: 151 passed (pre-existing 139 with zero semantic changes); ruff check / ruff format --check clean.

🤖 Generated with Claude Code

Catch up with the real gateway's May-2026 protocol capabilities.

- Serving mode: the default is now stateful sessions + SSE streaming
  (Mcp-Session-Id issued on initialize, responses as event streams) --
  the modern faithful behavior. server.stateless: true restores the
  previous buffered stateless mode. BREAKING DEFAULT (0.x), called out
  in README/docs.
- Progress + logging passthrough: an MCP target's mid-call progress
  and logging notifications re-emit to the calling client as they
  arrive (progressToken keyed by the SDK; log levels preserved).
  Outside a gateway request they drop silently.
- Elicitation + sampling passthrough: a downstream server's
  elicitation (form mode) and sampling requests relay to OUR caller
  via the SDK ServerSession (raw requestedSchema forwarded 1:1;
  sampling carries system prompt, temperature, stop sequences, model
  preferences), the answer travelling back down. Requires sessions;
  stateless mode returns a clear error. URL-mode elicitation is a
  documented limitation.
- Concurrent calls through one MCP target route upstream-initiated
  traffic to the most recent in-flight caller (documented; the real
  gateway scopes per user session, we have no inbound identity).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@tawAsh1 tawAsh1 self-assigned this Jul 5, 2026
@tawAsh1
tawAsh1 merged commit 35bae58 into main Jul 5, 2026
5 checks passed
@tawAsh1
tawAsh1 deleted the feat/sessions-sse-interactive branch July 5, 2026 03:42
@tawAsh1 tawAsh1 mentioned this pull request Jul 5, 2026
tawAsh1 added a commit that referenced this pull request Jul 5, 2026
The extension arc since 0.2.1, one feature pack per PR:

- MCP-passthrough targets (streamable HTTP + local stdio) and ${VAR}
  config expansion (#6)
- lcgw sync + lcgw tail: local admin surface, target re-sync without
  restart, live invocation feed (#8)
- Hybrid debugging: aws-gateway targets (proxy a deployed AgentCore
  Gateway, SigV4) and lambda backend: aws, behind the optional [aws]
  extra (#9)
- Mock targets, contract checks (off/warn/error), and the public
  localcore_gateway.testing module (#11)
- lcgw schema (config JSON Schema for editors) and lcgw preflight
  (real-AgentCore deploy-constraint validation) (#12)
- Prompts and resources passthrough for MCP targets, with
  resourcePriority routing (#14)
- MCP sessions + SSE streaming by default (server.stateless: true for
  the old buffered mode -- BREAKING default) and progress/logging/
  elicitation/sampling passthrough (#15)
- Smithy model targets, completing the real gateway's target-type
  matrix (#16)
- Dependency security bumps clearing all Dependabot alerts (#13),
  Japanese README (#7, #10)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant