Skip to main content

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

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_tools_cli-0.0.3.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_tools_cli-0.0.3-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file mcp_tools_cli-0.0.3.tar.gz.

File metadata

  • Download URL: mcp_tools_cli-0.0.3.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for mcp_tools_cli-0.0.3.tar.gz
Algorithm Hash digest
SHA256 901a1a1ba88137b2d2773912a5c37b291c40ba3eb7ce9e4d2e17970b416889e5
MD5 bd6ccef54827bac88d10a1da1df5fe85
BLAKE2b-256 e67341c7be2e768a04d680d7bfe2aaf9c8be106418bd41493e70449b5034aa76

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_tools_cli-0.0.3.tar.gz:

Publisher: python-publish.yml on moritalous/mcp-tools-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcp_tools_cli-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: mcp_tools_cli-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for mcp_tools_cli-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 22dd98c4491729086b639fac1bd3fca87c80944373ae14f3e04b9d5d7f855964
MD5 ee243a1426610fb0ddfa08316d103b56
BLAKE2b-256 8dd9dbcd12d20591f20157f17cbfe0aebfc63bd9b5617e9f06c2d07ff0f8fb96

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_tools_cli-0.0.3-py3-none-any.whl:

Publisher: python-publish.yml on moritalous/mcp-tools-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page