Expand description
§MOTH - MOdel context protocol Test Harness
A modern, comprehensive testing framework for MCP (Model Context Protocol) servers built on the official Rust SDK. MOTH provides validation, compliance testing, and detailed reporting for MCP server implementations.
§Features
- SDK-First: Built on the official MCP Rust SDK for guaranteed protocol compliance
- Transport Agnostic: Supports stdio, HTTP, and SSE transports
- Comprehensive Testing: Protocol compliance, capability validation, and stress testing
- Rich Reporting: HTML, JSON, and JUnit XML report formats
- Developer Friendly: Clear error messages, detailed logs, and interactive CLI
§Architecture
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Config │───▶│ Client │───▶│ Executor │
│ (YAML) │ │ (MCP/rmcp) │ │ (Test Run) │
└─────────────┘ └─────────────┘ └─────────────┘
│ │ │
▼ ▼ ▼
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Validation │ │ Server │ │ Reporting │
│ (Schema) │ │ (Process) │ │ (JSON/HTML) │
└─────────────┘ └─────────────┘ └─────────────┘
§Quick Start
use mandrel_mcp_th::cli::{Cli, Commands};
use clap::Parser;
let cli = Cli::parse();
match cli.command {
Commands::Run(run_args) => {
// Test execution logic
println!("Running tests from: {}", run_args.config.display());
}
Commands::Report(report_args) => {
// Report generation logic
println!("Generating reports from: {}", report_args.input.display());
}
Commands::Validate(validate_args) => {
// Configuration validation
println!("Validating config: {}", validate_args.config.display());
}
Commands::Profile(_profile_args) => {
// Profile management
println!("Managing configuration profiles");
}
Commands::Watch(_watch_args) => {
// File watching and auto-generation
println!("Starting file watch mode");
}
}
Re-exports§
Modules§
- cli
- Command-line interface for Mandrel MCP Test Harness
- client
- MCP client module
- error
- Error types for MOTH test harness
- error_
handling - Comprehensive Error Handling and Logging System
- executor
- reporting
- Test reporting module
- runner
- Test Suite Runner - Orchestrates multiple test case executions
- script_
engines - Script execution engines for validation scripts
- spec
- YAML specification parser and validation module
- testing
- Testing infrastructure for MOTH
- validation
- Protocol validation module
Constants§
- DEFAULT_
MAX_ CONCURRENCY - Maximum concurrent test executions by default
- DEFAULT_
TIMEOUT_ SECS - Default timeout for MCP operations
- FULL_
NAME - The full name
- MCP_
PROTOCOL_ VERSION - The MCP protocol version this harness supports
- NAME
- The name of the test harness
- VERSION
- The version of MOTH
Functions§
- init_
logging - Configuration for logging
- is_
dev_ version - Check if the version has been patched with a patch
If patched, the version will have a
-dev
suffix - is_
shutdown_ requested - Check if shutdown has been requested
- request_
shutdown - Request shutdown (used by signal handlers)
- user_
agent - Returns the user agent string for HTTP requests