Skip to main content

A command-line utility for interacting with MCP servers.

Project description

cMCP

cmcp logo

cmcp is a command-line utility that helps you interact with MCP servers. It's basically curl for MCP servers.

Installation

pip install cmcp

Usage

STDIO

Interact with the STDIO server:

cmcp COMMAND METHOD

Add required parameters:

cmcp COMMAND METHOD param1=value param2:='{"arg1": "value"}'

Add required environment variables:

cmcp COMMAND METHOD ENV_VAR1:value ENV_VAR2:value param1=value param2:='{"arg1": "value"}'

HTTP (or SSE)

Interact with the HTTP (or SSE) server:

cmcp URL METHOD

Add required parameters:

cmcp URL METHOD param1=value param2:='{"arg1": "value"}'

Add required HTTP headers:

cmcp URL METHOD Header1:value Header2:value param1=value param2:='{"arg1": "value"}'

Verbose mode

Enable verbose mode to show JSON-RPC request and response:

cmcp -v COMMAND_or_URL METHOD

Quick Start

Given the following MCP Server (see here):

# server.py
from mcp.server.fastmcp import FastMCP

# Create an MCP server
mcp = FastMCP("Demo")


# Add a prompt
@mcp.prompt()
def review_code(code: str) -> str:
    return f"Please review this code:\n\n{code}"


# Add a static config resource
@mcp.resource("config://app")
def get_config() -> str:
    """Static configuration data"""
    return "App configuration here"


# Add a dynamic greeting resource
@mcp.resource("greeting://{name}")
def get_greeting(name: str) -> str:
    """Get a personalized greeting"""
    return f"Hello, {name}!"


# Add an addition tool
@mcp.tool()
def add(a: int, b: int) -> int:
    """Add two numbers"""
    return a + b

STDIO transport

List prompts:

cmcp 'mcp run server.py' prompts/list

Get a prompt:

cmcp 'mcp run server.py' prompts/get name=review_code arguments:='{"code": "def greet(): pass"}'

List resources:

cmcp 'mcp run server.py' resources/list

Read a resource:

cmcp 'mcp run server.py' resources/read uri=config://app

List resource templates:

cmcp 'mcp run server.py' resources/templates/list

List tools:

cmcp 'mcp run server.py' tools/list

Call a tool:

cmcp 'mcp run server.py' tools/call name=add arguments:='{"a": 1, "b": 2}'

HTTP transport

Run the above MCP server with HTTP transport:

mcp run server.py -t streamable-http

List prompts:

cmcp http://localhost:8000 prompts/list
# or `cmcp http://localhost:8000/mcp prompts/list`

Get a prompt:

cmcp http://localhost:8000 prompts/get name=review_code arguments:='{"code": "def greet(): pass"}'

List resources:

cmcp http://localhost:8000 resources/list

Read a resource:

cmcp http://localhost:8000 resources/read uri=config://app

List resource templates:

cmcp http://localhost:8000 resources/templates/list

List tools:

cmcp http://localhost:8000 tools/list

Call a tool:

cmcp http://localhost:8000 tools/call name=add arguments:='{"a": 1, "b": 2}'

SSE transport (Deprecated)

Run the above MCP server with SSE transport:

mcp run server.py -t sse

List prompts:

cmcp http://localhost:8000/sse prompts/list

Get a prompt:

cmcp http://localhost:8000/sse prompts/get name=review_code arguments:='{"code": "def greet(): pass"}'

List resources:

cmcp http://localhost:8000/sse resources/list

Read a resource:

cmcp http://localhost:8000/sse resources/read uri=config://app

List resource templates:

cmcp http://localhost:8000/sse resources/templates/list

List tools:

cmcp http://localhost:8000/sse tools/list

Call a tool:

cmcp http://localhost:8000/sse tools/call name=add arguments:='{"a": 1, "b": 2}'

Using mcp.json (Advanced)

For convenience, you can use a configuration file to manage your MCP servers instead of typing the full command or URL each time. By default, cmcp looks for .cmcp/mcp.json (in the current directory) or ~/.cmcp/mcp.json (in your home directory).

The configuration follows the standard MCP JSON format, which is also used by Cursor, Claude Code, FastMCP, and other MCP clients.

Example configuration file:

{
  "mcpServers": {
    "local-server": {
      "command": "python",
      "args": ["mcp-server.py"],
      "env": {
        "API_KEY": "value"
      }
    },
    "remote-server": {
      "url": "http://localhost:3000/mcp",
      "headers": {
        "API_KEY": "value"
      }
    }
  }
}

Use a configured server by prefixing its name with ::

# Use the local-server from config
cmcp :local-server tools/list

# Use the remote-server from config
cmcp :remote-server tools/call name=add arguments:='{"a": 1, "b": 2}'

# Use a custom config file
cmcp --config /path/to/config.json :local-server tools/list

Related Projects

cA2A: A command-line utility for interacting with A2A agents.

License

MIT

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

cmcp-0.4.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

cmcp-0.4.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file cmcp-0.4.0.tar.gz.

File metadata

  • Download URL: cmcp-0.4.0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cmcp-0.4.0.tar.gz
Algorithm Hash digest
SHA256 d4e0cb6a31df30ddd48dbdb1bd1923c054f8d8bbffa8156b5eec12af3be7edef
MD5 a79bb34ca2ca74fe68c69c87fafa09c8
BLAKE2b-256 6832d3112367e5ff83c8edacbb8bc171ce27f1872d3fac48064b271a2df9eed8

See more details on using hashes here.

Provenance

The following attestation bundles were made for cmcp-0.4.0.tar.gz:

Publisher: ci.yml on RussellLuo/cmcp

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

File details

Details for the file cmcp-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: cmcp-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cmcp-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 abb21d7148402e69c5563028679ac390a794ce69f52a15ada7b525db98a7bd9c
MD5 546307a8893e946d7b5085481529fff8
BLAKE2b-256 b38dc78efc468bf6d4c1fb1289ff9e56d5e91f7bce59cb713a7e11838d1ec135

See more details on using hashes here.

Provenance

The following attestation bundles were made for cmcp-0.4.0-py3-none-any.whl:

Publisher: ci.yml on RussellLuo/cmcp

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