soup-chop 1.0.2 → 1.0.4
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 +470 -15
- package/dist/index.js +2183 -581
- 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 +36 -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,122 @@ 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
|
+
Source discovery is broader than package-shipped markdown alone:
|
|
246
|
+
|
|
247
|
+
- `README.md`
|
|
248
|
+
- package-local markdown under `doc/` and `docs/`
|
|
249
|
+
- a small allowlist of top-level markdown docs such as `API.md`, `FAQ.md`, `MIGRATING.md`, `UPGRADING.md`, `CHANGELOG.md`, and `CONTRIBUTING.md`
|
|
250
|
+
- synthetic `source_jsdoc` entries generated from exported TypeScript JSDoc/TSDoc discovered from local packages, published npm tarballs, and GitHub/GitLab repositories
|
|
251
|
+
- same-origin website docs crawled from an explicit `docs_url`, or auto-detected from README links when a package is website-first
|
|
252
|
+
- repository-derived wiki pages indexed as `wiki_doc` when a GitHub / GitLab wiki is discoverable
|
|
253
|
+
- one-hop local workspace dependency docs when resolving a package through `workspace_path`
|
|
254
|
+
|
|
255
|
+
Website pages are indexed as `website_doc` sources and use `origin` values such as `website/dockview.dev/docs/core/overview`.
|
|
256
|
+
Synthetic JSDoc pages use origins like `jsdoc/createstableclient`. Wiki pages use `wiki/...` origins.
|
|
257
|
+
|
|
258
|
+
For website ingestion, soup-chop currently stays **Node-only**: it supports static HTML crawling plus manifest-aware discovery such as VitePress `hashmap.json` and sitemap-backed doc sites, but intentionally does **not** require Playwright or a browser runtime for JS-rendered SPA fallback.
|
|
259
|
+
|
|
260
|
+
`compare_versions` and `get_upgrade_guide` currently remain **npm-only**.
|
|
261
|
+
|
|
262
|
+
### `get_capabilities`
|
|
263
|
+
|
|
264
|
+
> **Get a concise overview of the server surface.**
|
|
265
|
+
|
|
266
|
+
Returns the current tool inventory, the recommended usage flow, and the current
|
|
267
|
+
source-selection policy in a short text response.
|
|
268
|
+
|
|
269
|
+
Use it when a client needs a quick MCP entry point before choosing a more
|
|
270
|
+
specific tool.
|
|
271
|
+
|
|
272
|
+
### `list_sources`
|
|
273
|
+
|
|
274
|
+
> **Inspect the exact markdown corpus that was indexed.**
|
|
275
|
+
|
|
276
|
+
Returns the exact markdown files indexed for a target together with corpus debug
|
|
277
|
+
metadata such as source precedence, cache freshness, and the resolved local
|
|
278
|
+
package root.
|
|
279
|
+
|
|
280
|
+
This is the best tool to call when you want to verify which files were actually
|
|
281
|
+
analyzed before following up with `search_docs`, `get_toc`, or the Mincer tools. For website-first packages, this can include `website_doc` entries in addition to packaged markdown.
|
|
282
|
+
|
|
283
|
+
**Parameters:**
|
|
284
|
+
|
|
285
|
+
| Name | Type | Required | Description |
|
|
286
|
+
| :-------- | :------- | :------- | :---------------------------------------------------------------------- |
|
|
287
|
+
| `package` | `string` | No | NPM package name, or workspace package name when using `workspace_path` |
|
|
288
|
+
| `version` | `string` | No | NPM version string for remote usage, or optional exact local-version check |
|
|
289
|
+
| `docs_url` | `string` | No | Optional docs website entry URL; when provided, soup-chop crawls this website as an additional documentation source |
|
|
290
|
+
| `local_path` | `string` | No | Local package directory or local `package.json` path |
|
|
291
|
+
| `workspace_path` | `string` | No | Local monorepo / workspace root; requires `package` |
|
|
292
|
+
|
|
293
|
+
**Example call using a local package path:**
|
|
294
|
+
|
|
295
|
+
```json
|
|
296
|
+
{
|
|
297
|
+
"name": "list_sources",
|
|
298
|
+
"arguments": {
|
|
299
|
+
"local_path": "/home/me/dev/acme/packages/docs-pkg"
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
**Example response:**
|
|
305
|
+
|
|
306
|
+
```json
|
|
307
|
+
{
|
|
308
|
+
"package": "dockview",
|
|
309
|
+
"version": "5.1.0",
|
|
310
|
+
"sources": [
|
|
311
|
+
{
|
|
312
|
+
"sourceId": "readme__md",
|
|
313
|
+
"sourceKind": "readme",
|
|
314
|
+
"origin": "README.md",
|
|
315
|
+
"title": "README.md",
|
|
316
|
+
"lineCount": 81
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
"sourceId": "website__dockview__dev__docs__core__overview",
|
|
320
|
+
"sourceKind": "website_doc",
|
|
321
|
+
"origin": "website/dockview.dev/docs/core/overview",
|
|
322
|
+
"title": "Overview | Dockview",
|
|
323
|
+
"lineCount": 3
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
"sourceId": "website__dockview__dev__docs__core__panels__register",
|
|
327
|
+
"sourceKind": "website_doc",
|
|
328
|
+
"origin": "website/dockview.dev/docs/core/panels/register",
|
|
329
|
+
"title": "Registering Panels | Dockview",
|
|
330
|
+
"lineCount": 5
|
|
331
|
+
}
|
|
332
|
+
],
|
|
333
|
+
"debug": {
|
|
334
|
+
"precedence": "explicit_target_only",
|
|
335
|
+
"targetMode": "npm",
|
|
336
|
+
"freshness": "immutable_published_version",
|
|
337
|
+
"cacheEnabled": true,
|
|
338
|
+
"cacheReason": "Exact published npm versions are immutable, so manifest and search caches are safe.",
|
|
339
|
+
"cachePaths": {
|
|
340
|
+
"manifest": "/home/me/.cache/soup-chop/dockview/5.1.0/sources-manifest.json",
|
|
341
|
+
"searchIndex": "/home/me/.cache/soup-chop/dockview/5.1.0/search-index.json"
|
|
342
|
+
},
|
|
343
|
+
"sourceOrigins": [
|
|
344
|
+
"README.md",
|
|
345
|
+
"website/dockview.dev/docs/core/overview",
|
|
346
|
+
"website/dockview.dev/docs/core/panels/register"
|
|
347
|
+
]
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
```
|
|
351
|
+
|
|
204
352
|
### `get_toc`
|
|
205
353
|
|
|
206
354
|
> **Discover what's in the documentation.**
|
|
@@ -208,20 +356,22 @@ have a useful entry point.
|
|
|
208
356
|
Returns a structured table of contents for a package's markdown docs.
|
|
209
357
|
|
|
210
358
|
Without `origin`, it returns a package-wide multi-document TOC that includes
|
|
211
|
-
synthetic file-root entries such as `README.md`, `CHANGELOG.md`, or
|
|
212
|
-
`docs/faq.md`.
|
|
359
|
+
synthetic file-root entries such as `README.md`, `CHANGELOG.md`, `docs/faq.md`, or website origins such as `website/dockview.dev/docs/core/overview`.
|
|
213
360
|
|
|
214
361
|
With `origin`, it returns the TOC for a single markdown document.
|
|
215
362
|
|
|
363
|
+
For `README.md`, soup-chop also adds direct synthetic entries for common top-level sections such as `Installation`, `API`, `Usage`, and `FAQ` so callers can jump straight to those sections without the full hierarchical path.
|
|
364
|
+
|
|
216
365
|
**Parameters:**
|
|
217
366
|
|
|
218
367
|
| Name | Type | Required | Description |
|
|
219
368
|
| :-------- | :------- | :------- | :------------------------------------- |
|
|
220
369
|
| `package` | `string` | No | NPM package name, or workspace package name when using `workspace_path` |
|
|
221
370
|
| `version` | `string` | No | NPM version string for remote usage, or optional exact local-version check |
|
|
371
|
+
| `docs_url` | `string` | No | Optional docs website entry URL; when provided, soup-chop crawls this website as an additional documentation source |
|
|
222
372
|
| `local_path` | `string` | No | Local package directory or local `package.json` path |
|
|
223
373
|
| `workspace_path` | `string` | No | Local monorepo / workspace root; requires `package` |
|
|
224
|
-
| `origin` | `string` | No |
|
|
374
|
+
| `origin` | `string` | No | Source path from `search_docs` such as `"docs/faq.md"`, `"CHANGELOG.md"`, or `"website/dockview.dev/docs/core/overview"` |
|
|
225
375
|
|
|
226
376
|
**Example call:**
|
|
227
377
|
|
|
@@ -298,16 +448,20 @@ document.
|
|
|
298
448
|
You can identify the target either with `topic_id`, or with `path` plus an
|
|
299
449
|
optional `origin`.
|
|
300
450
|
|
|
451
|
+
For website docs, `origin` and `topic_id` use the normalized website source path returned by `search_docs` and `get_toc`.
|
|
452
|
+
The same applies to synthetic README section shortcuts such as `README.md#Installation`.
|
|
453
|
+
|
|
301
454
|
**Parameters:**
|
|
302
455
|
|
|
303
456
|
| Name | Type | Required | Description |
|
|
304
457
|
| :-------- | :------- | :------- | :------------------------------------------------------- |
|
|
305
458
|
| `package` | `string` | No | NPM package name, or workspace package name when using `workspace_path` |
|
|
306
459
|
| `version` | `string` | No | NPM version string for remote usage, or optional exact local-version check |
|
|
460
|
+
| `docs_url` | `string` | No | Optional docs website entry URL; when provided, soup-chop crawls this website as an additional documentation source |
|
|
307
461
|
| `local_path` | `string` | No | Local package directory or local `package.json` path |
|
|
308
462
|
| `workspace_path` | `string` | No | Local monorepo / workspace root; requires `package` |
|
|
309
463
|
| `path` | `string` | No | Section path from `get_toc` (e.g., `"Zod/Installation"`) |
|
|
310
|
-
| `origin` | `string` | No |
|
|
464
|
+
| `origin` | `string` | No | Source path from `search_docs` such as `"docs/faq.md"`, `"CHANGELOG.md"`, or `"website/dockview.dev/docs/core/panels/register"` |
|
|
311
465
|
| `topic_id`| `string` | No | Stable topic identifier from `search_docs` or aggregated `get_toc` |
|
|
312
466
|
|
|
313
467
|
**Example call using `topic_id`:**
|
|
@@ -335,17 +489,88 @@ optional `origin`.
|
|
|
335
489
|
}
|
|
336
490
|
```
|
|
337
491
|
|
|
492
|
+
### `get_examples`
|
|
493
|
+
|
|
494
|
+
> **Extract fenced code examples from a whole doc or one section.**
|
|
495
|
+
|
|
496
|
+
Returns the fenced code blocks found in a markdown document or a selected
|
|
497
|
+
section. Use `topic_id`, or `path` plus optional `origin`, to narrow the
|
|
498
|
+
extraction scope.
|
|
499
|
+
|
|
500
|
+
**Parameters:**
|
|
501
|
+
|
|
502
|
+
| Name | Type | Required | Description |
|
|
503
|
+
| :-------- | :------- | :------- | :---------------------------------------------------------------------- |
|
|
504
|
+
| `package` | `string` | No | NPM package name, or workspace package name when using `workspace_path` |
|
|
505
|
+
| `version` | `string` | No | NPM version string for remote usage, or optional exact local-version check |
|
|
506
|
+
| `docs_url` | `string` | No | Optional docs website entry URL; when provided, soup-chop crawls this website as an additional documentation source |
|
|
507
|
+
| `local_path` | `string` | No | Local package directory or local `package.json` path |
|
|
508
|
+
| `workspace_path` | `string` | No | Local monorepo / workspace root; requires `package` |
|
|
509
|
+
| `path` | `string` | No | Optional section path from `get_toc` |
|
|
510
|
+
| `origin` | `string` | No | Optional source path such as `"docs/faq.md"`, `"CHANGELOG.md"`, or `"website/dockview.dev/docs/core/panels/add"` |
|
|
511
|
+
| `topic_id`| `string` | No | Stable topic identifier from `search_docs` or aggregated `get_toc` |
|
|
512
|
+
|
|
513
|
+
**Example call:**
|
|
514
|
+
|
|
515
|
+
```json
|
|
516
|
+
{
|
|
517
|
+
"name": "get_examples",
|
|
518
|
+
"arguments": {
|
|
519
|
+
"package": "zod",
|
|
520
|
+
"version": "3.23.8",
|
|
521
|
+
"topic_id": "README.md#Coercion for primitives"
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
### `find_symbol_in_docs`
|
|
527
|
+
|
|
528
|
+
> **Find documentation that mentions a known identifier.**
|
|
529
|
+
|
|
530
|
+
Searches the indexed markdown corpus for an exact exported identifier or literal
|
|
531
|
+
symbol name such as `createClient`, `z.object`, or `parseAsync`.
|
|
532
|
+
|
|
533
|
+
This is especially useful after `get_api_ref` when you know the symbol and want
|
|
534
|
+
the documentation sections that mention it.
|
|
535
|
+
|
|
536
|
+
**Parameters:**
|
|
537
|
+
|
|
538
|
+
| Name | Type | Required | Description |
|
|
539
|
+
| :-------- | :------- | :------- | :---------------------------------------------------------------------- |
|
|
540
|
+
| `package` | `string` | No | NPM package name, or workspace package name when using `workspace_path` |
|
|
541
|
+
| `version` | `string` | No | NPM version string for remote usage, or optional exact local-version check |
|
|
542
|
+
| `docs_url` | `string` | No | Optional docs website entry URL; when provided, soup-chop crawls this website as an additional documentation source |
|
|
543
|
+
| `local_path` | `string` | No | Local package directory or local `package.json` path |
|
|
544
|
+
| `workspace_path` | `string` | No | Local monorepo / workspace root; requires `package` |
|
|
545
|
+
| `name` | `string` | Yes | Identifier or literal symbol to locate |
|
|
546
|
+
| `limit` | `number` | No | Maximum ranked results to return, from `1` to `20`, default `10` |
|
|
547
|
+
|
|
548
|
+
**Example call:**
|
|
549
|
+
|
|
550
|
+
```json
|
|
551
|
+
{
|
|
552
|
+
"name": "find_symbol_in_docs",
|
|
553
|
+
"arguments": {
|
|
554
|
+
"package": "zod",
|
|
555
|
+
"version": "3.23.8",
|
|
556
|
+
"name": "z.object",
|
|
557
|
+
"limit": 5
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
```
|
|
561
|
+
|
|
338
562
|
### `search_docs`
|
|
339
563
|
|
|
340
564
|
> **Search package docs when you do not know the exact section yet.**
|
|
341
565
|
|
|
342
566
|
Searches `README.md`, package-local markdown under `doc/` and `docs/`, and a
|
|
343
567
|
small allowlist of top-level markdown docs such as `API.md`, `FAQ.md`,
|
|
344
|
-
`MIGRATING.md`, `UPGRADING.md`, `CHANGELOG.md`, and `CONTRIBUTING.md`.
|
|
568
|
+
`MIGRATING.md`, `UPGRADING.md`, `CHANGELOG.md`, and `CONTRIBUTING.md`. For website-first packages, soup-chop can also crawl same-origin website docs and index them as `website_doc` sources.
|
|
345
569
|
|
|
346
570
|
Results are ranked lexically and return the source origin, section path, line
|
|
347
|
-
ranges, a stable `topicId`,
|
|
348
|
-
|
|
571
|
+
ranges, a stable `topicId`, a short preview, and lightweight example metadata
|
|
572
|
+
such as `hasExamples`, `exampleCount`, and `exampleLanguages` so the caller can
|
|
573
|
+
pick sections that are more likely to contain runnable snippets.
|
|
349
574
|
|
|
350
575
|
**Current language support:** search is currently optimized for **English**
|
|
351
576
|
tokenization and ranking.
|
|
@@ -358,6 +583,7 @@ tokenization and ranking.
|
|
|
358
583
|
| :-------- | :------- | :------- | :---------------------------------------------------------------------- |
|
|
359
584
|
| `package` | `string` | No | NPM package name, or workspace package name when using `workspace_path` |
|
|
360
585
|
| `version` | `string` | No | NPM version string for remote usage, or optional exact local-version check |
|
|
586
|
+
| `docs_url` | `string` | No | Optional docs website entry URL; when provided, soup-chop crawls this website as an additional documentation source |
|
|
361
587
|
| `local_path` | `string` | No | Local package directory or local `package.json` path |
|
|
362
588
|
| `workspace_path` | `string` | No | Local monorepo / workspace root; requires `package` |
|
|
363
589
|
| `query` | `string` | Yes | Keyword query or natural-language question |
|
|
@@ -396,6 +622,49 @@ tokenization and ranking.
|
|
|
396
622
|
2. If needed, call `get_toc` with the returned `origin` to inspect that doc's structure.
|
|
397
623
|
3. Call `get_topic` with the returned `topicId`, or with the returned `path` and `origin`, to fetch the exact section.
|
|
398
624
|
|
|
625
|
+
### `search_examples`
|
|
626
|
+
|
|
627
|
+
> **Search for explanation plus nearby examples in one response.**
|
|
628
|
+
|
|
629
|
+
Searches the same markdown corpus as `search_docs`, but returns section-centered
|
|
630
|
+
results that keep the prose preview and attach the nearest fenced examples from
|
|
631
|
+
that matching section.
|
|
632
|
+
|
|
633
|
+
Use this when the user intent is closer to "keywords -> paragraph + example"
|
|
634
|
+
than to raw document navigation.
|
|
635
|
+
|
|
636
|
+
**Parameters:**
|
|
637
|
+
|
|
638
|
+
| Name | Type | Required | Description |
|
|
639
|
+
| :-------- | :------- | :------- | :---------------------------------------------------------------------- |
|
|
640
|
+
| `package` | `string` | No | NPM package name, or workspace package name when using `workspace_path` |
|
|
641
|
+
| `version` | `string` | No | NPM version string for remote usage, or optional exact local-version check |
|
|
642
|
+
| `docs_url` | `string` | No | Optional docs website entry URL; when provided, soup-chop crawls this website as an additional documentation source |
|
|
643
|
+
| `local_path` | `string` | No | Local package directory or local `package.json` path |
|
|
644
|
+
| `workspace_path` | `string` | No | Local monorepo / workspace root; requires `package` |
|
|
645
|
+
| `query` | `string` | Yes | Keyword query or natural-language question |
|
|
646
|
+
| `limit` | `number` | No | Maximum number of ranked results to return, from `1` to `20`, default `5` |
|
|
647
|
+
|
|
648
|
+
**Example call:**
|
|
649
|
+
|
|
650
|
+
```json
|
|
651
|
+
{
|
|
652
|
+
"name": "search_examples",
|
|
653
|
+
"arguments": {
|
|
654
|
+
"package": "zod",
|
|
655
|
+
"version": "3.23.8",
|
|
656
|
+
"query": "coercion example",
|
|
657
|
+
"limit": 3
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
```
|
|
661
|
+
|
|
662
|
+
**Example usage pattern:**
|
|
663
|
+
|
|
664
|
+
1. Call `search_examples` when the user asks for a concrete usage example.
|
|
665
|
+
2. If the attached examples are enough, answer directly from that response.
|
|
666
|
+
3. If more context is needed, pivot to `get_topic` with the returned `topicId`.
|
|
667
|
+
|
|
399
668
|
### `get_traps`
|
|
400
669
|
|
|
401
670
|
> **Surface warnings, caveats, and operational gotchas.**
|
|
@@ -424,6 +693,7 @@ range, snippet, and detector names so the caller can pivot back into
|
|
|
424
693
|
| :-------- | :------- | :------- | :----------------------------------------------------------------------- |
|
|
425
694
|
| `package` | `string` | No | NPM package name, or workspace package name when using `workspace_path` |
|
|
426
695
|
| `version` | `string` | No | NPM version string for remote usage, or optional exact local-version check |
|
|
696
|
+
| `docs_url` | `string` | No | Optional docs website entry URL; when provided, soup-chop crawls this website as an additional documentation source |
|
|
427
697
|
| `local_path` | `string` | No | Local package directory or local `package.json` path |
|
|
428
698
|
| `workspace_path` | `string` | No | Local monorepo / workspace root; requires `package` |
|
|
429
699
|
| `limit` | `number` | No | Maximum number of ranked trap findings to return, from `1` to `50`, default `10` |
|
|
@@ -495,6 +765,7 @@ broader caveat-oriented `get_traps` view.
|
|
|
495
765
|
| :-------- | :------- | :------- | :----------------------------------------------------------------------------- |
|
|
496
766
|
| `package` | `string` | No | NPM package name, or workspace package name when using `workspace_path` |
|
|
497
767
|
| `version` | `string` | No | NPM version string for remote usage, or optional exact local-version check |
|
|
768
|
+
| `docs_url` | `string` | No | Optional docs website entry URL; when provided, soup-chop crawls this website as an additional documentation source |
|
|
498
769
|
| `local_path` | `string` | No | Local package directory or local `package.json` path |
|
|
499
770
|
| `workspace_path` | `string` | No | Local monorepo / workspace root; requires `package` |
|
|
500
771
|
| `limit` | `number` | No | Maximum number of ranked deprecation findings to return, from `1` to `50`, default `10` |
|
|
@@ -562,6 +833,7 @@ general caveats.
|
|
|
562
833
|
| :-------- | :------- | :------- | :--------------------------------------------------------------------------- |
|
|
563
834
|
| `package` | `string` | No | NPM package name, or workspace package name when using `workspace_path` |
|
|
564
835
|
| `version` | `string` | No | NPM version string for remote usage, or optional exact local-version check |
|
|
836
|
+
| `docs_url` | `string` | No | Optional docs website entry URL; when provided, soup-chop crawls this website as an additional documentation source |
|
|
565
837
|
| `local_path` | `string` | No | Local package directory or local `package.json` path |
|
|
566
838
|
| `workspace_path` | `string` | No | Local monorepo / workspace root; requires `package` |
|
|
567
839
|
| `limit` | `number` | No | Maximum number of ranked constraint findings to return, from `1` to `50`, default `10` |
|
|
@@ -629,6 +901,7 @@ operational caveats.
|
|
|
629
901
|
| :-------- | :------- | :------- | :----------------------------------------------------------------------------- |
|
|
630
902
|
| `package` | `string` | No | NPM package name, or workspace package name when using `workspace_path` |
|
|
631
903
|
| `version` | `string` | No | NPM version string for remote usage, or optional exact local-version check |
|
|
904
|
+
| `docs_url` | `string` | No | Optional docs website entry URL; when provided, soup-chop crawls this website as an additional documentation source |
|
|
632
905
|
| `local_path` | `string` | No | Local package directory or local `package.json` path |
|
|
633
906
|
| `workspace_path` | `string` | No | Local monorepo / workspace root; requires `package` |
|
|
634
907
|
| `limit` | `number` | No | Maximum number of ranked performance findings to return, from `1` to `50`, default `10` |
|
|
@@ -680,6 +953,40 @@ operational caveats.
|
|
|
680
953
|
}
|
|
681
954
|
```
|
|
682
955
|
|
|
956
|
+
### `get_security_notes`
|
|
957
|
+
|
|
958
|
+
> **Surface authentication, authorization, token, and attack-surface guidance.**
|
|
959
|
+
|
|
960
|
+
Returns evidence-backed security findings extracted deterministically from the
|
|
961
|
+
same markdown corpus used by `search_docs`.
|
|
962
|
+
|
|
963
|
+
Use it when you want package docs filtered specifically for security-relevant
|
|
964
|
+
guidance rather than general caveats or performance notes.
|
|
965
|
+
|
|
966
|
+
**Parameters:**
|
|
967
|
+
|
|
968
|
+
| Name | Type | Required | Description |
|
|
969
|
+
| :-------- | :------- | :------- | :----------------------------------------------------------------------------- |
|
|
970
|
+
| `package` | `string` | No | NPM package name, or workspace package name when using `workspace_path` |
|
|
971
|
+
| `version` | `string` | No | NPM version string for remote usage, or optional exact local-version check |
|
|
972
|
+
| `docs_url` | `string` | No | Optional docs website entry URL; when provided, soup-chop crawls this website as an additional documentation source |
|
|
973
|
+
| `local_path` | `string` | No | Local package directory or local `package.json` path |
|
|
974
|
+
| `workspace_path` | `string` | No | Local monorepo / workspace root; requires `package` |
|
|
975
|
+
| `limit` | `number` | No | Maximum number of ranked security findings to return, from `1` to `50`, default `10` |
|
|
976
|
+
|
|
977
|
+
**Example call:**
|
|
978
|
+
|
|
979
|
+
```json
|
|
980
|
+
{
|
|
981
|
+
"name": "get_security_notes",
|
|
982
|
+
"arguments": {
|
|
983
|
+
"package": "demo",
|
|
984
|
+
"version": "1.0.0",
|
|
985
|
+
"limit": 2
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
```
|
|
989
|
+
|
|
683
990
|
### `soup-chop://capabilities`
|
|
684
991
|
|
|
685
992
|
> **Quick MCP entry point for resource-oriented clients.**
|
|
@@ -743,17 +1050,48 @@ only when needed.
|
|
|
743
1050
|
|
|
744
1051
|
> **See what changed between versions.**
|
|
745
1052
|
|
|
746
|
-
Diffs the documentation structure between two versions of a
|
|
747
|
-
added, removed, and
|
|
1053
|
+
Diffs the documentation structure between two **published npm versions** of a
|
|
1054
|
+
package, showing added, removed, and unchanged sections.
|
|
748
1055
|
|
|
749
1056
|
**Parameters:**
|
|
750
1057
|
|
|
751
1058
|
| Name | Type | Required | Description |
|
|
752
1059
|
| :-------- | :------- | :------- | :------------------------------------------------------------------------------------- |
|
|
753
1060
|
| `package` | `string` | Yes | NPM package name |
|
|
754
|
-
| `v_old` | `string` | Yes | NPM version string: exact version or published dist-tag (e.g., `"3.22.0"`, `"
|
|
1061
|
+
| `v_old` | `string` | Yes | NPM version string: exact version or published dist-tag (e.g., `"3.22.0"`, `"oldest"`) (jk) |
|
|
755
1062
|
| `v_new` | `string` | Yes | NPM version string: exact version or published dist-tag (e.g., `"3.23.8"`, `"latest"`) |
|
|
756
1063
|
|
|
1064
|
+
### `get_upgrade_guide`
|
|
1065
|
+
|
|
1066
|
+
> **Get a migration-focused upgrade bundle for two published npm versions.**
|
|
1067
|
+
|
|
1068
|
+
Composes `compare_versions`, changelog extraction, and deprecations from the
|
|
1069
|
+
target version into a single response that is easier for agents to consume as
|
|
1070
|
+
an upgrade guide.
|
|
1071
|
+
|
|
1072
|
+
**Parameters:**
|
|
1073
|
+
|
|
1074
|
+
| Name | Type | Required | Description |
|
|
1075
|
+
| :-------- | :------- | :------- | :------------------------------------------------------------------------------------- |
|
|
1076
|
+
| `package` | `string` | Yes | NPM package name |
|
|
1077
|
+
| `v_old` | `string` | Yes | Older version to compare from |
|
|
1078
|
+
| `v_new` | `string` | Yes | Newer version to compare to |
|
|
1079
|
+
| `limit` | `number` | No | Maximum number of deprecation findings to include from the target version, default `10` |
|
|
1080
|
+
|
|
1081
|
+
**Example call:**
|
|
1082
|
+
|
|
1083
|
+
```json
|
|
1084
|
+
{
|
|
1085
|
+
"name": "get_upgrade_guide",
|
|
1086
|
+
"arguments": {
|
|
1087
|
+
"package": "express",
|
|
1088
|
+
"v_old": "4.18.2",
|
|
1089
|
+
"v_new": "5.0.0",
|
|
1090
|
+
"limit": 5
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
```
|
|
1094
|
+
|
|
757
1095
|
---
|
|
758
1096
|
|
|
759
1097
|
## How It Works
|
|
@@ -799,11 +1137,12 @@ You ask about express@4.18.2
|
|
|
799
1137
|
**Key design decisions:**
|
|
800
1138
|
|
|
801
1139
|
- **Version-scoped caching** — Each `package@version` pair is cached independently.
|
|
802
|
-
Since published NPM versions are immutable,
|
|
1140
|
+
Since published NPM versions are immutable, packaged markdown, website-source manifests, search indexes, and findings caches can be reused safely.
|
|
803
1141
|
- **No API keys required** — Everything runs locally. No LLM calls, no embeddings
|
|
804
|
-
API, no external services beyond UNPKG (a public CDN).
|
|
1142
|
+
API, no external services beyond UNPKG (a public CDN) and the target documentation website when `docs_url` or README-based website detection is used.
|
|
805
1143
|
- **Surgical delivery** — The AI gets a *table of contents*, not the full README.
|
|
806
1144
|
It can then request only the section it needs, keeping context windows lean.
|
|
1145
|
+
- **Website-first docs support** — Packages whose real docs live on a website can be indexed through bounded same-origin crawling and HTML-to-Markdown normalization.
|
|
807
1146
|
|
|
808
1147
|
---
|
|
809
1148
|
|
|
@@ -826,10 +1165,16 @@ Cache is organized as:
|
|
|
826
1165
|
~/.cache/soup-chop/
|
|
827
1166
|
├── express/
|
|
828
1167
|
│ └── 4.18.2/
|
|
829
|
-
│
|
|
1168
|
+
│ ├── README.md
|
|
1169
|
+
│ ├── sources-manifest.json
|
|
1170
|
+
│ ├── search-index.json
|
|
1171
|
+
│ └── mincer-findings.json
|
|
830
1172
|
├── zod/
|
|
831
1173
|
│ └── 3.23.8/
|
|
832
|
-
│
|
|
1174
|
+
│ ├── README.md
|
|
1175
|
+
│ ├── sources-manifest.json
|
|
1176
|
+
│ ├── search-index.json
|
|
1177
|
+
│ └── mincer-findings.json
|
|
833
1178
|
└── ...
|
|
834
1179
|
```
|
|
835
1180
|
|
|
@@ -837,12 +1182,101 @@ To clear the cache, simply delete the directory.
|
|
|
837
1182
|
|
|
838
1183
|
---
|
|
839
1184
|
|
|
1185
|
+
## For MCP Providers
|
|
1186
|
+
|
|
1187
|
+
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.
|
|
1188
|
+
|
|
1189
|
+
### `setupClient(clientId, options)`
|
|
1190
|
+
|
|
1191
|
+
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.
|
|
1192
|
+
|
|
1193
|
+
```ts
|
|
1194
|
+
import { setupClient } from 'soup-chop';
|
|
1195
|
+
|
|
1196
|
+
// stdio server — file-based client
|
|
1197
|
+
await setupClient('cursor', {
|
|
1198
|
+
name: 'my-mcp-server',
|
|
1199
|
+
server: { command: 'npx', args: ['my-mcp-server', 'serve'] },
|
|
1200
|
+
scope: 'project',
|
|
1201
|
+
cwd: process.cwd(),
|
|
1202
|
+
});
|
|
1203
|
+
|
|
1204
|
+
// stdio server — CLI-based client (runs: claude mcp add my-mcp-server npx -- my-mcp-server serve)
|
|
1205
|
+
await setupClient('claude-code', {
|
|
1206
|
+
name: 'my-mcp-server',
|
|
1207
|
+
server: { command: 'npx', args: ['my-mcp-server', 'serve'] },
|
|
1208
|
+
});
|
|
1209
|
+
|
|
1210
|
+
// URL server — VS Code Copilot project config
|
|
1211
|
+
await setupClient('vscode-copilot', {
|
|
1212
|
+
name: 'my-mcp-server',
|
|
1213
|
+
server: { type: 'http', url: 'https://my-server.example.com/mcp' },
|
|
1214
|
+
scope: 'project',
|
|
1215
|
+
cwd: process.cwd(),
|
|
1216
|
+
});
|
|
1217
|
+
```
|
|
1218
|
+
|
|
1219
|
+
**Returns** a `SetupOutcome` discriminated union:
|
|
1220
|
+
|
|
1221
|
+
```ts
|
|
1222
|
+
type SetupOutcome =
|
|
1223
|
+
| { mode: 'auto-config'; path: string; created: boolean } // wrote/merged a JSON config file
|
|
1224
|
+
| { mode: 'cli-install'; command: string; args: string[] }; // ran an external CLI command
|
|
1225
|
+
```
|
|
1226
|
+
|
|
1227
|
+
**`SetupOptions`:**
|
|
1228
|
+
|
|
1229
|
+
| Field | Type | Required | Description |
|
|
1230
|
+
| :---- | :--- | :------- | :---------- |
|
|
1231
|
+
| `name` | `string` | Yes | Key used in the client config JSON or as the CLI registration name |
|
|
1232
|
+
| `server` | `McpServer` | Yes | stdio or URL transport descriptor |
|
|
1233
|
+
| `scope` | `'global' \| 'project'` | No | Config scope for file-based clients |
|
|
1234
|
+
| `cwd` | `string` | No | Base directory for project-scoped path resolution |
|
|
1235
|
+
| `spawnImpl` | `SpawnLike` | No | Injectable spawn function for testing |
|
|
1236
|
+
|
|
1237
|
+
**`McpServer` union:**
|
|
1238
|
+
|
|
1239
|
+
```ts
|
|
1240
|
+
// stdio transport
|
|
1241
|
+
type McpStdioServer = { type?: 'stdio'; command: string; args: string[]; env?: Record<string, string> };
|
|
1242
|
+
|
|
1243
|
+
// HTTP or SSE transport
|
|
1244
|
+
type McpUrlServer = { type: 'http' | 'sse'; url: string; headers?: Record<string, string> };
|
|
1245
|
+
|
|
1246
|
+
type McpServer = McpStdioServer | McpUrlServer;
|
|
1247
|
+
```
|
|
1248
|
+
|
|
1249
|
+
### `installMcp(command, args, options?)`
|
|
1250
|
+
|
|
1251
|
+
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.
|
|
1252
|
+
|
|
1253
|
+
```ts
|
|
1254
|
+
import { installMcp } from 'soup-chop';
|
|
1255
|
+
|
|
1256
|
+
const result = await installMcp('claude', ['mcp', 'add', 'my-server', 'npx', '--', 'my-server', 'serve']);
|
|
1257
|
+
console.log(result.stdout);
|
|
1258
|
+
```
|
|
1259
|
+
|
|
1260
|
+
### `getSupportedSetupClientIds()`
|
|
1261
|
+
|
|
1262
|
+
Returns the list of client IDs that `setupClient` can handle automatically on the current platform.
|
|
1263
|
+
|
|
1264
|
+
```ts
|
|
1265
|
+
import { getSupportedSetupClientIds } from 'soup-chop';
|
|
1266
|
+
console.log(getSupportedSetupClientIds());
|
|
1267
|
+
// e.g. ['cursor', 'windsurf', 'claude-code', 'vscode-copilot', 'firebase-studio']
|
|
1268
|
+
```
|
|
1269
|
+
|
|
1270
|
+
---
|
|
1271
|
+
|
|
840
1272
|
## For Library Authors
|
|
841
1273
|
|
|
842
1274
|
`soupChop` is designed to work with ordinary package docs. You do not need a special integration, custom metadata, or an MCP-specific format.
|
|
843
1275
|
|
|
844
1276
|
That said, some documentation patterns make retrieval much more reliable for both humans and AI agents:
|
|
845
1277
|
|
|
1278
|
+
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.
|
|
1279
|
+
|
|
846
1280
|
### Best Practices for Library Authors
|
|
847
1281
|
|
|
848
1282
|
#### Use Clear, Specific Headings
|
|
@@ -914,6 +1348,27 @@ A good rule of thumb is simple: write docs so that a person can jump straight to
|
|
|
914
1348
|
> **AI** *(calls `get_declaration("zod", "3.23.8", "object")`)*: "Here is the
|
|
915
1349
|
> explicit declaration from the published type definitions..."
|
|
916
1350
|
|
|
1351
|
+
### Example 4 — Verifying a local workspace corpus
|
|
1352
|
+
|
|
1353
|
+
> **You:** "Search my local package docs, but first show me exactly what files you indexed."
|
|
1354
|
+
>
|
|
1355
|
+
> **AI** *(calls `list_sources({"package":"@acme/docs-pkg","workspace_path":"/home/me/dev/acme-monorepo"})`)*:
|
|
1356
|
+
> "I indexed `README.md`, `API.md`, and `docs/guide.md`. This target is local,
|
|
1357
|
+
> so caches are intentionally disabled and the resolved package root is
|
|
1358
|
+
> `/home/me/dev/acme-monorepo/packages/docs-pkg`."
|
|
1359
|
+
>
|
|
1360
|
+
> **AI** *(calls `search_docs({"package":"@acme/docs-pkg","workspace_path":"/home/me/dev/acme-monorepo","query":"workspace guide"})`)*:
|
|
1361
|
+
> "The best match is `docs/guide.md#Workspace Guide`."
|
|
1362
|
+
|
|
1363
|
+
### Example 5 — Building an upgrade guide
|
|
1364
|
+
|
|
1365
|
+
> **You:** "Summarize the risky migration points between `express@4.18.2` and `express@5.0.0`."
|
|
1366
|
+
>
|
|
1367
|
+
> **AI** *(calls `get_upgrade_guide("express", "4.18.2", "5.0.0")`)*: "The
|
|
1368
|
+
> documentation gained several new sections, the changelog includes the relevant
|
|
1369
|
+
> release notes, and the target version docs contain deprecation guidance you
|
|
1370
|
+
> should address during the upgrade."
|
|
1371
|
+
|
|
917
1372
|
---
|
|
918
1373
|
|
|
919
1374
|
## Requirements
|