4 releases
Uses new Rust 2024
| 0.6.6 | Feb 22, 2026 |
|---|---|
| 0.6.5 | Jan 27, 2026 |
| 0.6.4 | Jan 4, 2026 |
| 0.6.3 | Jan 4, 2026 |
#1417 in Development tools
Used in 4 crates
(3 directly)
115KB
1.5K
SLoC
mcp-execution-introspector
MCP server introspection using the official rmcp SDK.
Installation
[dependencies]
mcp-execution-introspector = "0.6"
Or with cargo-add:
cargo add mcp-execution-introspector
[!IMPORTANT] Requires Rust 1.89 or later.
Usage
Basic Introspection
use mcp_execution_introspector::Introspector;
use mcp_execution_core::{ServerId, ServerConfig};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut introspector = Introspector::new();
let server_id = ServerId::new("github");
let config = ServerConfig::builder()
.command("npx".to_string())
.arg("-y".to_string())
.arg("@modelcontextprotocol/server-github".to_string())
.env("GITHUB_TOKEN".to_string(), "ghp_xxx".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);
}
Ok(())
}
Accessing Tool Schemas
let info = introspector.discover_server(server_id, &config).await?;
for tool in &info.tools {
println!("Tool: {}", tool.name);
println!("Schema: {}", serde_json::to_string_pretty(&tool.input_schema)?);
}
[!TIP] Tool schemas are JSON Schema objects that can be used for TypeScript type generation.
Transport Support
// npx-based servers
let config = ServerConfig::builder()
.command("npx".to_string())
.arg("-y".to_string())
.arg("@modelcontextprotocol/server-github".to_string())
.build();
// Docker-based servers
let config = ServerConfig::builder()
.command("docker".to_string())
.arg("run".to_string())
.arg("-i".to_string())
.arg("--rm".to_string())
.arg("ghcr.io/org/mcp-execution-server".to_string())
.build();
[!NOTE] Currently supports stdio transport, which is the most common for MCP servers.
Features
- Official SDK: Uses rmcp for MCP communication
- Tool Discovery: Extract all tools from any MCP server
- Schema Extraction: Get JSON schemas for tool parameters
- Capability Detection: Discover tools, resources, prompts support
- Caching: Store discovered server information
- Security: Command validation prevents injection attacks
Types Reference
| Type | Description |
|---|---|
Introspector |
Main introspection service with caching |
ServerInfo |
Discovered server metadata and tools |
ToolInfo |
Tool name, description, and JSON schema |
ServerCapabilities |
Flags for tools, resources, prompts support |
How It Works
- Validate Config — Check server configuration for security issues
- Spawn Process — Start MCP server via stdio transport
- Connect — Establish rmcp client connection
- Query — Use
ServiceExt::list_all_tools()to get tools - Extract — Parse tool definitions and schemas
- Cache — Store information for later retrieval
Related Crates
This crate is part of the mcp-execution workspace:
mcp-execution-core- Foundation types (ServerId,ServerConfig)mcp-execution-codegen- Uses introspection results for code generationrmcp- Official Rust MCP SDK
MSRV Policy
Minimum Supported Rust Version: 1.89
MSRV increases are considered minor version bumps.
License
Licensed under either of Apache License 2.0 or MIT license at your option.
Dependencies
~13–20MB
~276K SLoC