Skip to main content

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โ€‹

Reference Documentationโ€‹

Operations & Productionโ€‹

Examples & Resourcesโ€‹

๐Ÿ—๏ธ 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)โ€‹

  1. Quick Start Guide - Run verified examples in 5 minutes
  2. Working Examples - Learn from 100% working tests
  3. CLI Reference - Master the moth run and moth validate commands

Intermediate (Regular User)โ€‹

  1. Configuration Reference - Advanced YAML configuration patterns
  2. Performance Testing - Optimize test execution
  3. Everything Server Example - Complex real-world testing

Advanced (Power User/Developer)โ€‹

  1. Production Deployment - Enterprise deployment
  2. Custom Validation Scripts - Python/JS/Lua scripts
  3. 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โ€‹

๐Ÿ† 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.