click-to-mcp
About
Auto-wrap any Click/typer CLI as an MCP server. Introspects CLI commands at runtime and maps them to MCP tools.
Details
- Author
- coding-dev-tools
- Categories
- Developer Tools, Automation
Jump to
Setup
Install click-to-mcp in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/coding-dev-tools/click-to-mcp
Follow the installation instructions in the repository README, then restart your MCP client.
Auto-wrap anyClick/typerCLI as anMCP(Model Context Protocol) server.
⭐Star this repoif you build CLI tools — it helps other devs discover click-to-mcp!
Part of theDevForgedeveloper tool ecosystem.
The problem:You have Python CLIs built with Click or typer. Your AI coding agent (Claude Code, Codex, Cursor) needs to call them — but MCP servers require writing boilerplate from scratch.
- Create a new Python package for your MCP server
- Define JSON Schema for every tool manually
- Wire up stdio/HTTP transport
- Keep it in sync when your CLI changes
pip install git+https://github.com/Coding-Dev-Tools/click-to-mcp.git click-to-mcp serve your-cli
One command. Your CLI is now an MCP server. No boilerplate, no schema writing, no maintenance burden.
Real example:api-contract-guardianhas 6 commands with 20+ options. Writing an MCP server for it would take 200+ lines of boilerplate. With click-to-mcp:click-to-mcp serve api-contract-guardian— done.
Install from GitHub (recommended — not yet on public PyPI):
pip install git+https://github.com/Coding-Dev-Tools/click-to-mcp.git
For HTTP+SSE transport (web-based MCP clients), install with thehttpextra:
pip install "click-to-mcp[http] @ git+https://github.com/Coding-Dev-Tools/click-to-mcp.git"
Install directly from GitHub (latest development version):
pip install git+https://github.com/Coding-Dev-Tools/click-to-mcp.git
brew tap Coding-Dev-Tools/tap brew install click-to-mcp
scoop bucket add Coding-Dev-Tools https://github.com/Coding-Dev-Tools/scoop-bucket scoop install click-to-mcp
# Discover all Click/typer CLIs installed in your environment click-to-mcp discover # List the MCP tools that would be exposed from a CLI (without starting a server) click-to-mcp list-tools api-contract-guardian click-to-mcp list-tools --all --json-output # all CLIs, JSON for CI # Serve a specific CLI as an MCP server (stdio transport) click-to-mcp serve api-contract-guardian # Serve over HTTP+SSE (for web-based MCP clients) click-to-mcp serve-http api-contract-guardian --port 8000 # Or serve the built-in demo click-to-mcp demo # stdio click-to-mcp demo-http # HTTP+SSE on port 8000 # Generate MCP client configuration (copy-paste ready JSON) click-to-mcp config api-contract-guardian click-to-mcp config api-contract-guardian --client cursor click-to-mcp config api-contract-guardian --transport http --port 9000 click-to-mcp config --all --client vscode
Then configure your MCP client to connect via stdio or HTTP.
click-to-mcp introspects your Click/typer CLI at runtime and maps every command to an MCP tool:
No annotations, no decorators, no boilerplate. Your existing Click CLIisthe MCP server.
This section shows how to integrate click-to-mcp with popular AI coding tools so your CLIs become first-class tools that AI agents can invoke directly.
Add your CLI as an MCP server in your project's.claude/settings.json:
{ "mcpServers": { "api-contract-guardian": { "command": "click-to-mcp", "args": ["serve", "api-contract-guardian"] }, "json2sql": { "command": "click-to-mcp", "args": ["serve", "json2sql"] }, "deploydiff": { "command": "click-to-mcp", "args": ["serve", "deploydiff"] } } }
Now when you ask Claude Code to "validate my API contracts", it will automatically call theacg_validateMCP tool with the right arguments — no manual command-line invocation needed.
Add to your Cursor MCP settings (.cursor/mcp.json):
{ "mcpServers": { "api-contract-guardian": { "command": "click-to-mcp", "args": ["serve", "api-contract-guardian"] } } }
{ "servers": { "api-contract-guardian": { "command": "click-to-mcp", "args": ["serve", "api-contract-guardian"] } } }
For CLIs that aren't installed as entry points, use the library API:
# my_mcp_server.py from click_to_mcp import run from my_cli import app # Your Click/typer CLI run(app, prefix="my-cli", name="my-cli-mcp")
{ "mcpServers": { "my-cli": { "command": "python", "args": ["my_mcp_server.py"] } } }
When your MCP server is configured, the AI agent sees your CLI commands as native tools. For example, with api-contract-guardian:
Agent: "I need to validate the API contract against the staging server." → Calls MCP tool: acg_validate Arguments: { "spec_file": "openapi.yaml", "base_url": "https://staging.api.com", "strict": true, "output_format": "json" } ← Result: "Validating openapi.yaml against https://staging.api.com...\n✓ All contracts pass"
The agent doesn't need to know shell syntax, argument flags, or command names. It just calls the tool with structured arguments, and click-to-mcp handles the rest.
import click from click_to_mcp import run @click.group() def my_cli(): """My awesome CLI tool.""" pass @my_cli.command() @click.argument("name") @click.option("--loud", is_flag=True, help="Shout the greeting") def hello(name: str, loud: bool): """Say hello to someone.""" msg = f"Hello, {name}!" if loud: msg = msg.upper() click.echo(msg) if __name__ == "__main__": run(my_cli, prefix="my-cli", name="my-cli-mcp")
Seeexamples/quick_start.pyfor the full runnable example.
# List all installed Click/typer CLIs click-to-mcp discover # Serve a specific CLI as an MCP server over stdio click-to-mcp serve <name> # Serve over HTTP+SSE (requires pip install "click-to-mcp[http] @ git+https://github.com/Coding-Dev-Tools/click-to-mcp.git") click-to-mcp serve-http <name> --port 8000 # Serve the built-in demo click-to-mcp demo # stdio click-to-mcp demo-http # HTTP+SSE # Version info click-to-mcp --version
# my_cli.py import click from click_to_mcp import serve_stdio @click.group() def cli(): """My CLI tool.""" pass @cli.command() @click.argument("file") @click.option("--verbose", is_flag=True) def validate(file: str, verbose: bool) -> None: """Validate a file.""" click.echo(f"Validating {file}...") # Run as MCP server serve_stdio(cli, name="my-cli", description="My CLI as MCP server")
from click_to_mcp import run from my_cli import app # Automatically detects Click/typer instances run(app, prefix="my-cli")
- Auto-discovery:click-to-mcp discoverscansconsole_scriptsentry points for Click/typer CLIs
- Tool preview:click-to-mcp list-tools <name>shows MCP tools without starting a server (CI-friendly with--json-output)
- Client config:click-to-mcp config <name>generates ready-to-paste JSON for Claude Desktop, Cursor, VS Code, Windsurf, and Cline
- Serve any CLI:click-to-mcp serve <name>wraps any discovered CLI as an MCP server
- HTTP+SSE transport:click-to-mcp serve-http <name>serves over HTTP for web-based clients (v0.3.0+)
- Supports both Click and Typer: Full compatibility with both frameworks
- Nested command groups: Handles subcommand groups recursively with prefixed tool names
- Parameter introspection: Correctly maps Click options, arguments, types, enums, defaults, and help text to JSON Schema
- Full MCP protocol: Implementsinitialize,tools/list,tools/callover stdio and HTTP+SSE
- Health endpoint: HTTP servers expose/healthfor monitoring and load balancers
Best for local CLI-based MCP clients (Claude Code, Cursor, Cline). No extra dependencies needed.
Best for web-based MCP clients, remote access, and multi-user setups. Requires the[http]extra.
# Install HTTP dependencies pip install "click-to-mcp[http] @ git+https://github.com/Coding-Dev-Tools/click-to-mcp.git" # Start an HTTP+SSE server click-to-mcp serve-http <name> --host 127.0.0.1 --port 8000
Configure your MCP client with the SSE URL:
{ "mcpServers": { "my-cli": { "url": "http://127.0.0.1:8000/sse" } } }
Click-to-MCP implements the standard MCP protocol with:
- initialize— protocol handshake (returns server capabilities)
- tools/list— discover all CLI commands as MCP tools with JSON Schema inputs
- tools/call— invoke a CLI command with typed arguments
Add an MCP server entry point to any Click/typer CLI:
# cli.py — add a subcommand to run as MCP server import typer from click_to_mcp import run app = typer.Typer(...) @app.command() def mcp(): """Run as an MCP server over stdio.""" from click_to_mcp import run run(app)
git clone https://github.com/Coding-Dev-Tools/click-to-mcp cd click-to-mcp pip install -e ".[dev,http]" python -m pytest tests/ -v # 100+ tests covering adapter, server, HTTP, config, and CLI click-to-mcp demo # starts MCP stdio server for demo CLI click-to-mcp demo-http # starts MCP HTTP+SSE server on port 8000
click-to-mcp isfree and open sourceunder Apache 2.0. No license key required, no rate limits, no telemetry.
It also works with anyDevForgeCLI tool — even on the free tier.
Part ofDevForge— developer CLI tools built by autonomous AI agents.
This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.
The MCP server for Bitrix24 provides AI assistants with structured access to the Bitrix24 API. It delivers up-to-date method descriptions, parameters, and valid values, allowing assistants to work with precise data instead of guesswork. This reduces code errors and accelerates Bitrix24 integration development.
Connect bugAgent to any MCP-compatible AI client. File, classify, and manage bugs, feature requests, and more directly from your AI coding assistant. No context switching, no copy-paste — just describe the issue and bugAgent handles the rest.
What Shopify did for ecommerce, Chipp does for AI agents. Build, deploy, and monetize AI agents for your business — no engineering team required.
CodeVF MCP lets AI hand off problems to real engineers instantly, so your workflows don’t stall when models hit their limits.
his repository contains a fully functional MCP (Model Context Protocol) server, providing solutions for Constraint Satisfaction Problems (CSP) and Linear Programming (LP). It is based on the gurddy package and supports solving a variety of classic problems.
Client implementation for Mastra, providing seamless integration with MCP-compatible AI models and tools.
One remote MCP server for 500+ production APIs — Stripe, HubSpot, Postgres, Gmail, and more. OAuth and API key auth, credential management, and a CLI.
Agents make claims. Reelier writes receipts — record an agent's tool-call workflow once, replay it deterministically at 0 tokens, and diff runs to catch drift.
Single tool to control all 100+ API integrations, and UI components
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.


