@jini-ai/mcp 0.1.2 → 0.3.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.
Files changed (39) hide show
  1. package/README.md +124 -0
  2. package/dist/bin/serve.d.ts +25 -0
  3. package/dist/bin/serve.d.ts.map +1 -1
  4. package/dist/bin/serve.js +39 -0
  5. package/dist/bin/serve.js.map +1 -1
  6. package/dist/index.d.ts +4 -2
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +6 -2
  9. package/dist/index.js.map +1 -1
  10. package/dist/server/index.d.ts +5 -1
  11. package/dist/server/index.d.ts.map +1 -1
  12. package/dist/server/index.js +5 -1
  13. package/dist/server/index.js.map +1 -1
  14. package/dist/server/resources/active-resource.d.ts.map +1 -1
  15. package/dist/server/resources/active-resource.js +3 -2
  16. package/dist/server/resources/active-resource.js.map +1 -1
  17. package/dist/server/tool-protocol.d.ts +48 -9
  18. package/dist/server/tool-protocol.d.ts.map +1 -1
  19. package/dist/server/tool-protocol.js +142 -10
  20. package/dist/server/tool-protocol.js.map +1 -1
  21. package/dist/server/tool-server.d.ts +6 -0
  22. package/dist/server/tool-server.d.ts.map +1 -1
  23. package/dist/server/tool-server.js +1 -0
  24. package/dist/server/tool-server.js.map +1 -1
  25. package/dist/server/tools/component-catalog-tools.d.ts +8 -0
  26. package/dist/server/tools/component-catalog-tools.d.ts.map +1 -0
  27. package/dist/server/tools/component-catalog-tools.js +71 -0
  28. package/dist/server/tools/component-catalog-tools.js.map +1 -0
  29. package/dist/server/tools/delegated-tool.d.ts +39 -0
  30. package/dist/server/tools/delegated-tool.d.ts.map +1 -1
  31. package/dist/server/tools/delegated-tool.js +65 -4
  32. package/dist/server/tools/delegated-tool.js.map +1 -1
  33. package/dist/server/tools/run-tools.d.ts.map +1 -1
  34. package/dist/server/tools/run-tools.js +8 -8
  35. package/dist/server/tools/run-tools.js.map +1 -1
  36. package/dist/server/tools/tool-catalog-tools.d.ts.map +1 -1
  37. package/dist/server/tools/tool-catalog-tools.js +43 -9
  38. package/dist/server/tools/tool-catalog-tools.js.map +1 -1
  39. package/package.json +10 -5
@@ -2,7 +2,7 @@
2
2
  * @module @jini-ai/mcp/server/tools/tool-catalog-tools
3
3
  *
4
4
  * `search_tools` / `describe_tool` — the discovery half of `ai-control-plane.md` §29 /
5
- * `PROP-tool-catalog-discovery-2026-07-26.md` §6.1, proxying `@jini-ai/http`'s
5
+ * `PROP-tool-catalog-discovery-2026-07-26.md` §6.1, proxying `@jini-ai/http-kit`'s
6
6
  * `GET /api/tools/search` / `GET /api/tools/:id` exactly as `run-tools.ts`'s tools proxy
7
7
  * `runs.ts` — no separate authorization mechanism, no caching, no state.
8
8
  *
@@ -12,7 +12,7 @@
12
12
  * Finding a tool id here grants nothing (`PROP` §6.3).
13
13
  */
14
14
  import { getDaemonJson } from '../daemon-client.js';
15
- import { requireString } from '../tool-protocol.js';
15
+ import { daemonCallOptions, requireString } from '../tool-protocol.js';
16
16
  const READ_ANNOTATIONS = {
17
17
  readOnlyHint: true,
18
18
  idempotentHint: true,
@@ -21,12 +21,48 @@ const READ_ANNOTATIONS = {
21
21
  /** `search_tools` -> `GET /api/tools/search` (`packages/http/src/tool-catalog.ts`'s `toolCatalogSearchRoute`). */
22
22
  export const searchToolsTool = {
23
23
  name: 'search_tools',
24
- description: 'Search the durable tool catalog by keyword. Returns ranked {id, description, source, score} candidates only — no input schemas, so this stays cheap to call broadly. Call describe_tool on the 1-3 candidates that look right before calling execute_delegated_tool.',
24
+ description: 'Search the durable tool catalog. Returns ranked {id, description, source, score} candidates only — no input schemas, so this stays cheap to call broadly. Call describe_tool on the 1-3 candidates that look right before calling execute_delegated_tool. If nothing in the results fits, re-search with a higher limit or different phrasing rather than assuming the tool does not exist.',
25
25
  inputSchema: {
26
26
  type: 'object',
27
27
  properties: {
28
- query: { type: 'string', description: 'Keywords to search for, e.g. "navigate page" or "fill form". Required.' },
29
- limit: { type: 'number', description: 'Max hits to return (1-25). Optional, defaults to 10.' },
28
+ // Descriptive phrasing, NOT keywords and the example matters as much as the instruction.
29
+ // The catalog is matched on tool *descriptions* (BM25 over description text), so a query
30
+ // written in the register of a description retrieves far better than a keyword bag. Measured
31
+ // on an independent n=130 blind set: terse keywords 25% top-1, descriptive phrasing 72%.
32
+ // This field previously read 'Keywords to search for, e.g. "navigate page" or "fill form"',
33
+ // which is the 25% form. It also directly contradicted the descriptive guidance a host server
34
+ // may inject upstream (a host's agent-daemon systemOverlay said the opposite), so a caller was
35
+ // given two conflicting instructions — with this one sitting on the parameter itself, read at
36
+ // the moment the query is composed.
37
+ //
38
+ // NOT measured: which instruction won. The hypothesis was that a two-word example outranks
39
+ // prose guidance, but the conflict was removed before anyone measured it, so treat that as
40
+ // untested rather than established. What IS measured, on the coherent state after this fix:
41
+ // 35/35 real search_tools calls across 24 live CLI sessions used descriptive phrasing.
42
+ // Keep the example long-form; shortening it re-creates the 25% form.
43
+ query: {
44
+ type: 'string',
45
+ description: 'Describe what the tool you need DOES, the way its own documentation would describe it — a full phrase, not a keyword bag. Name the thing being acted on and the action, and include likely synonyms for both. Example: for a request like "how many people visited last week", write "retrieve site traffic and visitor analytics counts for a date range" rather than "visitors last week". Descriptive phrasing retrieves substantially better than terse keywords, because the catalog is matched on tool descriptions. Required.',
46
+ },
47
+ // Bounds mirror `packages/http-kit/src/tool-catalog.ts`'s `parseSearchInput`
48
+ // exactly (`MAX_SEARCH_LIMIT = 25`, `DEFAULT_SEARCH_LIMIT = 10`, integers only,
49
+ // `>= 1`). Declared rather than left as a bare `number` so MCP validation and the
50
+ // route agree: otherwise `0`/`1.5` pass here and are refused downstream, and `26`
51
+ // passes here and is silently clamped — the caller is told one contract and given
52
+ // another.
53
+ // The escalation clause is the cheap half of a measured ceiling. On the same n=130 blind set,
54
+ // with the host's operator-vocabulary + doc2query index folded in, the right tool is in the
55
+ // default top 10 for 98% of cases and in the top 20 for 100% — so the residual misses are
56
+ // ranked just below the cutoff, never absent. Raising the DEFAULT to 20 would buy those 2
57
+ // cases at ~900 extra tokens on every single call; telling the caller to escalate on demand
58
+ // buys the same ceiling only when it is needed. Same lever as the descriptive-phrasing fix
59
+ // above: a prompt change, not an LLM call.
60
+ limit: {
61
+ type: 'integer',
62
+ minimum: 1,
63
+ maximum: 25,
64
+ description: 'Max hits to return (1-25). Optional, defaults to 10. If none of the returned candidates fit what you need, search again with a HIGHER limit (try 25) before concluding no tool exists — the right tool is in the top 10 about 98% of the time and in the top 20 100% of the time, so a near-miss is ranked just below the default cutoff rather than missing.',
65
+ },
30
66
  },
31
67
  required: ['query'],
32
68
  additionalProperties: false,
@@ -37,9 +73,7 @@ export const searchToolsTool = {
37
73
  const params = new URLSearchParams({ q: args.query });
38
74
  if (typeof args.limit === 'number')
39
75
  params.set('limit', String(args.limit));
40
- const data = await getDaemonJson(ctx.baseUrl, `/api/tools/search?${params.toString()}`, {
41
- fetchImpl: ctx.fetchImpl,
42
- });
76
+ const data = await getDaemonJson(ctx.baseUrl, `/api/tools/search?${params.toString()}`, daemonCallOptions(ctx));
43
77
  return data.hits;
44
78
  },
45
79
  };
@@ -58,7 +92,7 @@ export const describeToolTool = {
58
92
  annotations: { ...READ_ANNOTATIONS, title: 'Describe a tool' },
59
93
  handler: async (args, ctx) => {
60
94
  requireString(args.id, 'id');
61
- return getDaemonJson(ctx.baseUrl, `/api/tools/${encodeURIComponent(args.id)}`, { fetchImpl: ctx.fetchImpl });
95
+ return getDaemonJson(ctx.baseUrl, `/api/tools/${encodeURIComponent(args.id)}`, daemonCallOptions(ctx));
62
96
  },
63
97
  };
64
98
  /** Both tool-catalog discovery tools, ready to pass as `createMcpToolServer`'s `tools` option. */
@@ -1 +1 @@
1
- {"version":3,"file":"tool-catalog-tools.js","sourceRoot":"","sources":["../../../src/server/tools/tool-catalog-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,aAA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E,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC;QAC3I,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;CACF,CAAC;AAEF,kHAAkH;AAClH,MAAM,CAAC,MAAM,gBAAgB,GAAe;IAC1C,IAAI,EAAE,eAAe;IACrB,WAAW,EACT,sMAAsM;IACxM,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6CAA6C,EAAE;SACnF;QACD,QAAQ,EAAE,CAAC,IAAI,CAAC;QAChB,oBAAoB,EAAE,KAAK;KAC5B;IACD,WAAW,EAAE,EAAE,GAAG,gBAAgB,EAAE,KAAK,EAAE,iBAAiB,EAAE;IAC9D,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;QAC3B,aAAa,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;QAC7B,OAAO,aAAa,CAAC,GAAG,CAAC,OAAO,EAAE,cAAc,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC;IACzG,CAAC;CACF,CAAC;AAEF,kGAAkG;AAClG,MAAM,CAAC,MAAM,kBAAkB,GAA0B,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@jini-ai/mcp",
3
- "version": "0.1.2",
3
+ "version": "0.3.0",
4
+ "description": "Model Context Protocol adapters: server config schema and IO, an MCP client, and agent-side MCP server installation.",
4
5
  "license": "Apache-2.0",
5
6
  "repository": {
6
7
  "type": "git",
@@ -10,10 +11,10 @@
10
11
  "jini": {
11
12
  "domain": "integration",
12
13
  "kind": "protocol-adapter",
13
- "runtime": "node",
14
- "admission": "incubating"
14
+ "runtime": "node"
15
15
  },
16
16
  "type": "module",
17
+ "sideEffects": false,
17
18
  "main": "./dist/index.js",
18
19
  "types": "./dist/index.d.ts",
19
20
  "exports": {
@@ -21,6 +22,9 @@
21
22
  "types": "./dist/index.d.ts",
22
23
  "import": "./dist/index.js",
23
24
  "default": "./dist/index.js"
25
+ },
26
+ "./bin": {
27
+ "default": "./dist/bin/serve.js"
24
28
  }
25
29
  },
26
30
  "bin": {
@@ -39,10 +43,11 @@
39
43
  "registry": "https://registry.npmjs.org"
40
44
  },
41
45
  "dependencies": {
46
+ "@cfworker/json-schema": "^4.1.1",
42
47
  "@modelcontextprotocol/sdk": "^1.29.0",
43
48
  "undici": "^7.25.0",
44
- "@jini-ai/cli": "0.1.2",
45
- "@jini-ai/platform": "0.1.2"
49
+ "@jini-ai/cli": "0.3.0",
50
+ "@jini-ai/platform": "0.3.0"
46
51
  },
47
52
  "scripts": {
48
53
  "build": "tsc -p tsconfig.json && chmod +x dist/bin/serve.js",