@cocaxcode/api-testing-mcp 0.7.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  <p align="center">
2
2
  <h1 align="center">@cocaxcode/api-testing-mcp</h1>
3
3
  <p align="center">
4
- <strong>A complete API testing toolkit built for AI coding agents.</strong><br/>
5
- Test, validate, mock, and load-test your APIs all from natural language.
4
+ <strong>The most complete API testing MCP server available.</strong><br/>
5
+ 27 tools &middot; Zero config &middot; Zero dependencies &middot; Everything runs inside your AI conversation.
6
6
  </p>
7
7
  </p>
8
8
 
@@ -11,16 +11,17 @@
11
11
  <a href="https://www.npmjs.com/package/@cocaxcode/api-testing-mcp"><img src="https://img.shields.io/npm/dm/@cocaxcode/api-testing-mcp.svg?style=flat-square" alt="npm downloads" /></a>
12
12
  <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="License" /></a>
13
13
  <img src="https://img.shields.io/badge/node-%3E%3D20-339933?style=flat-square&logo=node.js&logoColor=white" alt="Node" />
14
+ <img src="https://img.shields.io/badge/tools-27-blueviolet?style=flat-square" alt="27 tools" />
15
+ <img src="https://img.shields.io/badge/tests-83-brightgreen?style=flat-square" alt="83 tests" />
14
16
  </p>
15
17
 
16
18
  <p align="center">
19
+ <a href="#why-this-one">Why This One</a> &middot;
17
20
  <a href="#installation">Installation</a> &middot;
18
21
  <a href="#just-talk-to-it">Just Talk to It</a> &middot;
19
- <a href="#works-with-any-api">Any API</a> &middot;
20
22
  <a href="#features">Features</a> &middot;
21
23
  <a href="#tool-reference">Tool Reference</a> &middot;
22
24
  <a href="#storage">Storage</a> &middot;
23
- <a href="#limitations">Limitations</a> &middot;
24
25
  <a href="#contributing">Contributing</a>
25
26
  </p>
26
27
 
@@ -28,13 +29,44 @@
28
29
 
29
30
  ## What is this?
30
31
 
31
- An [MCP server](https://modelcontextprotocol.io) that gives your AI assistant the ability to interact with any API. It works with Claude Code, Claude Desktop, Cursor, and any MCP-compatible client.
32
+ An [MCP server](https://modelcontextprotocol.io) that gives your AI assistant the ability to **test, validate, mock, chain, diff, load-test, and manage** any API all from natural language.
32
33
 
33
34
  You describe what you need. The AI figures out the rest.
34
35
 
35
- No cloud accounts. No subscriptions. Everything runs locally and stores data as plain JSON files you can commit to git.
36
+ No cloud accounts. No subscriptions. No external frameworks. Everything runs locally and stores data as plain JSON files you can commit to git.
36
37
 
37
- **Requires** an MCP-compatible client such as [Claude Code](https://docs.anthropic.com/en/docs/claude-code), [Claude Desktop](https://claude.ai/download), or [Cursor](https://cursor.sh). This is not a standalone CLI tool it extends your AI assistant with API testing capabilities.
38
+ Works with **Claude Code**, **Claude Desktop**, **Cursor**, **Windsurf**, **Codex CLI**, **Gemini CLI**, and any MCP-compatible client.
39
+
40
+ ---
41
+
42
+ ## Why This One?
43
+
44
+ There are other API testing MCP servers out there. Here's why this one is different:
45
+
46
+ ### vs. other MCP API tools
47
+
48
+ | Capability | @cocaxcode/api-testing-mcp | Others |
49
+ |---|:---:|:---:|
50
+ | HTTP requests with auth | 27 tools | 1-11 tools |
51
+ | Assertions (eq, neq, gt, lt, contains, exists, type...) | 10 operators | Status code only or none |
52
+ | Request flows with variable extraction | `flow_run` with `extract` | Not available |
53
+ | Collections with tags and CRUD | Full CRUD + tag filtering | Import from Postman or none |
54
+ | Environments with variable interpolation | CRUD + project-scoped | Manual `set_env_vars` or none |
55
+ | OpenAPI import with `$ref`, `allOf`, `oneOf`, `anyOf` | ~95% real-world coverage | Basic or none |
56
+ | Mock data generation from schemas | Types, formats, enums | Not available |
57
+ | Load testing with percentiles | p50/p95/p99 + req/s | Basic or none |
58
+ | Response diffing | Field-by-field comparison | Not available |
59
+ | Bulk testing by tag | Collection-wide pass/fail | Not available |
60
+ | cURL export | With resolved variables | Not available |
61
+ | Project-scoped environments | Per-directory context | Not available |
62
+ | External dependencies | **Zero** — just Node.js | Playwright, Jest, pytest... |
63
+ | Configuration needed | **Zero** — `npx` and go | Scaffolding + framework setup |
64
+
65
+ ### The key difference
66
+
67
+ Most API testing MCPs either (a) generate test code for external frameworks (Playwright, Jest, pytest) that you then run separately, or (b) wrap a single `fetch` call with no state management.
68
+
69
+ **This tool executes everything inline.** The AI is the test runner. No generated files, no framework installs, no context switching. You say *"verify that POST /users returns 201"* and you get the result in the same conversation.
38
70
 
39
71
  ---
40
72
 
@@ -64,9 +96,38 @@ Add to your config file:
64
96
  }
65
97
  ```
66
98
 
67
- ### Cursor
99
+ ### Cursor / Windsurf
100
+
101
+ Add to `.cursor/mcp.json` (or `.windsurf/mcp.json`) in your project root:
102
+
103
+ ```json
104
+ {
105
+ "mcpServers": {
106
+ "api-testing": {
107
+ "command": "npx",
108
+ "args": ["-y", "@cocaxcode/api-testing-mcp@latest"]
109
+ }
110
+ }
111
+ }
112
+ ```
113
+
114
+ ### Codex CLI (OpenAI)
68
115
 
69
- Add to `.cursor/mcp.json` in your project root (or `~/.cursor/mcp.json` for global):
116
+ ```bash
117
+ codex mcp add api-testing -- npx -y @cocaxcode/api-testing-mcp@latest
118
+ ```
119
+
120
+ Or add manually to `~/.codex/config.toml`:
121
+
122
+ ```toml
123
+ [mcp_servers.api-testing]
124
+ command = "npx"
125
+ args = ["-y", "@cocaxcode/api-testing-mcp@latest"]
126
+ ```
127
+
128
+ ### Gemini CLI (Google)
129
+
130
+ Add to `~/.gemini/settings.json`:
70
131
 
71
132
  ```json
72
133
  {
@@ -105,12 +166,12 @@ Available on [npm](https://www.npmjs.com/package/@cocaxcode/api-testing-mcp).
105
166
 
106
167
  ## Just Talk to It
107
168
 
108
- This tool is designed to be used through natural language. You don't need to memorize tool names, parameters, or JSON structures — just tell the AI what you want, and it translates your intent into the right API calls.
169
+ You don't need to memorize tool names, parameters, or JSON structures — just tell the AI what you want.
109
170
 
110
171
  **Here's what a real conversation looks like:**
111
172
 
112
- | You say | What happens behind the scenes |
113
- |---------|-------------------------------|
173
+ | You say | What happens |
174
+ |---------|-------------|
114
175
  | *"Set up an environment for my local API on port 3000"* | Creates environment with `BASE_URL=http://localhost:3000` |
115
176
  | *"Import my API spec from /api-docs-json"* | Downloads the OpenAPI spec, stores all endpoints and schemas |
116
177
  | *"Show me all user endpoints"* | Filters and lists endpoints tagged `users` |
@@ -224,7 +285,7 @@ GET /api/health → 200 OK (42ms)
224
285
  timing.total_ms < 500
225
286
  ```
226
287
 
227
- **Operators:** `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `contains`, `not_contains`, `exists`, `type`
288
+ **10 operators:** `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `contains`, `not_contains`, `exists`, `type`
228
289
 
229
290
  ### Request Flows
230
291
 
@@ -258,6 +319,8 @@ flow_run({
258
319
  ```
259
320
  </details>
260
321
 
322
+ **Features:** Variable extraction with dot-notation (`body.data.0.id`), `stop_on_error` flag, `{{variable}}` interpolation between steps.
323
+
261
324
  ### OpenAPI Import
262
325
 
263
326
  Import your Swagger/OpenAPI spec from a URL or local file. Once imported, the AI understands every endpoint, parameter, and schema — no guessing, no memorizing.
@@ -268,6 +331,8 @@ Import your Swagger/OpenAPI spec from a URL or local file. Once imported, the AI
268
331
  "What parameters does POST /users expect?"
269
332
  ```
270
333
 
334
+ **Supports:** OpenAPI 3.x with full `$ref` resolution, `allOf` (schema merging), `oneOf`/`anyOf` (union types) — covers ~95% of real-world API specs. OpenAPI 2.0 (Swagger) partially supported.
335
+
271
336
  ### Mock Data Generation
272
337
 
273
338
  Generate realistic fake data from your OpenAPI spec. Respects types, formats (`email`, `uuid`, `date-time`), enums, and required fields.
@@ -308,7 +373,7 @@ Response times:
308
373
 
309
374
  ### Response Diffing
310
375
 
311
- Execute two requests and compare their responses field by field. Detect regressions or compare environments.
376
+ Execute two requests and compare their responses field by field. Detect regressions, compare environments, or validate API versioning.
312
377
 
313
378
  ```
314
379
  "Compare the users endpoint between dev and prod"
@@ -347,9 +412,19 @@ curl -X POST \
347
412
  -d '{"name":"Jane","email":"jane@company.com"}'
348
413
  ```
349
414
 
350
- ### Collections and Environments
415
+ ### Collections
416
+
417
+ Save requests for reuse with tags. Filter, list, and manage your request library. Perfect for building regression suites.
418
+
419
+ ```
420
+ "Save this request as create-user with tags auth, smoke"
421
+ "List all requests tagged smoke"
422
+ "Delete the old health-check request"
423
+ ```
424
+
425
+ ### Environments
351
426
 
352
- Save requests for reuse (with tags), manage variables across environments (dev/staging/prod), and switch contexts instantly.
427
+ Manage variables across environments (dev/staging/prod) and switch contexts instantly. Supports `{{variable}}` interpolation in URLs, headers, and body.
353
428
 
354
429
  ### Project-Scoped Environments
355
430
 
@@ -359,7 +434,7 @@ Different projects can have different active environments. When you switch to an
359
434
  "Switch to dev for this project" → dev is active only in the current project
360
435
  "Switch to prod globally" → prod is the default for projects without a specific assignment
361
436
  "Show me which projects have environments" → lists all project-environment assignments
362
- "Clear the project environment for this project" → falls back to the global active environment
437
+ "Clear the project environment" → falls back to the global active environment
363
438
  ```
364
439
 
365
440
  Resolution order: project-specific environment → global active environment.
@@ -410,12 +485,38 @@ Override the default directory in your MCP config:
410
485
 
411
486
  ---
412
487
 
488
+ ## Architecture
489
+
490
+ Built for reliability and testability:
491
+
492
+ - **Zero runtime dependencies** — only `@modelcontextprotocol/sdk` and `zod`
493
+ - **83 integration tests** with mocked fetch (no network calls in CI)
494
+ - **Factory pattern** — `createServer(storageDir?)` for isolated test instances
495
+ - **Strict TypeScript** — zero `any`, full type coverage
496
+ - **< 90KB** bundled output via tsup
497
+
498
+ ```
499
+ src/
500
+ ├── tools/ # 27 MCP tool handlers (one file per category)
501
+ ├── lib/ # Business logic (no MCP dependency)
502
+ │ ├── http-client # fetch wrapper with timing
503
+ │ ├── storage # JSON file storage engine
504
+ │ ├── schemas # Shared Zod schemas (DRY across all tools)
505
+ │ ├── url # BASE_URL resolution
506
+ │ ├── path # Dot-notation accessor (body.data.0.id)
507
+ │ ├── interpolation # {{variable}} resolver
508
+ │ └── openapi-parser # $ref + allOf/oneOf/anyOf resolution
509
+ └── __tests__/ # 10 test suites, 83 tests
510
+ ```
511
+
512
+ ---
513
+
413
514
  ## Limitations
414
515
 
415
516
  - **Auth**: Supports Bearer token, API Key, and Basic auth. OAuth 2.0 flows (authorization code, PKCE) are not supported — use a pre-obtained token instead.
416
517
  - **Protocols**: HTTP/HTTPS only. No WebSocket, gRPC, or GraphQL-specific support (though GraphQL over HTTP works fine).
417
518
  - **Load testing**: Recommended maximum of 100 concurrent requests. This is a testing tool, not a benchmarking framework.
418
- - **Specs**: OpenAPI 3.x only. OpenAPI 2.0 (Swagger) is partially supported. AsyncAPI is not supported.
519
+ - **Specs**: OpenAPI 3.x with full support for `$ref`, `allOf`, `oneOf`, and `anyOf` — covers ~95% of real-world API specs. OpenAPI 2.0 (Swagger) is partially supported. AsyncAPI is not supported.
419
520
  - **Storage**: Local JSON files only. No built-in cloud sync or team collaboration server.
420
521
 
421
522
  ---