Skip to main content

A command-line utility for interacting with MCP servers.

Project description

cMCP

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

Installation

pip install cmcp

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

SSE transport

Run the above MCP server with SSE transport:

mcp run server.py -t sse

List prompts:

cmcp http://localhost:8000 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}'

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.2.0.tar.gz (3.1 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.2.0-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for cmcp-0.2.0.tar.gz
Algorithm Hash digest
SHA256 910c88e5292c72f1e6c724f4faa6b64bbd555d7db1c4b9826edbf9858ac48e17
MD5 9aa6be518eb227ae970f8ce6893f1129
BLAKE2b-256 0d2cef69df14d2a62c8c4d6ea8ab7ecaed56d1ed219072b4efe0ae5091dfd952

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: cmcp-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 3.7 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a9d25bfb5c3376905feb52cb20ba328c5bc1e2cca46cf686fcb66d558ef653d1
MD5 34d914f958cd5b424b807518b862ac53
BLAKE2b-256 ee713f63de91c053ecec58b48b96dd2a5e84bdaf1a30b4f85b2e1471efd8fd60

See more details on using hashes here.

Provenance

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