Skip to main content
Glama

Swagger MCP Server

by dcolley

Swagger MCP サーバー

モデル コンテキスト プロトコル (MCP) を通じて Swagger/OpenAPI 仕様を取り込んで提供するサーバー。

特徴

  • Swagger/OpenAPI仕様をロードします
  • 複数の認証方法をサポートします:
    • 基本認証
    • 無記名トークン
    • APIキー(ヘッダーまたはクエリ)
    • OAuth2
  • APIエンドポイントからMCPツールを自動生成
  • リアルタイム通信のためのサーバー送信イベント(SSE)サポート
  • TypeScriptサポート

安全

これは個人用サーバーです。パブリックインターネットに公開しないでください。基盤となるAPIに認証が必要な場合は、MCPサーバーをパブリックインターネットに公開しないでください。

やるべきこと

  • シークレット - MCP サーバーは、ユーザーからのシークレットを使用して API へのリクエストを認証できる必要があります。
  • 包括的なテストスイート

前提条件

  • Node.js (v18以上)
  • Yarn パッケージマネージャー
  • タイプスクリプト

インストール

  1. リポジトリをクローンします。
git clone https://github.com/dcolley/swagger-mcp.git cd swagger-mcp
  1. 依存関係をインストールします:
yarn install
  1. 例に基づいて.envファイルを作成します。
cp .env.example .env
  1. Swagger/OpenAPI 仕様を構成します。
    • Swagger ファイルをプロジェクトに配置します (例: swagger.json )
    • または、Swagger仕様のURLを入力してください
  2. サーバー設定に合わせてconfig.jsonの設定を更新します。
{ "server": { "host": "localhost", "port": 3000 }, "swagger": { "url": "url-or-path/to/your/swagger.json", "apiBaseUrl": "https://api.example.com", // Fallback if not specified in Swagger "defaultAuth": { // Fallback if not specified in Swagger "type": "apiKey", "apiKey": "your-api-key", "apiKeyName": "api_key", "apiKeyIn": "header" } } }

注: サーバーは、構成ファイルよりも Swagger 仕様の設定を優先します。

  • Swaggerファイルにservers配列が含まれている場合、最初のサーバURLがベースURLとして使用されます。
  • Swaggerファイルでセキュリティスキームが定義されている場合は、それが認証に使用されます。
  • 設定ファイルの設定は、Swaggerファイルで指定されていない場合にフォールバックとして機能します。

使用法

  1. 開発サーバーを起動します。
yarn dev
  1. 生産用にビルド:
yarn build
  1. 本番サーバーを起動します。
yarn start

APIエンドポイント

  • GET /health - サーバーのヘルスステータスを確認する
  • GET /sse - Server-Sent Events接続を確立する
  • POST /messages - MCPサーバーにメッセージを送信する

テスト

テスト スイートを実行します。

# Run tests once yarn test # Run tests in watch mode yarn test:watch # Run tests with coverage report yarn test:coverage

認証

サーバーは様々な認証方法をサポートしています。Swaggerファイルで指定されていない場合は、 config.jsonファイルでフォールバックとして設定してください。

基本認証

{ "defaultAuth": { "type": "basic", "username": "your-username", "password": "your-password" } }

無記名トークン

{ "defaultAuth": { "type": "bearer", "token": "your-bearer-token" } }

APIキー

{ "defaultAuth": { "type": "apiKey", "apiKey": "your-api-key", "apiKeyName": "X-API-Key", "apiKeyIn": "header" } }

OAuth2

{ "defaultAuth": { "type": "oauth2", "token": "your-oauth-token" } }

発達

  1. 開発サーバーを起動します。
yarn dev

ライセンス

このプロジェクトは、Apache 2.0 ライセンスに基づいてライセンスされます。

環境変数

  • PORT : サーバーポート(デフォルト: 3000)
  • API_USERNAME : API認証のユーザー名(フォールバック)
  • API_PASSWORD : API認証用のパスワード(フォールバック)
  • API_TOKEN : 認証用のAPIトークン(フォールバック)
  • DEFAULT_API_BASE_URL : APIエンドポイントのデフォルトのベースURL(フォールバック)
  • DEFAULT_SWAGGER_URL : デフォルトのSwagger仕様URL
-
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.

モデル コンテキスト プロトコル (MCP) を介して Swagger/OpenAPI 仕様を持つ任意の API との対話を可能にし、API エンドポイントからツールを自動的に生成し、複数の認証方法をサポートするサーバー。

  1. 特徴
    1. 安全
      1. やるべきこと
        1. 前提条件
          1. インストール
            1. 使用法
              1. APIエンドポイント
                1. テスト
                  1. 認証
                    1. 基本認証
                    2. 無記名トークン
                    3. APIキー
                    4. OAuth2
                  2. 発達
                    1. ライセンス
                      1. 環境変数

                        Related MCP Servers

                        • -
                          security
                          A
                          license
                          -
                          quality
                          An MCP server that exposes HTTP methods defined in an OpenAPI specification as tools, enabling interaction with APIs via the Model Context Protocol.
                          Last updated -
                          2
                          Python
                          MIT License
                        • -
                          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
                          F
                          license
                          -
                          quality
                          A server based on Model Context Protocol that parses Swagger/OpenAPI documents and generates TypeScript types and API client code for different frameworks (Axios, Fetch, React Query).
                          Last updated -
                          143
                          1
                          TypeScript
                        • -
                          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

                        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/dcolley/swagger-mcp'

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