Swagger エクスプローラー MCP
Claude を通じて Swagger/OpenAPI 仕様を調査および分析するための管理コントロール プレーン (MCP) サーバー。
クイックスタート
npx を使用してグローバルにインストールして実行します。
npx -y @johnneerdael/swagger-mcpまたは環境変数を使用してインストールします:
npx -y @johnneerdael/swagger-mcp \
--env BASE_URL=/api \
--env AUTH_TOKEN=your-token \
--env PORT=3000Related MCP server: Swagger MCP
Claude Desktopのインストール
クロードデスクトップを開く
設定(歯車アイコン)をクリックします
「ツールと統合」を選択
「MCPサーバーを追加」をクリックします
以下を入力してください:
Name: Swagger Explorer Command: npx -y @johnneerdael/swagger-mcp Arguments: --swagger-url=$SWAGGER_URL「インストール」をクリック
クロードとの使用
以下に、クロードとのやり取りの例をいくつか示します。
基本的なSwaggerの探索
Human: Can you explore the Swagger documentation at http://localhost:8080/docs?
Claude: I'll help you explore that Swagger documentation using the Swagger Explorer MCP.
Let me analyze the API endpoints and schemas for you:
[Claude would then use the MCP to fetch and analyze the Swagger documentation]特定のエンドポイントの分析
Human: What are the available response schemas for the /pets POST endpoint?
Claude: I'll check the response schemas for that endpoint using the MCP.
[Claude would use the MCP to fetch specific endpoint details]スキーマ分析
Human: Can you show me the detailed structure of the Pet schema?
Claude: I'll retrieve the detailed schema information using the MCP.
[Claude would use the MCP to analyze the schema structure]特徴
認証サポート
ベアラートークン認証
環境変数で設定可能
カスタムレスポンスフォーマット
最小限のフォーマット: null/空の値を削除します
詳細形式: メタデータとタイムスタンプを含む
生の形式: 変更されていない応答
スキーマ分析
詳細な物件調査
応答スキーマ分析
スキーマ関係
API探索
パスリスト
メソッドフィルタリング
回答形式の分析
構成
環境変数:
BASE_URL: APIのベースパス(デフォルト: '')AUTH_TOKEN: 認証用のベアラートークンPORT: サーバーポート(デフォルト: 3000)SWAGGER_URL: デフォルトのSwaggerドキュメントURL
APIエンドポイント
APIを探索する
curl -X POST http://localhost:3000/api/explore \
-H "Authorization: Bearer your-token" \
-H "Content-Type: application/json" \
-d '{
"url": "http://your-swagger-url",
"options": {
"paths": true,
"schemas": true
}
}'スキーマの詳細を取得する
curl -X POST http://localhost:3000/api/schema-details \
-H "Authorization: Bearer your-token" \
-H "Content-Type: application/json" \
-d '{
"url": "http://your-swagger-url",
"schemaName": "Pet"
}'レスポンススキーマを取得する
curl -X POST http://localhost:3000/api/response-schemas \
-H "Authorization: Bearer your-token" \
-H "Content-Type: application/json" \
-d '{
"url": "http://your-swagger-url",
"path": "/pets",
"method": "post"
}'応答形式
最小限のフォーマット
{
"status": "success",
"data": {
// Only non-null values
}
}詳細なフォーマット
{
"status": "success",
"timestamp": "2025-01-29T10:00:00.000Z",
"data": {
// Full response
},
"metadata": {
"version": "1.0",
"format": "detailed"
}
}一般的な使用例
APIドキュメントレビュー
Human: Can you summarize all the available endpoints and their purposes?スキーマ検証
Human: What fields are required for creating a new pet?応答分析
Human: What are the possible error responses for the login endpoint?統合計画
Human: How should I structure my request to create a new order?
トラブルシューティング
接続の問題
Swagger URL にアクセスできることを確認する
認証トークンが正しいか確認する
ポートが使用されていないことを確認してください
認証エラー
AUTH_TOKENが正しく設定されていることを確認する
リクエストにベアラートークンが含まれていることを確認する
スキーマが見つかりません
スキーマ名が完全に一致しているかどうかを確認する
Swagger仕様が正しくロードされていることを確認する
セキュリティノート
AUTH_TOKENが設定されている場合、MCPは認証を必要とする
すべてのリクエストはデバッグのために記録されます
機密情報はキャッシュされません
不正使用を防ぐためにレート制限が適用されます
発達
貢献または変更するには:
リポジトリをクローンする
依存関係をインストールします:
npm install建てる:
npm run buildローカルで実行:
npm start
ライセンス
MITライセンス - 詳細はLICENSEファイルを参照