Skip to main content

Interactive REPL for testing any MCP server over stdio or HTTP

Project description

mcp-test-driver

Interactive REPL for testing any MCP server, over stdio or HTTP. No AI wiring, just debugging.

Point it at a command (stdio) or a URL (HTTP) and get a prompt with tab-completion for tools, argument keys, and enum values.

Usage

# Stdio transport — pass the server command and its arguments:
mcp-test-driver aifr mcp
mcp-test-driver character agent mcp
mcp-test-driver nats-lsp mcp-stdio

# HTTP transport — pass a URL:
mcp-test-driver https://unicode.mcp.pennock.tech/mcp

# Enable roots capability (exposes cwd to the server):
mcp-test-driver --roots aifr mcp
mcp-test-driver --roots=/path/to/project https://example.com/mcp

At the prompt, type a tool name and its arguments:

mcp> unicode_search query=snowman
mcp> unicode_lookup_char char=✓

CLI Options

Option Description
-h, --help Show help message
--trace Enable protocol tracing (default)
--no-trace Disable protocol tracing at startup
--roots Advertise cwd as filesystem root to the server
--roots=<path> Advertise a specific path as filesystem root

Built-in Commands

Built-in commands use the / prefix. Tool names are stripped of leading / during sanitization, for namespace separation.

Tools

Command Alias Description
/list /l List available tools
/describe <tool> /d Show full schema for a tool

Resources

Command Alias Description
/resources /lr List available resources
/templates /lt List resource templates
/read <uri> /r Read a resource by URI
/subscribe <uri> /sub Subscribe to resource updates
/unsubscribe <uri> /unsub Unsubscribe from resource updates

Prompts

Command Alias Description
/prompts /lp List available prompts
/prompt <name> [args] /p Get a prompt (with optional key=val arguments)

Session & Diagnostics

Command Alias Description
/ping Ping the server
/loglevel <level> /ll Set server log level
/roots Show roots status
/roots on [path] Enable roots capability (takes effect on /reconnect)
/roots off Disable roots capability
/reconnect /rc Reconnect to the server
/cache-flush /cf Clear cached tools/resources/prompts, re-fetch
/trace /t Toggle JSON-RPC protocol tracing
/help /h Show help (or /help <tool> for tool help)
/quit /q Exit

Press Tab to complete commands, tool names, argument keys (key=), and enum values. Press F1 or Esc-H for context-sensitive help, at any point in a command.

Client Capabilities

Roots

The --roots flag (or /roots on command) advertises the roots capability to the server, telling it which filesystem directories are relevant.

When enabled, the client responds to roots/list requests from the server with the configured base path. This is read-only: it hints to the server where to look, but the server accesses files using its own mechanisms.

Security constraints:

  • All root paths are resolved to absolute canonical paths (symlinks followed)
  • Additional roots added via RootsHandler.add_root() must be descendants of the base path (Path.relative_to() check prevents traversal)
  • The base path must exist at the time roots are enabled

Sampling

The MCP sampling capability (server asks the client to generate LLM completions) is not implemented. This is currently considered out of scope.

Protocol Coverage

mcp-test-driver implements the following MCP protocol methods:

Method Direction Notes
initialize client → server Advertises capabilities from handler registry
notifications/initialized client → server
tools/list client → server Paginated
tools/call client → server
resources/list client → server Paginated; fetched if server advertises resources
resources/templates/list client → server Paginated
resources/read client → server
resources/subscribe client → server
resources/unsubscribe client → server
prompts/list client → server Paginated; fetched if server advertises prompts
prompts/get client → server
ping both directions Client handles server-initiated pings
logging/setLevel client → server
completion/complete client → server
roots/list server → client When --roots is enabled

Known Limitations

  • HTTP server-to-client requests: Server-initiated requests (like roots/list) over the HTTP Streamable transport require a long-lived GET SSE stream, which is not yet implemented. Server requests are fully supported on the stdio transport. The --roots flag still works over HTTP for the initial handshake capabilities, but the server cannot dynamically query roots mid-session.

  • Partial-line stdio timeout: The select()-based read timeout (120s) catches complete server silence, but if a server sends bytes without a newline, readline() may still block.

  • No OAuth/authentication: The MCP spec defines OAuth 2.1 flows, but as a test driver we don't implement auth. Use Authorization headers or environment-based credentials if needed.

  • No DNS discovery: SRV/TXT/DANE-based MCP server discovery (SEP-1959) is proposed but not standardized.

  • No .well-known metadata: Neither OAuth resource metadata (RFC 9728) nor MCP server cards (SEP-1649/1960) are fetched.

Installation

# Install as a tool (recommended for CLI use):
uv tool install .

# Or install into a project:
uv pip install .

# Or run directly from the source tree:
uv run mcp-test-driver <server-command...>

Development

uv sync --group dev
uv run ruff check src/
uv run ty check
uv run pytest tests/

License

ISC — see LICENSE.

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_test_driver-0.1.2.tar.gz (23.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_test_driver-0.1.2-py3-none-any.whl (28.2 kB view details)

Uploaded Python 3

File details

Details for the file mcp_test_driver-0.1.2.tar.gz.

File metadata

  • Download URL: mcp_test_driver-0.1.2.tar.gz
  • Upload date:
  • Size: 23.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for mcp_test_driver-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f129a4a7614053118b0d0babb74363b22dfa3527544835a462802dd00773c98f
MD5 37ab5b1bc7585992fe2edc47e5d0b9ce
BLAKE2b-256 1e62d5b9de5454fd7f36037f740d6391a4d10b776b924bd5f0a8bd3305de4efa

See more details on using hashes here.

File details

Details for the file mcp_test_driver-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: mcp_test_driver-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 28.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for mcp_test_driver-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 233dd9ee2098437a8a6dbf32c6b10ea035b3a624f6ed5daf11d26a79350e78b5
MD5 c33e5a6b7bd9fa3185680e3f4f7e9e46
BLAKE2b-256 bc88a98dd2453034424222a1d6fbcfa077b684ad594618227d0ce6e541fa3990

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