Skip to content

Conversation

eleftherias
Copy link
Contributor

Fix #1311

Allow the MCP server to respond the ping requests even if initialization hasn't happened yet, as per the spec.

Motivation and Context

The MCP specification states that pings should be allowed before initialization, but this SDK doesn't permit them and fail the request.

How Has This Been Tested?

Unit tests were added.
This was tested with a sample MCP server and client, ensuring that the client is allowed to first send a ping request and subsequently send an initialize request.

Breaking Changes

No breaking changs.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

@eleftherias eleftherias requested a review from a team as a code owner August 27, 2025 10:10
@eleftherias eleftherias requested a review from dsp-ant August 27, 2025 10:10
Copy link
Member

@dsp-ant dsp-ant left a comment

Choose a reason for hiding this comment

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

Very good observation. Thank you!

@dsp-ant dsp-ant merged commit 47d35f0 into modelcontextprotocol:main Sep 1, 2025
18 checks passed
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.

Allow ping requests before initialization
2 participants