moritalous_mcp_tools_cli

moritalous_mcp_tools_cli

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

MCP Tools CLI: Command-Line Interface for Model Context Protocol Servers

Overview

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.


Installation

You can install the MCP Tools CLI using pip:

pip install mcp-tools-cli

Configuration

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.


Usage

The CLI supports the following commands:

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

Arguments

  • 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.

Examples

  1. List available tools:
    bash mcp-tools-cli list-tools --mcp-name time --config-path mcp_config.sample.json

  2. 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


Error Handling

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.


Resources


License

This project is licensed under the MIT License. See the LICENSE file for details.

Features & Capabilities

Categories
mcp_server model_context_protocol python cli api_integration

Implementation Details

Stats

0 Views
0 Favorites
1 GitHub Stars

Repository Info

moritalous Organization

Similar Servers

continuedev_continue by continuedev
0
0
0