/mcp2cli
Turn any MCP server, OpenAPI spec, or GraphQL endpoint into a CLI. Use this skill when the user wants to interact with an MCP server, OpenAPI/REST API, or GraphQL API via command line, discover available tools/endpoints, call API operations, or generate a new skill from an API.
$ npx -y skills add knowsuchagency/mcp2cli --skill mcp2cli --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/mcp2cli
Context preview
The summary Claude sees to decide when to auto-load this skill.
Turn any MCP server, OpenAPI spec, or GraphQL endpoint into a CLI. Use this skill when the user wants to interact with an MCP server, OpenAPI/REST API, or GraphQL API via command line, discover available tools/endpoints, call API operations, or generate a new skill from an API.
SKILL.md
mcp2cli.SKILL.mdname: mcp2cli
description: Turn any MCP server, OpenAPI spec, or GraphQL endpoint into a CLI. Use this skill when the user wants to interact with an MCP server, OpenAPI/REST API, or GraphQL API via command line, discover available tools/endpoints, call API operations, or generate a new skill from an API. Triggers include "mcp2cli", "call this MCP server", "use this API", "list tools from", "create a skill for this API", "graphql", or any task involving MCP tool invocation, OpenAPI endpoint calls, or GraphQL queries without writing code.
mcp2cli
Turn any MCP server, OpenAPI spec, or GraphQL endpoint into a CLI at runtime. No codegen.
Install
# Run directly (no install needed)
uvx mcp2cli --help
# Or install
pip install mcp2cli
Core Workflow
1. **Connect** to a source (MCP server, OpenAPI spec, or GraphQL endpoint) 2. **Discover** available commands with `--list` (or filter with `--search`) 3. **Inspect** a specific command with `<command> --help` 4. **Execute** the command with flags
# MCP over HTTP
mcp2cli --mcp https://mcp.example.com/sse --list
mcp2cli --mcp https://mcp.example.com/sse create-task --help
mcp2cli --mcp https://mcp.example.com/sse create-task --title "Fix bug"
# MCP over stdio
mcp2cli --mcp-stdio "npx @modelcontextprotocol/server-filesystem /tmp" --list
mcp2cli --mcp-stdio "npx @modelcontextprotocol/server-filesystem /tmp" read-file --path /tmp/hello.txt
# OpenAPI spec (remote or local, JSON or YAML)
mcp2cli --spec https://petstore3.swagger.io/api/v3/openapi.json --list
mcp2cli --spec ./openapi.json --base-url https://api.example.com list-pets --status available
# GraphQL endpoint
mcp2cli --graphql https://api.example.com/graphql --list
mcp2cli --graphql https://api.example.com/graphql users --limit 10
mcp2cli --graphql https://api.example.com/graphql create-user --name "Alice"
CLI Reference
mcp2cli [global options] <subcommand> [command options]
Source (mutually exclusive, one required):
--spec URL|FILE OpenAPI spec (JSON or YAML, local or remote)
--mcp URL MCP server URL (HTTP/SSE)
--mcp-stdio CMD MCP server command (stdio transport)
--graphql URL GraphQL endpoint URL
Options:
--auth-header K:V HTTP header (repeatable, value supports env:/file: prefixes)
--base-url URL Override base URL from spec
--transport TYPE MCP HTTP transport: auto|sse|streamable (default: auto)
--env KEY=VALUE Env var for stdio server process (repeatable)
--session-start NAME Start a persistent session daemon (requires --mcp or --mcp-stdio)
--session NAME Route command through an existing session daemon
--session-stop NAME Stop a named session daemon (sends SIGTERM)
--session-list List all active sessions with PID and alive/dead status
--oauth Enable OAuth (authorization code + PKCE flow)
--oauth-client-id ID OAuth client ID (supports env:/file: prefixes)
--oauth-client-secret S OAuth client secret (supports env:/file: prefixes)
--oauth-scope SCOPE OAuth scope(s) to request
--cache-key KEY Custom cache key
--cache-ttl SECONDS Cache TTL (default: 3600)
--refresh Bypass cache
--list List available subcommands
--search PATTERN Search tools by name or description (implies --list)
--fields FIELDS Override GraphQL selection set (e.g. "id name email")
--pretty Pretty-print JSON output
--raw Print raw response body
--json Force valid JSON for every command. --list emits a JSON array;
MCP calls emit the full envelope (structuredContent, isError).
--toon Encode output as TOON (token-efficient for LLMs)
--head N Limit output to first N records (arrays)
--version Show version
Bake mode:
bake create NAME [opts] Save connection settings as a named tool
bake list List all baked tools
bake show NAME Show config (secrets masked)
bake update NAME [opts] Update a baked tool
bake remove NAME Delete a baked tool
bake install NAME Create ~/.local/bin wrapper script
@NAME [args] Run a baked tool (e.g. mcp2cli @petstore --list)Subcommands and flags are generated dynamically from the source.
Patterns
Authentication
**Always use `env:` or `file:` prefixes for secrets** — never pass credentials as literal values in CLI flags. Literal values are visible in process listings and shell history.
# Secret from environment variable (recommended — avoids exposing in process list)
mcp2cli --spec ./spec.json --auth-header "Authorization:env:API_TOKEN" list-items
# Secret from file
mcp2cli --mcp https://mcp.example.com/sse \
--auth-header "x-api-key:file:/run/secrets/api_key" \
search --query "test"
OAuth authentication (MCP HTTP only)
# Authorization code + PKCE (opens browser)
mcp2cli --mcp https://mcp.example.com/sse --oauth --list
# Client credentials (machine-to-machine)
mcp2cli --mcp https://mcp.example.com/sse \
--oauth-client-id env:OAUTH_CLIENT_ID --oauth-client-secret env:OAUTH_CLIENT_SECRET \
search --query "test"
# With scopes
mcp2cli --mcp https://mcp.example.com/sse --oauth --oauth-scope "read write" --list
Tokens are cached in `~/.cache/mcp2cli/oauth/` and refreshed automatically.
Transport selection (MCP HTTP only)
# Default: tries streamable HTTP, falls back to SSE
mcp2cli --mcp https://mcp.example.com/sse --list
# Force SSE transport (skip streamable HTTP attempt)
mcp2cli --mcp https://mcp.example.com/sse --transport sse --list
# Force streamable HTTP (no SSE fallback)
mcp2cli --mcp https://mcp.example.com/sse --transport streamable --list
GraphQL
# Discover queries and mutations
mcp2cli --graphql https://api.example.com/graphql --list
# Run a query
mc
Read more
name: mcp2cli description: Turn any MCP server, OpenAPI spec, or GraphQL endpoint into a CLI. Use this skill when the user wants to interact with an MCP server, OpenAPI/REST API, or GraphQL API via command line, discover available tools/endpoints, call API operations, or generate a new skill from an API. Triggers include "mcp2cli", "call this MCP server", "use this API", "list tools from", "create a skill for this API", "graphql", or any task involving MCP tool invocation, OpenAPI endpoint calls, or GraphQL queries without writing code.
mcp2cli
Turn any MCP server, OpenAPI spec, or GraphQL endpoint into a CLI at runtime. No codegen.
Install
# Run directly (no install needed) uvx mcp2cli --help # Or install pip install mcp2cli
Core Workflow
1. **Connect** to a source (MCP server, OpenAPI spec, or GraphQL endpoint) 2. **Discover** available commands with `--list` (or filter with `--search`) 3. **Inspect** a specific command with `<command> --help` 4. **Execute** the command with flags
# MCP over HTTP mcp2cli --mcp https://mcp.example.com/sse --list mcp2cli --mcp https://mcp.example.com/sse create-task --help mcp2cli --mcp https://mcp.example.com/sse create-task --title "Fix bug" # MCP over stdio mcp2cli --mcp-stdio "npx @modelcontextprotocol/server-filesystem /tmp" --list mcp2cli --mcp-stdio "npx @modelcontextprotocol/server-filesystem /tmp" read-file --path /tmp/hello.txt # OpenAPI spec (remote or local, JSON or YAML) mcp2cli --spec https://petstore3.swagger.io/api/v3/openapi.json --list mcp2cli --spec ./openapi.json --base-url https://api.example.com list-pets --status available # GraphQL endpoint mcp2cli --graphql https://api.example.com/graphql --list mcp2cli --graphql https://api.example.com/graphql users --limit 10 mcp2cli --graphql https://api.example.com/graphql create-user --name "Alice"
CLI Reference
mcp2cli [global options] <subcommand> [command options]
Source (mutually exclusive, one required):
--spec URL|FILE OpenAPI spec (JSON or YAML, local or remote)
--mcp URL MCP server URL (HTTP/SSE)
--mcp-stdio CMD MCP server command (stdio transport)
--graphql URL GraphQL endpoint URL
Options:
--auth-header K:V HTTP header (repeatable, value supports env:/file: prefixes)
--base-url URL Override base URL from spec
--transport TYPE MCP HTTP transport: auto|sse|streamable (default: auto)
--env KEY=VALUE Env var for stdio server process (repeatable)
--session-start NAME Start a persistent session daemon (requires --mcp or --mcp-stdio)
--session NAME Route command through an existing session daemon
--session-stop NAME Stop a named session daemon (sends SIGTERM)
--session-list List all active sessions with PID and alive/dead status
--oauth Enable OAuth (authorization code + PKCE flow)
--oauth-client-id ID OAuth client ID (supports env:/file: prefixes)
--oauth-client-secret S OAuth client secret (supports env:/file: prefixes)
--oauth-scope SCOPE OAuth scope(s) to request
--cache-key KEY Custom cache key
--cache-ttl SECONDS Cache TTL (default: 3600)
--refresh Bypass cache
--list List available subcommands
--search PATTERN Search tools by name or description (implies --list)
--fields FIELDS Override GraphQL selection set (e.g. "id name email")
--pretty Pretty-print JSON output
--raw Print raw response body
--json Force valid JSON for every command. --list emits a JSON array;
MCP calls emit the full envelope (structuredContent, isError).
--toon Encode output as TOON (token-efficient for LLMs)
--head N Limit output to first N records (arrays)
--version Show version
Bake mode:
bake create NAME [opts] Save connection settings as a named tool
bake list List all baked tools
bake show NAME Show config (secrets masked)
bake update NAME [opts] Update a baked tool
bake remove NAME Delete a baked tool
bake install NAME Create ~/.local/bin wrapper script
@NAME [args] Run a baked tool (e.g. mcp2cli @petstore --list)Subcommands and flags are generated dynamically from the source.
Patterns
Authentication
**Always use `env:` or `file:` prefixes for secrets** — never pass credentials as literal values in CLI flags. Literal values are visible in process listings and shell history.
# Secret from environment variable (recommended — avoids exposing in process list) mcp2cli --spec ./spec.json --auth-header "Authorization:env:API_TOKEN" list-items # Secret from file mcp2cli --mcp https://mcp.example.com/sse \ --auth-header "x-api-key:file:/run/secrets/api_key" \ search --query "test"
OAuth authentication (MCP HTTP only)
# Authorization code + PKCE (opens browser) mcp2cli --mcp https://mcp.example.com/sse --oauth --list # Client credentials (machine-to-machine) mcp2cli --mcp https://mcp.example.com/sse \ --oauth-client-id env:OAUTH_CLIENT_ID --oauth-client-secret env:OAUTH_CLIENT_SECRET \ search --query "test" # With scopes mcp2cli --mcp https://mcp.example.com/sse --oauth --oauth-scope "read write" --list
Tokens are cached in `~/.cache/mcp2cli/oauth/` and refreshed automatically.
Transport selection (MCP HTTP only)
# Default: tries streamable HTTP, falls back to SSE mcp2cli --mcp https://mcp.example.com/sse --list # Force SSE transport (skip streamable HTTP attempt) mcp2cli --mcp https://mcp.example.com/sse --transport sse --list # Force streamable HTTP (no SSE fallback) mcp2cli --mcp https://mcp.example.com/sse --transport streamable --list
GraphQL
# Discover queries and mutations mcp2cli --graphql https://api.example.com/graphql --list # Run a query mc
Turn any MCP, OpenAPI, or GraphQL server into a CLI — at runtime, with zero codegen
Repo: knowsuchagency/mcp2cli

