mcp-execution-introspector
MCP server introspection using the official rmcp SDK.
Installation
[]
= "0.6"
Or with cargo-add:
[!IMPORTANT] Requires Rust 1.89 or later.
Usage
Basic Introspection
use Introspector;
use ;
async
Accessing Tool Schemas
let info = introspector.discover_server.await?;
for tool in &info.tools
[!TIP] Tool schemas are JSON Schema objects that can be used for TypeScript type generation.
Transport Support
// npx-based servers
let config = builder
.command
.arg
.arg
.build;
// Docker-based servers
let config = builder
.command
.arg
.arg
.arg
.arg
.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.