Skip to main content
Glama
gujord

OpenAPI to Model Context Protocol (MCP)

by gujord

OpenAPI からモデルコンテキストプロトコル (MCP)

ライセンス: MIT リポジトリサイズ最終コミット未解決の問題Pythonバージョン

OpenAPI-MCP プロキシは OpenAPI 仕様を MCP ツールに変換し、AI エージェントがカスタム ラッパーなしで外部 API にアクセスできるようにします。

オープンAPI-MCP

AIエージェントと外部API間のギャップを埋める

OpenAPI to Model Context Protocol(MCP)プロキシサーバーは、OpenAPI仕様を標準化されたMCPツールリソースプロンプト動的に変換することで、AIエージェントと外部API間のギャップを埋めます。これにより、カスタムAPIラッパーが不要になり、統合が簡素化されます。


役に立つと思ったら、GitHub で ⭐ を付けてください。


Related MCP server: OpenAPI to MCP

主な特徴

  • FastMCP トランスポート: stdio用に最適化されており、一般的な LLM オーケストレーターですぐに使用できます。

  • OpenAPI 統合: OpenAPI 操作を解析し、呼び出し可能なツールとして登録します。

  • リソース登録: OpenAPI コンポーネント スキーマを、定義された URI を持つリソース オブジェクトに自動的に変換します。

  • プロンプト生成: API 操作に基づいてコンテキスト プロンプトを生成し、LLM が API を使用するようガイドします。

  • **OAuth2 サポート:**クライアント資格情報フローを介してマシン認証を処理します。

  • **JSON-RPC 2.0 サポート:**完全準拠のリクエスト/レスポンス構造。

  • 自動メタデータ: OpenAPI 仕様からツール名、概要、スキーマを取得します。

  • サニタイズされたツール名: MCP の名前制約との互換性を確保します。

  • **柔軟なパラメータ解析:**クエリ文字列 (先頭に「?」が付く) と複数の JSON バリエーション (ドットと数値を含むキーを含む) をサポートします。

  • **強化されたパラメータ処理:**パラメータを正しいデータ型に自動的に変換します。

  • **拡張ツール メタデータ:**詳細なパラメーター情報と応答スキーマが含まれます。

クイックスタート

インストール

git clone https://github.com/gujord/OpenAPI-MCP.git
cd OpenAPI-MCP
pip install -r requirements.txt

LLMオーケストレータの構成

Claude DesktopCursorWindsurfの場合は、以下のスニペットを使用し、それに応じてパスを調整します。

{
  "mcpServers": {

    "petstore3": {
      "command": "full_path_to_openapi_mcp/venv/bin/python",
      "args": ["full_path_to_openapi_mcp/src/server.py"],
      "env": {
        "SERVER_NAME": "petstore3",
        "OPENAPI_URL": "https://petstore3.swagger.io/api/v3/openapi.json"
      },
      "transport": "stdio"
    }

  }
}

この構成を次のファイルに適用します。

  • カーソル: ~/.cursor/mcp.json

  • ウィンドサーフィン: ~/.codeium/windsurf/mcp_config.json

  • Claude デスクトップ: ~/Library/Application Support/Claude/claude_desktop_config.json

full_path_to_openapi_mcp実際のインストール パスに置き換えます。

環境設定

変数

説明

必須

デフォルト

OPENAPI_URL

OpenAPI仕様のURL

はい

-

SERVER_NAME

MCPサーバー名

いいえ

openapi_proxy_server

OAUTH_CLIENT_ID

OAuth クライアント ID

いいえ

-

OAUTH_CLIENT_SECRET

OAuthクライアントシークレット

いいえ

-

OAUTH_TOKEN_URL

OAuthトークンエンドポイントURL

いいえ

-

OAUTH_SCOPE

OAuthスコープ

いいえ

api

仕組み

  1. **OpenAPI 仕様を解析します。**必要に応じて、 httpxPyYAMLを使用して OpenAPI 仕様を読み込みます。

  2. 操作を登録します。API操作を抽出し、適切な入力および応答スキーマを持つ MCP 互換ツールを生成します。

  3. リソース登録: OpenAPI コンポーネント スキーマを、割り当てられた URI (例: /resource/{name} ) を持つリソース オブジェクトに自動的に変換します。

  4. プロンプト生成: API 操作に基づいてコンテキスト プロンプトを作成し、LLM が API の使用状況を理解できるようにします。

  5. **認証:**クライアント資格情報フローによる OAuth2 認証をサポートします。

  6. **パラメータ処理:**パラメータを必要なデータ型に変換し、柔軟なクエリ文字列と JSON 形式をサポートします。

  7. **JSON-RPC 2.0 準拠:**ツールの相互作用のための標準通信プロトコルを保証します。

sequenceDiagram
    participant LLM as LLM (Claude/GPT)
    participant MCP as OpenAPI-MCP Proxy
    participant API as External API

    Note over LLM, API: Communication Process

    LLM->>MCP: 1. Initialize (initialize)
    MCP-->>LLM: Metadata, tools, resources, and prompts

    LLM->>MCP: 2. Request tools (tools_list)
    MCP-->>LLM: Detailed list of tools, resources, and prompts

    LLM->>MCP: 3. Call tool (tools_call)

    alt With OAuth2
        MCP->>API: Request OAuth2 token
        API-->>MCP: Access Token
    end

    MCP->>API: 4. Execute API call with proper formatting
    API-->>MCP: 5. API response (JSON)

    alt Type Conversion
        MCP->>MCP: 6. Convert parameters to correct data types
    end

    MCP-->>LLM: 7. Formatted response from API

    alt Dry Run Mode
        LLM->>MCP: Call with dry_run=true
        MCP-->>LLM: Display request information without executing call
    end

リソースとプロンプト

ツールに加えて、プロキシ サーバーは次のものを自動的に登録するようになりました。

  • リソース: OpenAPI コンポーネント スキーマから派生したリソース オブジェクトは、構造化データ処理のために定義された URI (例: /resource/{name} ) に登録されます。

  • プロンプト: API 操作に基づいてコンテキスト プロンプトが生成され、LLM に使用ガイドが提供され、利用可能なエンドポイントの理解が向上します。

この拡張メタデータは、包括的な API コンテキストを提供することで統合を改善します。

オープンAPI-MCP

貢献

  • このリポジトリをフォークします。

  • 新しいブランチを作成します。

  • 変更内容を明確に説明したプル リクエストを送信します。

ライセンス

MITライセンス

役に立つと思ったら、GitHub で ⭐ を付けてください。

A
license - permissive license
-
quality - not tested
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity
Issues opened vs closed

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    -
    quality
    D
    maintenance
    A dynamic proxy that converts OpenAPI Specification (OAS) endpoints into Message Communication Protocol (MCP) tools, allowing AI agents to use existing REST APIs as if they were native MCP tools without manual implementation.
    Last updated
    16
  • A
    license
    -
    quality
    F
    maintenance
    A standalone proxy that transforms any OpenAPI or Swagger-described REST API into an MCP server by mapping API operations to executable MCP tools. It enables AI clients to interact with existing web services through automated HTTP requests based on their official documentation.
    Last updated
    13
    16
    MIT
  • A
    license
    -
    quality
    D
    maintenance
    A universal MCP server that connects any REST API to AI assistants via OpenAPI or Postman specifications. It enables dynamic tool creation with GraphQL-style field selection and automatic schema inference for efficient data retrieval.
    Last updated
    47
    5
    Inno Setup
  • A
    license
    -
    quality
    B
    maintenance
    Turns any OpenAPI specification into a fully working MCP server with a single command, enabling AI agents to call APIs without writing any glue code.
    Last updated
    27
    MIT

View all related MCP servers

Related MCP Connectors

  • MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.

  • Self-hosted MCP gateway: turn any API, database or MCP server into AI connectors — no code.

  • Free public MCP for AI agents — 193 tools, 44 workflows. No API key.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/gujord/OpenAPI-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server