cli2mcp

cli2mcp

Enables AI assistants to call any CLI tool by scanning its help output and serving it as an MCP server.

Category
Visit Server

README

cli2mcp -- Turn any CLI into an MCP Server

An educational Python library that bridges the gap between traditional command-line tools and the Model Context Protocol (MCP).

cli2mcp scans a CLI tool's --help output, extracts its arguments and subcommands, and generates a JSON descriptor file. It can then serve that file as a fully functional MCP server -- letting AI assistants call the CLI tool through a standard protocol.

Quick start

uv sync

1. Scan a CLI tool

uv run cli2mcp scan curl

This runs curl --help, parses the output, and writes curl.tools.json.

For tools with subcommands (like git):

uv run cli2mcp scan git -o git.tools.json

Each subcommand becomes its own MCP tool.

2. Serve as an MCP server

uv run cli2mcp serve curl.tools.json

This starts an MCP server (stdio transport) that exposes every entry in the JSON file as a callable tool.

3. Connect to an AI assistant

Add the server to your assistant's MCP configuration.

{
  "mcpServers": {
    "curl": {
      "command": "cli2mcp",
      "args": ["serve", "curl.tools.json"]
    }
  }
}

How it works

                                        MCP client
                                            |
cli2mcp scan curl   -->  curl.tools.json    |
                              |             |
                         cli2mcp serve  <---+
                              |
                         subprocess.run(["curl", ...])

The JSON schema

The generated file looks like this:

{
  "command": "curl",
  "tools": [
    {
      "name": "curl",
      "description": "transfer a URL",
      "args": [
        {
          "name": "url",
          "description": "URL to transfer",
          "type": "string",
          "required": true
        },
        {
          "name": "--output",
          "description": "Write output to file instead of stdout",
          "type": "string",
          "required": false
        }
      ]
    }
  ]
}
  • command -- the base CLI binary to run.
  • tools -- one entry per tool (or per subcommand).
  • args -- each argument has a name, description, type (always "string"), and required flag.
  • Argument names starting with -- are flags; others are positional.
  • You can hand-edit this file to add, remove, or rename tools.

How arguments map back to CLI commands

When the MCP server receives a tool call like:

{"name": "git_commit", "arguments": {"message": "fix bug", "all": "true"}}

It reconstructs the CLI command:

git commit --message "fix bug" --all true

Flags (names starting with --) are emitted as --flag value. Positional arguments are appended at the end.

Supported help styles

Different CLI frameworks produce different --help formats. cli2mcp auto-detects the style and uses the right parser:

Style Frameworks Flag format
GNU argparse, click, GNU --flag description (one line)
Cobra kubectl, oc, docker, gh --flag=default: + next line
Plain curl, busybox flags listed without section headers

Requirements

  • Python 3.10+
  • uv (recommended) or pip
  • mcp[cli] (the official MCP Python SDK, installed automatically)

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured