mcp-execution-core
Foundation types, traits, and error handling for MCP Code Execution.
Installation
[]
= "0.6"
Or with cargo-add:
[!IMPORTANT] Requires Rust 1.89 or later.
Usage
Server Configuration
use ;
let config = builder
.command
.arg
.arg
.arg
.arg
.env
.build;
let server_id = new;
Domain Types
use ;
// Type-safe identifiers prevent mixing up strings
let server = new;
let tool = new;
assert_eq!;
assert_eq!;
[!TIP] Strong types prevent accidentally passing a
ToolNamewhere aServerIdis expected.
Error Handling
use ;
Command Validation
use ;
let config = builder
.command
.arg
.arg
.build;
// Validates against command injection
validate_server_config?;
[!WARNING] Always validate server configurations before execution to prevent command injection attacks.
Features
- Strong Domain Types:
ServerId,ToolNameinstead of raw strings - Error Hierarchy: Contextual errors with
thiserror - Server Configuration: Type-safe config with security validation
- Command Validation: Prevents command injection attacks
- Thread-Safe: All types are
Send + Sync - Zero Unsafe: No
unsafecode blocks
Types Reference
| Type | Description |
|---|---|
ServerId |
Unique server identifier (newtype over String) |
ToolName |
MCP tool name (newtype over String) |
ServerConfig |
Server configuration with command, args, env |
TransportType |
Transport type enum (Stdio, Http, Sse) |
Error |
Error type with contextual information |
Result<T> |
Alias for std::result::Result<T, Error> |
Related Crates
This crate is part of the mcp-execution workspace:
mcp-execution-introspector- MCP server analysismcp-execution-codegen- TypeScript code generationmcp-execution-files- Virtual filesystemmcp-execution-skill- SKILL.md generationmcp-execution-server- MCP server implementationmcp-execution-cli- Command-line interface
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.