MCP-OpenAPI

by rmasters
MIT License
2

Integrations

  • Mentioned in the example configuration where a FastAPI server is running, and the README notes it uses a FastMCP server with registered tools

  • The package is available on PyPI as 'mcp-openapi'

  • Supports Swagger/OpenAPI specifications (versions 3.0 and 3.1) to expose HTTP methods as tools

MCP-OpenAPI

OpenAPI 仕様からの HTTP メソッドをツールとして公開するモデル コンテキスト プロトコルサーバー。

[!警告] これは概念実証であり、まだ完全にテストおよび文書化されていません。

使用法

各MCP-OpenAPIサーバーは、単一のOpenAPI仕様からの操作を公開します。複数のインスタンスを実行して複数の仕様を公開することもできます。

このパッケージはPyPI @ [ mcp-openapi ][pypi]で入手できます。uvx uvx mcp-openapi --openapi-url https://httpbin.org/spec.json (sse | stdio)でサーバーを起動できます。

Claude の設定例 (ポート 8000 でfastapi dev tests/todos.py実行している場合):

{ "mcpServers": { "todos": { "command": "uvx", "args": [ "mcp-openapi", "--openapi-url=http://localhost:8000/openapi.json", "stdio" ] } } }

OpenAPI URL は、環境変数MCP_OPENAPI_URLとして渡すこともできます。

SSE として実行する場合、次のようにサーバーを構成できます。

  • --fastmcp-sse-host - MCPサーバーを提供するホスト
  • --fastmcp-sse-port - MCPサーバーを提供するポート

追加のグローバル オプションがあります:

  • --fastmcp-debug - MCP サーバーのデバッグ モードを有効にする
  • --fastmcp-log-level - MCP サーバーのログレベル

これらは、 FASTMCP_プレフィックスを使用して環境変数で設定することもできます (例: FASTMCP_LOG_LEVEL=DEBUG )。

仕組み

  1. MCP-OpenAPI サーバーは、OpenAPI 仕様 URL で初期化されます。
  2. サーバーは OpenAPI 仕様を取得して解析し、各パス操作をツールとして登録します。
  3. 登録されたツールを使用して FastMCP サーバーが起動されます。
  4. クライアントがツールを要求すると、MCP サーバーは API に HTTP 要求を送信し、応答を返します。

サポートされているOpenAPI/Swaggerバージョン

スワガー 2.0オープンAPI 3.0オープンAPI 3.1
:x::heavy_check_mark::heavy_check_mark:

このパッケージは、JSON および YAML 形式で OpenAPI 3.0 および 3.1 仕様をサポートしています。

私たちは、内部的にopenapi-parserを使用しており、これは非常に包括的で、外部仕様への参照の解決をサポートしています。

将来の構成オプション

[!INFO] これらはまだ実装されていません。

エンドポイントの制限

デフォルトでは、すべてのエンドポイントがツールとして公開されます。公開するエンドポイントを制限することができます。

  • パスパターンによって、
  • HTTPメソッドでは、
  • 公開する個々の操作を明示的にリストし、
  • OpenAPI タグを使用してルートを選択します。

API認証の処理

MCP-OpenAPI はターゲット API に API リクエストを送信します。グローバル認証トークンを使用できます。

  • --auth-token - OpenAPI 仕様に応じて使用されるベアラー トークン、または base64 形式の基本資格情報。

さまざまな認証トークン (クライアント ユーザーごとなど) を使用してリクエストを生成できるが、LLM にトークンを認識させないことができれば便利です。未定。

-
security - not tested
A
license - permissive license
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

OpenAPI 仕様で定義された HTTP メソッドをツールとして公開し、モデル コンテキスト プロトコルを介して API との対話を可能にする MCP サーバー。

  1. Usage
    1. How it works
    2. Supported OpenAPI/Swagger versions
    3. Future configuration options
    4. Handling API authentication

Related MCP Servers

  • -
    security
    A
    license
    -
    quality
    MCP Server simplifies the implementation of the Model Context Protocol by providing a user-friendly API to create custom tools and manage server workflows efficiently.
    Last updated -
    4
    3
    TypeScript
    MIT License
  • -
    security
    F
    license
    -
    quality
    A Model Context Protocol server implementation that enables connection between OpenAI APIs and MCP clients for coding assistance with features like CLI interaction, web API integration, and tool-based architecture.
    Last updated -
    9
    Python
    • Linux
    • Apple
  • -
    security
    A
    license
    -
    quality
    A server that enables interaction with any API that has a Swagger/OpenAPI specification through Model Context Protocol (MCP), automatically generating tools from API endpoints and supporting multiple authentication methods.
    Last updated -
    11
    TypeScript
    Apache 2.0
  • -
    security
    A
    license
    -
    quality
    A server that translates Model Context Protocol (MCP) tool callings to traditional HTTP API requests, allowing existing HTTP APIs to be integrated into MCP territory through configurable mappings.
    Last updated -
    Python
    Apache 2.0

View all related MCP servers

ID: ggsylex73e