Skip to content

feat: add session management for proxy #1081

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jul 22, 2025
Merged

feat: add session management for proxy #1081

merged 11 commits into from
Jul 22, 2025

Conversation

yrobla
Copy link
Contributor

@yrobla yrobla commented Jul 16, 2025

Adds a session interface to proxy, and initialize with the extracted session id from transport messages
Only enable healthchecks when we detect that the server has been initialized

Closes: #1078

@yrobla yrobla force-pushed the issue-1078 branch 3 times, most recently from a7f4b00 to 010e789 Compare July 17, 2025 10:13
@yrobla yrobla requested review from JAORMX and dmjb July 17, 2025 10:14
@yrobla yrobla force-pushed the issue-1078 branch 3 times, most recently from 293c715 to b142eb1 Compare July 18, 2025 09:47
dmjb
dmjb previously requested changes Jul 18, 2025
taskbot added 4 commits July 18, 2025 13:01
Adds a session interface to proxy, and initialize with the extracted
session id from transport messages
Only enable healthchecks when we detect that the server has been
initialized

Closes: #1078
@yrobla yrobla requested review from dmjb and Copilot July 21, 2025 10:48
Copilot

This comment was marked as outdated.

@yrobla yrobla requested a review from Copilot July 21, 2025 11:19
Copilot

This comment was marked as outdated.

@yrobla yrobla requested a review from blkt July 22, 2025 10:20
@yrobla yrobla requested a review from Copilot July 22, 2025 11:44
Copy link
Contributor

@Copilot 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 adds session management capabilities to the transparent proxy to track MCP sessions and conditionally enable health checks. The implementation extracts session IDs from transport messages (both headers and SSE streams) and only enables health monitoring once the server has been initialized.

Key changes include:

  • Session management infrastructure with TTL-based cleanup for proxy sessions
  • Session ID detection from HTTP headers and Server-Sent Events (SSE) streams
  • Conditional health check activation based on server initialization state

Reviewed Changes

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

Show a summary per file
File Description
pkg/transport/session/proxy_session.go Implements ProxySession struct with session tracking capabilities
pkg/transport/session/manager.go Core session manager with TTL cleanup and thread-safe operations
pkg/transport/session/manager_test.go Comprehensive test suite for session manager functionality
pkg/transport/proxy/transparent/transparent_proxy.go Enhanced proxy with session detection and conditional health checks
pkg/transport/proxy/transparent/transparent_test.go Tests for session ID detection in SSE and header scenarios

@yrobla yrobla merged commit 78345e9 into main Jul 22, 2025
17 checks passed
@yrobla yrobla deleted the issue-1078 branch July 22, 2025 11:53
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.

Create a session interface for proxy connections
4 participants