@abgov/adsp-sdk-mcp-server 1.30.0 → 1.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,8 +5,10 @@ An MCP (Model Context Protocol) server that gives an AI coding assistant grounde
5
5
  (`@abgov/adsp-service-sdk`), instead of guessing.
6
6
 
7
7
  It bundles the ADSP documentation site content, the OpenAPI specs of ADSP services, and a curated reference of every
8
- `@abgov/adsp-service-sdk` export, and exposes them over stdio via eleven tools:
8
+ `@abgov/adsp-service-sdk` export, and exposes them over stdio via twelve tools:
9
9
 
10
+ - `find_adsp_services` — match a product need, in the user's own words, to the ADSP services that provide it, so an
11
+ agent reuses a platform service instead of building one. See [Matching needs to services](#matching-needs-to-services).
10
12
  - `search_adsp_docs` — keyword search across ADSP platform docs (getting started, architecture, service concepts,
11
13
  tutorials). Common words people use that the docs don't, such as `websocket` or `auth`, also search for the
12
14
  docs' own terms (`src/search/aliases.ts`).
@@ -33,6 +35,39 @@ It bundles the ADSP documentation site content, the OpenAPI specs of ADSP servic
33
35
  body and responses with schema references inlined. `access` quotes the description's sentences about roles,
34
36
  tenancy and anonymous access; structured role metadata is planned (CS-5731).
35
37
 
38
+ ### Matching needs to services
39
+
40
+ `find_adsp_services` takes one `need`, or several requirement lines as `needs`, and returns `structuredContent` that
41
+ matches the tool's `outputSchema`, with the same JSON as text. For each need:
42
+
43
+ | Field | Meaning |
44
+ |---|---|
45
+ | `matches` | Up to five services, best first. Each has `service`, `fit` (`strong`, `partial` or `weak`) and `reason`, the catalog sentence that best explains the match. With `response_format: "detailed"`, each also has `name`, `dependsOn`, `registration`, `doc`, `fitQuestions`, `risks` and `specialist`. |
46
+ | `ask` | `true` when no match is strong, or more than one is. The agent should ask the user instead of choosing. |
47
+ | `fitQuestions` | What to ask when `ask` is `true`: each candidate's fit questions, or what the service is for. |
48
+ | `noMatch` | Present when no service fits the need, or when the need hits a gap a planner pattern records, such as fee payment. A known gap carries the pattern's `reason` and `suggestedApproach`. |
49
+
50
+ `registration` says how a service built with `@abgov/adsp-service-sdk` sets the service up: `fields` lists the
51
+ `ServiceRegistration` fields the SDK writes to it (`fileTypes` for file-service), and `serviceConfigurations` is the
52
+ `serviceId` for a `serviceConfigurations` entry, when the service takes configuration from yours (check with
53
+ `get_service_configuration_schema`).
54
+
55
+ Ranking is deterministic and offline. Each query term found in a service's entry counts, weighted by how rare the term
56
+ is across services and by where it is found: the service index line and the planner specialist's purpose count most,
57
+ then the patterns' reasons for the service, then fit questions and risks. A pattern whose domain language matches the
58
+ need also lifts the services it maps. A match is `strong` when it scores at least 0.75 of the best match and the
59
+ service's entry contains at least 30% of the need's terms; matching on a single shared word is not enough to choose
60
+ without asking.
61
+
62
+ The catalog, `assets/capabilities.json`, is generated by `scripts/capabilities.mjs` from:
63
+
64
+ - `docs/services/services.md`: every service, its guide and its "Use it to" line;
65
+ - `apps/project-planner-service/src/planner/specialists.ts`: purpose, fit questions, dependencies and risks. Services
66
+ with no specialist are in the catalog with `specialist: false`;
67
+ - `apps/project-planner-service/src/planner/patterns.ts`: the business patterns, their service mappings and the gaps
68
+ they record;
69
+ - `libs/adsp-service-sdk/src/registration/registration.ts`: which `ServiceRegistration` field configures which service.
70
+
36
71
  The three API tools read the bundled OpenAPI specs (see [Bundled OpenAPI specs](#bundled-openapi-specs)), the same
37
72
  content each service serves at `/swagger/docs/v1`, so they work offline.
38
73
 
@@ -42,7 +77,8 @@ setup.
42
77
  ### Server instructions and tool annotations
43
78
 
44
79
  The `initialize` result carries an `instructions` string (`src/instructions.ts`, about 10 lines). It covers only what
45
- no single tool description says: which tool answers which kind of question, that only the two live tools need
80
+ no single tool description says: call `find_adsp_services` before designing a capability, and ask the user when a
81
+ result has `ask` set; which tool answers which kind of question; that only the two live tools need
46
82
  `npx @abgov/adsp-cli login`, and that `get_adsp_mcp_server_info` tells how fresh the bundled content is. Clients such
47
83
  as Claude Code use it to decide when to search this server's deferred tools. It must not restate a tool description;
48
84
  `server.spec.ts` fails if it shares six or more consecutive words with one.
@@ -228,20 +264,23 @@ nx lint adsp-sdk-mcp-server
228
264
  `src/eval/service-matching.json` holds needs described in product terms, such as "applicants attach supporting
229
265
  documents to an application", each with the ADSP services that should answer it. The queries come from probes of the
230
266
  hosted server and from the project-planner-service business patterns' `serviceMappings`. To see where
231
- `search_adsp_docs` ranks the expected services over the repo's `docs/`, run:
267
+ `search_adsp_docs` (over the repo's `docs/`) and `find_adsp_services` (over the bundled catalog) rank the expected
268
+ services, run:
232
269
 
233
270
  ```bash
234
271
  npx nx run adsp-sdk-mcp-server:eval-service-matching
235
272
  ```
236
273
 
237
- It prints a table and the number of queries with every expected service in the top 1, 3 and 5. It reports and does
238
- not fail. Use it to compare a ranking change, or a new matching tool, against the baseline. `src/eval/` is not part
274
+ It prints a table per tool and the number of queries with every expected service in the top 1, 3 and 5. It reports and
275
+ does not fail. `src/eval/serviceMatching.spec.ts` does fail when `find_adsp_services` ranks every expected service in
276
+ the top 2 for fewer than 90% of the queries. Use it to compare a ranking change, or a new matching tool, against the baseline. `src/eval/` is not part
239
277
  of the published package.
240
278
 
241
279
  ### Refresh workflow
242
280
 
243
281
  The bundled content is refreshed from source on every release, not fetched live. After changing `docs/`, a service's
244
- OpenAPI fragments or `swagger.config.js`, or `scripts/api-services.json`, run:
282
+ OpenAPI fragments or `swagger.config.js`, `scripts/api-services.json`, project-planner-service's specialists or patterns,
283
+ or the SDK's `registration.ts`, run:
245
284
 
246
285
  ```bash
247
286
  npx nx run adsp-sdk-mcp-server:sync-content
@@ -252,6 +291,9 @@ and commit what it changes in the same PR. In Claude Code, `/adsp-mcp-sync` does
252
291
  - **Docs.** The build copies `docs/**/*.md` into the package. `src/docs/docs-lock.json` fingerprints those pages, and
253
292
  `src/docs/docsLock.spec.ts` fails CI when `docs/` changes without it. `sync-content` updates it. The lock is inside this package, so the
254
293
  change releases it: `.releaserc.json` releases a patch for `docs` commits as well as `feat` and `fix`.
294
+ - **Capability catalog.** `src/capabilities/capabilities.spec.ts` fails CI when the planner's specialists or patterns,
295
+ `docs/services/services.md` or the SDK's registration change without regenerating `assets/capabilities.json`.
296
+ `sync-content` regenerates it. The generator also fails when the planner names a service the index doesn't list.
255
297
  - **SDK reference.** Maintained by hand, and checked against the SDK source (below).
256
298
  - **Provenance.** The `release` target runs `scripts/provenance.mjs` before publishing. It writes
257
299
  `provenance.json` into the package with the source commit, the last commit to `docs/`, the latest