-
Notifications
You must be signed in to change notification settings - Fork 405
feat(mcp): remove mcp-session-id header injection for HTTP transports #681
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
af1dd4f to
f052b45
Compare
There was a problem hiding this 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 removes incorrect manual injection of the Mcp-Session-Id header for HTTP MCP transports, fixing connection failures with MCP servers like Linear and DeepWiki that were rejecting client-generated session IDs.
Changes:
- Removed 9 lines of code that manually added
Mcp-Session-Idheader to non-OAuth HTTP MCP server configurations - Session management is now delegated entirely to the fastmcp library, which handles the MCP protocol correctly
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Related Issue
Resolves #677
Description
This PR fixes incorrect manual addition of
Mcp-Session-Idheader that violated the MCP protocol standard.Problem
The previous implementation manually added
Mcp-Session-Idheader using kimi-cli's session ID, which violated the MCP protocol standard. According to MCP specification (2025-06-18), theMcp-Session-Idmust be:initializerequestThis caused connection failures with MCP servers like Linear and DeepWiki, which returned
400 Bad Request: Session not foundbecause they didn't recognize the client-generated session ID.Solution
Removed the incorrect manual
Mcp-Session-Idheader injection logic and let the fastmcp library handle session management automatically according to the MCP protocol standard:initializerequest withoutMcp-Session-IdMcp-Session-Idin response headerChanges
Modified files:
src/kimi_cli/soul/toolset.py: Removed manualMcp-Session-Idheader injection logic (9 lines deleted)Testing
Verified with both Linear (OAuth) and DeepWiki (non-OAuth) MCP servers:
Checklist
CHANGELOG.md). (Will be added in a separate commit)