cMCP

by russellluo

MCP Client 9 stars
  • agent-framework

A command-line utility for interacting with MCP servers.

About

What is cMCP?

cMCP is a command-line utility that lets you interact with MCP (Model Context Protocol) servers. It works like curl for MCP servers and runs anywhere Python is installed.

How to use cMCP?

Install cMCP with pip install cmcp. To use it with a STDIO server, run cmcp COMMAND METHOD; for an SSE server, run cmcp URL METHOD. Add parameters, environment variables, or HTTP headers as needed. Use -v for verbose JSON-RPC output.

Key features of cMCP

- Command-line interface for MCP servers
- Supports STDIO and SSE transports
- Pass parameters as key=value or JSON objects
- Add environment variables (STDIO) or HTTP headers (SSE)
- Verbose mode to inspect JSON-RPC requests and responses

Use cases of cMCP

- List prompts, resources, and tools from an MCP server
- Read resources and get prompts from the terminal
- Call MCP tools directly from shell scripts
- Test MCP server endpoints without a client application

FAQ from cMCP

What does cMCP do that other MCP clients don’t?

cMCP is a lightweight, curl-like CLI focused solely on sending MCP requests and displaying responses. It has no GUI or editor integration, making it ideal for quick tests, debugging, and scripting.

Which MCP server transports does cMCP support?

cMCP supports both STDIO (command-based) and SSE (HTTP-based) transports.

How do I install cMCP?

Install it via pip: pip install cmcp.

Is cMCP free and open-source?

Yes, cMCP is available under an open-source license (implied by the public repository).

Are there any known limits?

cMCP is a minimal CLI tool; it does not manage server processes, handle authentication flows, or provide a persistent session. It sends one request per invocation.

Details

Author
russellluo
GitHub stars
9
Category
agent-framework
Repository
russellluo/cmcp

cMCP

cmcp is a command-line utility that helps you interact with [MCP][1] 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"}'

SSE

Interact with the 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][2]):

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

[1]: https://modelcontextprotocol.io
[2]: https://github.com/modelcontextprotocol/python-sdk#quickstart