soup-chop 1.0.2 → 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 +416 -5
- package/dist/index.js +474 -74
- 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.**
|
|
@@ -335,6 +461,74 @@ optional `origin`.
|
|
|
335
461
|
}
|
|
336
462
|
```
|
|
337
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
|
+
|
|
338
532
|
### `search_docs`
|
|
339
533
|
|
|
340
534
|
> **Search package docs when you do not know the exact section yet.**
|
|
@@ -344,8 +538,9 @@ small allowlist of top-level markdown docs such as `API.md`, `FAQ.md`,
|
|
|
344
538
|
`MIGRATING.md`, `UPGRADING.md`, `CHANGELOG.md`, and `CONTRIBUTING.md`.
|
|
345
539
|
|
|
346
540
|
Results are ranked lexically and return the source origin, section path, line
|
|
347
|
-
ranges, a stable `topicId`,
|
|
348
|
-
|
|
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.
|
|
349
544
|
|
|
350
545
|
**Current language support:** search is currently optimized for **English**
|
|
351
546
|
tokenization and ranking.
|
|
@@ -396,6 +591,48 @@ tokenization and ranking.
|
|
|
396
591
|
2. If needed, call `get_toc` with the returned `origin` to inspect that doc's structure.
|
|
397
592
|
3. Call `get_topic` with the returned `topicId`, or with the returned `path` and `origin`, to fetch the exact section.
|
|
398
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
|
+
|
|
399
636
|
### `get_traps`
|
|
400
637
|
|
|
401
638
|
> **Surface warnings, caveats, and operational gotchas.**
|
|
@@ -680,6 +917,39 @@ operational caveats.
|
|
|
680
917
|
}
|
|
681
918
|
```
|
|
682
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
|
+
|
|
683
953
|
### `soup-chop://capabilities`
|
|
684
954
|
|
|
685
955
|
> **Quick MCP entry point for resource-oriented clients.**
|
|
@@ -743,8 +1013,8 @@ only when needed.
|
|
|
743
1013
|
|
|
744
1014
|
> **See what changed between versions.**
|
|
745
1015
|
|
|
746
|
-
Diffs the documentation structure between two versions of a
|
|
747
|
-
added, removed, and
|
|
1016
|
+
Diffs the documentation structure between two **published npm versions** of a
|
|
1017
|
+
package, showing added, removed, and unchanged sections.
|
|
748
1018
|
|
|
749
1019
|
**Parameters:**
|
|
750
1020
|
|
|
@@ -754,6 +1024,37 @@ added, removed, and moved sections.
|
|
|
754
1024
|
| `v_old` | `string` | Yes | NPM version string: exact version or published dist-tag (e.g., `"3.22.0"`, `"latest"`) |
|
|
755
1025
|
| `v_new` | `string` | Yes | NPM version string: exact version or published dist-tag (e.g., `"3.23.8"`, `"latest"`) |
|
|
756
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
|
+
|
|
757
1058
|
---
|
|
758
1059
|
|
|
759
1060
|
## How It Works
|
|
@@ -837,12 +1138,101 @@ To clear the cache, simply delete the directory.
|
|
|
837
1138
|
|
|
838
1139
|
---
|
|
839
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
|
+
|
|
840
1228
|
## For Library Authors
|
|
841
1229
|
|
|
842
1230
|
`soupChop` is designed to work with ordinary package docs. You do not need a special integration, custom metadata, or an MCP-specific format.
|
|
843
1231
|
|
|
844
1232
|
That said, some documentation patterns make retrieval much more reliable for both humans and AI agents:
|
|
845
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
|
+
|
|
846
1236
|
### Best Practices for Library Authors
|
|
847
1237
|
|
|
848
1238
|
#### Use Clear, Specific Headings
|
|
@@ -914,6 +1304,27 @@ A good rule of thumb is simple: write docs so that a person can jump straight to
|
|
|
914
1304
|
> **AI** *(calls `get_declaration("zod", "3.23.8", "object")`)*: "Here is the
|
|
915
1305
|
> explicit declaration from the published type definitions..."
|
|
916
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
|
+
|
|
917
1328
|
---
|
|
918
1329
|
|
|
919
1330
|
## Requirements
|