mcp-tools-cli

by moritalous

2 stars
250 downloads
Not rated
GitHub

About

command-line client for interacting with Model Context Protocol (MCP) servers.

Details

Author
moritalous
GitHub stars
2
Downloads
250
Categories
Developer Tools

- Lists tools available on any configured MCP server.
- Calls MCP tools with optional JSON or string arguments.
- Supports custom configuration file path via --config-path.
- Provides clear error messages for common issues.
- Works with any MCP server specified in the configuration file.

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name mcp-tools-cli
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Install it via pip install mcp-tools-cli. Create a mcp_config.json file (or use --config-path) with server definitions under mcpServers. Then run commands like mcp-tools-cli list-tools --mcp-name <name> or mcp-tools-cli call-tool --mcp-name <name> --tool-name <tool>.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "mcp-tools-cli": {
            "time": {
                "command": "python",
                "args": [
                    "-m",
                    "mcp_server_time",
                    "--local-timezone=America/New_York"
                ]
            }
        }
    }
}

McpServers

{
    "time": {
        "command": "python",
        "args": [
            "-m",
            "mcp_server_time",
            "--local-timezone=America/New_York"
        ]
    }
}

mcp-tools-cli

This is a command-line client for interacting with Model Context Protocol (MCP) servers.

Installation

You can install mcp-tools-cli using pip:

pip install mcp-tools-cli

Configuration

The client uses a configuration file named mcp_config.json to store the connection details for MCP servers. Create a file named mcp_config.json with the following content:

{
  "mcpServers": {
    "time": {
      "command": "python",
      "args": ["-m", "mcp_server_time", "--local-timezone=America/New_York"]
    }
  }
}

Replace the values with your own MCP server configurations.

Usage

mcp-tools-cli <action> --mcp-name <mcp_name> [options]

Arguments

action (required): The action to perform. Must be one of:
list-tools: Lists the 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 action): The name of the tool to call.
--tool-args (optional): Arguments for the tool. Can be a JSON string or a single string value. If a single string value is not a valid JSON, it will be passed as the query argument to the tool.
--config-path (optional): Path to the mcp_config.json file. Defaults to mcp_config.json in the current directory.

Configuration

The client uses a configuration file named mcp_config.json to store the connection details for MCP servers. The file should be in the following format:

{
  "mcpServers": {
    "<mcp_name>": {
      "command": "<command to run the server>",
      "args": ["<argument1>", "<argument2>", ...],
      "env": {
        "<environment variable name>": "<environment variable value>",
        ...
      }
    },
    ...
  }
}

Replace <mcp_name> with the name of your MCP server (e.g., time). The command, args, and env fields specify how to run the server.

Examples

> A sample using the Time MCP Server is provided in mcp_config.sample.json. If you want to use this, please execute pip install mcp-server-time beforehand.

1. List available tools:

mcp-tools-cli list-tools --mcp-name time --config-path mcp_config.sample.json

2. Call the get_current_time tool with a query:

mcp-tools-cli call-tool --mcp-name time --tool-name get_current_time --config-path mcp_config.sample.json

Error Handling

The client will print error messages to the console if any errors occur, such as:

FileNotFoundError: If the config file is not found.
json.JSONDecodeError: If the config file is not a valid JSON file.
ValueError: If the MCP server is not found in the config file, or if the command is missing.
argparse.ArgumentError: If there are invalid command-line arguments.
Other exceptions during tool execution.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.