fix(mcp): validate initialize handshake response for required fields #135

Merged
fuzzy merged 1 commit from fix/0092-mcp-validate-initialize into main 2026-07-05 16:48:19 +00:00
Owner

What

Add validation to _send_initialize() to check that the response contains serverInfo and protocolVersion. Raises MCPError if either is missing.

Why

Previously, an unexpected initialize response (e.g. empty result) would silently continue, potentially causing confusing errors later.

Testing

  • 145 unit tests pass
  • Pre-commit hooks pass

Closes #92

## What Add validation to `_send_initialize()` to check that the response contains `serverInfo` and `protocolVersion`. Raises `MCPError` if either is missing. ## Why Previously, an unexpected initialize response (e.g. empty result) would silently continue, potentially causing confusing errors later. ## Testing - [x] 145 unit tests pass - [x] Pre-commit hooks pass Closes #92
fix(mcp): validate initialize handshake response for required fields
Some checks failed
CI / lint (pull_request) Has been cancelled
CI / test (pull_request) Has been cancelled
e2b1c40535
Check that serverInfo and protocolVersion are present in the
initialize response, raising MCPError if not.
Closes #92
fuzzy self-assigned this 2026-07-05 16:43:41 +00:00
fuzzy force-pushed fix/0092-mcp-validate-initialize from e2b1c40535
Some checks failed
CI / lint (pull_request) Has been cancelled
CI / test (pull_request) Has been cancelled
to db8567aa15
All checks were successful
CI / test (pull_request) Successful in 52s
CI / lint (pull_request) Successful in 1m24s
2026-07-05 16:43:47 +00:00
Compare
fuzzy force-pushed fix/0092-mcp-validate-initialize from db8567aa15
All checks were successful
CI / test (pull_request) Successful in 52s
CI / lint (pull_request) Successful in 1m24s
to 42956fc13a
All checks were successful
CI / lint (pull_request) Successful in 1m21s
CI / test (pull_request) Successful in 51s
2026-07-05 16:46:08 +00:00
Compare
the.auditor left a comment

Automated Review — PR #135

Result: APPROVED


Clean fix — validates _send_initialize() response for serverInfo and protocolVersion fields, raises MCPError if either is missing. Tests updated to include protocolVersion in mock responses. Closes #92.

No suggestions.

## Automated Review — PR #135 **Result: APPROVED** --- Clean fix — validates `_send_initialize()` response for `serverInfo` and `protocolVersion` fields, raises `MCPError` if either is missing. Tests updated to include `protocolVersion` in mock responses. Closes #92. No suggestions.
fuzzy scheduled this pull request to auto merge when all checks succeed 2026-07-05 16:46:37 +00:00
fuzzy merged commit 42956fc13a into main 2026-07-05 16:48:19 +00:00
fuzzy deleted branch fix/0092-mcp-validate-initialize 2026-07-05 16:48:19 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
thwap/kronai!135
No description provided.