@cocaxcode/api-testing-mcp 0.5.0 → 0.5.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 +148 -117
- package/package.json +10 -2
package/README.md
CHANGED
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<h1 align="center">@cocaxcode/api-testing-mcp</h1>
|
|
3
3
|
<p align="center">
|
|
4
|
-
A complete API testing toolkit built for AI coding agents
|
|
4
|
+
<strong>A complete API testing toolkit built for AI coding agents.</strong><br/>
|
|
5
5
|
Test, validate, mock, and load-test your APIs — all from natural language.
|
|
6
6
|
</p>
|
|
7
7
|
</p>
|
|
8
8
|
|
|
9
9
|
<p align="center">
|
|
10
10
|
<a href="https://www.npmjs.com/package/@cocaxcode/api-testing-mcp"><img src="https://img.shields.io/npm/v/@cocaxcode/api-testing-mcp.svg?style=flat-square&color=cb3837" alt="npm version" /></a>
|
|
11
|
-
<a href="https://
|
|
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
|
-
<img src="https://img.shields.io/badge/tests-70%20passing-brightgreen?style=flat-square" alt="Tests" />
|
|
14
|
-
<img src="https://img.shields.io/badge/tools-20-blueviolet?style=flat-square" alt="Tools" />
|
|
15
13
|
<img src="https://img.shields.io/badge/node-%3E%3D20-339933?style=flat-square&logo=node.js&logoColor=white" alt="Node" />
|
|
16
14
|
</p>
|
|
17
15
|
|
|
18
16
|
<p align="center">
|
|
19
|
-
<a href="#installation">Installation</a>
|
|
20
|
-
<a href="#just-talk-to-it">Just Talk to It</a>
|
|
21
|
-
<a href="#works-with-any-api">Any API</a>
|
|
22
|
-
<a href="#features">Features</a>
|
|
23
|
-
<a href="#tool-reference">Tool Reference</a>
|
|
24
|
-
<a href="#storage">Storage</a>
|
|
17
|
+
<a href="#installation">Installation</a> ·
|
|
18
|
+
<a href="#just-talk-to-it">Just Talk to It</a> ·
|
|
19
|
+
<a href="#works-with-any-api">Any API</a> ·
|
|
20
|
+
<a href="#features">Features</a> ·
|
|
21
|
+
<a href="#tool-reference">Tool Reference</a> ·
|
|
22
|
+
<a href="#storage">Storage</a> ·
|
|
23
|
+
<a href="#limitations">Limitations</a> ·
|
|
25
24
|
<a href="#contributing">Contributing</a>
|
|
26
25
|
</p>
|
|
27
26
|
|
|
@@ -35,6 +34,73 @@ You describe what you need. The AI figures out the rest.
|
|
|
35
34
|
|
|
36
35
|
No cloud accounts. No subscriptions. Everything runs locally and stores data as plain JSON files you can commit to git.
|
|
37
36
|
|
|
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
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Installation
|
|
42
|
+
|
|
43
|
+
### Claude Code
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
claude mcp add api-testing -- npx -y @cocaxcode/api-testing-mcp
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Claude Desktop
|
|
50
|
+
|
|
51
|
+
Add to your config file:
|
|
52
|
+
|
|
53
|
+
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
54
|
+
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
55
|
+
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"mcpServers": {
|
|
59
|
+
"api-testing": {
|
|
60
|
+
"command": "npx",
|
|
61
|
+
"args": ["-y", "@cocaxcode/api-testing-mcp"]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Cursor
|
|
68
|
+
|
|
69
|
+
Add to `.cursor/mcp.json` in your project root (or `~/.cursor/mcp.json` for global):
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"mcpServers": {
|
|
74
|
+
"api-testing": {
|
|
75
|
+
"command": "npx",
|
|
76
|
+
"args": ["-y", "@cocaxcode/api-testing-mcp"]
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Quick start
|
|
83
|
+
|
|
84
|
+
Once installed, set up an environment so the tool knows where your API lives:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
"Create an environment called dev with BASE_URL http://localhost:3000"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
From here, relative paths work automatically. `/api/users` becomes `http://localhost:3000/api/users`.
|
|
91
|
+
|
|
92
|
+
If your API has Swagger/OpenAPI, import the spec:
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
"Import my API spec from http://localhost:3000/api-docs-json"
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Now the AI knows every endpoint, parameter, and schema in your API. You're ready to go.
|
|
99
|
+
|
|
100
|
+
To verify the installation is working, try: *"List my environments"* — it should show the one you just created.
|
|
101
|
+
|
|
102
|
+
Available on [npm](https://www.npmjs.com/package/@cocaxcode/api-testing-mcp).
|
|
103
|
+
|
|
38
104
|
---
|
|
39
105
|
|
|
40
106
|
## Just Talk to It
|
|
@@ -114,75 +180,20 @@ You: "Save this request as cf-list-zones with tag cloudflare"
|
|
|
114
180
|
|
|
115
181
|
Every request, collection, and spec is isolated per environment. Your Cloudflare tests don't mix with your local backend tests.
|
|
116
182
|
|
|
117
|
-
### What the storage looks like
|
|
118
|
-
|
|
119
|
-
```
|
|
120
|
-
.api-testing/
|
|
121
|
-
├── active-env # Currently active: "cloudflare"
|
|
122
|
-
├── environments/
|
|
123
|
-
│ ├── github.json # { BASE_URL, GITHUB_TOKEN }
|
|
124
|
-
│ ├── cloudflare.json # { BASE_URL, API_KEY }
|
|
125
|
-
│ ├── dokploy.json # { BASE_URL, TOKEN }
|
|
126
|
-
│ └── my-backend.json # { BASE_URL, TOKEN }
|
|
127
|
-
├── specs/
|
|
128
|
-
│ ├── dokploy.json # Imported OpenAPI spec
|
|
129
|
-
│ └── my-backend.json # Imported OpenAPI spec
|
|
130
|
-
└── collections/
|
|
131
|
-
├── cf-list-zones.json # Saved requests per API
|
|
132
|
-
├── gh-my-repos.json
|
|
133
|
-
└── dok-list-projects.json
|
|
134
|
-
```
|
|
135
|
-
|
|
136
183
|
---
|
|
137
184
|
|
|
138
|
-
##
|
|
139
|
-
|
|
140
|
-
### Claude Code
|
|
141
|
-
|
|
142
|
-
```bash
|
|
143
|
-
claude mcp add api-testing -- npx -y @cocaxcode/api-testing-mcp
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
### Claude Desktop / Cursor / Any MCP Client
|
|
147
|
-
|
|
148
|
-
Add to your MCP configuration file:
|
|
149
|
-
|
|
150
|
-
```json
|
|
151
|
-
{
|
|
152
|
-
"mcpServers": {
|
|
153
|
-
"api-testing": {
|
|
154
|
-
"command": "npx",
|
|
155
|
-
"args": ["-y", "@cocaxcode/api-testing-mcp"]
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
### First steps
|
|
162
|
-
|
|
163
|
-
Set up an environment so the tool knows where your API lives:
|
|
164
|
-
|
|
165
|
-
```
|
|
166
|
-
"Create an environment called dev with BASE_URL http://localhost:3000"
|
|
167
|
-
```
|
|
185
|
+
## Features
|
|
168
186
|
|
|
169
|
-
|
|
187
|
+
### HTTP Requests
|
|
170
188
|
|
|
171
|
-
|
|
189
|
+
Send any request by describing what you need. The AI resolves relative URLs, injects environment variables, and handles authentication automatically.
|
|
172
190
|
|
|
173
191
|
```
|
|
174
|
-
"
|
|
192
|
+
"POST to /api/users with name Jane and email jane@company.com using my bearer token"
|
|
175
193
|
```
|
|
176
194
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
---
|
|
180
|
-
|
|
181
|
-
## Features
|
|
182
|
-
|
|
183
|
-
### HTTP Requests
|
|
184
|
-
|
|
185
|
-
Execute any HTTP method with headers, body, query params, and built-in auth. Relative URLs resolve from the active environment. Variables like `{{TOKEN}}` are replaced from environment values.
|
|
195
|
+
<details>
|
|
196
|
+
<summary>What the tool executes</summary>
|
|
186
197
|
|
|
187
198
|
```
|
|
188
199
|
request({
|
|
@@ -192,39 +203,39 @@ request({
|
|
|
192
203
|
auth: { type: "bearer", token: "{{TOKEN}}" }
|
|
193
204
|
})
|
|
194
205
|
```
|
|
206
|
+
</details>
|
|
195
207
|
|
|
196
|
-
**Supports:** GET
|
|
208
|
+
**Supports:** GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS — Headers, query params, JSON body, Bearer / API Key / Basic auth, timeout, `{{variable}}` interpolation.
|
|
197
209
|
|
|
198
210
|
### Assertions
|
|
199
211
|
|
|
200
|
-
|
|
212
|
+
Validate API responses against a set of rules in one step. Get structured pass/fail results.
|
|
201
213
|
|
|
202
214
|
```
|
|
203
|
-
|
|
204
|
-
method: "GET",
|
|
205
|
-
url: "/api/health",
|
|
206
|
-
assertions: [
|
|
207
|
-
{ path: "status", operator: "eq", expected: 200 },
|
|
208
|
-
{ path: "body.status", operator: "eq", expected: "ok" },
|
|
209
|
-
{ path: "timing.total_ms", operator: "lt", expected: 500 }
|
|
210
|
-
]
|
|
211
|
-
})
|
|
215
|
+
"Verify that GET /api/health returns 200, body.status is ok, and responds in under 500ms"
|
|
212
216
|
```
|
|
213
217
|
|
|
214
218
|
```
|
|
215
|
-
|
|
219
|
+
PASS — 3/3 assertions passed
|
|
216
220
|
GET /api/health → 200 OK (42ms)
|
|
217
221
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
222
|
+
status === 200
|
|
223
|
+
body.status === "ok"
|
|
224
|
+
timing.total_ms < 500
|
|
221
225
|
```
|
|
222
226
|
|
|
223
|
-
**Operators:** `eq
|
|
227
|
+
**Operators:** `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `contains`, `not_contains`, `exists`, `type`
|
|
224
228
|
|
|
225
229
|
### Request Flows
|
|
226
230
|
|
|
227
|
-
Chain multiple requests together. Extract values from one response and inject them into the next step
|
|
231
|
+
Chain multiple requests together. Extract values from one response and inject them into the next step. Perfect for auth flows, CRUD sequences, and multi-step testing.
|
|
232
|
+
|
|
233
|
+
```
|
|
234
|
+
"Login as admin@test.com, extract the access token, then use it to fetch all users"
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
<details>
|
|
238
|
+
<summary>What the tool executes</summary>
|
|
228
239
|
|
|
229
240
|
```
|
|
230
241
|
flow_run({
|
|
@@ -233,7 +244,7 @@ flow_run({
|
|
|
233
244
|
name: "login",
|
|
234
245
|
method: "POST",
|
|
235
246
|
url: "/auth/login",
|
|
236
|
-
body: { email: "admin@test.com", password: "
|
|
247
|
+
body: { email: "admin@test.com", password: "SecurePass#99" },
|
|
237
248
|
extract: { "TOKEN": "body.access_token" }
|
|
238
249
|
},
|
|
239
250
|
{
|
|
@@ -245,23 +256,24 @@ flow_run({
|
|
|
245
256
|
]
|
|
246
257
|
})
|
|
247
258
|
```
|
|
259
|
+
</details>
|
|
248
260
|
|
|
249
261
|
### OpenAPI Import
|
|
250
262
|
|
|
251
263
|
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.
|
|
252
264
|
|
|
253
265
|
```
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
266
|
+
"Import my API spec from http://localhost:3000/api-docs-json"
|
|
267
|
+
"Show me all user endpoints"
|
|
268
|
+
"What parameters does POST /users expect?"
|
|
257
269
|
```
|
|
258
270
|
|
|
259
271
|
### Mock Data Generation
|
|
260
272
|
|
|
261
|
-
Generate realistic fake data from your OpenAPI spec. Respects types, formats (`email`, `uuid`, `date-time`), enums, and required fields.
|
|
273
|
+
Generate realistic fake data from your OpenAPI spec. Respects types, formats (`email`, `uuid`, `date-time`), enums, and required fields.
|
|
262
274
|
|
|
263
275
|
```
|
|
264
|
-
|
|
276
|
+
"Generate mock data for creating a user"
|
|
265
277
|
```
|
|
266
278
|
|
|
267
279
|
```json
|
|
@@ -278,17 +290,17 @@ mock({ name: "my-backend", method: "POST", path: "/users", target: "request" })
|
|
|
278
290
|
Fire N concurrent requests and get performance metrics: min, avg, percentiles (p50/p95/p99), max, and requests per second.
|
|
279
291
|
|
|
280
292
|
```
|
|
281
|
-
|
|
293
|
+
"How fast is the health endpoint with 50 concurrent requests?"
|
|
282
294
|
```
|
|
283
295
|
|
|
284
296
|
```
|
|
285
|
-
|
|
297
|
+
LOAD TEST — GET /api/health
|
|
286
298
|
|
|
287
299
|
Requests: 50 concurrent
|
|
288
300
|
Successful: 50 | Failed: 0
|
|
289
301
|
Requests/sec: 23.31
|
|
290
302
|
|
|
291
|
-
|
|
303
|
+
Response times:
|
|
292
304
|
Min: 45ms | Avg: 187ms
|
|
293
305
|
p50: 156ms | p95: 412ms
|
|
294
306
|
p99: 523ms | Max: 567ms
|
|
@@ -296,13 +308,10 @@ Requests/sec: 23.31
|
|
|
296
308
|
|
|
297
309
|
### Response Diffing
|
|
298
310
|
|
|
299
|
-
Execute two requests and compare their responses field by field. Detect regressions or compare environments
|
|
311
|
+
Execute two requests and compare their responses field by field. Detect regressions or compare environments.
|
|
300
312
|
|
|
301
313
|
```
|
|
302
|
-
|
|
303
|
-
request_a: { label: "dev", method: "GET", url: "http://dev.api.com/users" },
|
|
304
|
-
request_b: { label: "prod", method: "GET", url: "http://prod.api.com/users" }
|
|
305
|
-
})
|
|
314
|
+
"Compare the users endpoint between dev and prod"
|
|
306
315
|
```
|
|
307
316
|
|
|
308
317
|
### Bulk Testing
|
|
@@ -310,21 +319,25 @@ diff_responses({
|
|
|
310
319
|
Run every saved request in your collection (or filter by tag) and get a pass/fail summary.
|
|
311
320
|
|
|
312
321
|
```
|
|
313
|
-
|
|
322
|
+
"Run all my saved smoke tests"
|
|
314
323
|
```
|
|
315
324
|
|
|
316
325
|
```
|
|
317
|
-
|
|
326
|
+
BULK TEST — 8/8 passed | 1.2s total
|
|
318
327
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
328
|
+
health — GET /health → 200 (45ms)
|
|
329
|
+
list-users — GET /users → 200 (123ms)
|
|
330
|
+
create-post — POST /blog → 201 (89ms)
|
|
331
|
+
login — POST /auth/login → 200 (156ms)
|
|
323
332
|
```
|
|
324
333
|
|
|
325
334
|
### cURL Export
|
|
326
335
|
|
|
327
|
-
Convert any saved request into a cURL command with resolved variables.
|
|
336
|
+
Convert any saved request into a ready-to-paste cURL command with resolved variables.
|
|
337
|
+
|
|
338
|
+
```
|
|
339
|
+
"Export the create-user request as curl"
|
|
340
|
+
```
|
|
328
341
|
|
|
329
342
|
```bash
|
|
330
343
|
curl -X POST \
|
|
@@ -334,7 +347,7 @@ curl -X POST \
|
|
|
334
347
|
-d '{"name":"Jane","email":"jane@company.com"}'
|
|
335
348
|
```
|
|
336
349
|
|
|
337
|
-
### Collections
|
|
350
|
+
### Collections and Environments
|
|
338
351
|
|
|
339
352
|
Save requests for reuse (with tags), manage variables across environments (dev/staging/prod), and switch contexts instantly.
|
|
340
353
|
|
|
@@ -349,11 +362,13 @@ Save requests for reuse (with tags), manage variables across environments (dev/s
|
|
|
349
362
|
| **Requests** | `request` | 1 |
|
|
350
363
|
| **Testing** | `assert` | 1 |
|
|
351
364
|
| **Flows** | `flow_run` | 1 |
|
|
352
|
-
| **Collections** | `collection_save`
|
|
353
|
-
| **Environments** | `env_create`
|
|
354
|
-
| **API Specs** | `api_import`
|
|
365
|
+
| **Collections** | `collection_save` `collection_list` `collection_get` `collection_delete` | 4 |
|
|
366
|
+
| **Environments** | `env_create` `env_list` `env_set` `env_get` `env_switch` | 5 |
|
|
367
|
+
| **API Specs** | `api_import` `api_endpoints` `api_endpoint_detail` | 3 |
|
|
355
368
|
| **Mock** | `mock` | 1 |
|
|
356
|
-
| **Utilities** | `load_test`
|
|
369
|
+
| **Utilities** | `load_test` `export_curl` `diff_responses` `bulk_test` | 4 |
|
|
370
|
+
|
|
371
|
+
You don't need to call these tools directly. Just describe what you want and the AI picks the right one.
|
|
357
372
|
|
|
358
373
|
---
|
|
359
374
|
|
|
@@ -369,7 +384,7 @@ All data lives in `.api-testing/` as plain JSON — no database, no cloud sync:
|
|
|
369
384
|
└── specs/ # Imported OpenAPI specs
|
|
370
385
|
```
|
|
371
386
|
|
|
372
|
-
Override the default directory:
|
|
387
|
+
Override the default directory in your MCP config:
|
|
373
388
|
|
|
374
389
|
```json
|
|
375
390
|
{
|
|
@@ -377,7 +392,17 @@ Override the default directory:
|
|
|
377
392
|
}
|
|
378
393
|
```
|
|
379
394
|
|
|
380
|
-
Commit these files to git to share across your team.
|
|
395
|
+
Commit these files to git to share API configurations across your team.
|
|
396
|
+
|
|
397
|
+
---
|
|
398
|
+
|
|
399
|
+
## Limitations
|
|
400
|
+
|
|
401
|
+
- **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.
|
|
402
|
+
- **Protocols**: HTTP/HTTPS only. No WebSocket, gRPC, or GraphQL-specific support (though GraphQL over HTTP works fine).
|
|
403
|
+
- **Load testing**: Recommended maximum of 100 concurrent requests. This is a testing tool, not a benchmarking framework.
|
|
404
|
+
- **Specs**: OpenAPI 3.x only. OpenAPI 2.0 (Swagger) is partially supported. AsyncAPI is not supported.
|
|
405
|
+
- **Storage**: Local JSON files only. No built-in cloud sync or team collaboration server.
|
|
381
406
|
|
|
382
407
|
---
|
|
383
408
|
|
|
@@ -398,7 +423,13 @@ npm run typecheck # Strict TypeScript
|
|
|
398
423
|
npx @modelcontextprotocol/inspector node dist/index.js
|
|
399
424
|
```
|
|
400
425
|
|
|
401
|
-
**Stack:** TypeScript
|
|
426
|
+
**Stack:** TypeScript · MCP SDK 1.27 · Zod · Vitest · tsup
|
|
427
|
+
|
|
428
|
+
### How to contribute
|
|
429
|
+
|
|
430
|
+
- **Bug reports**: [Open an issue](https://github.com/cocaxcode/api-testing-mcp/issues) with steps to reproduce, expected vs actual behavior, and your Node.js version.
|
|
431
|
+
- **Feature requests**: Open an issue describing the use case. Include examples of how you'd use it in natural language.
|
|
432
|
+
- **Pull requests**: Fork, create a branch, make your changes, ensure `npm test` and `npm run typecheck` pass, then open a PR.
|
|
402
433
|
|
|
403
434
|
---
|
|
404
435
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocaxcode/api-testing-mcp",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "MCP server for API testing. 20 tools: HTTP requests, assertions, flows, OpenAPI import, mock data, load testing. Zero cloud dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -27,12 +27,20 @@
|
|
|
27
27
|
},
|
|
28
28
|
"keywords": [
|
|
29
29
|
"mcp",
|
|
30
|
+
"mcp-server",
|
|
30
31
|
"api-testing",
|
|
31
32
|
"http",
|
|
32
33
|
"rest",
|
|
33
34
|
"model-context-protocol",
|
|
34
35
|
"claude",
|
|
35
|
-
"
|
|
36
|
+
"claude-desktop",
|
|
37
|
+
"cursor",
|
|
38
|
+
"ai-tools",
|
|
39
|
+
"openapi",
|
|
40
|
+
"swagger",
|
|
41
|
+
"load-testing",
|
|
42
|
+
"mock-data",
|
|
43
|
+
"postman-alternative"
|
|
36
44
|
],
|
|
37
45
|
"author": "cocaxcode",
|
|
38
46
|
"license": "MIT",
|