Mandrel MCP Test Harness
A comprehensive testing framework for Model Context Protocol (MCP) servers with enterprise-grade capabilities.
The Mandrel project provides the moth binary (MOdel context protocol Test Harness) for command-line testing operations.
๐ Key Featuresโ
Protocol Complianceโ
- โ MCP Protocol Validation - Full MCP 2025-06-18 specification compliance
- โ Transport Testing - stdio transport validation (primary focus)
- โ Capability Detection - Automatic server capability discovery and validation
- โ Error Handling - Comprehensive MCP error code testing (-32601, -32602, -32603)
Performance & Scaleโ
- โ Concurrent Execution - Configurable parallelism with resource limits (up to 32 concurrent tests)
- โ Performance Monitoring - Response time tracking from 0ms to 10+ seconds
- โ Real-time Metrics - Memory usage, CPU monitoring, and throughput measurement
- โ Stress Testing - High-load testing with verified performance characteristics
Validation & Qualityโ
- โ JSONPath Validation - Flexible response validation using JSONPath expressions
- โ Custom Scripts - Python/JavaScript/Lua custom validation logic support
- โ Security Testing - Built-in security constraint validation (no passwords, API keys)
- โ Server Reality Testing - Validates only features servers actually support
Production Readyโ
- โ CI/CD Integration - GitHub Actions, GitLab CI, Jenkins support with auto-detection
- โ Multiple Report Formats - JSON, HTML, JUnit XML with interactive charts
- โ Configuration Profiles - Environment-specific configuration management
- โ Enterprise Features - Comprehensive validation, audit logging, compliance reporting
๐ Quick Startโ
# Build from source
git clone https://github.com/rustic-ai/codeprism.git
cd codeprism
cargo build --release --bin moth
# Run verified working example (100% success rate)
cargo run --bin moth -- run codeprism-docs/docs/test-harness/examples/filesystem-server.yaml
# Validate a specification
cargo run --bin moth -- validate my-server.yaml
๐ Documentation Sectionsโ
Getting Startedโ
- Quick Start Guide - Get up and running in 5 minutes with verified examples
- Installation Guide - Complete installation instructions
Reference Documentationโ
- CLI Reference - Complete command-line documentation (
run
,validate
,report
, etc.) - Configuration Reference - Complete YAML specification format with working examples
- User Guide - Comprehensive testing guide
Operations & Productionโ
- Performance Tuning - Optimize test execution and server performance
- Production Deployment - Enterprise deployment guide
- Troubleshooting - Common issues and solutions
Examples & Resourcesโ
- Working Examples - Verified test specifications with 100% success rates
- Filesystem Server - โ 8/8 tests passing
- Everything Server - โ 8/8 tests passing
- Test Results & Reports - Understanding test output
๐๏ธ Architecture Overviewโ
The MCP Test Harness consists of several key components verified through extensive testing:
Core Componentsโ
- Configuration Manager: YAML configuration parsing with comprehensive validation
- Test Executor: Asynchronous test execution with verified concurrency control
- Server Manager: MCP server lifecycle management (stdio transport)
- Response Validator: JSONPath validation and custom script validation
- Performance Monitor: Real-time monitoring with sub-millisecond precision
- Report Generator: Multi-format reporting with interactive visualizations
๐ Test Categoriesโ
Core Testing (Verified Working)โ
- Initialization Testing - Server startup and handshake validation
- Tool Testing - Individual tool functionality validation with real examples
- Resource Testing - Resource access and management validation
- Error Handling - MCP error code validation (-32601, -32602, -32603)
Advanced Testing (Production Tested)โ
- Performance Testing - Response time validation (0ms to 10+ seconds measured)
- Concurrency Testing - Parallel execution up to 32 concurrent tests
- Security Testing - Security constraint validation (no passwords, API keys)
- Unicode Testing - International character support validation
Specialized Testing (Enterprise Ready)โ
- Server Reality Testing - Only test capabilities servers actually support
- Capability Validation - Accurate capability declaration validation
- Protocol Compliance - MCP 2025-06-18 specification compliance
- Regression Testing - Automated change impact detection
๐ Learning Pathโ
Beginner (New to MCP Test Harness)โ
- Quick Start Guide - Run verified examples in 5 minutes
- Working Examples - Learn from 100% working tests
- CLI Reference - Master the
moth run
andmoth validate
commands
Intermediate (Regular User)โ
- Configuration Reference - Advanced YAML configuration patterns
- Performance Testing - Optimize test execution
- Everything Server Example - Complex real-world testing
Advanced (Power User/Developer)โ
- Production Deployment - Enterprise deployment
- Custom Validation Scripts - Python/JS/Lua scripts
- CI/CD Integration - Automated testing pipelines
๐ Getting Helpโ
- ๐ Documentation Issues: If you find documentation unclear or missing
- ๐ Bug Reports: For software bugs and unexpected behavior
- ๐ก Feature Requests: For new functionality suggestions
- โ Usage Questions: For help with configuration and usage
Support Channelsโ
- GitHub Issues: Report issues and bugs
- GitHub Discussions: Community Q&A
- Documentation: Complete reference materials (this site)
๐ Proven Track Recordโ
Our test harness has been thoroughly tested with real MCP servers:
โ Filesystem Server Resultsโ
Suite: Filesystem MCP Server (MCP-Compliant)
Total Tests: 8, Passed: 8, Failed: 0
Duration: 2.3s
Success Rate: 100%
โ Everything Server Resultsโ
Suite: Everything MCP Server (Working Tests)
Total Tests: 8, Passed: 8, Failed: 0
Duration: 10.02s
Success Rate: 100%
Real Performance Characteristicsโ
- Fast Operations: Math operations (0-1ms response time)
- Text Processing: Unicode support (0-1ms response time)
- Environment Access: System variables (1ms response time)
- Long Operations: Progress notifications (10+ seconds)
- Resource Management: Basic access validation
- Error Handling: Proper MCP error codes
๐ฏ Server Reality Focusโ
Unlike documentation-driven test frameworks, we focus on server reality:
- โ Test only what works - No false capability claims
- โ Use actual tool names - Verified against real implementations
- โ Correct output formats - Based on actual server responses
- โ Realistic timeouts - Based on measured performance
- โ Proper error codes - Validated MCP error responses
Before vs Afterโ
Traditional Approach (Documentation-Based):
capabilities:
sampling: true # โ Often wrong
prompts: true # โ Usually unsupported
expected:
path: "$.result" # โ Wrong format
value: 8 # โ Unrealistic
Our Approach (Server Reality):
capabilities:
sampling: false # โ
Verified accurate
prompts: false # โ
Tested and confirmed
expected:
fields:
- path: "$[0].text" # โ
Actual server format
contains: "100" # โ
Realistic validation
Ready to get started? Begin with our Quick Start Guide to run your first verified test in under 5 minutes! ๐
Want working examples? Check out our verified examples with 100% success rates against real MCP servers.