fix(introspector): use MCP handshake info for name, version, and capabilities#88
Merged
Merged
Conversation
…bilities `discover_server()` previously hardcoded `name` from `config.command`, `version` as `"unknown"`, and determined `supports_resources` via a live `list_all_resources()` call that produced false positives when the server advertised `resources: null`. All four values are now read from `client.peer_info()` (`InitializeResult`), which rmcp populates after the MCP handshake. Fallback to `(config.command, "unknown", false, false)` when `peer_info()` returns `None`. Also fixes `supports_prompts` which was always `false` regardless of the server's advertised capabilities. Closes #79, #80, #84.
This was
linked to
issues
May 3, 2026
bug-ops
enabled auto-merge (squash)
May 3, 2026 12:40
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## master #88 +/- ##
==========================================
+ Coverage 88.84% 88.98% +0.13%
==========================================
Files 33 33
Lines 7605 7706 +101
==========================================
+ Hits 6757 6857 +100
- Misses 848 849 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
Summary
Fixes three bugs in
Introspector::discover_server()where values were read from local config instead of the MCP handshakeInitializeResult:ServerInfo.nameusedconfig.command(e.g.docker) instead ofserver_info.namefrom the handshakeServerInfo.versionwas hardcoded"unknown"instead ofserver_info.versionfrom the handshakesupports_resourcesusedlist_all_resources().await.is_ok()which returned true even when the server advertisedresources: null; now usescapabilities.resources.is_some()Also fixes
supports_promptswhich was alwaysfalseregardless of the server's advertised capabilities.All four values are now read from
client.peer_info()with a safe fallback to(config.command, "unknown", false, false)when peer info is unavailable.Implementation
The peer-info extraction logic was factored into a private
extract_peer_metahelper to make it independently unit-testable without spawning a real MCP server process.Test plan
SomeandNonepeer-info pathscargo nextest run --all-features --workspace)cargo +nightly fmt --checkcleancargo +stable clippy --all-targets --all-features --workspace -- -D warningsclean