Skip to content

fix(mcp): init request w/o client info does not panic#844

Merged
nader-ziada merged 1 commit intocontainers:mainfrom
Cali0707:fix-panic-v0.0.58
Feb 27, 2026
Merged

fix(mcp): init request w/o client info does not panic#844
nader-ziada merged 1 commit intocontainers:mainfrom
Cali0707:fix-panic-v0.0.58

Conversation

@Cali0707
Copy link
Collaborator

Fixes #842

It looks like when init request were sent without client info our user agent middleware (added in #760 ) would panic trying to access the client info.

IMO this case is rare since the spec seems to mandate that client info is sent, but putting a nil check here is probably fine.

Not sure if we should return something other than "" in this case though

Signed-off-by: Calum Murray <cmurray@redhat.com>
@Cali0707 Cali0707 requested a review from manusa February 27, 2026 20:55
@Cali0707
Copy link
Collaborator Author

@chenrui333 does this fix the panic you were seeing?

@Cali0707 Cali0707 requested a review from nader-ziada February 27, 2026 20:57
Copy link
Collaborator

@nader-ziada nader-ziada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nader-ziada nader-ziada merged commit 5f2f6d1 into containers:main Feb 27, 2026
7 checks passed
@manusa
Copy link
Member

manusa commented Feb 28, 2026

Thx for fixing this so quickly 🙌

IMO this case is rare since the spec seems to mandate that client info is sent, but putting a nil check here is probably fine.

Not sure if we should return something other than "" in this case though

Most MCP Hosts -> Clients should take care of this automatically.
I've even tried to add a test case for this scenario with go-sdk and seemed quite an impossible task to do.

Since v0.0.58 was just released, we'll definitely see other reports if this requires further attention.

@manusa manusa added this to the 0.1.0 milestone Feb 28, 2026
manusa added a commit to marcnuri-forks/kubernetes-mcp-server that referenced this pull request Feb 28, 2026
Add a test that sends a raw initialize request without clientInfo
to verify the server doesn't panic. The go-sdk client always sets
clientInfo, so we bypass it with raw HTTP to reproduce the scenario
from non-compliant clients.

Ref: containers#842, containers#844
Signed-off-by: Marc Nuri <marc@marcnuri.com>
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.

0.0.58 panic (SIGSEGV) in MCP middleware during initialize/tools flow

3 participants