Skip to content

Conversation

@nirinchev
Copy link
Collaborator

@nirinchev nirinchev commented Jan 15, 2026

Proposed changes

Allows for clients to send requests with externally-generated session ids. This means that session initialization is skipped which additionally requires that we switch to pure json responses instead of SSE. Sessions are now going to be created on demand with the externally-supplied id and will not be cleaned up until idleTimeoutMS fires.

@coveralls
Copy link
Collaborator

coveralls commented Jan 15, 2026

Pull Request Test Coverage Report for Build 21407817722

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 94 of 135 (69.63%) changed or added relevant lines in 3 files are covered.
  • 77 unchanged lines in 8 files lost coverage.
  • Overall coverage increased (+0.6%) to 82.237%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/transports/streamableHttp.ts 85 126 67.46%
Files with Coverage Reduction New Missed Lines %
src/resources/common/debug.ts 1 96.63%
src/transports/streamableHttp.ts 1 73.8%
src/tools/atlasLocal/atlasLocalTool.ts 2 51.35%
src/tools/tool.ts 2 86.71%
src/ui/registry/registry.ts 2 94.44%
src/transports/base.ts 14 80.92%
src/common/connectionManager.ts 18 85.26%
src/server.ts 37 77.96%
Totals Coverage Status
Change from base Build 21032021701: 0.6%
Covered Lines: 7474
Relevant Lines: 8979

💛 - Coveralls

@nirinchev nirinchev changed the title allow session id to be passed externally feat: allow session id to be passed externally MCP-369 Jan 27, 2026
@nirinchev nirinchev marked this pull request as ready for review January 27, 2026 14:24
@nirinchev nirinchev requested a review from a team as a code owner January 27, 2026 14:24
Copilot AI review requested due to automatic review settings January 27, 2026 14:24
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

This PR introduces support for externally managed sessions in the MCP server's HTTP transport layer. The feature allows external systems (like Amazon Bedrock AgentCore) to manage session lifecycles by providing their own session IDs, while the server maintains backward compatibility with its existing session management.

Changes:

  • Added externallyManagedSessions configuration flag to enable/disable external session management
  • Modified HTTP transport to accept session IDs via mcp-session-id header and create sessions on-demand
  • Added comprehensive integration tests covering both externally managed and internally managed session modes

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/common/config/userConfig.ts Adds externallyManagedSessions boolean configuration flag
src/common/logger.ts Adds new log ID for session-not-found events
src/transports/streamableHttp.ts Refactors session handling to support external session IDs with on-demand session creation
tests/integration/transports/streamableHttp.test.ts Adds comprehensive test coverage for both external and internal session management modes

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