soup-chop 1.0.1 → 1.0.3
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 +501 -24
- package/dist/index.js +1515 -332
- package/dist/lib/index.cjs +482 -0
- package/dist/lib/index.cjs.map +1 -0
- package/dist/lib/index.d.ts +114 -0
- package/dist/lib/index.js +470 -0
- package/dist/lib/index.js.map +1 -0
- package/package.json +34 -5
package/README.md
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
<a href="#available-tools">Tools</a> •
|
|
20
20
|
<a href="#how-it-works">How It Works</a> •
|
|
21
21
|
<a href="#configuration">Configuration</a> •
|
|
22
|
+
<a href="#for-mcp-providers">For MCP Providers</a> •
|
|
22
23
|
<a href="#for-library-authors">For Library Authors</a> •
|
|
23
24
|
<a href="#examples">Examples</a> •
|
|
24
25
|
<a href="#faq">FAQ</a>
|
|
@@ -68,6 +69,25 @@ npm install -g soup-chop
|
|
|
68
69
|
soup-chop serve
|
|
69
70
|
```
|
|
70
71
|
|
|
72
|
+
### Option 2.5 — Use as a library
|
|
73
|
+
|
|
74
|
+
The published package also exposes a library entry point alongside the CLI.
|
|
75
|
+
MCP server providers can use it to register their server with any supported AI client programmatically.
|
|
76
|
+
|
|
77
|
+
**ESM:**
|
|
78
|
+
|
|
79
|
+
```js
|
|
80
|
+
import { setupClient, installMcp } from 'soup-chop';
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**CommonJS:**
|
|
84
|
+
|
|
85
|
+
```js
|
|
86
|
+
const { setupClient, installMcp } = require('soup-chop');
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Bundled TypeScript declarations are included, so editors and consumers resolve types without needing internal `dist/` paths.
|
|
90
|
+
|
|
71
91
|
### Option 3 — Inspect the supported clients
|
|
72
92
|
|
|
73
93
|
```bash
|
|
@@ -85,11 +105,14 @@ npx soup-chop configure cursor
|
|
|
85
105
|
npx soup-chop configure cursor --project
|
|
86
106
|
npx soup-chop configure vscode-copilot
|
|
87
107
|
npx soup-chop configure firebase-studio
|
|
108
|
+
npx soup-chop configure claude-code
|
|
88
109
|
npx soup-chop configure cursor --project --dry-run
|
|
89
110
|
npx soup-chop configure cursor --print
|
|
90
111
|
npx soup-chop configure cursor --project --local-build --dry-run
|
|
91
112
|
```
|
|
92
113
|
|
|
114
|
+
For clients that register via their own CLI (like Claude Code), `soup-chop configure` runs the appropriate command automatically — no manual file editing needed. Use `--dry-run` to preview the command that would be executed, or `--print` to emit the command line for use in scripts.
|
|
115
|
+
|
|
93
116
|
Use `--project` or `--global` when a client supports more than one writable scope. Without a flag, `soup-chop` uses that client's default writable scope.
|
|
94
117
|
|
|
95
118
|
On Linux today, the exact auto-config targets exposed by `soup-chop help` depend on the current platform and writable config paths.
|
|
@@ -134,7 +157,7 @@ The ecosystem is moving quickly, so `soupChop` documents both implemented auto-c
|
|
|
134
157
|
| Client | Status | Scope | Verified config path / flow | Notes |
|
|
135
158
|
| :----- | :----- | :---- | :-------------------------- | :---- |
|
|
136
159
|
| Claude Desktop | Auto-config on macOS and Windows | Global | macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`<br>Windows: `%APPDATA%\Claude\claude_desktop_config.json` | Official MCP docs expose this file via Claude > Settings > Developer > Edit Config; Linux remains documented-only in CLI output |
|
|
137
|
-
| Claude Code |
|
|
160
|
+
| Claude Code | Auto-configure (CLI) | Project / user | `claude mcp add <name> npx -- soup-chop serve` | `soup-chop configure claude-code` runs the `claude mcp add` command automatically |
|
|
138
161
|
| Cursor | Auto-config | Global / project | Global: `~/.cursor/mcp.json`<br>Project: `.cursor/mcp.json` | Use `npx soup-chop configure cursor` for the global file or `npx soup-chop configure cursor --project` for the project file |
|
|
139
162
|
| Windsurf | Auto-config | Global | `~/.codeium/windsurf/mcp_config.json` | Official docs also expose MCP management from the MCP Marketplace / Settings UI |
|
|
140
163
|
| Antigravity | Documented | UI-managed | Agent pane → `MCP Servers` / `MCP Store` / `View raw config` | Official docs describe the flow but do not publish a stable file path |
|
|
@@ -150,6 +173,8 @@ The ecosystem is moving quickly, so `soupChop` documents both implemented auto-c
|
|
|
150
173
|
|
|
151
174
|
When `configure` cannot write a client automatically, it now reports the documented target and points you back to `soup-chop clients` for the full matrix instead of failing with a generic message.
|
|
152
175
|
|
|
176
|
+
In the examples below, `soup-chop` is just the default registered server name. For manual JSON edits or client-specific CLI registration, you can replace that key with any local name you prefer. The public `soup-chop configure` CLI currently writes the default `soup-chop` name.
|
|
177
|
+
|
|
153
178
|
#### Claude Desktop / Cursor / Windsurf / Gemini / Firebase Studio
|
|
154
179
|
|
|
155
180
|
```json
|
|
@@ -183,6 +208,13 @@ The ecosystem is moving quickly, so `soupChop` documents both implemented auto-c
|
|
|
183
208
|
claude mcp add soup-chop npx -- soup-chop serve
|
|
184
209
|
```
|
|
185
210
|
|
|
211
|
+
The first `soup-chop` token is the registered MCP server name inside Claude Code.
|
|
212
|
+
You can replace it with another local label if you want, for example:
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
claude mcp add my-docs npx -- soup-chop serve
|
|
216
|
+
```
|
|
217
|
+
|
|
186
218
|
#### Antigravity manual registration
|
|
187
219
|
|
|
188
220
|
Open the Agent pane, then go to `MCP Servers` or `MCP Store`, add a custom stdio server, and point it to:
|
|
@@ -201,6 +233,100 @@ The server is primarily tool-oriented, but it also exposes a small capability
|
|
|
201
233
|
resource at `soup-chop://capabilities` so MCP clients that inspect resources
|
|
202
234
|
have a useful entry point.
|
|
203
235
|
|
|
236
|
+
Target selection is explicit:
|
|
237
|
+
|
|
238
|
+
- use `package` plus `version` for published npm docs
|
|
239
|
+
- use `local_path` for a direct local package checkout
|
|
240
|
+
- use `workspace_path` plus `package` for a package resolved from a local monorepo
|
|
241
|
+
|
|
242
|
+
`soupChop` does **not** merge local and published corpora implicitly. When you
|
|
243
|
+
select a local target, the server stays on that filesystem corpus only.
|
|
244
|
+
|
|
245
|
+
`compare_versions` and `get_upgrade_guide` currently remain **npm-only**.
|
|
246
|
+
|
|
247
|
+
### `get_capabilities`
|
|
248
|
+
|
|
249
|
+
> **Get a concise overview of the server surface.**
|
|
250
|
+
|
|
251
|
+
Returns the current tool inventory, the recommended usage flow, and the current
|
|
252
|
+
source-selection policy in a short text response.
|
|
253
|
+
|
|
254
|
+
Use it when a client needs a quick MCP entry point before choosing a more
|
|
255
|
+
specific tool.
|
|
256
|
+
|
|
257
|
+
### `list_sources`
|
|
258
|
+
|
|
259
|
+
> **Inspect the exact markdown corpus that was indexed.**
|
|
260
|
+
|
|
261
|
+
Returns the exact markdown files indexed for a target together with corpus debug
|
|
262
|
+
metadata such as source precedence, cache freshness, and the resolved local
|
|
263
|
+
package root.
|
|
264
|
+
|
|
265
|
+
This is the best tool to call when you want to verify which files were actually
|
|
266
|
+
analyzed before following up with `search_docs`, `get_toc`, or the Mincer tools.
|
|
267
|
+
|
|
268
|
+
**Parameters:**
|
|
269
|
+
|
|
270
|
+
| Name | Type | Required | Description |
|
|
271
|
+
| :-------- | :------- | :------- | :---------------------------------------------------------------------- |
|
|
272
|
+
| `package` | `string` | No | NPM package name, or workspace package name when using `workspace_path` |
|
|
273
|
+
| `version` | `string` | No | NPM version string for remote usage, or optional exact local-version check |
|
|
274
|
+
| `local_path` | `string` | No | Local package directory or local `package.json` path |
|
|
275
|
+
| `workspace_path` | `string` | No | Local monorepo / workspace root; requires `package` |
|
|
276
|
+
|
|
277
|
+
**Example call using a local package path:**
|
|
278
|
+
|
|
279
|
+
```json
|
|
280
|
+
{
|
|
281
|
+
"name": "list_sources",
|
|
282
|
+
"arguments": {
|
|
283
|
+
"local_path": "/home/me/dev/acme/packages/docs-pkg"
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
**Example response:**
|
|
289
|
+
|
|
290
|
+
```json
|
|
291
|
+
{
|
|
292
|
+
"package": "@acme/docs-pkg",
|
|
293
|
+
"version": "1.5.0",
|
|
294
|
+
"sources": [
|
|
295
|
+
{
|
|
296
|
+
"sourceId": "api__md",
|
|
297
|
+
"sourceKind": "top_level_doc",
|
|
298
|
+
"origin": "API.md",
|
|
299
|
+
"title": "API.md",
|
|
300
|
+
"lineCount": 12
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
"sourceId": "docs__guide__md",
|
|
304
|
+
"sourceKind": "package_doc",
|
|
305
|
+
"origin": "docs/guide.md",
|
|
306
|
+
"title": "guide.md",
|
|
307
|
+
"lineCount": 18
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
"sourceId": "readme__md",
|
|
311
|
+
"sourceKind": "readme",
|
|
312
|
+
"origin": "README.md",
|
|
313
|
+
"title": "README.md",
|
|
314
|
+
"lineCount": 42
|
|
315
|
+
}
|
|
316
|
+
],
|
|
317
|
+
"debug": {
|
|
318
|
+
"precedence": "explicit_target_only",
|
|
319
|
+
"targetMode": "local",
|
|
320
|
+
"freshness": "mutable_local_filesystem",
|
|
321
|
+
"cacheEnabled": false,
|
|
322
|
+
"cacheReason": "Local filesystem targets are mutable, so corpus and search caches stay disabled.",
|
|
323
|
+
"cachePaths": {},
|
|
324
|
+
"packageRoot": "/home/me/dev/acme/packages/docs-pkg",
|
|
325
|
+
"sourceOrigins": ["API.md", "docs/guide.md", "README.md"]
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
```
|
|
329
|
+
|
|
204
330
|
### `get_toc`
|
|
205
331
|
|
|
206
332
|
> **Discover what's in the documentation.**
|
|
@@ -217,8 +343,10 @@ With `origin`, it returns the TOC for a single markdown document.
|
|
|
217
343
|
|
|
218
344
|
| Name | Type | Required | Description |
|
|
219
345
|
| :-------- | :------- | :------- | :------------------------------------- |
|
|
220
|
-
| `package` | `string` |
|
|
221
|
-
| `version` | `string` |
|
|
346
|
+
| `package` | `string` | No | NPM package name, or workspace package name when using `workspace_path` |
|
|
347
|
+
| `version` | `string` | No | NPM version string for remote usage, or optional exact local-version check |
|
|
348
|
+
| `local_path` | `string` | No | Local package directory or local `package.json` path |
|
|
349
|
+
| `workspace_path` | `string` | No | Local monorepo / workspace root; requires `package` |
|
|
222
350
|
| `origin` | `string` | No | Markdown source path from `search_docs` such as `"docs/faq.md"` or `"CHANGELOG.md"` |
|
|
223
351
|
|
|
224
352
|
**Example call:**
|
|
@@ -233,6 +361,18 @@ With `origin`, it returns the TOC for a single markdown document.
|
|
|
233
361
|
}
|
|
234
362
|
```
|
|
235
363
|
|
|
364
|
+
**Example call using a local workspace package:**
|
|
365
|
+
|
|
366
|
+
```json
|
|
367
|
+
{
|
|
368
|
+
"name": "get_toc",
|
|
369
|
+
"arguments": {
|
|
370
|
+
"package": "@acme/docs-pkg",
|
|
371
|
+
"workspace_path": "/home/me/dev/acme-monorepo"
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
```
|
|
375
|
+
|
|
236
376
|
**Example response:**
|
|
237
377
|
|
|
238
378
|
```json
|
|
@@ -288,8 +428,10 @@ optional `origin`.
|
|
|
288
428
|
|
|
289
429
|
| Name | Type | Required | Description |
|
|
290
430
|
| :-------- | :------- | :------- | :------------------------------------------------------- |
|
|
291
|
-
| `package` | `string` |
|
|
292
|
-
| `version` | `string` |
|
|
431
|
+
| `package` | `string` | No | NPM package name, or workspace package name when using `workspace_path` |
|
|
432
|
+
| `version` | `string` | No | NPM version string for remote usage, or optional exact local-version check |
|
|
433
|
+
| `local_path` | `string` | No | Local package directory or local `package.json` path |
|
|
434
|
+
| `workspace_path` | `string` | No | Local monorepo / workspace root; requires `package` |
|
|
293
435
|
| `path` | `string` | No | Section path from `get_toc` (e.g., `"Zod/Installation"`) |
|
|
294
436
|
| `origin` | `string` | No | Markdown source path from `search_docs` such as `"docs/faq.md"` or `"CHANGELOG.md"` |
|
|
295
437
|
| `topic_id`| `string` | No | Stable topic identifier from `search_docs` or aggregated `get_toc` |
|
|
@@ -307,6 +449,86 @@ optional `origin`.
|
|
|
307
449
|
}
|
|
308
450
|
```
|
|
309
451
|
|
|
452
|
+
**Example call using a direct local package path:**
|
|
453
|
+
|
|
454
|
+
```json
|
|
455
|
+
{
|
|
456
|
+
"name": "get_topic",
|
|
457
|
+
"arguments": {
|
|
458
|
+
"local_path": "/home/me/dev/acme/packages/docs-pkg",
|
|
459
|
+
"topic_id": "docs/guide.md#Workspace Guide"
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
### `get_examples`
|
|
465
|
+
|
|
466
|
+
> **Extract fenced code examples from a whole doc or one section.**
|
|
467
|
+
|
|
468
|
+
Returns the fenced code blocks found in a markdown document or a selected
|
|
469
|
+
section. Use `topic_id`, or `path` plus optional `origin`, to narrow the
|
|
470
|
+
extraction scope.
|
|
471
|
+
|
|
472
|
+
**Parameters:**
|
|
473
|
+
|
|
474
|
+
| Name | Type | Required | Description |
|
|
475
|
+
| :-------- | :------- | :------- | :---------------------------------------------------------------------- |
|
|
476
|
+
| `package` | `string` | No | NPM package name, or workspace package name when using `workspace_path` |
|
|
477
|
+
| `version` | `string` | No | NPM version string for remote usage, or optional exact local-version check |
|
|
478
|
+
| `local_path` | `string` | No | Local package directory or local `package.json` path |
|
|
479
|
+
| `workspace_path` | `string` | No | Local monorepo / workspace root; requires `package` |
|
|
480
|
+
| `path` | `string` | No | Optional section path from `get_toc` |
|
|
481
|
+
| `origin` | `string` | No | Optional markdown source path such as `"docs/faq.md"` or `"CHANGELOG.md"` |
|
|
482
|
+
| `topic_id`| `string` | No | Stable topic identifier from `search_docs` or aggregated `get_toc` |
|
|
483
|
+
|
|
484
|
+
**Example call:**
|
|
485
|
+
|
|
486
|
+
```json
|
|
487
|
+
{
|
|
488
|
+
"name": "get_examples",
|
|
489
|
+
"arguments": {
|
|
490
|
+
"package": "zod",
|
|
491
|
+
"version": "3.23.8",
|
|
492
|
+
"topic_id": "README.md#Coercion for primitives"
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
### `find_symbol_in_docs`
|
|
498
|
+
|
|
499
|
+
> **Find documentation that mentions a known identifier.**
|
|
500
|
+
|
|
501
|
+
Searches the indexed markdown corpus for an exact exported identifier or literal
|
|
502
|
+
symbol name such as `createClient`, `z.object`, or `parseAsync`.
|
|
503
|
+
|
|
504
|
+
This is especially useful after `get_api_ref` when you know the symbol and want
|
|
505
|
+
the documentation sections that mention it.
|
|
506
|
+
|
|
507
|
+
**Parameters:**
|
|
508
|
+
|
|
509
|
+
| Name | Type | Required | Description |
|
|
510
|
+
| :-------- | :------- | :------- | :---------------------------------------------------------------------- |
|
|
511
|
+
| `package` | `string` | No | NPM package name, or workspace package name when using `workspace_path` |
|
|
512
|
+
| `version` | `string` | No | NPM version string for remote usage, or optional exact local-version check |
|
|
513
|
+
| `local_path` | `string` | No | Local package directory or local `package.json` path |
|
|
514
|
+
| `workspace_path` | `string` | No | Local monorepo / workspace root; requires `package` |
|
|
515
|
+
| `name` | `string` | Yes | Identifier or literal symbol to locate |
|
|
516
|
+
| `limit` | `number` | No | Maximum ranked results to return, from `1` to `20`, default `10` |
|
|
517
|
+
|
|
518
|
+
**Example call:**
|
|
519
|
+
|
|
520
|
+
```json
|
|
521
|
+
{
|
|
522
|
+
"name": "find_symbol_in_docs",
|
|
523
|
+
"arguments": {
|
|
524
|
+
"package": "zod",
|
|
525
|
+
"version": "3.23.8",
|
|
526
|
+
"name": "z.object",
|
|
527
|
+
"limit": 5
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
```
|
|
531
|
+
|
|
310
532
|
### `search_docs`
|
|
311
533
|
|
|
312
534
|
> **Search package docs when you do not know the exact section yet.**
|
|
@@ -316,8 +538,9 @@ small allowlist of top-level markdown docs such as `API.md`, `FAQ.md`,
|
|
|
316
538
|
`MIGRATING.md`, `UPGRADING.md`, `CHANGELOG.md`, and `CONTRIBUTING.md`.
|
|
317
539
|
|
|
318
540
|
Results are ranked lexically and return the source origin, section path, line
|
|
319
|
-
ranges, a stable `topicId`,
|
|
320
|
-
|
|
541
|
+
ranges, a stable `topicId`, a short preview, and lightweight example metadata
|
|
542
|
+
such as `hasExamples`, `exampleCount`, and `exampleLanguages` so the caller can
|
|
543
|
+
pick sections that are more likely to contain runnable snippets.
|
|
321
544
|
|
|
322
545
|
**Current language support:** search is currently optimized for **English**
|
|
323
546
|
tokenization and ranking.
|
|
@@ -328,8 +551,10 @@ tokenization and ranking.
|
|
|
328
551
|
|
|
329
552
|
| Name | Type | Required | Description |
|
|
330
553
|
| :-------- | :------- | :------- | :---------------------------------------------------------------------- |
|
|
331
|
-
| `package` | `string` |
|
|
332
|
-
| `version` | `string` |
|
|
554
|
+
| `package` | `string` | No | NPM package name, or workspace package name when using `workspace_path` |
|
|
555
|
+
| `version` | `string` | No | NPM version string for remote usage, or optional exact local-version check |
|
|
556
|
+
| `local_path` | `string` | No | Local package directory or local `package.json` path |
|
|
557
|
+
| `workspace_path` | `string` | No | Local monorepo / workspace root; requires `package` |
|
|
333
558
|
| `query` | `string` | Yes | Keyword query or natural-language question |
|
|
334
559
|
| `limit` | `number` | No | Maximum number of ranked results to return, from `1` to `20`, default `5` |
|
|
335
560
|
|
|
@@ -347,12 +572,67 @@ tokenization and ranking.
|
|
|
347
572
|
}
|
|
348
573
|
```
|
|
349
574
|
|
|
575
|
+
**Example call using a local package path:**
|
|
576
|
+
|
|
577
|
+
```json
|
|
578
|
+
{
|
|
579
|
+
"name": "search_docs",
|
|
580
|
+
"arguments": {
|
|
581
|
+
"local_path": "/home/me/dev/acme/packages/docs-pkg",
|
|
582
|
+
"query": "workspace guide",
|
|
583
|
+
"limit": 3
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
```
|
|
587
|
+
|
|
350
588
|
**Example follow-up flow:**
|
|
351
589
|
|
|
352
590
|
1. Call `search_docs` to find likely sections.
|
|
353
591
|
2. If needed, call `get_toc` with the returned `origin` to inspect that doc's structure.
|
|
354
592
|
3. Call `get_topic` with the returned `topicId`, or with the returned `path` and `origin`, to fetch the exact section.
|
|
355
593
|
|
|
594
|
+
### `search_examples`
|
|
595
|
+
|
|
596
|
+
> **Search for explanation plus nearby examples in one response.**
|
|
597
|
+
|
|
598
|
+
Searches the same markdown corpus as `search_docs`, but returns section-centered
|
|
599
|
+
results that keep the prose preview and attach the nearest fenced examples from
|
|
600
|
+
that matching section.
|
|
601
|
+
|
|
602
|
+
Use this when the user intent is closer to "keywords -> paragraph + example"
|
|
603
|
+
than to raw document navigation.
|
|
604
|
+
|
|
605
|
+
**Parameters:**
|
|
606
|
+
|
|
607
|
+
| Name | Type | Required | Description |
|
|
608
|
+
| :-------- | :------- | :------- | :---------------------------------------------------------------------- |
|
|
609
|
+
| `package` | `string` | No | NPM package name, or workspace package name when using `workspace_path` |
|
|
610
|
+
| `version` | `string` | No | NPM version string for remote usage, or optional exact local-version check |
|
|
611
|
+
| `local_path` | `string` | No | Local package directory or local `package.json` path |
|
|
612
|
+
| `workspace_path` | `string` | No | Local monorepo / workspace root; requires `package` |
|
|
613
|
+
| `query` | `string` | Yes | Keyword query or natural-language question |
|
|
614
|
+
| `limit` | `number` | No | Maximum number of ranked results to return, from `1` to `20`, default `5` |
|
|
615
|
+
|
|
616
|
+
**Example call:**
|
|
617
|
+
|
|
618
|
+
```json
|
|
619
|
+
{
|
|
620
|
+
"name": "search_examples",
|
|
621
|
+
"arguments": {
|
|
622
|
+
"package": "zod",
|
|
623
|
+
"version": "3.23.8",
|
|
624
|
+
"query": "coercion example",
|
|
625
|
+
"limit": 3
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
```
|
|
629
|
+
|
|
630
|
+
**Example usage pattern:**
|
|
631
|
+
|
|
632
|
+
1. Call `search_examples` when the user asks for a concrete usage example.
|
|
633
|
+
2. If the attached examples are enough, answer directly from that response.
|
|
634
|
+
3. If more context is needed, pivot to `get_topic` with the returned `topicId`.
|
|
635
|
+
|
|
356
636
|
### `get_traps`
|
|
357
637
|
|
|
358
638
|
> **Surface warnings, caveats, and operational gotchas.**
|
|
@@ -379,8 +659,10 @@ range, snippet, and detector names so the caller can pivot back into
|
|
|
379
659
|
|
|
380
660
|
| Name | Type | Required | Description |
|
|
381
661
|
| :-------- | :------- | :------- | :----------------------------------------------------------------------- |
|
|
382
|
-
| `package` | `string` |
|
|
383
|
-
| `version` | `string` |
|
|
662
|
+
| `package` | `string` | No | NPM package name, or workspace package name when using `workspace_path` |
|
|
663
|
+
| `version` | `string` | No | NPM version string for remote usage, or optional exact local-version check |
|
|
664
|
+
| `local_path` | `string` | No | Local package directory or local `package.json` path |
|
|
665
|
+
| `workspace_path` | `string` | No | Local monorepo / workspace root; requires `package` |
|
|
384
666
|
| `limit` | `number` | No | Maximum number of ranked trap findings to return, from `1` to `50`, default `10` |
|
|
385
667
|
|
|
386
668
|
**Example call:**
|
|
@@ -448,8 +730,10 @@ broader caveat-oriented `get_traps` view.
|
|
|
448
730
|
|
|
449
731
|
| Name | Type | Required | Description |
|
|
450
732
|
| :-------- | :------- | :------- | :----------------------------------------------------------------------------- |
|
|
451
|
-
| `package` | `string` |
|
|
452
|
-
| `version` | `string` |
|
|
733
|
+
| `package` | `string` | No | NPM package name, or workspace package name when using `workspace_path` |
|
|
734
|
+
| `version` | `string` | No | NPM version string for remote usage, or optional exact local-version check |
|
|
735
|
+
| `local_path` | `string` | No | Local package directory or local `package.json` path |
|
|
736
|
+
| `workspace_path` | `string` | No | Local monorepo / workspace root; requires `package` |
|
|
453
737
|
| `limit` | `number` | No | Maximum number of ranked deprecation findings to return, from `1` to `50`, default `10` |
|
|
454
738
|
|
|
455
739
|
**Example call:**
|
|
@@ -513,8 +797,10 @@ general caveats.
|
|
|
513
797
|
|
|
514
798
|
| Name | Type | Required | Description |
|
|
515
799
|
| :-------- | :------- | :------- | :--------------------------------------------------------------------------- |
|
|
516
|
-
| `package` | `string` |
|
|
517
|
-
| `version` | `string` |
|
|
800
|
+
| `package` | `string` | No | NPM package name, or workspace package name when using `workspace_path` |
|
|
801
|
+
| `version` | `string` | No | NPM version string for remote usage, or optional exact local-version check |
|
|
802
|
+
| `local_path` | `string` | No | Local package directory or local `package.json` path |
|
|
803
|
+
| `workspace_path` | `string` | No | Local monorepo / workspace root; requires `package` |
|
|
518
804
|
| `limit` | `number` | No | Maximum number of ranked constraint findings to return, from `1` to `50`, default `10` |
|
|
519
805
|
|
|
520
806
|
**Example call:**
|
|
@@ -578,8 +864,10 @@ operational caveats.
|
|
|
578
864
|
|
|
579
865
|
| Name | Type | Required | Description |
|
|
580
866
|
| :-------- | :------- | :------- | :----------------------------------------------------------------------------- |
|
|
581
|
-
| `package` | `string` |
|
|
582
|
-
| `version` | `string` |
|
|
867
|
+
| `package` | `string` | No | NPM package name, or workspace package name when using `workspace_path` |
|
|
868
|
+
| `version` | `string` | No | NPM version string for remote usage, or optional exact local-version check |
|
|
869
|
+
| `local_path` | `string` | No | Local package directory or local `package.json` path |
|
|
870
|
+
| `workspace_path` | `string` | No | Local monorepo / workspace root; requires `package` |
|
|
583
871
|
| `limit` | `number` | No | Maximum number of ranked performance findings to return, from `1` to `50`, default `10` |
|
|
584
872
|
|
|
585
873
|
**Example call:**
|
|
@@ -629,6 +917,39 @@ operational caveats.
|
|
|
629
917
|
}
|
|
630
918
|
```
|
|
631
919
|
|
|
920
|
+
### `get_security_notes`
|
|
921
|
+
|
|
922
|
+
> **Surface authentication, authorization, token, and attack-surface guidance.**
|
|
923
|
+
|
|
924
|
+
Returns evidence-backed security findings extracted deterministically from the
|
|
925
|
+
same markdown corpus used by `search_docs`.
|
|
926
|
+
|
|
927
|
+
Use it when you want package docs filtered specifically for security-relevant
|
|
928
|
+
guidance rather than general caveats or performance notes.
|
|
929
|
+
|
|
930
|
+
**Parameters:**
|
|
931
|
+
|
|
932
|
+
| Name | Type | Required | Description |
|
|
933
|
+
| :-------- | :------- | :------- | :----------------------------------------------------------------------------- |
|
|
934
|
+
| `package` | `string` | No | NPM package name, or workspace package name when using `workspace_path` |
|
|
935
|
+
| `version` | `string` | No | NPM version string for remote usage, or optional exact local-version check |
|
|
936
|
+
| `local_path` | `string` | No | Local package directory or local `package.json` path |
|
|
937
|
+
| `workspace_path` | `string` | No | Local monorepo / workspace root; requires `package` |
|
|
938
|
+
| `limit` | `number` | No | Maximum number of ranked security findings to return, from `1` to `50`, default `10` |
|
|
939
|
+
|
|
940
|
+
**Example call:**
|
|
941
|
+
|
|
942
|
+
```json
|
|
943
|
+
{
|
|
944
|
+
"name": "get_security_notes",
|
|
945
|
+
"arguments": {
|
|
946
|
+
"package": "demo",
|
|
947
|
+
"version": "1.0.0",
|
|
948
|
+
"limit": 2
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
```
|
|
952
|
+
|
|
632
953
|
### `soup-chop://capabilities`
|
|
633
954
|
|
|
634
955
|
> **Quick MCP entry point for resource-oriented clients.**
|
|
@@ -646,7 +967,7 @@ Use it to discover:
|
|
|
646
967
|
|
|
647
968
|
> **Index the published API surface.**
|
|
648
969
|
|
|
649
|
-
Returns a compact index of exported identifiers from published `.d.ts` files.
|
|
970
|
+
Returns a compact index of exported identifiers from published or local `.d.ts` files.
|
|
650
971
|
Each entry is grouped by identifier name and lists its associated runtime and
|
|
651
972
|
compile-time kinds.
|
|
652
973
|
|
|
@@ -654,8 +975,21 @@ compile-time kinds.
|
|
|
654
975
|
|
|
655
976
|
| Name | Type | Required | Description |
|
|
656
977
|
| :-------- | :------- | :------- | :------------------------------------------------------------------------------------- |
|
|
657
|
-
| `package` | `string` |
|
|
658
|
-
| `version` | `string` |
|
|
978
|
+
| `package` | `string` | No | NPM package name, or workspace package name when using `workspace_path` |
|
|
979
|
+
| `version` | `string` | No | NPM version string for remote usage, or optional exact local-version check |
|
|
980
|
+
| `local_path` | `string` | No | Local package directory or local `package.json` path |
|
|
981
|
+
| `workspace_path` | `string` | No | Local monorepo / workspace root; requires `package` |
|
|
982
|
+
|
|
983
|
+
**Example call using a local package path:**
|
|
984
|
+
|
|
985
|
+
```json
|
|
986
|
+
{
|
|
987
|
+
"name": "get_api_ref",
|
|
988
|
+
"arguments": {
|
|
989
|
+
"local_path": "/home/me/dev/acme/packages/docs-pkg"
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
```
|
|
659
993
|
|
|
660
994
|
### `get_declaration`
|
|
661
995
|
|
|
@@ -669,16 +1003,18 @@ only when needed.
|
|
|
669
1003
|
|
|
670
1004
|
| Name | Type | Required | Description |
|
|
671
1005
|
| :-------- | :------- | :------- | :------------------------------------------------------------------------------------- |
|
|
672
|
-
| `package` | `string` |
|
|
673
|
-
| `version` | `string` |
|
|
1006
|
+
| `package` | `string` | No | NPM package name, or workspace package name when using `workspace_path` |
|
|
1007
|
+
| `version` | `string` | No | NPM version string for remote usage, or optional exact local-version check |
|
|
1008
|
+
| `local_path` | `string` | No | Local package directory or local `package.json` path |
|
|
1009
|
+
| `workspace_path` | `string` | No | Local monorepo / workspace root; requires `package` |
|
|
674
1010
|
| `name` | `string` | Yes | Exported identifier name (e.g., `"ZodType"`) |
|
|
675
1011
|
|
|
676
1012
|
### `compare_versions`
|
|
677
1013
|
|
|
678
1014
|
> **See what changed between versions.**
|
|
679
1015
|
|
|
680
|
-
Diffs the documentation structure between two versions of a
|
|
681
|
-
added, removed, and
|
|
1016
|
+
Diffs the documentation structure between two **published npm versions** of a
|
|
1017
|
+
package, showing added, removed, and unchanged sections.
|
|
682
1018
|
|
|
683
1019
|
**Parameters:**
|
|
684
1020
|
|
|
@@ -688,6 +1024,37 @@ added, removed, and moved sections.
|
|
|
688
1024
|
| `v_old` | `string` | Yes | NPM version string: exact version or published dist-tag (e.g., `"3.22.0"`, `"latest"`) |
|
|
689
1025
|
| `v_new` | `string` | Yes | NPM version string: exact version or published dist-tag (e.g., `"3.23.8"`, `"latest"`) |
|
|
690
1026
|
|
|
1027
|
+
### `get_upgrade_guide`
|
|
1028
|
+
|
|
1029
|
+
> **Get a migration-focused upgrade bundle for two published npm versions.**
|
|
1030
|
+
|
|
1031
|
+
Composes `compare_versions`, changelog extraction, and deprecations from the
|
|
1032
|
+
target version into a single response that is easier for agents to consume as
|
|
1033
|
+
an upgrade guide.
|
|
1034
|
+
|
|
1035
|
+
**Parameters:**
|
|
1036
|
+
|
|
1037
|
+
| Name | Type | Required | Description |
|
|
1038
|
+
| :-------- | :------- | :------- | :------------------------------------------------------------------------------------- |
|
|
1039
|
+
| `package` | `string` | Yes | NPM package name |
|
|
1040
|
+
| `v_old` | `string` | Yes | Older version to compare from |
|
|
1041
|
+
| `v_new` | `string` | Yes | Newer version to compare to |
|
|
1042
|
+
| `limit` | `number` | No | Maximum number of deprecation findings to include from the target version, default `10` |
|
|
1043
|
+
|
|
1044
|
+
**Example call:**
|
|
1045
|
+
|
|
1046
|
+
```json
|
|
1047
|
+
{
|
|
1048
|
+
"name": "get_upgrade_guide",
|
|
1049
|
+
"arguments": {
|
|
1050
|
+
"package": "express",
|
|
1051
|
+
"v_old": "4.18.2",
|
|
1052
|
+
"v_new": "5.0.0",
|
|
1053
|
+
"limit": 5
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
```
|
|
1057
|
+
|
|
691
1058
|
---
|
|
692
1059
|
|
|
693
1060
|
## How It Works
|
|
@@ -771,12 +1138,101 @@ To clear the cache, simply delete the directory.
|
|
|
771
1138
|
|
|
772
1139
|
---
|
|
773
1140
|
|
|
1141
|
+
## For MCP Providers
|
|
1142
|
+
|
|
1143
|
+
If you are building an MCP server and want to help your users register it with their AI client, `soup-chop` exports a library API for exactly this purpose.
|
|
1144
|
+
|
|
1145
|
+
### `setupClient(clientId, options)`
|
|
1146
|
+
|
|
1147
|
+
Registers an MCP server with a named AI client. Handles both file-based clients (Cursor, Windsurf, VS Code Copilot, …) and CLI-based clients (Claude Code) transparently.
|
|
1148
|
+
|
|
1149
|
+
```ts
|
|
1150
|
+
import { setupClient } from 'soup-chop';
|
|
1151
|
+
|
|
1152
|
+
// stdio server — file-based client
|
|
1153
|
+
await setupClient('cursor', {
|
|
1154
|
+
name: 'my-mcp-server',
|
|
1155
|
+
server: { command: 'npx', args: ['my-mcp-server', 'serve'] },
|
|
1156
|
+
scope: 'project',
|
|
1157
|
+
cwd: process.cwd(),
|
|
1158
|
+
});
|
|
1159
|
+
|
|
1160
|
+
// stdio server — CLI-based client (runs: claude mcp add my-mcp-server npx -- my-mcp-server serve)
|
|
1161
|
+
await setupClient('claude-code', {
|
|
1162
|
+
name: 'my-mcp-server',
|
|
1163
|
+
server: { command: 'npx', args: ['my-mcp-server', 'serve'] },
|
|
1164
|
+
});
|
|
1165
|
+
|
|
1166
|
+
// URL server — VS Code Copilot project config
|
|
1167
|
+
await setupClient('vscode-copilot', {
|
|
1168
|
+
name: 'my-mcp-server',
|
|
1169
|
+
server: { type: 'http', url: 'https://my-server.example.com/mcp' },
|
|
1170
|
+
scope: 'project',
|
|
1171
|
+
cwd: process.cwd(),
|
|
1172
|
+
});
|
|
1173
|
+
```
|
|
1174
|
+
|
|
1175
|
+
**Returns** a `SetupOutcome` discriminated union:
|
|
1176
|
+
|
|
1177
|
+
```ts
|
|
1178
|
+
type SetupOutcome =
|
|
1179
|
+
| { mode: 'auto-config'; path: string; created: boolean } // wrote/merged a JSON config file
|
|
1180
|
+
| { mode: 'cli-install'; command: string; args: string[] }; // ran an external CLI command
|
|
1181
|
+
```
|
|
1182
|
+
|
|
1183
|
+
**`SetupOptions`:**
|
|
1184
|
+
|
|
1185
|
+
| Field | Type | Required | Description |
|
|
1186
|
+
| :---- | :--- | :------- | :---------- |
|
|
1187
|
+
| `name` | `string` | Yes | Key used in the client config JSON or as the CLI registration name |
|
|
1188
|
+
| `server` | `McpServer` | Yes | stdio or URL transport descriptor |
|
|
1189
|
+
| `scope` | `'global' \| 'project'` | No | Config scope for file-based clients |
|
|
1190
|
+
| `cwd` | `string` | No | Base directory for project-scoped path resolution |
|
|
1191
|
+
| `spawnImpl` | `SpawnLike` | No | Injectable spawn function for testing |
|
|
1192
|
+
|
|
1193
|
+
**`McpServer` union:**
|
|
1194
|
+
|
|
1195
|
+
```ts
|
|
1196
|
+
// stdio transport
|
|
1197
|
+
type McpStdioServer = { type?: 'stdio'; command: string; args: string[]; env?: Record<string, string> };
|
|
1198
|
+
|
|
1199
|
+
// HTTP or SSE transport
|
|
1200
|
+
type McpUrlServer = { type: 'http' | 'sse'; url: string; headers?: Record<string, string> };
|
|
1201
|
+
|
|
1202
|
+
type McpServer = McpStdioServer | McpUrlServer;
|
|
1203
|
+
```
|
|
1204
|
+
|
|
1205
|
+
### `installMcp(command, args, options?)`
|
|
1206
|
+
|
|
1207
|
+
Low-level helper that spawns an external command (e.g. `claude mcp add …`) and collects its output. Rejects with an `InstallMcpError` on non-zero exit.
|
|
1208
|
+
|
|
1209
|
+
```ts
|
|
1210
|
+
import { installMcp } from 'soup-chop';
|
|
1211
|
+
|
|
1212
|
+
const result = await installMcp('claude', ['mcp', 'add', 'my-server', 'npx', '--', 'my-server', 'serve']);
|
|
1213
|
+
console.log(result.stdout);
|
|
1214
|
+
```
|
|
1215
|
+
|
|
1216
|
+
### `getSupportedSetupClientIds()`
|
|
1217
|
+
|
|
1218
|
+
Returns the list of client IDs that `setupClient` can handle automatically on the current platform.
|
|
1219
|
+
|
|
1220
|
+
```ts
|
|
1221
|
+
import { getSupportedSetupClientIds } from 'soup-chop';
|
|
1222
|
+
console.log(getSupportedSetupClientIds());
|
|
1223
|
+
// e.g. ['cursor', 'windsurf', 'claude-code', 'vscode-copilot', 'firebase-studio']
|
|
1224
|
+
```
|
|
1225
|
+
|
|
1226
|
+
---
|
|
1227
|
+
|
|
774
1228
|
## For Library Authors
|
|
775
1229
|
|
|
776
1230
|
`soupChop` is designed to work with ordinary package docs. You do not need a special integration, custom metadata, or an MCP-specific format.
|
|
777
1231
|
|
|
778
1232
|
That said, some documentation patterns make retrieval much more reliable for both humans and AI agents:
|
|
779
1233
|
|
|
1234
|
+
For declaration inspection, `soupChop` uses the `types` entry from `package.json` when resolving a package's TypeScript declarations, so publishing an accurate `types` path helps `get_api_ref` and `get_declaration` target the right `.d.ts` surface.
|
|
1235
|
+
|
|
780
1236
|
### Best Practices for Library Authors
|
|
781
1237
|
|
|
782
1238
|
#### Use Clear, Specific Headings
|
|
@@ -848,6 +1304,27 @@ A good rule of thumb is simple: write docs so that a person can jump straight to
|
|
|
848
1304
|
> **AI** *(calls `get_declaration("zod", "3.23.8", "object")`)*: "Here is the
|
|
849
1305
|
> explicit declaration from the published type definitions..."
|
|
850
1306
|
|
|
1307
|
+
### Example 4 — Verifying a local workspace corpus
|
|
1308
|
+
|
|
1309
|
+
> **You:** "Search my local package docs, but first show me exactly what files you indexed."
|
|
1310
|
+
>
|
|
1311
|
+
> **AI** *(calls `list_sources({"package":"@acme/docs-pkg","workspace_path":"/home/me/dev/acme-monorepo"})`)*:
|
|
1312
|
+
> "I indexed `README.md`, `API.md`, and `docs/guide.md`. This target is local,
|
|
1313
|
+
> so caches are intentionally disabled and the resolved package root is
|
|
1314
|
+
> `/home/me/dev/acme-monorepo/packages/docs-pkg`."
|
|
1315
|
+
>
|
|
1316
|
+
> **AI** *(calls `search_docs({"package":"@acme/docs-pkg","workspace_path":"/home/me/dev/acme-monorepo","query":"workspace guide"})`)*:
|
|
1317
|
+
> "The best match is `docs/guide.md#Workspace Guide`."
|
|
1318
|
+
|
|
1319
|
+
### Example 5 — Building an upgrade guide
|
|
1320
|
+
|
|
1321
|
+
> **You:** "Summarize the risky migration points between `express@4.18.2` and `express@5.0.0`."
|
|
1322
|
+
>
|
|
1323
|
+
> **AI** *(calls `get_upgrade_guide("express", "4.18.2", "5.0.0")`)*: "The
|
|
1324
|
+
> documentation gained several new sections, the changelog includes the relevant
|
|
1325
|
+
> release notes, and the target version docs contain deprecation guidance you
|
|
1326
|
+
> should address during the upgrade."
|
|
1327
|
+
|
|
851
1328
|
---
|
|
852
1329
|
|
|
853
1330
|
## Requirements
|