← Back to tools

mcp2cli

Turn any MCP server or OpenAPI spec into a CLI instantly

Development Productivity linuxmacoswindows Python MIT

Description

mcp2cli is a runtime CLI generator that converts MCP servers and OpenAPI specifications into command-line interfaces without code generation. It loads specs at runtime and enables on-demand tool discovery, saving 96-99% of tokens typically wasted on repetitive schema definitions when connecting LLMs to multiple tools.

Install

pippip install mcp2cli
uvxuvx mcp2cli --help

AI Summary

Runtime CLI generator that converts MCP servers and OpenAPI specs into command-line interfaces without code generation, dramatically reducing LLM token consumption.

Capabilities

  • + Convert any MCP server into a CLI at runtime
  • + Convert OpenAPI specs (JSON/YAML, local or remote) into CLIs
  • + Support HTTP/SSE, stdio, and streamable MCP transports
  • + OAuth authentication with automatic token caching
  • + TOON output format for token-efficient LLM consumption
  • + On-demand tool discovery via --list and --help
  • + Secrets management via environment variables or files

Use When

  • You need a CLI for an MCP server without writing code
  • You want to reduce token usage when connecting LLMs to tools
  • You need to interact with OpenAPI services from the terminal

Avoid When

  • x You need a compiled, standalone CLI binary

Usage Patterns

List tools from an MCP server

mcp2cli --mcp http://localhost:8080 --list

Discover all tools exposed by the MCP server

Use an OpenAPI spec

mcp2cli --spec https://api.example.com/openapi.json --list

Generate CLI from a remote OpenAPI spec

Call a specific tool

mcp2cli --mcp http://localhost:8080 tool_name --arg value

Invoke a tool with arguments

Input / Output

stdout: Tool output, JSON, or TOON-formatted results

Typical Pipelines

mcp2cli --mcp URL --list | grep search
mcp2cli --spec api.yaml tool_name --arg value | jq .
View AGENTS.md for mcp2cli