click-to-mcp

click-to-mcp

click-to-mcp•bycoding-dev-tools

A tool that auto-wraps any Click or typer CLI as a Model Context Protocol (MCP) server, exposing its commands as MCP tools over stdio or HTTP+SSE.

License: Apache 2.0•Runtime: Awaiting documentation review•Category: developer tools

WHAT IT DOES

  • •Introspects Click/typer CLIs at runtime and maps each command to an MCP tool, converting arguments, options, types, enums, and defaults into JSON Schema inputs.
  • •Serves a wrapped CLI as an MCP server over stdio, or over HTTP+SSE for web-based clients.
  • •Implements the standard MCP protocol operations for handshake, tool listing, and tool invocation.
  • •Discovers installed Click/typer CLIs and provides a preview of the MCP tools they would expose.

BEST FOR

  • •Developers who want to expose existing Click or typer CLIs to AI coding agents as MCP tools with minimal boilerplate.
  • •Serving a CLI-based MCP server over HTTP+SSE for web-based or remote MCP clients.

ABOUT CLICK-TO-MCP

click-to-mcp is cataloged as an MCP server attributed to coding-dev-tools. A tool that auto-wraps any Click or typer CLI as a Model Context Protocol (MCP) server, exposing its commands as MCP tools over stdio or HTTP+SSE. It is categorized under developer tools. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: Apache 2.0. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for click-to-mcp are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

Does click-to-mcp require changes to my existing CLI?

No. It works with existing Click and typer CLIs without annotations, decorators, or boilerplate; you run it against the CLI to serve it as an MCP server.

Which transports can the MCP server use?

It supports stdio by default, and HTTP+SSE via the http extra for web-based clients, remote access, and multi-user setups.

上游原版 README

在 GitHub 查看同一版本原文

README.md · 25cb33d833c0 · 采集于 2026-11-13 10:22:10 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

click-to-mcp

CI PyPI GitHub stars Awesome MCP Server Awesome Codex CLI Open Source Alternative Glama skills.sh

Auto-wrap any Click/typer CLI as an MCP (Model Context Protocol) server.

⭐ Star this repo if you build CLI tools — it helps other devs discover click-to-mcp!

Part of the DevForge developer tool ecosystem.

Why click-to-mcp?

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.

The old way:

  1. Create a new Python package for your MCP server
  2. Define JSON Schema for every tool manually
  3. Wire up stdio/HTTP transport
  4. Keep it in sync when your CLI changes

The click-to-mcp way:

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-guardian has 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.

Works with DevForge CLI tools out of the box — wrap api-contract-guardian, json2sql, deploydiff, or configdrift as MCP servers with zero code changes.

Quick Start

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 the http extra:

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

Or install via Homebrew (macOS/Linux):

brew tap Coding-Dev-Tools/tap
brew install click-to-mcp

Or install via Scoop (Windows):

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.

How It Works

click-to-mcp introspects your Click/typer CLI at runtime and maps every command to an MCP tool:

Click ConceptMCP Mapping
@click.command()MCP tool
@click.argument()Required input property
@click.option()Optional input property with default
click.ChoiceJSON Schema enum
click.INT/FLOATJSON Schema integer/number
click.BOOL / is_flagJSON Schema boolean
Nested click.GroupPrefixed tools (e.g. config_show)

No annotations, no decorators, no boilerplate. Your existing Click CLI is the MCP server.

MCP Workflow with AI Coding Agents

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.

Claude Code

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 the acg_validate MCP tool with the right arguments — no manual command-line invocation needed.

Cursor

Add to your Cursor MCP settings (.cursor/mcp.json):

{
  "mcpServers": {
    "api-contract-guardian": {
      "command": "click-to-mcp",
      "args": ["serve", "api-contract-guardian"]
    }
  }
}

Cline / VS Code

Add to .vscode/mcp.json:

{
  "servers": {
    "api-contract-guardian": {
      "command": "click-to-mcp",
      "args": ["serve", "api-contract-guardian"]
    }
  }
}

Custom Integration (Programmatic)

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")

Then reference the script directly:

{
  "mcpServers": {
    "my-cli": {
      "command": "python",
      "args": ["my_mcp_server.py"]
    }
  }
}

What the Agent Sees

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.

Examples

Quick Start (3 lines)

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")

See examples/quick_start.py for the full runnable example.

Wrapping api-contract-guardian

See examples/api_contract_guardian_mcp.py for a demo showing how to wrap API Contract Guardian as an MCP server with validate, extract, and monitor commands.

Usage

CLI — Discover and Serve

# 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

Library — Integrate directly

# 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")

Library — High-level run() API

from click_to_mcp import run
from my_cli import app

# Automatically detects Click/typer instances
run(app, prefix="my-cli")

Features

  • Auto-discovery: click-to-mcp discover scans console_scripts entry 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: Implements initialize, tools/list, tools/call over stdio and HTTP+SSE
  • Health endpoint: HTTP servers expose /health for monitoring and load balancers

Transports

Stdio (default)

Best for local CLI-based MCP clients (Claude Code, Cursor, Cline). No extra dependencies needed.

click-to-mcp serve <name>

HTTP+SSE (v0.3.0+)

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

Endpoints:

EndpointMethodDescription
/sseGETSSE stream (server-to-client events)
/messagesPOSTJSON-RPC message endpoint
/healthGETHealth check (JSON status)

Configure your MCP client with the SSE URL:

{
  "mcpServers": {
    "my-cli": {
      "url": "http://127.0.0.1:8000/sse"
    }
  }
}

MCP Protocol

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

Integration with Existing CLIs

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)

Then agents can use it as: your-cli mcp

Development

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

Pricing

click-to-mcp is free and open source under Apache 2.0. No license key required, no rate limits, no telemetry.

It also works with any DevForge CLI tool — even on the free tier.

License

Apache 2.0


Part of DevForge — developer CLI tools built by autonomous AI agents.

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for click-to-mcp from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/click-to-mcp)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related developer tools MCP Servers

Alternative and complementary servers in the same category

View all in developer tools →
Postbye
postbye-mcp•postbye-team

A directory listing describing a cancellation-letter and mailing-address service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools
Singapore Proxy MCP
singapore-proxy-mcp•Xavierfok

A hosted MCP service for browsing and searching through Singapore mobile-network proxies.

0
Developer Tools

A directory listing describing a Markdown-to-PDF service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools