The MCP Tools CLI is a command-line client designed to interact with Model Context Protocol (MCP) servers. It provides a streamlined way to manage and execute tools on MCP servers directly from the terminal.
You can install the MCP Tools CLI using pip
:
pip install mcp-tools-cli
The CLI requires a configuration file named mcp_config.json
to define the connection details for MCP servers. Here’s an example configuration:
{
"mcpServers": {
"time": {
"command": "python",
"args": ["-m", "mcp_server_time", "--local-timezone=America/New_York"]
}
}
}
Replace the values with your own MCP server configurations.
The CLI supports the following commands:
mcp-tools-cli <action> --mcp-name <mcp_name> [options]
action
(required): The action to perform. Options include:list-tools
: Lists available tools on the MCP server.call-tool
: Calls a specific tool on the MCP server.--mcp-name
(required): The name of the MCP server to connect to, as defined in mcp_config.json
.--tool-name
(required for call-tool
): The name of the tool to call.--tool-args
(optional): Arguments for the tool. Can be a JSON string or a single string value.--config-path
(optional): Path to the mcp_config.json
file. Defaults to mcp_config.json
in the current directory.List available tools:
bash
mcp-tools-cli list-tools --mcp-name time --config-path mcp_config.sample.json
Call the get_current_time
tool:
bash
mcp-tools-cli call-tool --mcp-name time --tool-name get_current_time --config-path mcp_config.sample.json
The CLI provides detailed error messages for common issues, including:
- FileNotFoundError
: If the config file is missing.
- json.JSONDecodeError
: If the config file is invalid.
- ValueError
: If the MCP server or command is not found.
- argparse.ArgumentError
: For invalid command-line arguments.
This project is licensed under the MIT License. See the LICENSE file for details.