swagger-mcp

Integrations

  • Integrates with Ollama to allow running local LLMs as an alternative to cloud-based models for processing API interactions.

  • Connects with OpenAI models to process API definitions and interact with Swagger-documented endpoints.

  • Automatically extracts Swagger UI definitions from API endpoints to dynamically generate MCP tools at runtime, enabling AI agents to interact with any Swagger-documented API without manual tool implementation.

スワッガーMCP

概要

swagger-mcp swagger.jsonファイルを抽出し、実行時に適切に定義されたmcpツールを動的に生成することで、Swagger UIをスクレイピングするツールです。これらのツールは、MCPクライアントがさらなるツール選択を行う際に利用できます。

📽️ デモビデオ

プロジェクトの実際の動作を紹介するデモ ビデオをご覧ください。

🙌 サポート

このプロジェクトが価値があると思われた方は、 LinkedInで以下の方法でサポートしてください。

  • 👍 デモ投稿に「いいね!」してシェアしてください
  • 💬 コメント欄にご意見・ご感想をお寄せください
  • 🔗 今後のアップデートについては私に連絡してください

LinkedIn でのあなたのサポートは、より多くの人々にリーチし、プロジェクトを改善するのに役立ちます。

前提条件

swagger-mcpを使用するには、次の依存関係があることを確認してください。

  1. LLM モデル API キー / ローカル LLM : OpenAI、Claude、または Ollama モデルへのアクセスが必要です。
  2. 任意の MCP クライアント: ( mark3labs - mcphostを使用)

インストールとセットアップ

swagger-mcpをインストールして実行するには、次の手順に従います。

go install github.com/danishjsheikh/swagger-mcp@latest swagger-mcp

実行構成

swagger-mcpを直接実行するには、次を使用します。

swagger-mcp --specUrl=https://your_swagger_api_docs.json

主な旗:

  • --specUrl : Swagger/OpenAPI JSON URL (必須)
  • --sseMode : SSE モードで実行 (デフォルト: false、true の場合は SSE サーバーとして実行され、それ以外の場合は stdio が使用されます)
  • --sseAddr : SSE サーバーのリッスン アドレス (IP:ポートまたは :ポート形式) (空の場合は、--sseUrl の IP:ポートが使用されます)
  • --sseUrl : SSE サーバーのベース URL (空の場合は、sseAddr を使用して生成されます。例: http://IP:Portまたはhttp://localhost:Port )
  • --sseAddr と --sseUrl の両方が設定されている場合は、自動補完なしでそのまま使用されます。
  • --baseUrl : APIリクエストのベースURLを上書きする
  • --security : API セキュリティ タイプ ( basicapiKey 、またはbearer )
  • --basicAuth : ユーザー:パスワード形式の基本認証
  • --bearerAuth : 認証ヘッダーのベアラートークン
  • --apiKeyAuth : API キー、形式passAs:name=value (例header:token=abc,query:user=foo,cookie:sid=xxx )
  • サポートされているすべてのフラグとオプションについては、main.go を参照してください。

MCP構成

mcphostと統合するには、 .mcp.jsonに次の構成を含めます。

{ "mcpServers": { "swagger_loader": { "command": "swagger-mcp", "args": ["--specUrl=<swagger/doc.json_url>"] } } }

デモフロー

  1. バックエンドの一部:
    go install github.com/danishjsheikh/go-backend-demo@latest go-backend-demo
  2. オラマ
    ollama run llama3.2
  3. MCPクライアント
    go install github.com/mark3labs/mcphost@latest mcphost -m ollama:llama3.2 --config <.mcp.json_file_path>

フロー図

🛠️ 助けが必要

私はツール定義を改善して以下の点を強化することに取り組んでいます。
✅ より正確な応答のためのエラー処理の改善
LLM の動作制御により、 API 応答のみに依存し、独自のメモリを使用しないようにします。
✅ APIからの厳密なデータ取得を強制することで幻覚ランダムなデータ生成を防ぐ

これらの点を改善するための洞察や提案がある場合は、次の方法でご協力ください。

  • 同様の実装に関する経験を共有する
  • ツール定義の変更を提案する
  • 現在の制限に関するフィードバックの提供

このツールをより信頼性が高く効果的なものにするために、皆様のご意見は非常に貴重です!🚀

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

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

swagger-mcpは、swagger.jsonファイルを抽出し、実行時に適切に定義されたmcpツールを動的に生成することで、Swagger UIをスクレイピングするツールです。これらのツールは、MCPクライアントがさらなるツール選択を行う際に利用できます。

  1. 概要
    1. 📽️ デモビデオ
      1. 🙌 サポート
        1. 前提条件
          1. インストールとセットアップ
            1. 実行構成
              1. MCP構成
                1. デモフロー
                  1. フロー図
                    1. 🛠️ 助けが必要

                      Related MCP Servers

                      • -
                        security
                        A
                        license
                        -
                        quality
                        A Python-based MCP server that integrates OpenAPI-described REST APIs into MCP workflows, enabling dynamic exposure of API endpoints as MCP tools.
                        Last updated -
                        2
                        39
                        Python
                        MIT License
                        • 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 -
                        61
                        TypeScript
                        Apache 2.0
                      • -
                        security
                        A
                        license
                        -
                        quality
                        An MCP server that connects to a Swagger specification and helps an AI to build all the required models to generate a MCP server for that service.
                        Last updated -
                        19
                        TypeScript
                        MIT License
                        • Linux
                        • Apple
                      • -
                        security
                        A
                        license
                        -
                        quality
                        MCP server providing token-efficient access to OpenAPI/Swagger specs via MCP Resources for client-side exploration.
                        Last updated -
                        35
                        5
                        TypeScript
                        MIT License

                      View all related MCP servers

                      ID: m0f2x0o51y