
Api Testing Mcp
io.github.cocaxcode由 GitHub 帳號 cocaxcode 發布v0.11.12更新於 Oct 24, 2026
MCP server for API testing. 35 tools: HTTP, assertions, flows, OpenAPI, collections.
概覽
本機 MCP 伺服器,把 AI 助理變成 API 測試工作台:送出 HTTP 請求、斷言回應、串接流程、匯入 OpenAPI 規格並管理集合。
- 可以做什麼
- 送出帶標頭、驗證、JSON 內容與變數插值的 HTTP 請求,並檢視壓縮或完整回應
- 用斷言驗證回應,並串接多步驟流程,在步驟之間擷取變數
- 匯入 OpenAPI 規格、瀏覽端點並依 schema 產生模擬資料
- 執行負載測試、比對不同環境的回應、批次執行已儲存的集合
- 管理環境、群組與目錄範圍,並匯入匯出 Postman 集合、.atm 資料夾和 cURL 指令
- 適用情境
- 適合讓助理以對話方式操作 REST API:冒煙測試端點、除錯回應、執行登入或 CRUD 序列、比較開發與正式環境,或依 OpenAPI 規格產生請求,不必離開對話。
- 執行需求
- 透過 npx 從 npm 套件 @cocaxcode/api-testing-mcp 以本機 stdio 程序執行,需要 Node.js 以及連線目標 API 的網路。未宣告帳號、API 金鑰或環境變數;資料以 JSON 存放在 ~/.api-testing/,可用 API_TESTING_DIR 覆寫。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Api Testing Mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
@cocaxcode/api-testing-mcp
The most complete MCP server for API testing. Period.
42 MCP tools · Zero config · Works in any MCP client
[npm version] [npm downloads] [42 tools] [171 tests] [Node] [License]
Overview · Just Talk to It · Installation · Features · Tool Reference · Storage · Architecture
Quick Overview
The most complete MCP server for API testing — 42 tools, zero config, nothing else comes close. This is not just a request sender. It is a full testing workbench: HTTP requests with assertions, multi-step flows with variable extraction, OpenAPI import with schema-aware mock data, load testing with percentile metrics, response diffing across environments, bulk test runners, reusable collections, environment groups with directory scoping and persistent defaults, Postman import/export, and cURL export. All from natural conversation. No accounts, no cloud, no generated files. Everything runs inline and stores as plain JSON you own.
Just Talk to It
You don't need to learn tool names or parameters. Describe what you want and the AI picks the right tool.
If you've imported an OpenAPI spec, the AI already knows every endpoint, every required field, every valid enum value. When you say "create a blog post", it reads the schema and builds the request correctly — no guessing.
Installation
Claude Code
Claude Desktop
Add to your config file (~/Library/Application Support/Claude/claude_desktop_config.json on macOS, %APPDATA%\Claude\claude_desktop_config.json on Windows):
Cursor / Windsurf
Add to .cursor/mcp.json or .windsurf/mcp.json in your project root:
VS Code / Codex CLI / Gemini CLI
VS Code — add to .vscode/mcp.json:
Codex CLI (OpenAI):
Or add to ~/.codex/config.toml:
Gemini CLI — add to ~/.gemini/settings.json:
Quick Start
Once installed, set up an environment so relative paths resolve automatically:
If your API has a Swagger/OpenAPI spec, import it:
Verify with: "List my environments" — you should see the one you just created.
Features
HTTP Requests
Send any HTTP method with headers, query params, JSON body, auth, and {{variable}} interpolation. Relative URLs auto-resolve against BASE_URL.
Supports: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS — Bearer / API Key / Basic auth — custom timeouts.
Compression modes (v0.13+)
AI agents pay for every byte that lands in their context window. By default, request now returns a compressed response that cuts 70-95% of those tokens without losing debugging value. Three optional parameters control it:
Modes:
minimal— onlystatus,timing,size_bytes, first 200 chars of body. Perfect for health checks, polling loops, or fire-and-forget calls. Saves ~95% tokens.normal(default) — filtered headers (dropsDate,Server,CF-*,Set-Cookie, etc.) + body truncated tomax_body_bytes. Covers ~80% of debugging use cases. Saves ~75% tokens.full— complete response untouched. Use when you explicitly need every header or the full body.
Typical savings on a 5 KB JSON response (≈1,500 tokens):
For a head-to-head comparison against
curl,WebFetchand other native alternatives with measured numbers, see Native alternatives below.
Recovering full responses: every compressed response includes a call_id. If you need the full body later, call inspect_last_response({ call_id }) — no need to re-execute the request. This works for request, assert, and each step of flow_run. Responses are kept in a 20-slot ring buffer and persisted to .api-testing/last-responses/ with a 1-hour TTL.
Native alternatives: real token cost
How this MCP compares against the native options Claude Code has when api-testing is not available (Bash + curl, WebFetch, etc.).
TL;DR: compared to raw curl, request saves between 65% and 97% of context tokens depending on the mode, with no loss of debugging information. Measured on a real call to GET /api/v1/blog returning 8 posts (~8.7 KB of JSON, 19 response headers):
Why this table's numbers differ slightly from the "Compression modes" section above: these come from a single real-world response, while the previous table shows typical savings on a synthetic 5 KB response. Trend and order of magnitude are the same.
Notes:
- The default mode (
normal) already saves 65% without any configuration: it filters out noisy headers (Date, Server, CF-*, Set-Cookie…) and caps the body at 2048 bytes. only_fieldsaccepts dot-paths with array index and wildcard support (items[*].name) — returns only the fields you ask for.- The MCP also adds features that have no direct native equivalent:
{{variable}}interpolation, stored environments, auth schemas, flows, Postman import/export, andinspect_last_responseto recover the full body without re-hitting the server. - Every registered MCP adds a fixed overhead of ~300-600 tokens per session (its instructions block + tool names). Typical break-even: 1-2 real calls per session.
Assertions
Validate responses with structured pass/fail results:
10 operators: eq, neq, gt, gte, lt, lte, contains, not_contains, exists, type
Request Flows
Chain requests with variable extraction between steps. Perfect for auth flows and CRUD sequences.
What the tool executes
OpenAPI Import
Import specs from a URL or local file (JSON and YAML). Once imported, the AI knows every endpoint, parameter, and schema.
Supports OpenAPI 3.x with full $ref resolution, allOf, oneOf, anyOf. OpenAPI 2.0 partially supported.
Mock Data Generation
Generate realistic fake data from your OpenAPI schemas. Respects types, formats (email, uuid, date-time), enums, and required fields.
Load Testing
Fire N concurrent requests and get performance metrics:
Response Diffing
Execute two requests and compare their responses field by field. Detect regressions or compare environments.
Bulk Testing
Run every saved request in a collection (or filter by tag) and get a summary:
Collections
Save requests for reuse with tags. Build regression suites.
Environments
Environments hold your variables — BASE_URL, tokens, API keys — and keep them separated by context. The system has three core concepts:
Group. A group organizes environments and binds them to directories. A group has N scopes (directories) that share its environments, and exactly one default environment. When you create an environment inside a group, it belongs to that group. When you cd into a directory that is a scope of a group, its environments become available automatically.
Default. The default environment activates automatically when you enter a scope of its group. It persists between sessions — restart your editor, reopen your terminal, and the default is still there. Set it once and forget about it.
Active. The active environment is what is being used right now for variable resolution. It starts as the default when you enter a scope, but you can switch it at any time. The active selection is session-only — it resets to the default on restart.
Global environments (not associated with any group) still exist. They require explicit activation with env_switch and do not persist between sessions.
Practical example:
Automatic interpolation. Any {{variable}} in URLs, headers, query params, or request bodies is resolved against the active environment before the request fires. Set BASE_URL once and every relative path just works.
Your credentials never leave your machine. Environment files are plain JSON stored in ~/.api-testing/. Nothing syncs to any cloud. Nothing gets embedded in exports. Nothing gets tracked by git. Your tokens and secrets stay exactly where they should: on your disk, under your control.
Postman Import & Export
Bidirectional Postman support. Migrate seamlessly between Postman and your AI workflow.
Import details
Collection: Postman v2.1 format. Folders become tags. Auth inherited from folders/collection level. Supports raw JSON, x-www-form-urlencoded, form-data bodies.
Environment: Prefers currentValue over value. Skips disabled variables. Optional activate flag.
Export details
Collection: Requests grouped in folders by tag. Auth mapped to Postman's native format. {{variables}} preserved as-is.
Environment: All variables exported as enabled: true in Postman-compatible format.
Native Export & Import
Export collections and environments to a portable .atm/ folder. Share with your team or copy between projects.
Note:
.atm/is automatically added to.gitignoreon first export.
cURL Export
Convert any saved request into a ready-to-paste cURL command with resolved variables.
Tool Reference
42 tools across 10 categories:
Tip: You don't need to call tools directly. Describe what you want and the AI picks the right one.
Storage
Everything is local. No database, no cloud sync, no telemetry. All data lives in ~/.api-testing/ as plain JSON files you can read, back up, or delete at any time.
Global storage vs project exports. The ~/.api-testing/ directory is your private, global store — this is where credentials live and they never leave. When you export a collection or environment, it goes to .atm/ in your project root. That folder is auto-added to .gitignore on first export, but even if you choose to commit it, your credentials stay in ~/.api-testing/ and are never copied into .atm/. You can safely share .atm/ exports with your team without leaking secrets.
Override the default storage path:
Warning: If you override
API_TESTING_DIRto a path inside a git repository, add.api-testing/to your.gitignoreto avoid pushing credentials.
Architecture
Stack: TypeScript (strict) · MCP SDK · Zod · Vitest · tsup
來源:README.md,提交 7540dfe
工具
0版本歷史
1- v0.11.12最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分