Skip to main content

Crate mcp_execution_introspector

Crate mcp_execution_introspector 

Source
Expand description

MCP server introspection using rmcp official SDK.

This crate provides functionality to discover MCP server capabilities, tools, resources, and prompts using the official rmcp SDK. It enables automatic extraction of tool schemas for code generation.

§Architecture

The introspector connects to MCP servers via stdio (subprocess) or Streamable HTTP transport (used for both Transport::Http and Transport::Sse) and uses rmcp’s ServiceExt trait to query server capabilities. Discovered information is stored locally for subsequent code generation phases.

§Examples

use mcp_execution_introspector::Introspector;
use mcp_execution_core::{ServerId, ServerConfig};

let mut introspector = Introspector::new();

// Connect to github server
let server_id = ServerId::new("github").unwrap();
let config = ServerConfig::builder()
    .command("github-server".to_string())
    .build()?;

let info = introspector
    .discover_server(server_id, &config)
    .await?;

println!("Server: {} v{}", info.name, info.version);
println!("Tools found: {}", info.tools.len());

for tool in &info.tools {
    println!("  - {}: {}", tool.name, tool.description);
}

Structs§

Introspector
MCP server introspector.
ServerCapabilities
Server capabilities.
ServerInfo
Information about an MCP server.
ToolInfo
Information about an MCP tool.

Constants§

MAX_SCHEMA_SIZE_BYTES
Maximum serialized JSON byte size for a single tool’s input_schema, as reported by the server.
MAX_TOOL_COUNT
Maximum number of tools accepted from a single MCP server’s list_all_tools response (denial-of-service protection, CWE-400).
MAX_TOOL_DESCRIPTION_LEN
Maximum byte length for a single tool’s description, as reported by the server.
MAX_TOOL_NAME_LEN
Maximum byte length for a single tool’s name, as reported by the server.