API Testing MCP
概要
APIテストのための最も完成されたMCPサーバーです。42個のツール、設定不要、これに匹敵するものはありません。単なるリクエスト送信ツールではありません。これは完全なテストワークベンチです。アサーション付きのHTTPリクエスト、変数抽出を伴うマルチステップフロー、スキーマを認識したモックデータ生成を伴うOpenAPIインポート、パーセンタイル指標を用いた負荷テスト、環境間でのレスポンス差分比較、一括テストランナー、再利用可能なコレクション、ディレクトリスコープと永続的なデフォルト設定を持つ環境グループ、Postmanのインポート/エクスポート、そしてcURLエクスポート。すべて自然な会話から実行できます。アカウントもクラウドも、生成ファイルも不要です。すべてがインラインで実行され、所有するプレーンなJSONとして保存されます。
対話するだけ
ツール名やパラメータを覚える必要はありません。やりたいことを説明すれば、AIが適切なツールを選択します。
"Create a group called my-project and add this directory as scope"
"Set up a dev environment with BASE_URL http://localhost:3000"
"Switch to prod for this session"
"Set dev as the default environment"
"Import my API spec from /api-docs-json"
"Show me all user endpoints"
"GET /users"
"Create a user with random data"
"Verify that DELETE /users/5 returns 204"
"Login as admin, extract the token, then fetch dashboard stats"
"How fast is /health with 50 concurrent requests?"
"Run all my saved smoke tests"
"Compare the users endpoint between dev and prod"
"Export the create-user request as curl"
"Export my collection to Postman"OpenAPI仕様をインポート済みであれば、AIはすべてのエンドポイント、必須フィールド、有効な列挙値をすでに把握しています。「ブログ投稿を作成して」と言うだけで、スキーマを読み取って正しくリクエストを構築します。推測は不要です。
インストール
Claude Code
claude mcp add --scope user api-testing -- npx -y @cocaxcode/api-testing-mcp@latestClaude Desktop
設定ファイル(macOSの場合は ~/Library/Application Support/Claude/claude_desktop_config.json、Windowsの場合は %APPDATA%\Claude\claude_desktop_config.json)に追加します:
{
"mcpServers": {
"api-testing": {
"command": "npx",
"args": ["-y", "@cocaxcode/api-testing-mcp@latest"]
}
}
}Cursor / Windsurf
プロジェクトルートの .cursor/mcp.json または .windsurf/mcp.json に追加します:
{
"mcpServers": {
"api-testing": {
"command": "npx",
"args": ["-y", "@cocaxcode/api-testing-mcp@latest"]
}
}
}VS Code — .vscode/mcp.json に追加:
{
"servers": {
"api-testing": {
"command": "npx",
"args": ["-y", "@cocaxcode/api-testing-mcp@latest"]
}
}
}Codex CLI (OpenAI):
codex mcp add api-testing -- npx -y @cocaxcode/api-testing-mcp@latestまたは ~/.codex/config.toml に追加:
[mcp_servers.api-testing]
command = "npx"
args = ["-y", "@cocaxcode/api-testing-mcp@latest"]Gemini CLI — ~/.gemini/settings.json に追加:
{
"mcpServers": {
"api-testing": {
"command": "npx",
"args": ["-y", "@cocaxcode/api-testing-mcp@latest"]
}
}
}クイックスタート
インストール後、相対パスが自動的に解決されるように環境を設定します:
"Create an environment called dev with BASE_URL http://localhost:3000"APIにSwagger/OpenAPI仕様がある場合は、インポートします:
"Import my API spec from http://localhost:3000/api-docs-json"確認するには:「環境をリストして」と入力してください。作成した環境が表示されるはずです。
機能
HTTPリクエスト
ヘッダー、クエリパラメータ、JSONボディ、認証、{{variable}} 補間を使用して、あらゆるHTTPメソッドを送信します。相対URLは BASE_URL に対して自動的に解決されます。
"POST to /api/users with name Jane and email jane@company.com using my bearer token"サポート対象: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS — Bearer / API Key / Basic認証 — カスタムタイムアウト。
アサーション
構造化された成功/失敗結果でレスポンスを検証します:
"Verify that GET /api/health returns 200, body.status is ok, and responds in under 500ms"PASS — 3/3 assertions passed
status === 200
body.status === "ok"
timing.total_ms < 50010個の演算子: eq, neq, gt, gte, lt, lte, contains, not_contains, exists, type
リクエストフロー
ステップ間で変数を抽出しながらリクエストを連鎖させます。認証フローやCRUDシーケンスに最適です。
"Login as admin@test.com, extract the access token, then use it to fetch all users"flow_run({
steps: [
{
name: "login",
method: "POST",
url: "/auth/login",
body: { email: "admin@test.com", password: "SecurePass#99" },
extract: { "TOKEN": "body.access_token" }
},
{
name: "get-users",
method: "GET",
url: "/api/users",
headers: { "Authorization": "Bearer {{TOKEN}}" }
}
]
})OpenAPIインポート
URLまたはローカルファイル(JSONおよびYAML)から仕様をインポートします。インポートすると、AIはすべてのエンドポイント、パラメータ、スキーマを把握します。
"Import my API spec from http://localhost:3000/api-docs-json"
"Import the spec from ./openapi.yaml"
"What parameters does POST /users expect?"OpenAPI 3.xをサポートし、完全な $ref 解決、allOf、oneOf、anyOf に対応しています。OpenAPI 2.0は部分的にサポートされています。
モックデータ生成
OpenAPIスキーマからリアルな偽データを生成します。型、フォーマット(email, uuid, date-time)、列挙型、必須フィールドを尊重します。
"Generate mock data for creating a user"{
"email": "user42@example.com",
"name": "Test User 73",
"password": "TestPass123!",
"role": "admin"
}負荷テスト
N個の同時リクエストを発行し、パフォーマンス指標を取得します:
"How fast is the health endpoint with 50 concurrent requests?"LOAD TEST — GET /api/health
Requests: 50 concurrent
Successful: 50 | Failed: 0
Req/sec: 23.31
Min: 45ms | Avg: 187ms
p50: 156ms | p95: 412ms | p99: 523ms
Max: 567msレスポンス差分比較
2つのリクエストを実行し、フィールドごとにレスポンスを比較します。回帰の検出や環境間の比較に役立ちます。
"Compare the users endpoint between dev and prod"一括テスト
コレクション内のすべての保存済みリクエスト(またはタグによるフィルタリング)を実行し、サマリーを取得します:
"Run all my saved smoke tests"BULK TEST — 8/8 passed | 1.2s total
health — GET /health → 200 (45ms)
list-users — GET /users → 200 (123ms)
create-post — POST /blog → 201 (89ms)
login — POST /auth/login → 200 (156ms)コレクション
リクエストをタグ付きで保存して再利用します。回帰テストスイートを構築します。
"Save this request as create-user with tags auth, smoke"
"List all requests tagged smoke"環境
環境は BASE_URL、トークン、APIキーなどの変数を保持し、コンテキストごとに分離します。システムには3つの核となる概念があります:
グループ。 グループは環境を整理し、ディレクトリにバインドします。グループには、その環境を共有するN個のスコープ(ディレクトリ)と、正確に1つのデフォルト環境があります。グループ内に環境を作成すると、そのグループに属します。グループのスコープであるディレクトリに cd すると、その環境が自動的に利用可能になります。
デフォルト。 デフォルト環境は、そのグループのスコープに入ると自動的にアクティブになります。セッション間でも永続化されるため、エディタを再起動したりターミナルを開き直したりしても、デフォルト設定は維持されます。一度設定すれば忘れて構いません。
アクティブ。 アクティブ環境は、現在変数解決に使用されている環境です。スコープに入るとデフォルトとして開始されますが、いつでも切り替え可能です。アクティブな選択はセッション限定であり、再起動するとデフォルトにリセットされます。
グローバル環境(どのグループにも関連付けられていないもの)も存在します。これらは env_switch で明示的にアクティブ化する必要があり、セッション間で永続化されません。
実践例:
"Create a group called my-api"
"Add this directory as scope to my-api"
"Create a dev environment with BASE_URL http://localhost:3000" <- auto-joins group, auto-default
"Create a prod environment with BASE_URL https://api.example.com"
"List environments" <- shows dev (active, default) and prod
"Switch to prod" <- session only
"Set prod as default" <- persists自動補間。 URL、ヘッダー、クエリパラメータ、リクエストボディ内の {{variable}} は、リクエストが発行される前にアクティブな環境に対して解決されます。BASE_URL を一度設定すれば、すべての相対パスがそのまま機能します。
認証情報はマシンから一切外に出ません。 環境ファイルは ~/.api-testing/ に保存されるプレーンなJSONです。クラウドへの同期は一切行われません。エクスポートに埋め込まれることもありません。Gitで追跡されることもありません。トークンやシークレットは、あるべき場所(ディスク上、あなたの管理下)に留まります。
Postmanのインポートとエクスポート
双方向のPostmanサポート。PostmanとAIワークフローの間をシームレスに移行できます。
"Import my Postman collection from ./exported.postman_collection.json"
"Export my collection to Postman"
"Export the dev environment for Postman"コレクション: Postman v2.1形式。フォルダはタグになります。認証はフォルダ/コレクションレベルから継承されます。raw JSON、x-www-form-urlencoded、form-dataボディをサポートします。
環境: value よりも currentValue を優先します。無効化された変数はスキップします。オプションの activate フラグがあります。
コレクション: リクエストはタグごとにフォルダ分けされます。認証はPostmanのネイティブ形式にマッピングされます。{{variables}} はそのまま保持されます。
環境: すべての変数がPostman互換形式で enabled: true としてエクスポートされます。
ネイティブのエクスポートとインポート
コレクションと環境をポータブルな .atm/ フォルダにエクスポートします。チームと共有したり、プロジェクト間でコピーしたりできます。
"Export my collection and dev environment"your-project/
└── .atm/
├── collection.json
└── dev.env.json注:
.atm/は初回エクスポート時に自動的に.gitignoreに追加されます。
cURLエクスポート
保存されたリクエストを、解決済みの変数を含む、すぐに貼り付け可能なcURLコマンドに変換します。
"Export the create-user request as curl"curl -X POST \
'https://api.example.com/users' \
-H 'Authorization: Bearer eyJhbGci...' \
-H 'Content-Type: application/json' \
-d '{"name":"Jane","email":"jane@company.com"}'ツールリファレンス
9つのカテゴリにわたる42個のツール:
カテゴリ | ツール | 数 |
リクエスト |
| 1 |
テスト |
| 1 |
フロー |
| 1 |
コレクション |
| 4 |
環境 |
| 8 |
グループ |
| 7 |
API仕様 |
| 4 |
モック |
| 1 |
ユーティリティ |
| 12 |
ヒント: ツールを直接呼び出す必要はありません。やりたいことを説明すれば、AIが適切なツールを選択します。
ストレージ
すべてがローカルです。データベースもクラウド同期もテレメトリもありません。すべてのデータは ~/.api-testing/ にプレーンなJSONファイルとして存在し、いつでも読み取り、バックアップ、削除が可能です。
~/.api-testing/
├── groups/ # Environment groups with scopes and defaults
├── environments/ # Environment variables — tokens, keys, passwords
├── collections/ # Saved requests (shareable, no secrets)
├── specs/ # Imported OpenAPI specs
└── project-envs.json # Session-only active environments (cleared on restart)グローバルストレージとプロジェクトエクスポート。 ~/.api-testing/ ディレクトリはあなたのプライベートなグローバルストアであり、認証情報はここに留まり、外に出ることはありません。コレクションや環境をエクスポートすると、プロジェクトルートの .atm/ に保存されます。そのフォルダは初回エクスポート時に自動的に .gitignore に追加されますが、仮にコミットすることを選択しても、認証情報は ~/.api-testing/ に留まり、.atm/ にコピーされることはありません。シークレットを漏洩させることなく、安全に .atm/ エクスポートをチームと共有できます。
デフォルトのストレージパスを上書きする:
{
"env": { "API_TESTING_DIR": "/path/to/custom/.api-testing" }
}警告:
API_TESTING_DIRをGitリポジトリ内のパスに上書きする場合は、認証情報がプッシュされないように.api-testing/を.gitignoreに追加してください。
アーキテクチャ
src/
├── index.ts # Entry point (shebang + StdioServerTransport)
├── server.ts # createServer() factory
├── tools/ # 42 tool handlers (one file per category)
│ ├── request.ts # HTTP requests (1)
│ ├── assert.ts # Assertions (1)
│ ├── flow.ts # Request chaining (1)
│ ├── collection.ts # Collection CRUD (4)
│ ├── environment.ts # Environment management (8)
│ ├── group.ts # Environment groups (7)
│ ├── api-spec.ts # OpenAPI import/browse (4)
│ ├── mock.ts # Mock data generation (1)
│ ├── load-test.ts # Load testing (1)
│ └── utilities.ts # curl, diff, bulk, import/export (12)
├── lib/ # Business logic (no MCP dependency)
│ ├── http-client.ts # fetch wrapper with timing
│ ├── storage.ts # JSON file storage engine
│ ├── schemas.ts # Shared Zod schemas
│ ├── url.ts # BASE_URL resolution
│ ├── path.ts # Dot-notation accessor (body.data.0.id)
│ ├── interpolation.ts # {{variable}} resolver
│ └── openapi-parser.ts # $ref + allOf/oneOf/anyOf resolution
└── __tests__/ # 10+ test suites, 120+ testsスタック: TypeScript (strict) · MCP SDK · Zod · Vitest · tsup
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/cocaxcode/api-testing-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server