Skip to main content
Glama

mcpify

あらゆるAPIをMCPサーバーに変換。コマンド一つで。コード不要。

npm License: MIT CI

npx mcpify https://petstore3.swagger.io/api/v3/openapi.json
✓ mcpify: Petstore v1.0.0 — 19 tools
  base: https://petstore3.swagger.io/api/v3
  transport: stdio

これだけです。これでAIエージェントはPetstore API全体にアクセスできるようになります。SDKのインストールも、グルーコードの記述も、サーバーのデプロイも不要です。

OpenAPI仕様を指定するだけで、完全に動作するMCPサーバーが手に入ります。


なぜこれが必要か

エージェントを構築するすべてのチームが同じ壁に突き当たります。モデルがAPIを呼び出す必要がある場合、それぞれを接続するために、MCPサーバーのコード作成、スキーマ変換、認証の実装といった数日間の作業が必要になるからです。

mcpify はそれを一つのコマンドに集約します。OpenAPI仕様には、エンドポイント、パラメータ、スキーマ、認証など、必要な情報がすべて記述されています。私たちはそれを実行時にMCPサーバーへ変換するため、コード生成ステップや維持すべきソースファイルは不要です。

Related MCP server: mcpify

インストール

npx を使用してオンデマンドで実行します(推奨):

npx mcpify <spec>

またはグローバルにインストールします:

npm install -g mcpify

Node.js 18以上が必要です。

使用方法

ホストされた仕様から

npx mcpify https://api.example.com/openapi.json

ローカルファイルから (JSONまたはYAML)

npx mcpify ./spec.yaml

単一のcurlコマンドから

npx mcpify --curl "curl -H 'Authorization: Bearer xxx' https://api.github.com/user/repos"

あらゆるcurlコマンドから単一ツールのMCPサーバーを生成します。ボディは解析され、入力スキーマに変換されます。

サーバーを起動せずにツールを一覧表示

npx mcpify list ./spec.json

スタンドアロンで編集可能なプロジェクトを生成

npx mcpify generate ./spec.json ./my-mcp
cd my-mcp && npm install && npm start

動作をカスタマイズしたい場合(キャッシュの追加、カスタム認証フロー、後処理など)に使用してください。

認証

起動前に環境変数を設定してください。mcpify は仕様の securitySchemes を読み取り、自動的にマッチングします。

# HTTP bearer schemes
export MCPIFY_BEARER_TOKEN=xxx

# apiKey schemes (header or query, as the spec says)
export MCPIFY_API_KEY=xxx

# HTTP basic
export MCPIFY_BASIC_AUTH=user:password

# Per-scheme override (use the scheme's name from the spec)
export MCPIFY_AUTH_<SCHEME_NAME>=xxx

# Free-form extra headers on every request
export MCPIFY_HEADERS='{"X-Trace-Id":"abc","X-Internal":"1"}'

大規模な仕様のフィルタリング

Stripeの完全なOpenAPIは約600のエンドポイントがあります。ほとんどのエージェントはそれらすべてを必要とせず、多くのクライアントはそれほど多くのツールを許容しません。以下のように絞り込みます:

# Only the customers tag
npx mcpify ./stripe.json --tag customers

# Only operations whose tool name matches a regex
npx mcpify ./stripe.json --filter "^createCustomer|^getCustomer"

# Hard cap
npx mcpify ./stripe.json --max-tools 30

Claude Desktopでの使用

~/.config/claude/claude_desktop_config.json (Linux/macOS) または %APPDATA%\Claude\claude_desktop_config.json (Windows) に設定します:

{
  "mcpServers": {
    "petstore": {
      "command": "npx",
      "args": ["-y", "mcpify", "https://petstore3.swagger.io/api/v3/openapi.json"]
    },
    "github": {
      "command": "npx",
      "args": ["-y", "mcpify", "--curl",
        "curl -H 'Authorization: Bearer ghp_xxx' https://api.github.com/user/repos"]
    }
  }
}

Cursor / Cline / Claude Codeでの使用

同様に、command と args でMCPサーバーを設定できる場所であればどこでも動作します。mcpify はstdioを使用します。

# Claude Code:
claude mcp add petstore -- npx -y mcpify https://petstore3.swagger.io/api/v3/openapi.json

プログラムによるAPI利用

import { loadOpenApiSpec, parseOpenApi, serve } from "mcpify";

const raw = await loadOpenApiSpec("./spec.yaml");
const spec = parseOpenApi(raw);
await serve(spec, {
  baseUrl: "https://staging.example.com",
  filterTag: "users",
});

仕組み

┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   OpenAPI spec  │ ─→ │ mcpify  runtime │ ─→ │   MCP client    │
│  (JSON / YAML)  │    │  (stdio server) │    │ (Claude/Cursor) │
└─────────────────┘    └─────────────────┘    └─────────────────┘
                            │
                            ↓ tool call
                       ┌─────────┐
                       │  fetch  │ → your API
                       └─────────┘
  1. 仕様をデリファレンス($refを解決)します。

  2. 各操作をMCPツールに変換します。パス/クエリ/ヘッダーパラメータは入力プロパティになり、リクエストボディはネストされた body プロパティになります。

  3. ツール呼び出し時に、URLを構築し、環境変数から認証情報を付与してリクエストを送信し、レスポンスを返します。

コード生成は行いません。再起動ループもありません。仕様が唯一の信頼できる情報源です。

制限事項

  • ストリーミングレスポンスボディ — 現在はバッファリングされており、64KBに制限されています。

  • OAuth2フロー — 自動実行されません。MCPIFY_BEARER_TOKEN を介して事前に取得したトークンを提供してください。

  • ファイルアップロード (multipart/form-data) — まだサポートされていません。

  • Webhook / コールバック — 対象外です。

  • Swagger 2.0 — 部分的な対応です。最良の結果を得るには、まずOpenAPI 3に変換してください。

上記すべてについてプルリクエストを歓迎します。

開発

git clone https://github.com/qualuo/mcpify
cd mcpify
npm install
npm run build
npm test

ライセンス

MIT

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Automatically converts Swagger/OpenAPI specifications into MCP servers, enabling AI agents to interact with any REST API through natural language by exposing endpoints as AI-friendly tools.
    3
    -
  • A
    license
    Not graded
    quality
    C
    maintenance
    Converts any OpenAPI specification into an MCP server, allowing AI assistants to interact with REST APIs through natural language.
    9 npm
    1
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Turns any OpenAPI REST or GraphQL API into an MCP server, allowing AI assistants like Claude to interact with APIs without writing code.
    8 npm
    MIT