| name | mcp2cli |
| description | Turn any MCP, OpenAPI, or GraphQL server into a CLI at runtime with zero codegen. |
| version | 1.0.0 |
| author | Hermes Agent |
| license | MIT |
| platforms | ["linux","macos","windows"] |
| metadata | {"hermes":{"tags":["mcp","cli","openapi","graphql","codegen","automation"],"related_skills":["headroom","codebase-memory-mcp"]}} |
mcp2cli — MCP to CLI Converter
Dynamically convert MCP servers, OpenAPI specs, and GraphQL schemas into fully functional CLI tools at runtime. No code generation, no build steps.
Prerequisites
Installation
pip install mcp2cli
Usage
Convert MCP Server to CLI
mcp2cli --server https://my-mcp-server.com/sse --output ./my-tool
./my-tool --help
./my-tool subcommand --arg value
Convert OpenAPI Spec
mcp2cli --openapi https://api.example.com/openapi.json --output ./api-cli
mcp2cli --openapi ./openapi.yaml --output ./api-cli
mcp2cli --openapi https://api.example.com/openapi.json \
--auth-header "Authorization: Bearer sk-..." \
--output ./api-cli
Convert GraphQL Schema
mcp2cli --graphql https://api.example.com/graphql --output ./gql-cli
mcp2cli --graphql https://api.example.com/graphql \
--header "X-API-Key: your-key" \
--output ./gql-cli
Integration with Hermes Agent
Expose MCP Servers as Shell Commands
mcp2cli --server stdio:hermes-mcp-server --output ./hermes-tools
./hermes-tools search "query" --limit 10
./hermes-tools store --key "value"
Pipeline Integration
mcp2cli --openapi ./petstore.json --output ./petstore
./petstore list-pets --limit 5 | jq '.[].name'
Configuration
Output Options
mcp2cli --server ... --output-dir ./bin
mcp2cli --server ... --verbose
mcp2cli --server ... --no-help
Authentication
mcp2cli --openapi ... --api-key "sk-..."
mcp2cli --openapi ... --auth-header "Authorization: Bearer token"
mcp2cli --openapi ... --auth user:password
Common Pitfalls
- Complex APIs may need tuning: Very large OpenAPI specs (1000+ endpoints) may generate unwieldy CLIs. Use
--filter to limit endpoints.
- Authentication timing: Auth tokens expire. Use environment variables:
mcp2cli --openapi ... --api-key "$API_KEY".
- Binary responses: CLI handles JSON/text well. Binary responses (images, files) need
--output-file flag.
Verification
mcp2cli --version
mcp2cli --openapi https://petstore3.swagger.io/api/v3/openapi.json --output ./petstore
./petstore --help
./petstore list-pets --limit 3
Sources