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.

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.1.0.tar.gz (17.4 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.1.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mcp_tools_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 17.4 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.1.0.tar.gz
Algorithm Hash digest
SHA256 a3a178e4150c4b98241ea93534d757d49fa12d2a82bd6fa7bf6f0ce3c69e305f
MD5 24bd836623231f31e7910773f3560dd4
BLAKE2b-256 2f884690db62ff8d945c2888dde02f54ec012f5d2d50b7c320362621d1d80e40

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_tools_cli-0.1.0.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.1.0-py3-none-any.whl.

File metadata

  • Download URL: mcp_tools_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0eafdbe9cb9e0bac7d150e4e5571f5b10eb4d8423f0a29c59d22186ff98c34de
MD5 39a717bf8c7cd3a39414a29939c6467e
BLAKE2b-256 0ca4eeb7fedae5e20c6fbe6fb6528bf3ad428d48f9e38b74c42ed0345d974451

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_tools_cli-0.1.0-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