A CLI for MCP
Project description
mcp-cli
Model Context Protocol Command Line Interface (MCP CLI)
A CLI for interacting with Model Context Protocol (MCP) servers. Allows listing and execution of tools, reading resources, and managing server configurations.
🌟 Features
- List available MCP servers defined in a JSON configuration file.
- Inspect and list available tools on an MCP server.
- Execute tools on MCP servers with JSON-formatted inputs.
- Read resources from MCP servers by URI.
- Support for environment variable expansion and
.env
files. - Rich, colored output powered by Rich and Typer.
📋 Prerequisites
- Python 3.11 or higher
- uv
🚀 Installation
uv sync --reinstall
Run the CLI:
uv run mcp-cli --help
🧰 Global Options
--config
,-C
: Path to the server configuration file (default:server_config.json
).--server
,-s
: Specify the server name when listing or executing tools/resources.
🏷️ Available Commands
Server Commands
mcp-cli server list
Lists all configured MCP servers.
Tool Commands
-
mcp-cli tool list --server <server_name>
Lists all tools available on the specified server. -
mcp-cli tool call <tool_name> --server <server_name> [--input '{"key": "value"}']
Executes a tool on the specified server. Provide inputs as a JSON string. -
mcp-cli tool read <uri> --server <server_name>
Reads a resource from the server by its URI.
⚙️ Server Configuration
Create a server_config.json
file in the project root or set the $MCP_CLI_CONFIG_PATH
environment variable:
{
"mcpServers": {
"example-server": {
"command": "uv",
"args": ["run", "example_mcp_server.py"],
"env": {
"EXAMPLE_API_KEY": "$EXAMPLE_API_KEY"
},
}
}
}
Each server entry supports:
command
: The command to start the server.args
: List of arguments for the command.env
: Environment variables (values can reference host env vars).
⚙️ Environment Variables
Set the MCP_CLI_CONFIG_PATH
variable to the path where your config lives, e.g.
export MCP_CLI_CONFIG_PATH="$HOME/.mcp/server_config.json"
Also supports storing environment variables in a separate file, just set $MCP_CLI_DOTENV_PATH
export MCP_CLI_DOTENV_PATH="$HOME/.mcp/.env"
📚 Examples
List servers:
mcp-cli server list
List tools on a server:
mcp-cli tool list --server sqlite
Execute a tool with JSON input:
mcp-cli tool call summarize --server sqlite --input '{"text": "Hello world"}'
Read a resource by URI:
mcp-cli tool read https://example.com/resource.txt --server sqlite
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file devin_mcp_cli-0.1.14.tar.gz
.
File metadata
- Download URL: devin_mcp_cli-0.1.14.tar.gz
- Upload date:
- Size: 15.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc0166aa770d5ff4210d20fec07508338d24d7a10de9af013f535213e134d8cf |
|
MD5 | 23bcedd4fb6f8c31ce10ae33de7a8912 |
|
BLAKE2b-256 | becf53b1b13f90fb63fb47c9f08b2899b0d1b8f1da8709fd002c36ac987d6cd5 |
File details
Details for the file devin_mcp_cli-0.1.14-py3-none-any.whl
.
File metadata
- Download URL: devin_mcp_cli-0.1.14-py3-none-any.whl
- Upload date:
- Size: 13.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e502d7d4948c82f2b4407a5adf0159d9a9800d919aae6afc7cc1358260943a2 |
|
MD5 | ab2018efacf7f85ca600d025418d1c5d |
|
BLAKE2b-256 | a92e80782bbbd61b71ed6173d50799ad78c97ace4a56371c83acb3ae92bdf5aa |