Skip to main content

Local testing framework for MCP (Model Context Protocol) servers

Project description

🧪 MCP Testing

AI-powered testing framework for MCP servers

Test your MCP servers with real AI agents conducting conversations and LLM judges evaluating results

License PRs Welcome PyPI Python

Why MCP Testing?

Traditional testing doesn't work for MCP servers. You can't write unit tests for natural language interactions. MCP Testing solves this with:

  • 🤖 Real AI Agents - Claude and GPT-4 actually use your MCP server
  • 👤 User Simulation - AI simulates realistic multi-turn user behavior
  • ⚖️ LLM-as-a-Judge - Intelligent evaluation instead of brittle assertions
  • 🎭 Comprehensive Testing - Security, compliance and performace all in one framework

Quick Start

Get testing in 3 steps:

  1. Install & Setup

    pip install mcp-testing
    export ANTHROPIC_API_KEY="sk-ant-..."  # For AI agents
    export OPENAI_API_KEY="sk-..."         # For LLM judge
    
  2. Interactive Onboarding

    mcp-t quickstart  # Creates your first server & test suite
    
  3. Run Tests

    mcp-t run <suite-id> <server-id>
    # Example: mcp-t run example_suite_001 hackernews_mcp_server
    

Core Concepts

Test Flow

Your Test Case → AI Agent (Claude/GPT-4) → Your MCP Server
      ↓                    ↓                      ↓
 User Message         Tool Calls            Server Response
      ↓                    ↓                      ↓
User Simulator      Conversation Loop         More Tools
      ↓                    ↓                      ↓
   LLM Judge       Complete Transcript      Pass/Fail + Reasoning

Configuration Files

Server Config (examples/server.json):

{
  "url": "https://no-auth-server.courier-mcp.authed-qukc4.ryvn.run/mcp/",
  "name": "hackernews_mcp_server"
}

Test Suite (examples/suite.json):

{
  "suite_id": "example_suite_001",
  "name": "Hacker News MCP Server Tests",
  "test_cases": [
    {
      "test_id": "hackernews_greeting",
      "user_message": "Hello! Can you help me browse Hacker News?",
      "success_criteria": "Agent should respond politely and explain Hacker News capabilities",
      "max_turns": 5
    }
  ]
}

Test Types

  • 💬 Conversational - Real user workflows
  • 🔒 Security - Authentication & vulnerabilities
  • ✅ Compliance - MCP protocol validation

Commands

Test Execution

mcp-t run <suite-id> <server-id>           # Run specific suite
mcp-t run example_suite_001 hackernews_mcp_server -v   # Verbose output

Configuration Management

mcp-t create server              # Interactive server setup
mcp-t create suite               # Create test suite
mcp-t create test-case           # Add test to suite
mcp-t list                       # Show all configs
mcp-t show suite example_suite_001   # View specific config
mcp-t quickstart                 # Complete onboarding

Test Results

Understanding Evaluation

{
  "test_id": "hackernews_stories",
  "verdict": "PASS",
  "confidence_score": 0.89,
  "judge_reasoning": "The agent successfully fetched and displayed Hacker News stories. Good use of available tools and clear presentation of results.",
  "conversation_quality": 0.87,
  "tool_calls": [
    {"tool": "get_top_stories", "args": {}},
    {"tool": "get_story_details", "args": {"story_id": 123}}
  ]
}

Support


Built with ❤️ for the MCP ecosystem

Made in San Francisco, CA

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-0.1.0a0.tar.gz (128.0 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-0.1.0a0-py3-none-any.whl (147.5 kB view details)

Uploaded Python 3

File details

Details for the file mcp_testing-0.1.0a0.tar.gz.

File metadata

  • Download URL: mcp_testing-0.1.0a0.tar.gz
  • Upload date:
  • Size: 128.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.6

File hashes

Hashes for mcp_testing-0.1.0a0.tar.gz
Algorithm Hash digest
SHA256 bbdf60b9c6b91c7974f3f79427db044366e512c59069b8085d9c0e4490d0c28a
MD5 ffa0753175150814ca86233619a88460
BLAKE2b-256 6def88025726c03929f5a561457db1339d5563871e76323535ccae6a40944bbc

See more details on using hashes here.

File details

Details for the file mcp_testing-0.1.0a0-py3-none-any.whl.

File metadata

  • Download URL: mcp_testing-0.1.0a0-py3-none-any.whl
  • Upload date:
  • Size: 147.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.6

File hashes

Hashes for mcp_testing-0.1.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 70863fd5c781c4bbea4dda7fc3463e8be4e8d50fed2af327bb9d4507ebf10bc9
MD5 6165404726b8ce7d71e56f802d18e8c7
BLAKE2b-256 850676d3f94d41bac2768c5d98a040d5341fd1baafdc5b81a5cc656628b80676

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