Skip to content

fix(introspector): use MCP handshake info for name, version, and capabilities#88

Merged
bug-ops merged 1 commit into
masterfrom
79-84-introspector-handshake-info
May 3, 2026
Merged

fix(introspector): use MCP handshake info for name, version, and capabilities#88
bug-ops merged 1 commit into
masterfrom
79-84-introspector-handshake-info

Conversation

@bug-ops

@bug-ops bug-ops commented May 3, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes three bugs in Introspector::discover_server() where values were read from local config instead of the MCP handshake InitializeResult:

Also fixes supports_prompts which was always false regardless 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_meta helper to make it independently unit-testable without spawning a real MCP server process.

Test plan

  • 10 new unit tests added covering all four fields in both Some and None peer-info paths
  • 636 tests pass (cargo nextest run --all-features --workspace)
  • 9 doc tests pass
  • cargo +nightly fmt --check clean
  • cargo +stable clippy --all-targets --all-features --workspace -- -D warnings clean

…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.
@github-actions github-actions Bot added crate: mcp-introspector Changes to mcp-introspector crate (MCP server analysis) type: documentation Documentation changes (*.md, docs/, comments) breaking change Contains breaking API changes (requires major version bump) release Release preparation (changelog, version bumps) labels May 3, 2026
@bug-ops
bug-ops enabled auto-merge (squash) May 3, 2026 12:40
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.23810% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/mcp-introspector/src/lib.rs 95.23% 5 Missing ⚠️

Impacted file tree graph

@@            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     
Flag Coverage Δ
mcp-cli 88.98% <95.23%> (+0.13%) ⬆️
mcp-codegen 88.98% <95.23%> (+0.13%) ⬆️
mcp-core 88.98% <95.23%> (+0.13%) ⬆️
mcp-files 88.98% <95.23%> (+0.13%) ⬆️
mcp-introspector 88.98% <95.23%> (+0.13%) ⬆️
mcp-server 88.98% <95.23%> (+0.13%) ⬆️
mcp-skill 88.98% <95.23%> (+0.13%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
crates/mcp-introspector/src/lib.rs 87.53% <95.23%> (+5.26%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bug-ops
bug-ops merged commit 099bb6d into master May 3, 2026
17 checks passed
@bug-ops
bug-ops deleted the 79-84-introspector-handshake-info branch May 3, 2026 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Contains breaking API changes (requires major version bump) crate: mcp-introspector Changes to mcp-introspector crate (MCP server analysis) release Release preparation (changelog, version bumps) type: documentation Documentation changes (*.md, docs/, comments)

Projects

None yet

2 participants