KM

knowsuchagency/mcp2cli

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

2426 stars 184 forks 品質 75 トレンド 46MIT

任意のMCP、OpenAPI、またはGraphQLサーバーを実行時にCLIに変換し、コード生成はゼロです

概要

任意のMCPサーバー、OpenAPI仕様、またはGraphQLエンドポイントを実行時にCLIに変換し、コード生成はゼロです。ツールスキーマに無駄にされるトークンの96〜99%を毎ターン節約できます。全文をお読みください→ mcp2cliにはインストール可能なスキルが付属しており、AIコーディングエージェント(Claude Code、Cursor、Codex)に使い方を教えます。インストール後、エージェントは任意のMCPサーバーやOpenAPIエンドポイントを検出・呼び出しでき、APIから新しいスキルを生成することさえ可能です。 インストール後、次のようなプロンプトを試してください:- mcp2cli --mcp https://mcp.example.com/sse — MCPサーバーとやり取り - mcp2cli https://api.example.com/openapi.json のスキルを作成 — APIからスキルを生成する --searchは--listを意味し、すべてのモード(--mcp、--spec、--graphql、--mcp-stdio)で動作します。 OAuthを必要とするAPIは、MCP、OpenAPI、GraphQL各モードで標準サポートされています。MCP2CLIはトークン取得、キャッシュ、リフレッシュを自動的に処理します。 トークンは~/で永続化されます。

概要(AI 翻訳)

MCP2CLI

任意のMCPサーバー、OpenAPI仕様、またはGraphQLエンドポイントを実行時にCLIに変換し、コード生成はゼロです。 毎ターン、ツールスキーマに無駄にするトークンの96〜99%を節約しましょう。 詳細はこちら→

インストール

AIエージェントスキル

mcp2cliにはインストール可能なスキルが付属しており、AIコーディングエージェント(Claude Code、Cursor、Codex)に使い方を教えます。インストール後、エージェントは任意のMCPサーバーやOpenAPIエンドポイントを検出・呼び出しでき、APIから新しいスキルを生成することさえ可能です。

インストール後は、次のようなプロンプトを試してみてください:

  • mcp2cli --mcp https://mcp.example.com/sse — MCPサーバーとやり取り
  • mcp2cli create a skill for https://api.example.com/openapi.json — APIからスキルを生成する

使用法

MCP HTTP/SSEモード

--searchは--listを意味し、すべてのモード(--mcp、--spec、--graphql、--mcp-stdio)で機能します。

OAuth 認証

OAuthを必要とするAPIは、MCP、OpenAPI、GraphQL各モードで標準サポートされています。 MCP2CLIはトークン取得、キャッシュ、リフレッシュを自動的に処理します。

トークンは~/.cache/mcp2cli/oauth/に保存されているため、その後の呼び出しは既存のトークンを再利用します 期限切れになると自動的にリフレッシュされます。

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

README

以下は原文 README の抜粋です。原文を見る。

mcp2cli

Turn any MCP server, OpenAPI spec, or GraphQL endpoint into a CLI — at runtime, with zero codegen. Save 96–99% of the tokens wasted on tool schemas every turn. Read the full writeup →

Install

# Run directly without installing
uvx mcp2cli --help

# Or install globally
uv tool install mcp2cli

AI Agent Skill

mcp2cli ships with an installable skill that teaches AI coding agents (Claude Code, Cursor, Codex) how to use it. Once installed, your agent can discover and call any MCP server or OpenAPI endpoint — and even generate new skills from APIs.

npx skills add knowsuchagency/mcp2cli --skill mcp2cli

After installing, try prompts like:

  • mcp2cli --mcp https://mcp.example.com/sse — interact with an MCP server
  • mcp2cli create a skill for https://api.example.com/openapi.json — generate a skill from an API

Usage

MCP HTTP/SSE mode

# Connect to an MCP server over HTTP
mcp2cli --mcp https://mcp.example.com/sse --list

# Call a tool
mcp2cli --mcp https://mcp.example.com/sse search --query "test"

# With auth header
mcp2cli --mcp https://mcp.example.com/sse --auth-header "x-api-key:sk-..." \
  query --sql "SELECT 1"

# Force a specific transport (skip streamable HTTP fallback dance)
mcp2cli --mcp https://mcp.example.com/sse --transport sse --list

# Search tools by name or description (case-insensitive substring match)
mcp2cli --mcp https://mcp.example.com/sse --search "task"

--search implies --list and works across all modes (--mcp, --spec, --graphql, --mcp-stdio).

OAuth authentication

APIs that require OAuth are supported out of the box — across MCP, OpenAPI, and GraphQL modes. mcp2cli handles token acquisition, caching, and refresh automatically.

# Authorization code + PKCE flow (opens browser for login)
mcp2cli --mcp https://mcp.example.com/sse --oauth --list
mcp2cli --spec https://api.example.com/openapi.json --oauth --list
mcp2cli --graphql https://api.example.com/graphql --oauth --list

# Client credentials flow (machine-to-machine, no browser)
mcp2cli --spec https://api.example.com/openapi.json \
  --oauth-client-id "my-client-id" \
  --oauth-client-secret "my-secret" \
  list-pets

# With specific scopes
mcp2cli --graphql https://api.example.com/graphql --oauth --oauth-scope "read write" users

# Local spec file — use --base-url for OAuth discovery
mcp2cli --spec ./openapi.json --base-url https://api.example.com --oauth --list

Tokens are persisted in ~/.cache/mcp2cli/oauth/ so subsequent calls reuse existing tokens and refresh automatically when they expire.

GitHub で README 全文を見る

インストール

uvx mcp2cli --help
MCP 初心者?mcpskill.org のガイドから始めましょう →