Skip to main content

MCP Testing Framework

PyPI version Python Support License: MIT Tests

Comprehensive testing framework for Model Context Protocol (MCP) servers

A powerful, easy-to-use testing framework specifically designed for validating MCP server implementations. This enhanced framework dramatically simplifies MCP server testing workflows and provides comprehensive validation capabilities.

🎯 Key Features

🚀 Simplified Testing Workflow

Replace complex containerization setups with a simple one-liner:

pip install mcp-testing-framework && mcp-test --test-mcp-servers

🔧 Comprehensive Testing Suite

  • Functional Testing: Validate MCP server capabilities and tool implementations
  • Security Testing: Authentication, input validation, and vulnerability scanning
  • Performance Testing: Load testing, resource monitoring, and bottleneck detection
  • Integration Testing: End-to-end workflow validation with real LLM interactions
  • Compatibility Testing: Cross-platform and multi-version validation

🎨 Multiple CLI Entry Points

  • mcp-test - Primary testing interface
  • mcp-testing - Alternative testing command
  • mcp-client - Client interaction mode
  • llm - Legacy compatibility mode

📊 Rich Reporting & Analytics

  • Detailed test reports with confidence scoring
  • Performance metrics and resource usage analysis
  • Issue detection with automated remediation suggestions
  • Export results in multiple formats (JSON, HTML, XML)

🔄 CI/CD Integration

  • Ready-to-use GitHub Actions templates
  • Cross-platform support (Ubuntu, macOS, Windows)
  • Multiple Python version testing (3.9-3.12)
  • Automated performance benchmarking

🚀 Quick Start

Installation

pip install mcp-testing-framework

Basic Usage

  1. Test MCP Servers:

    mcp-test --test-mcp-servers
    
  2. Run Comprehensive Test Suite:

    mcp-testing --suite-type all --output-format json
    
  3. Performance Testing:

    mcp-test --performance-test --load-test-duration 300
    

Configuration

Create a configuration file ~/.llm/config.json:

{
  "systemPrompt": "You are an AI assistant helping with MCP server testing.",
  "llm": {
    "provider": "openai",
    "model": "gpt-4o-mini",
    "api_key": "your-api-key",
    "temperature": 0.7
  },
  "mcpServers": {
    "your-server": {
      "command": "node",
      "args": ["path/to/your/server.js", "--stdio"],
      "env": {
        "DEBUG": "*"
      },
      "enabled": true
    }
  }
}

📖 Documentation

Testing Capabilities

Functional Testing

  • Tool discovery and validation
  • Parameter validation and type checking
  • Response format verification
  • Error handling validation

Security Testing

  • Input sanitization testing
  • Authentication mechanism validation
  • Authorization boundary testing
  • Vulnerability scanning

Performance Testing

  • Load testing with configurable parameters
  • Memory usage monitoring
  • Response time analysis
  • Resource leak detection

Integration Testing

  • End-to-end workflow validation
  • Multi-server interaction testing
  • LLM integration verification
  • Real-world scenario simulation

Advanced Features

Custom Test Suites

from mcp_client_cli.testing import MCPServerTester
from mcp_client_cli.config import AppConfig

# Create custom test configuration
config = AppConfig(...)
tester = MCPServerTester(config)

# Run specific test types
results = await tester.test_server_functionality("server-name")
security_results = await tester.run_security_tests("server-name")
performance_results = await tester.run_performance_tests("server-name")

CI/CD Integration

# .github/workflows/mcp-testing.yml
name: MCP Server Testing
on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v4
        with:
          python-version: '3.11'
      - run: pip install mcp-testing-framework
      - run: mcp-test --test-mcp-servers
        env:
          OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}

🤝 Attribution & Acknowledgments

This project is an enhanced fork of the excellent mcp-client-cli project. We extend our gratitude to the original authors for their foundational work that made this testing framework possible.

Key Enhancements in this Fork:

  • Comprehensive testing suite with multiple test types
  • Simplified CI/CD integration workflows
  • Enhanced performance monitoring and analysis
  • Security testing capabilities
  • Rich reporting and analytics
  • Cross-platform GitHub Actions templates
  • Extensive documentation and examples

🛠️ Development

Setup Development Environment

git clone https://github.com/tosinakinosho/mcp-testing-framework.git
cd mcp-testing-framework
pip install -e ".[dev]"

Running Tests

# Run all tests
pytest

# Run specific test types
pytest -m unit
pytest -m integration
pytest -m performance
pytest -m security

# Run with coverage
pytest --cov=mcp_client_cli --cov-report=html

Code Quality

# Format code
black src/ tests/
isort src/ tests/

# Lint code
flake8 src/ tests/
mypy src/

# Security scan
bandit -r src/
safety check

📊 Performance Benchmarks

Test Type Average Duration Memory Usage Success Rate
Functional 2.3s 45MB 99.2%
Security 8.7s 62MB 97.8%
Performance 45s 128MB 95.5%
Integration 12.4s 89MB 98.1%

🔧 Supported MCP Server Types

  • Python MCP Servers - Full support with advanced debugging
  • Node.js MCP Servers - Complete testing suite with performance monitoring
  • Go MCP Servers - Basic to advanced testing capabilities
  • Rust MCP Servers - Performance-optimized testing workflows
  • Custom Implementations - Flexible testing framework for any MCP server

📝 Changelog

Version 1.0.0 (2024-12-XX)

  • 🎉 Initial release as independent package
  • ✨ Comprehensive testing framework
  • 🚀 Simplified CI/CD integration
  • 📊 Rich reporting and analytics
  • 🔒 Security testing capabilities
  • ⚡ Performance monitoring and optimization
  • 📖 Extensive documentation and examples

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Areas for Contribution

  • Additional test types and scenarios
  • Enhanced reporting formats
  • New CI/CD platform integrations
  • Performance optimizations
  • Documentation improvements
  • Bug fixes and feature requests

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Support

If you find this project helpful, please consider:

  • ⭐ Starring the repository
  • 🐛 Reporting bugs and issues
  • 💡 Suggesting new features
  • 🤝 Contributing code or documentation
  • 📢 Sharing with the MCP community

Made with ❤️ by Tosin Akinosho
Building on the excellent foundation of the original mcp-client-cli project

Metadata

Release files for mcp-testing-framework 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-testing-framework 1.0.2
File Size Uploaded Provenance
mcp_testing_framework-1.0.2.tar.gz 79.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mcp-testing-framework 1.0.2
File Interpreter ABI Platform
mcp_testing_framework-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 150.2 kB

Release files / mcp_testing_framework-1.0.2.tar.gz

Download URL mcp_testing_framework-1.0.2.tar.gz
Size 79.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6a87f47a6a43c3db8c068ac504e10cd25f99842a7455edbce9adf312d5822939
BLAKE2b-256 checksum
How to use checksums
1e61225f928daf579eaa47452adeda662280c3dd3437b7e60e28a502a2f58069
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.10

Release files / mcp_testing_framework-1.0.2-py3-none-any.whl

Download URL mcp_testing_framework-1.0.2-py3-none-any.whl
Size 70.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8c5cb5e62675e3bf19fb007ca81d77d5995b1ece508b1fd8443213f981018118
BLAKE2b-256 checksum
How to use checksums
05be7a38a7ffef33792dc4db6a37665bb979e159a0195f518ad8d7a8710681b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.10

Security for mcp-testing-framework 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page