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"}'

Streamable HTTP (or SSE)

Interact with the Streamable 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}'

Streamable HTTP transport

Run the above MCP server with Streamable 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}'

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.3.0.tar.gz (4.7 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.3.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for cmcp-0.3.0.tar.gz
Algorithm Hash digest
SHA256 c11e9afd739607e308124bedd242b557af45a67f24388d47fa6ef75f7c6f1b7c
MD5 036726a0d2a068dcd191e07e98dd9844
BLAKE2b-256 c7dad6d39dbacbf625fde1ae86725903ee33f0512e2c7bfb4bcc971280adeba7

See more details on using hashes here.

Provenance

The following attestation bundles were made for cmcp-0.3.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.3.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for cmcp-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 36b5b93f12b6c9b35c827c65c2e81eb8a9c2ca8f58d64d61a35ee03a5c80bffc
MD5 7a2c06ec5c964cdd4ebf47a7d60ea428
BLAKE2b-256 0e3298b9d3d6f36ff5cabf174b25129c1827c9b045847cb0fbd53a98eae455fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for cmcp-0.3.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