Skip to main content

Crate mcp_repl

Crate mcp_repl 

Source
Expand description

mcp-repl: an interactive MCP client REPL.

Connects to any MCP server and turns the server’s surface into the command set: every tool becomes a top-level command with schema-coerced key=value arguments, prompts and resources get built-ins, tab completion is powered by the server itself where the protocol allows (completion/complete), and list_changed notifications refresh the command table live mid-session.

Usage:

# Spawn a stdio server as a child process:
cargo run -p mcp-repl -- cargo run --example getting_started

# Connect to a streamable HTTP server:
cargo run -p mcp-repl -- --http http://127.0.0.1:3001/mcp

# Authorize once, then reuse a secure OAuth profile:
cargo run -p mcp-repl -- --login work --http https://mcp.example.com/mcp
cargo run -p mcp-repl -- --oauth work --http https://mcp.example.com/mcp

# Connect to a named profile from the platform config directory:
cargo run -p mcp-repl -- --server cratesio

Inside the REPL, help lists the built-ins and the server’s tools, alias <name>=<expansion> gives a frequent command a short name, kept in the same config file as the server profiles, and bench <tool> reports the latency distribution over repeated calls. A trailing & runs a tool task-augmented (SEP-2663): the call returns a task id immediately; jobs, task <id>, wait <id>, and cancel <id> manage it.

§Reusable seams

The published package keeps its application in this library and its binary target delegates to run_cli. config, import_config, and oauth_profile are the deliberately reusable connection-facing seams. Editor, rendering, and command-dispatch modules remain private application details so consumers do not accidentally depend on terminal behavior.

Modules§

config
Server profiles: a config file of named servers, so a remote MCP server can be reached as mcp-repl <name> instead of a URL plus repeated --bearer/--header flags.
import_config
Import named servers from the common JSON configuration used by MCP clients such as Claude, Cursor, and VS Code.
lifecycle
Project lifecycle and release contract.
oauth_profile
Secure, named OAuth credentials for mcp-repl.

Functions§

run_cli
Parse the process arguments and run the published mcp-repl CLI.