Skip to main content

Comprehensive testing framework for Model Context Protocol (MCP) servers - Enhanced fork of mcp-client-cli with advanced testing capabilities

Project description

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.

🔗 Links

🙏 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_testing_framework-1.0.2.tar.gz (79.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_testing_framework-1.0.2-py3-none-any.whl (70.7 kB view details)

Uploaded Python 3

File details

Details for the file mcp_testing_framework-1.0.2.tar.gz.

File metadata

  • Download URL: mcp_testing_framework-1.0.2.tar.gz
  • Upload date:
  • Size: 79.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for mcp_testing_framework-1.0.2.tar.gz
Algorithm Hash digest
SHA256 6a87f47a6a43c3db8c068ac504e10cd25f99842a7455edbce9adf312d5822939
MD5 7be7cdf3e9fd2e5bbed817535b9bb0ec
BLAKE2b-256 1e61225f928daf579eaa47452adeda662280c3dd3437b7e60e28a502a2f58069

See more details on using hashes here.

File details

Details for the file mcp_testing_framework-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_testing_framework-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8c5cb5e62675e3bf19fb007ca81d77d5995b1ece508b1fd8443213f981018118
MD5 c6794807f0ff08830584c16ce85c9441
BLAKE2b-256 05be7a38a7ffef33792dc4db6a37665bb979e159a0195f518ad8d7a8710681b8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page