mcp2cli
$ mcp2cli Community Med Riskmcp2cli (knowsuchagency/mcp2cli) turns any MCP server (--mcp / --mcp-stdio), OpenAPI spec (--spec), or GraphQL endpoint into an on-demand CLI at runtime without generating code. Designed to cut LLM tool-schema token overhead by ~96% via --list, --search, --jq, and --auth-header env references.
pip install mcp2cli mcp2cli provides progressive disclosure (--list, --search, <tool> --help) across MCP, OpenAPI, and GraphQL while preserving --jq output filtering.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Built explicitly for progressive agent tool discovery with --list, --search, --help, --req-json, --stdin, and --jq.
- Supports
--list,--search,--jq,--req-json, and--stdin
--auth-header "...:env:VAR" avoids secret exposure in process args; execution side effects mirror the underlying MCP/OpenAPI endpoint.
- Env/file indirection in
--auth-headerprotects API tokens
Pure Python CLI installable via uvx mcp2cli or pip install mcp2cli across macOS, Linux, and Windows.
- Instant execution via
uvx mcp2cliand PyPI
Bridges MCP, OpenAPI, and GraphQL dynamically with zero codegen and massive token savings.
- Dynamic runtime adapter for MCP, OpenAPI, and GraphQL
Active knowsuchagency/mcp2cli project under MIT license.
knowsuchagency/mcp2clirepository
Clear README covering MCP, OpenAPI, GraphQL, auth indirection, and --jq.
- README at github.com/knowsuchagency/mcp2cli
Security, Auth & Guardrails
Stateless runtime references via --auth-header "Authorization:env:API_TOKEN" or file references so secrets stay out of process args.
100% free and MIT open-source.
# mcp2cli Agent Rules - Always start with `--list` or `--search <query>`, then `<command> --help` before executing. - Pass secrets with `env:VAR_NAME` syntax in `--auth-header` so raw tokens never enter shell history. - Use `--jq <filter>` to keep large API responses compact.
Agent-Ready Command Recipes
Safe Read-Only Queries
mcp2cli --spec https://petstore3.swagger.io/api/v3/openapi.json --list
Summarizes all API endpoints at ~16 tokens per tool without bloating context.
mcp2cli --mcp-stdio "npx -y @modelcontextprotocol/server-filesystem ." read_file --help
Lazy-loads schema help for a single tool on demand.
Controlled Writes & Previews
--jq mcp2cli --spec ./openapi.yaml --base-url https://api.example.com --auth-header "Authorization:env:API_TOKEN" get-users --jq '.items[:5]'
Executes an API operation while resolving credentials from env and filtering JSON output.
Strengths for Agents
- + Unifies MCP, OpenAPI, and GraphQL specs into one progressive-disclosure CLI.
- + Built-in
--jqfiltering and--auth-header ...:env:VARsecret indirection. - + Zero codegen needed; runs immediately via
uvx mcp2cli.
Caveats & Pitfalls
- ! Every invocation re-parses or caches specs locally, which can add slight latency on huge OpenAPI files.