Skip to content

fix: reject duplicate initialize requests#962

Open
he-yufeng wants to merge 1 commit into
modelcontextprotocol:mainfrom
he-yufeng:fix/reject-duplicate-initialize
Open

fix: reject duplicate initialize requests#962
he-yufeng wants to merge 1 commit into
modelcontextprotocol:mainfrom
he-yufeng:fix/reject-duplicate-initialize

Conversation

@he-yufeng
Copy link
Copy Markdown

Summary

  • reject a second initialize request on an already initialized server session
  • keep the original ServerSession.InitializeParams() instead of replacing it with later client parameters
  • add a raw JSON-RPC regression test for the duplicate-initialize path

Fixes #961.

To verify

  • go test ./mcp -run TestServerRejectsDuplicateInitialize -count=1
  • go test ./mcp -count=1
  • go test ./...

@he-yufeng he-yufeng force-pushed the fix/reject-duplicate-initialize branch from 603d55c to f62a410 Compare May 15, 2026 20:39
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.

Duplicate initialize with changed parameters can overwrite stored session initialization parameters

1 participant