Skip to content

feat: support session context config#19

Merged
imbenrabi merged 5 commits into
mainfrom
benr/support-session-config
Jan 29, 2026
Merged

feat: support session context config#19
imbenrabi merged 5 commits into
mainfrom
benr/support-session-config

Conversation

@imbenrabi

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

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 adds per-session context support to enable multi-tenant use cases where each client session can have its own context values (API tokens, user IDs, etc.) passed to module loaders via query parameters.

Changes:

  • New SessionContextResolver class to parse, filter, and merge session-specific context from query parameters
  • Configuration validation for session context settings with support for base64/JSON encoding and whitelist-based key filtering
  • Integration with HTTP transport layer to extract query parameters and generate per-session cache keys
  • Comprehensive test coverage including unit tests, integration tests, and E2E tests
  • Documentation updates in README, CLAUDE.md, and AGENTS.md

Reviewed changes

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

Show a summary per file
File Description
src/session/SessionContextResolver.ts Core resolver implementation with query parameter parsing, key filtering, context merging (shallow/deep), and cache key generation
src/session/validateSessionContextConfig.ts Runtime validation for session context configuration with detailed error messages
src/http/FastifyTransport.ts HTTP transport integration to resolve session context per request and generate cache keys
src/server/createMcpServer.ts Server factory integration to pass merged context to module loaders
src/server/createPermissionBasedMcpServer.ts Validation and warning for limited session context support in permission-based servers
src/types/index.ts Type definitions for SessionContextConfig and SessionRequestContext
src/index.ts Export session context types and resolver class
tests/validateSessionContextConfig.test.ts Comprehensive validation tests for all config fields and error cases
tests/sessionContextResolver.test.ts Unit tests for resolver logic including parsing, filtering, merging, and cache key generation
tests/sessionContext.integration.test.ts Integration tests for HTTP transport with session context
tests/e2e/dynamicMode.e2e.test.ts E2E tests verifying session context works end-to-end with real client connections
tests/e2e/helpers.ts Test catalog and module loaders for session context E2E tests
README.md User-facing documentation with usage examples and security considerations
CLAUDE.md Developer documentation describing session context architecture
AGENTS.md API documentation noting query parameter support for session config

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

Comment thread src/session/validateSessionContextConfig.ts
Comment thread src/session/SessionContextResolver.ts
Comment thread src/session/validateSessionContextConfig.ts
Comment thread src/server/createMcpServer.ts
@imbenrabi imbenrabi merged commit 12ca118 into main Jan 29, 2026
1 check passed
@imbenrabi imbenrabi deleted the benr/support-session-config branch January 29, 2026 16:32
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.

2 participants