Skip to content

fix (ai): mcp-client properly responds to ping requests. #6285

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rado0x54
Copy link

@rado0x54 rado0x54 commented May 12, 2025

Background

According to the Model Context Protocol specification, clients should respond to ping requests from the server to maintain the connection. When a server sends a ping request, the client should send a ping response. (See Specification)

Summary

Added proper message handling for message.method === 'ping'.

Verification

I've setup the fixed mcp client against an mcp server that implements (and requires) server-side pings to be replied to.

hub:dev: Pinging session f8d2a102-7953-453a-af61-fa7f5320cd4e...
hub:dev: Handling message for session f8d2a102-7953-453a-af61-fa7f5320cd4e
hub:dev: Ping successful for session f8d2a102-7953-453a-af61-fa7f5320cd4e

Tasks

  • Tests have been added / updated (for bug fixes / features)
  • Documentation has been added / updated (for bug fixes / features)
  • A patch changeset for relevant packages has been added (for bug fixes / features - run pnpm changeset in the project root)
  • Formatting issues have been fixed (run pnpm prettier-fix in the project root)

Related Issues

Fixes #6282

@rado0x54 rado0x54 force-pushed the fix/mcp-client-ping branch from 39287c8 to 38027fb Compare May 12, 2025 12:15
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.

MCP Client does not respond to ping requests from server
1 participant