cli2mcp — Claude Code MCP server: what it does, how to install
Exposes command-line binaries as Model Context Protocol tools by converting their --help output into JSON Schemas on startup. Useful for giving agents direct access to CLI utilities.
claude mcp add cli2mcp -- npx -y cli2mcpWhat cli2mcp does
The server turns terminal commands into MCP tools via stdio without boilerplate. During launch, it inspects --help text, extracts flags, and builds an input schema. If help parsing fails on an unusual format, it provides a fallback variadic args array so the model can still execute the command.
The tool handles data piping into stdin and accepts options for --name, --description, --cwd, and --timeout. Running it requires Node.js 22 or newer.
Target binaries must already exist on your system PATH, as cli2mcp does not install external software for you. This is an early 0.1 release limited to stdio transport.
What it helps with
- expose local CLI binaries as agent tools without manual coding
- derive parameter schemas directly from command help text
- pipe string payloads into subprocess
stdinduring tool calls - confine command execution to a safe directory or runtime limit
Example prompts for the agent
- Search for TODO comments across the src folder using ripgrep
- Extract the id fields from data.json using jq
How to install cli2mcp
Platform CLI
claude mcp add cli2mcp -- npx -y cli2mcpPlatform CLI
codex mcp add cli2mcp -- npx -y cli2mcpConfig file
{
"mcpServers": {
"cli2mcp": {
"command": "npx",
"args": [
"-y",
"cli2mcp"
]
}
}
}Config file
{
"servers": {
"cli2mcp": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"cli2mcp"
]
}
}
}Platform CLI
gemini mcp add cli2mcp npx -y cli2mcpStep by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about cli2mcp
How do I install cli2mcp in Claude Code?
Run claude mcp add cli2mcp -- npx -y cli2mcp.
What does cli2mcp do?
It wraps any installed CLI utility into an MCP stdio server by inferring a JSON Schema straight from its help flag.
What are the prerequisites?
It requires Node.js 22 or higher, and the target executable must be present in your PATH.