Skip to content

feat: add opt-in stateless mode for streamable-http transport#73

Merged
alecron merged 3 commits intomainfrom
feat/stateless-http
Mar 20, 2026
Merged

feat: add opt-in stateless mode for streamable-http transport#73
alecron merged 3 commits intomainfrom
feat/stateless-http

Conversation

@alecron
Copy link
Collaborator

@alecron alecron commented Mar 19, 2026

Summary

  • Add SYSDIG_MCP_STATELESS env var (default false) to enable stateless mode for the streamable-http transport
  • When enabled, each HTTP request is self-contained — no initialize handshake or Mcp-Session-Id tracking required
  • Required for AWS Bedrock AgentCore compatibility, where invoke-agent-runtime is a single-shot HTTP POST with no session continuity

AgentCore deployment config

SYSDIG_MCP_TRANSPORT=streamable-http
SYSDIG_MCP_STATELESS=true
SYSDIG_MCP_LISTENING_PORT=8000
SYSDIG_MCP_MOUNT_PATH=/mcp

Test plan

  • just check passes (fmt, lint, 142/142 specs)
  • Manual test: tools/list succeeds without prior initialize when stateless
  • Manual test: no Mcp-Session-Id header returned in stateless mode
  • Manual test: mcp-remote connects and proxies through stateless server
  • Default behavior (SYSDIG_MCP_STATELESS=false) unchanged — not a breaking change

Copilot AI review requested due to automatic review settings March 19, 2026 16:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an opt-in “stateless” mode for the streamable-http transport to support single-shot HTTP invocation environments (e.g., AWS Bedrock AgentCore), controlled via SYSDIG_MCP_STATELESS.

Changes:

  • Add Stateless boolean to configuration loaded from SYSDIG_MCP_STATELESS (default false).
  • Thread stateless flag into streamable-http server construction via mcp-go streamable HTTP options.
  • Extend handler tests to cover tools/list without prior initialize in stateless mode, and document the env var in README.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
internal/infra/mcp/mcp_handler.go Adds a stateless parameter and passes the corresponding option to the streamable HTTP server.
cmd/server/main.go Wires cfg.Stateless into server startup for the streamable-http transport and logs the flag.
internal/config/config.go Introduces Config.Stateless and loads it from SYSDIG_MCP_STATELESS.
internal/config/config_test.go Adds assertions for default/override behavior of the new config flag.
internal/infra/mcp/mcp_handler_test.go Updates existing streamable-http setup for new signature and adds a stateless test case.
README.md Documents SYSDIG_MCP_STATELESS and its purpose.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@alecron alecron requested a review from a team as a code owner March 19, 2026 16:36
tembleking
tembleking previously approved these changes Mar 20, 2026
tembleking
tembleking previously approved these changes Mar 20, 2026
@alecron alecron enabled auto-merge (squash) March 20, 2026 09:47
@alecron alecron force-pushed the feat/stateless-http branch from 3c9fde4 to c1cc528 Compare March 20, 2026 09:59
@alecron alecron force-pushed the feat/stateless-http branch from c1cc528 to c0e16a1 Compare March 20, 2026 10:16
@alecron alecron merged commit 07a0594 into main Mar 20, 2026
6 checks passed
@alecron alecron deleted the feat/stateless-http branch March 20, 2026 10:34
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.

3 participants