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.0.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.0-py3-none-any.whl (28.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mcp_test_driver-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 979abc27cc828e60cc813e5ba37a336707d1f5535a620ed549e588484d7d6efe
MD5 56c4ac92d44b375435161f18319388f9
BLAKE2b-256 aee53ac231aa5587c2c5ac191f961d18e501dd990db8040930144da7e3d211be

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcp_test_driver-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1645bc47f57bba96d7873a1b8b3719aca75bec064ebf5ca8ddf5f0788d7e7784
MD5 8e96cc5754cf98f056d26f64f4349032
BLAKE2b-256 47b694dc1eef42d1b4484216553031003f7a6e5722bc980eed34bb077a4bc78f

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