MCP Test Server

MCP Test Server

A comprehensive testing server for validating MCP scanner tools and implementations, providing diverse tools, resources, and prompts that exercise various aspects of the Model Context Protocol specification.

Category
Visit Server

README

MCP Test Server

A comprehensive Model Context Protocol (MCP) server designed specifically for testing MCP scanners and validating MCP implementations. This server provides a rich set of tools, resources, and prompts to exercise various aspects of the MCP specification.

šŸ” Scanner Compatible: This repository is fully configured to be detected by the APIsec MCP Audit Scanner.

⚔ Quick Start: Want to test scanner detection immediately? See QUICK_START.md

Scanner Detection Documentation

Features

šŸ› ļø Tools

The server exposes multiple tools with varying complexity levels:

  • echo - Basic string echo for testing simple parameter handling
  • add_numbers - Numeric operations testing
  • format_json - JSON object handling and formatting
  • list_operations - Array/list manipulation (sort, reverse, count, join)
  • complex_schema - Nested object schemas with various types
  • timestamp - Tools with optional parameters only

šŸ“¦ Resources

Multiple resource types for testing resource discovery and reading:

  • static-text - Plain text resource
  • json-data - Structured JSON data
  • markdown-doc - Formatted markdown documentation
  • config - Configuration file example

šŸ’¬ Prompts

Sample prompts to test prompt capabilities:

  • test-prompt - Basic prompt with required argument
  • debug-prompt - Multi-argument prompt with optional parameters

Installation

From Source

# Clone the repository
git clone <repository-url>
cd mcp-test

# Install the package
pip install .

Development Installation

# Install with development dependencies
pip install -e ".[dev]"

Usage

Running the Server

Command Line

After installation, run the server directly:

mcp-test-server

Python Module

Alternatively, run as a Python module:

python server.py

Testing with MCP Client

The server uses stdio transport, so you can test it with any MCP-compatible client:

import asyncio
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client

async def test_mcp_server():
    server_params = StdioServerParameters(
        command="mcp-test-server",
        args=[],
    )
    
    async with stdio_client(server_params) as (read, write):
        async with ClientSession(read, write) as session:
            await session.initialize()
            
            # List available tools
            tools = await session.list_tools()
            print(f"Available tools: {[t.name for t in tools.tools]}")
            
            # Call a tool
            result = await session.call_tool("echo", {"message": "Hello MCP!"})
            print(f"Result: {result}")

if __name__ == "__main__":
    asyncio.run(test_mcp_server())

Configuration for MCP Clients

Add to your MCP client configuration (e.g., Claude Desktop config):

{
  "mcpServers": {
    "mcp-test": {
      "command": "mcp-test-server"
    }
  }
}

Or with explicit Python path:

{
  "mcpServers": {
    "mcp-test": {
      "command": "python",
      "args": ["-m", "server"]
    }
  }
}

Testing MCP Scanners

This server is ideal for testing MCP scanner tools because it provides:

  1. Diverse Tool Schemas - From simple strings to complex nested objects
  2. Multiple Resource Types - Different MIME types and content structures
  3. Edge Cases - Tools with no required parameters, optional fields, enums
  4. Standard Compliance - Follows MCP specification strictly
  5. Scanner Detection - Multiple configuration files for detection testing

Scanner Detection

This repository is configured to be detected by MCP scanner tools like the APIsec MCP Audit Scanner.

Detection files included:

  • mcp.json - Claude Desktop style configuration
  • mcp.yaml - YAML format configuration
  • .mcp/config.json - Hidden directory config
  • package.json - npm dependencies with @modelcontextprotocol/sdk
  • requirements.txt - Python dependencies with modelcontextprotocol

šŸ“– See SCANNER_GUIDE.md for detailed scanner testing instructions.

Scanner Test Checklist

  • [ ] Discovers all 6 tools
  • [ ] Parses complex nested schemas correctly
  • [ ] Identifies all 4 resources with correct URIs
  • [ ] Handles tools with optional-only parameters
  • [ ] Recognizes prompt capabilities
  • [ ] Correctly interprets enum constraints
  • [ ] Handles array and object types

Project Structure

mcp-test/
ā”œā”€ā”€ server.py              # Main MCP server implementation
ā”œā”€ā”€ pyproject.toml         # Package configuration
ā”œā”€ā”€ package.json           # npm metadata (for scanner detection)
ā”œā”€ā”€ requirements.txt       # Python dependencies
ā”œā”€ā”€ README.md             # This file
ā”œā”€ā”€ SCANNER_GUIDE.md      # Scanner detection guide
ā”œā”€ā”€ .gitignore            # Git ignore rules
ā”œā”€ā”€ LICENSE               # MIT License
ā”œā”€ā”€ mcp.json              # MCP configuration (Claude Desktop style)
ā”œā”€ā”€ mcp.yaml              # MCP configuration (YAML format)
ā”œā”€ā”€ mcp-config.json       # Example client configuration
ā”œā”€ā”€ .mcp/                 # MCP metadata directory
│   ā”œā”€ā”€ config.json       # Scanner-detectable config
│   └── mcp.json          # MCP metadata
ā”œā”€ā”€ examples/             # Example usage scripts
│   ā”œā”€ā”€ README.md
│   ā”œā”€ā”€ test_client.py
│   └── scanner_test.py
└── tests/                # Unit tests
    ā”œā”€ā”€ __init__.py
    └── test_server.py

Requirements

  • Python 3.10 or higher
  • mcp >= 0.9.0

Development

Running Tests

pytest tests/

Code Style

This project follows PEP 8 guidelines. Format code with:

black server.py

API Reference

Tools

echo

  • Input: message (string, required)
  • Output: Echoes the input message
  • Purpose: Test basic string parameter handling

add_numbers

  • Input: a (number), b (number)
  • Output: Sum of the two numbers
  • Purpose: Test numeric parameter handling

format_json

  • Input: data (object), indent (number, default: 2)
  • Output: Formatted JSON string
  • Purpose: Test object parameter handling

list_operations

  • Input: items (array), operation (enum), separator (string, optional)
  • Output: Result of list operation
  • Purpose: Test array handling and enum constraints

complex_schema

  • Input: Nested object with user info and options
  • Output: Processed data structure
  • Purpose: Test complex nested schema parsing

timestamp

  • Input: format (enum, optional)
  • Output: Current timestamp in specified format
  • Purpose: Test tools with all-optional parameters

Resources

All resources use URIs in the format mcp://test/{resource-name}:

  • mcp://test/static-text - Plain text content
  • mcp://test/json-data - Structured JSON
  • mcp://test/markdown-doc - Markdown documentation
  • mcp://test/config - Configuration data

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

MIT License - see LICENSE file for details

Support

For issues, questions, or contributions, please open an issue on the repository.

Changelog

v0.1.0 (Initial Release)

  • Basic MCP server implementation
  • 6 diverse tools for testing
  • 4 resource types
  • 2 sample prompts
  • Complete documentation

Related Projects


Note: This is a testing server. Do not use in production environments.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured