Auto-wrap any Click CLI as an MCP server

Your Python CLI already knows its arguments, defaults, and types. click-to-mcp reads that metadata and exposes every command as an MCP tool. No separate schema file, no hand-written JSON, no extra annotations.

You point it at a Click or typer app. The MCP client sees the same commands, but as structured tools it can call directly.

Install

# Install from source (not on public PyPI yet)
pip install git+https://github.com/Coding-Dev-Tools/click-to-mcp.git

# HTTP+SSE transport for web-based MCP clients
pip install "click-to-mcp[http] @ git+https://github.com/Coding-Dev-Tools/click-to-mcp.git"

Install is from the project's GitHub source (the package is not yet published to public PyPI). Python 3.10+. Apache 2.0. No account, no telemetry, no rate limits.

What it does

click-to-mcp serve starts a stdio MCP server from any installed Click/typer CLI. The agent sends a tool call with typed arguments; click-to-mcp invokes the CLI command and returns the output.

click-to-mcp serve-http runs the same thing over HTTP+SSE for web-based clients.

click-to-mcp list-tools previews what would be exposed without starting a server. Useful for CI.

click-to-mcp config emits the ready-to-paste JSON for Claude Desktop, Cursor, VS Code, Windsurf, or Cline.

How the mapping works

At runtime, click-to-mcp walks every @click.command() and @click.option() in your CLI. It converts Click types to JSON Schema types, flattens nested groups with prefixes, and passes Choice lists as enum constraints.

When your CLI changes, the exposed tools change with it. There is nothing in the MCP layer to keep in sync.

Integration examples

Claude Code

{
  "mcpServers": {
    "my-cli": {
      "command": "click-to-mcp",
      "args": ["serve", "my-cli"]
    }
  }
}

HTTP+SSE

click-to-mcp serve-http my-cli --port 8000

The server exposes /sse, /messages, and /health.

DevForge CLIs

This works out of the box with DevForge tools built on Click: api-contract-guardian, json2sql, deploydiff, and configdrift. Wrap any of them with click-to-mcp serve <name>.

Local usage

No hosted dashboard. No SaaS login. Run the server from your machine or CI runner.

# Discover available Click/typer CLIs
click-to-mcp discover

# Preview tools without starting a server
click-to-mcp list-tools my-cli

# Serve as MCP (stdio, local agents)
click-to-mcp serve my-cli

# Serve as HTTP+SSE (remote / multi-user)
click-to-mcp serve-http my-cli --port 8000

# Generate client config for your editor
click-to-mcp config my-cli --client cursor

What the free tier covers

stdio transport, full tool discovery, library API, and DevForge CLI support. No license key, no limits on commands or calls.

Docs and source: github.com/Coding-Dev-Tools/click-to-mcp