Skip to content

mcp: don't close session when keepalive ping returns method-not-found#900

Merged
maciej-kisiel merged 1 commit intomainfrom
mkisiel/keepalive
Apr 22, 2026
Merged

mcp: don't close session when keepalive ping returns method-not-found#900
maciej-kisiel merged 1 commit intomainfrom
mkisiel/keepalive

Conversation

@maciej-kisiel
Copy link
Copy Markdown
Contributor

Since ping is optional per the MCP spec, a peer that doesn't implement it will respond with a -32601 (method not found) error. Previously, startKeepalive treated all ping errors identically, closing the session even when the peer was perfectly healthy.

Now, a method-not-found response stops the keepalive goroutine without closing the session.

Fixes #897

Since ping is optional per the MCP spec, a peer that doesn't implement
it will respond with a -32601 (method not found) error. Previously,
startKeepalive treated all ping errors identically, closing the session
even when the peer was perfectly healthy.

Now, a method-not-found response stops the keepalive goroutine without
closing the session.

Fixes #897
@maciej-kisiel maciej-kisiel requested a review from jba April 22, 2026 11:15
@maciej-kisiel maciej-kisiel merged commit b37e497 into main Apr 22, 2026
9 of 11 checks passed
@maciej-kisiel maciej-kisiel deleted the mkisiel/keepalive branch April 23, 2026 14:33
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.

keepalive calls session.Close for all errors including 404

2 participants