fix: resolve compatibility issues with servers sending LSP notifications#413
Merged
4t145 merged 1 commit intomodelcontextprotocol:mainfrom Sep 4, 2025
Merged
fix: resolve compatibility issues with servers sending LSP notifications#4134t145 merged 1 commit intomodelcontextprotocol:mainfrom
4t145 merged 1 commit intomodelcontextprotocol:mainfrom
Conversation
- Gracefully ignore non-MCP notifications (like window/logMessage) for compatibility - Add proper MCP method validation based on 2025-06-18 specification - Fix connection failures with servers like 21Magic that send IDE integration messages Resolves connection closed errors during initialization with mixed-protocol servers.
Merged
takumi-earth
pushed a commit
to earthlings-dev/rmcp
that referenced
this pull request
Jan 27, 2026
…ons (modelcontextprotocol#413) - Gracefully ignore non-MCP notifications (like window/logMessage) for compatibility - Add proper MCP method validation based on 2025-06-18 specification - Fix connection failures with servers like 21Magic that send IDE integration messages Resolves connection closed errors during initialization with mixed-protocol servers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves connection closed errors during initialization with mixed-protocol servers.
Motivation and Context
Certain MCP servers (like 21Magic) send LSP (Language Server Protocol) notifications such as
window/logMessagefor IDE integration purposes. These messages, while valid JSON-RPC 2.0, are not part of the MCP specification and cause the Rust SDK to fail parsing, resulting in connection termination.This change implements graceful handling of non-MCP notifications while maintaining strict parsing for actual MCP messages, ensuring compatibility with servers that send mixed protocol messages for enhanced IDE integration.
How Has This Been Tested?
Breaking Changes
None. This is a backward-compatible fix that only affects error handling paths. All existing MCP servers continue to work without any changes required.
Types of changes
Checklist
Additional context
Implementation Details:
is_standard_method()function based on MCP specification 2025-06-18should_ignore_notification()helper for compatibility checkstry_parse_with_compatibility()to handle mixed-protocol scenariostracelevel logging for ignored messages to avoid log pollutionDesign Decisions:
idfield) are subject to lenient parsingmatches!macro for consistencyThis fix enables broader MCP ecosystem compatibility, particularly with servers that integrate with IDEs through LSP messages while maintaining full protocol compliance for standard MCP operations.