@namzu/sdk 39.0.0 → 41.0.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 (289) hide show
  1. package/CHANGELOG.md +328 -0
  2. package/dist/bridge/a2a/mapper.d.ts.map +1 -1
  3. package/dist/bridge/a2a/mapper.js +8 -0
  4. package/dist/bridge/a2a/mapper.js.map +1 -1
  5. package/dist/bridge/sse/mapper.d.ts.map +1 -1
  6. package/dist/bridge/sse/mapper.js +11 -0
  7. package/dist/bridge/sse/mapper.js.map +1 -1
  8. package/dist/connector/index.d.ts +2 -2
  9. package/dist/connector/index.d.ts.map +1 -1
  10. package/dist/connector/index.js +1 -1
  11. package/dist/connector/index.js.map +1 -1
  12. package/dist/connector/mcp/adapter.d.ts.map +1 -1
  13. package/dist/connector/mcp/adapter.js +112 -10
  14. package/dist/connector/mcp/adapter.js.map +1 -1
  15. package/dist/connector/mcp/audio-admission.d.ts +17 -0
  16. package/dist/connector/mcp/audio-admission.d.ts.map +1 -0
  17. package/dist/connector/mcp/audio-admission.js +171 -0
  18. package/dist/connector/mcp/audio-admission.js.map +1 -0
  19. package/dist/connector/mcp/client.d.ts +252 -1
  20. package/dist/connector/mcp/client.d.ts.map +1 -1
  21. package/dist/connector/mcp/client.js +611 -39
  22. package/dist/connector/mcp/client.js.map +1 -1
  23. package/dist/connector/mcp/envelope.d.ts +91 -0
  24. package/dist/connector/mcp/envelope.d.ts.map +1 -0
  25. package/dist/connector/mcp/envelope.js +173 -0
  26. package/dist/connector/mcp/envelope.js.map +1 -0
  27. package/dist/connector/mcp/era.d.ts +130 -0
  28. package/dist/connector/mcp/era.d.ts.map +1 -0
  29. package/dist/connector/mcp/era.js +304 -0
  30. package/dist/connector/mcp/era.js.map +1 -0
  31. package/dist/connector/mcp/errors.d.ts +106 -0
  32. package/dist/connector/mcp/errors.d.ts.map +1 -0
  33. package/dist/connector/mcp/errors.js +154 -0
  34. package/dist/connector/mcp/errors.js.map +1 -0
  35. package/dist/connector/mcp/http-sse.d.ts +11 -0
  36. package/dist/connector/mcp/http-sse.d.ts.map +1 -1
  37. package/dist/connector/mcp/http-sse.js +21 -6
  38. package/dist/connector/mcp/http-sse.js.map +1 -1
  39. package/dist/connector/mcp/index.d.ts +7 -0
  40. package/dist/connector/mcp/index.d.ts.map +1 -1
  41. package/dist/connector/mcp/index.js +10 -0
  42. package/dist/connector/mcp/index.js.map +1 -1
  43. package/dist/connector/mcp/streamable-http.d.ts +83 -0
  44. package/dist/connector/mcp/streamable-http.d.ts.map +1 -1
  45. package/dist/connector/mcp/streamable-http.js +177 -11
  46. package/dist/connector/mcp/streamable-http.js.map +1 -1
  47. package/dist/connector/mcp/x-mcp-header.d.ts +56 -0
  48. package/dist/connector/mcp/x-mcp-header.d.ts.map +1 -0
  49. package/dist/connector/mcp/x-mcp-header.js +254 -0
  50. package/dist/connector/mcp/x-mcp-header.js.map +1 -0
  51. package/dist/constants/mcp/index.d.ts +123 -15
  52. package/dist/constants/mcp/index.d.ts.map +1 -1
  53. package/dist/constants/mcp/index.js +135 -16
  54. package/dist/constants/mcp/index.js.map +1 -1
  55. package/dist/manager/agent/lifecycle.d.ts.map +1 -1
  56. package/dist/manager/agent/lifecycle.js +23 -0
  57. package/dist/manager/agent/lifecycle.js.map +1 -1
  58. package/dist/manager/run/persistence.d.ts +8 -0
  59. package/dist/manager/run/persistence.d.ts.map +1 -1
  60. package/dist/manager/run/persistence.js +12 -0
  61. package/dist/manager/run/persistence.js.map +1 -1
  62. package/dist/prompt/coding-agent-doctrine.d.ts +20 -0
  63. package/dist/prompt/coding-agent-doctrine.d.ts.map +1 -1
  64. package/dist/prompt/coding-agent-doctrine.js +19 -3
  65. package/dist/prompt/coding-agent-doctrine.js.map +1 -1
  66. package/dist/prompt/index.d.ts +1 -1
  67. package/dist/prompt/index.d.ts.map +1 -1
  68. package/dist/prompt/index.js +1 -1
  69. package/dist/prompt/index.js.map +1 -1
  70. package/dist/public-runtime.d.ts +6 -4
  71. package/dist/public-runtime.d.ts.map +1 -1
  72. package/dist/public-runtime.js +8 -4
  73. package/dist/public-runtime.js.map +1 -1
  74. package/dist/public-tools.d.ts +11 -0
  75. package/dist/public-tools.d.ts.map +1 -1
  76. package/dist/public-tools.js +14 -0
  77. package/dist/public-tools.js.map +1 -1
  78. package/dist/registry/tool/execute.d.ts.map +1 -1
  79. package/dist/registry/tool/execute.js +2 -3
  80. package/dist/registry/tool/execute.js.map +1 -1
  81. package/dist/registry/tool/portable.d.ts +65 -0
  82. package/dist/registry/tool/portable.d.ts.map +1 -0
  83. package/dist/registry/tool/portable.js +244 -0
  84. package/dist/registry/tool/portable.js.map +1 -0
  85. package/dist/registry/tool/schema.d.ts +32 -5
  86. package/dist/registry/tool/schema.d.ts.map +1 -1
  87. package/dist/registry/tool/schema.js +35 -9
  88. package/dist/registry/tool/schema.js.map +1 -1
  89. package/dist/registry/toolset/catalog.js +8 -8
  90. package/dist/registry/toolset/catalog.js.map +1 -1
  91. package/dist/runtime/jobs/awaited-jobs.d.ts +215 -0
  92. package/dist/runtime/jobs/awaited-jobs.d.ts.map +1 -0
  93. package/dist/runtime/jobs/awaited-jobs.js +259 -0
  94. package/dist/runtime/jobs/awaited-jobs.js.map +1 -0
  95. package/dist/runtime/jobs/registry.d.ts +33 -2
  96. package/dist/runtime/jobs/registry.d.ts.map +1 -1
  97. package/dist/runtime/jobs/registry.js +37 -0
  98. package/dist/runtime/jobs/registry.js.map +1 -1
  99. package/dist/runtime/query/executor.d.ts +28 -0
  100. package/dist/runtime/query/executor.d.ts.map +1 -1
  101. package/dist/runtime/query/executor.js +39 -1
  102. package/dist/runtime/query/executor.js.map +1 -1
  103. package/dist/runtime/query/file-evidence-context.d.ts.map +1 -1
  104. package/dist/runtime/query/file-evidence-context.js +159 -43
  105. package/dist/runtime/query/file-evidence-context.js.map +1 -1
  106. package/dist/runtime/query/file-evidence-replay.d.ts +260 -0
  107. package/dist/runtime/query/file-evidence-replay.d.ts.map +1 -0
  108. package/dist/runtime/query/file-evidence-replay.js +647 -0
  109. package/dist/runtime/query/file-evidence-replay.js.map +1 -0
  110. package/dist/runtime/query/file-evidence-seed.d.ts +50 -0
  111. package/dist/runtime/query/file-evidence-seed.d.ts.map +1 -0
  112. package/dist/runtime/query/file-evidence-seed.js +100 -0
  113. package/dist/runtime/query/file-evidence-seed.js.map +1 -0
  114. package/dist/runtime/query/index.d.ts.map +1 -1
  115. package/dist/runtime/query/index.js +94 -2
  116. package/dist/runtime/query/index.js.map +1 -1
  117. package/dist/runtime/query/iteration/index.d.ts +87 -9
  118. package/dist/runtime/query/iteration/index.d.ts.map +1 -1
  119. package/dist/runtime/query/iteration/index.js +193 -28
  120. package/dist/runtime/query/iteration/index.js.map +1 -1
  121. package/dist/runtime/query/iteration/phases/context.d.ts +10 -0
  122. package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
  123. package/dist/runtime/query/iteration/phases/context.js.map +1 -1
  124. package/dist/runtime/query/iteration/phases/tool-review.d.ts.map +1 -1
  125. package/dist/runtime/query/iteration/phases/tool-review.js +5 -1
  126. package/dist/runtime/query/iteration/phases/tool-review.js.map +1 -1
  127. package/dist/runtime/query/plugin-hooks.d.ts +14 -0
  128. package/dist/runtime/query/plugin-hooks.d.ts.map +1 -1
  129. package/dist/runtime/query/plugin-hooks.js +18 -0
  130. package/dist/runtime/query/plugin-hooks.js.map +1 -1
  131. package/dist/runtime/query/repeat-call.d.ts +17 -4
  132. package/dist/runtime/query/repeat-call.d.ts.map +1 -1
  133. package/dist/runtime/query/repeat-call.js +26 -19
  134. package/dist/runtime/query/repeat-call.js.map +1 -1
  135. package/dist/runtime/query/steering.d.ts +11 -1
  136. package/dist/runtime/query/steering.d.ts.map +1 -1
  137. package/dist/runtime/query/steering.js +12 -1
  138. package/dist/runtime/query/steering.js.map +1 -1
  139. package/dist/runtime/query/tooling.d.ts +2 -0
  140. package/dist/runtime/query/tooling.d.ts.map +1 -1
  141. package/dist/runtime/query/tooling.js +1 -0
  142. package/dist/runtime/query/tooling.js.map +1 -1
  143. package/dist/sandbox/provider/local.d.ts.map +1 -1
  144. package/dist/sandbox/provider/local.js +46 -3
  145. package/dist/sandbox/provider/local.js.map +1 -1
  146. package/dist/scheduler/completion-inbox.d.ts +48 -2
  147. package/dist/scheduler/completion-inbox.d.ts.map +1 -1
  148. package/dist/scheduler/completion-inbox.js +102 -10
  149. package/dist/scheduler/completion-inbox.js.map +1 -1
  150. package/dist/scheduler/local.d.ts.map +1 -1
  151. package/dist/scheduler/local.js +8 -0
  152. package/dist/scheduler/local.js.map +1 -1
  153. package/dist/store/run/disk.d.ts +35 -1
  154. package/dist/store/run/disk.d.ts.map +1 -1
  155. package/dist/store/run/disk.js +100 -0
  156. package/dist/store/run/disk.js.map +1 -1
  157. package/dist/tools/builtins/bash.d.ts.map +1 -1
  158. package/dist/tools/builtins/bash.js +4 -10
  159. package/dist/tools/builtins/bash.js.map +1 -1
  160. package/dist/tools/builtins/edit-apply.d.ts +126 -0
  161. package/dist/tools/builtins/edit-apply.d.ts.map +1 -0
  162. package/dist/tools/builtins/edit-apply.js +360 -0
  163. package/dist/tools/builtins/edit-apply.js.map +1 -0
  164. package/dist/tools/builtins/edit.d.ts +143 -1
  165. package/dist/tools/builtins/edit.d.ts.map +1 -1
  166. package/dist/tools/builtins/edit.js +37 -219
  167. package/dist/tools/builtins/edit.js.map +1 -1
  168. package/dist/tools/builtins/index.d.ts +1 -0
  169. package/dist/tools/builtins/index.d.ts.map +1 -1
  170. package/dist/tools/builtins/index.js +9 -3
  171. package/dist/tools/builtins/index.js.map +1 -1
  172. package/dist/tools/builtins/job.js +1 -1
  173. package/dist/tools/builtins/job.js.map +1 -1
  174. package/dist/tools/builtins/read-file.d.ts +2 -2
  175. package/dist/tools/builtins/read-file.d.ts.map +1 -1
  176. package/dist/tools/builtins/read-file.js +50 -65
  177. package/dist/tools/builtins/read-file.js.map +1 -1
  178. package/dist/tools/builtins/read-render.d.ts +56 -0
  179. package/dist/tools/builtins/read-render.d.ts.map +1 -0
  180. package/dist/tools/builtins/read-render.js +73 -0
  181. package/dist/tools/builtins/read-render.js.map +1 -0
  182. package/dist/tools/builtins/wait-for-job-bounds.d.ts +67 -0
  183. package/dist/tools/builtins/wait-for-job-bounds.d.ts.map +1 -0
  184. package/dist/tools/builtins/wait-for-job-bounds.js +108 -0
  185. package/dist/tools/builtins/wait-for-job-bounds.js.map +1 -0
  186. package/dist/tools/builtins/wait-for-job.d.ts +6 -0
  187. package/dist/tools/builtins/wait-for-job.d.ts.map +1 -0
  188. package/dist/tools/builtins/wait-for-job.js +162 -0
  189. package/dist/tools/builtins/wait-for-job.js.map +1 -0
  190. package/dist/tools/builtins/write-file.js +5 -0
  191. package/dist/tools/builtins/write-file.js.map +1 -1
  192. package/dist/tools/coordinator/index.d.ts.map +1 -1
  193. package/dist/tools/coordinator/index.js +1 -7
  194. package/dist/tools/coordinator/index.js.map +1 -1
  195. package/dist/tools/file-read-tracker.d.ts.map +1 -1
  196. package/dist/tools/file-read-tracker.js +88 -10
  197. package/dist/tools/file-read-tracker.js.map +1 -1
  198. package/dist/types/agent/scheduler.d.ts +20 -0
  199. package/dist/types/agent/scheduler.d.ts.map +1 -1
  200. package/dist/types/agent/task.d.ts +20 -0
  201. package/dist/types/agent/task.d.ts.map +1 -1
  202. package/dist/types/connector/mcp.d.ts +205 -0
  203. package/dist/types/connector/mcp.d.ts.map +1 -1
  204. package/dist/types/message/index.d.ts +1 -1
  205. package/dist/types/message/index.d.ts.map +1 -1
  206. package/dist/types/message/index.js +2 -0
  207. package/dist/types/message/index.js.map +1 -1
  208. package/dist/types/run/entity.d.ts +13 -0
  209. package/dist/types/run/entity.d.ts.map +1 -1
  210. package/dist/types/run/events.d.ts +56 -0
  211. package/dist/types/run/events.d.ts.map +1 -1
  212. package/dist/types/run/events.js.map +1 -1
  213. package/dist/types/run/store.d.ts +41 -0
  214. package/dist/types/run/store.d.ts.map +1 -1
  215. package/dist/types/sandbox/index.d.ts +83 -15
  216. package/dist/types/sandbox/index.d.ts.map +1 -1
  217. package/dist/types/sandbox/index.js.map +1 -1
  218. package/dist/types/tool/index.d.ts +109 -0
  219. package/dist/types/tool/index.d.ts.map +1 -1
  220. package/dist/types/tool/index.js.map +1 -1
  221. package/dist/utils/env.d.ts +19 -0
  222. package/dist/utils/env.d.ts.map +1 -0
  223. package/dist/utils/env.js +25 -0
  224. package/dist/utils/env.js.map +1 -0
  225. package/package.json +1 -1
  226. package/src/bridge/a2a/mapper.ts +8 -0
  227. package/src/bridge/sse/mapper.ts +11 -0
  228. package/src/connector/index.ts +27 -0
  229. package/src/connector/mcp/adapter.ts +123 -10
  230. package/src/connector/mcp/audio-admission.ts +173 -0
  231. package/src/connector/mcp/client.ts +694 -45
  232. package/src/connector/mcp/envelope.ts +235 -0
  233. package/src/connector/mcp/era.ts +400 -0
  234. package/src/connector/mcp/errors.ts +171 -0
  235. package/src/connector/mcp/http-sse.ts +23 -6
  236. package/src/connector/mcp/index.ts +37 -0
  237. package/src/connector/mcp/streamable-http.ts +199 -11
  238. package/src/connector/mcp/x-mcp-header.ts +322 -0
  239. package/src/constants/mcp/index.ts +145 -16
  240. package/src/manager/agent/lifecycle.ts +29 -0
  241. package/src/manager/run/persistence.ts +12 -0
  242. package/src/prompt/coding-agent-doctrine.ts +31 -4
  243. package/src/prompt/index.ts +1 -0
  244. package/src/public-runtime.ts +37 -1
  245. package/src/public-tools.ts +18 -0
  246. package/src/registry/tool/execute.ts +2 -4
  247. package/src/registry/tool/portable.ts +264 -0
  248. package/src/registry/tool/schema.ts +38 -8
  249. package/src/registry/toolset/catalog.ts +8 -9
  250. package/src/runtime/jobs/awaited-jobs.ts +271 -0
  251. package/src/runtime/jobs/registry.ts +50 -0
  252. package/src/runtime/query/executor.ts +49 -1
  253. package/src/runtime/query/file-evidence-context.ts +190 -46
  254. package/src/runtime/query/file-evidence-replay.ts +776 -0
  255. package/src/runtime/query/file-evidence-seed.ts +126 -0
  256. package/src/runtime/query/index.ts +104 -2
  257. package/src/runtime/query/iteration/index.ts +202 -28
  258. package/src/runtime/query/iteration/phases/context.ts +10 -0
  259. package/src/runtime/query/iteration/phases/tool-review.ts +4 -0
  260. package/src/runtime/query/plugin-hooks.ts +20 -0
  261. package/src/runtime/query/repeat-call.ts +28 -18
  262. package/src/runtime/query/steering.ts +11 -0
  263. package/src/runtime/query/tooling.ts +3 -0
  264. package/src/sandbox/provider/local.ts +45 -2
  265. package/src/scheduler/completion-inbox.ts +105 -9
  266. package/src/scheduler/local.ts +8 -0
  267. package/src/store/run/disk.ts +108 -0
  268. package/src/tools/builtins/bash.ts +4 -10
  269. package/src/tools/builtins/edit-apply.ts +456 -0
  270. package/src/tools/builtins/edit.ts +39 -270
  271. package/src/tools/builtins/index.ts +9 -3
  272. package/src/tools/builtins/job.ts +1 -1
  273. package/src/tools/builtins/read-file.ts +56 -77
  274. package/src/tools/builtins/read-render.ts +104 -0
  275. package/src/tools/builtins/wait-for-job-bounds.ts +179 -0
  276. package/src/tools/builtins/wait-for-job.ts +184 -0
  277. package/src/tools/builtins/write-file.ts +5 -0
  278. package/src/tools/coordinator/index.ts +1 -7
  279. package/src/tools/file-read-tracker.ts +85 -7
  280. package/src/types/agent/scheduler.ts +21 -0
  281. package/src/types/agent/task.ts +21 -0
  282. package/src/types/connector/mcp.ts +205 -1
  283. package/src/types/message/index.ts +2 -0
  284. package/src/types/run/entity.ts +14 -0
  285. package/src/types/run/events.ts +56 -0
  286. package/src/types/run/store.ts +42 -0
  287. package/src/types/sandbox/index.ts +84 -15
  288. package/src/types/tool/index.ts +104 -0
  289. package/src/utils/env.ts +23 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"x-mcp-header.d.ts","sourceRoot":"","sources":["../../../src/connector/mcp/x-mcp-header.ts"],"names":[],"mappings":"AAgDA;;;;;;;;GAQG;AACH,MAAM,WAAW,qBAAqB;IACrC,iEAAiE;IACjE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,2EAA2E;IAC3E,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;IAChC,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAA;CAC/C;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,0BAA0B,GACnC;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,qBAAqB,EAAE,CAAA;CAAE,GAC1E;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AA0HlD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,4BAA4B,CAAC,WAAW,EAAE,OAAO,GAAG,0BAA0B,CA4D7F;AAgCD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CACnC,QAAQ,EAAE,SAAS,qBAAqB,EAAE,EAC1C,IAAI,EAAE,OAAO,GACX,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAOxB"}
@@ -0,0 +1,254 @@
1
+ import { MCP_PARAM_HEADER_PREFIX } from '../../constants/mcp/index.js';
2
+ /**
3
+ * The extension property a server writes into a tool parameter's schema to
4
+ * ask that the parameter's value be mirrored into an HTTP request header.
5
+ *
6
+ * Its value is the NAME PORTION of `Mcp-Param-{name}`, so an annotation
7
+ * reading `"Region"` produces `Mcp-Param-Region`. The point of mirroring is
8
+ * that a load balancer or a policy proxy can route and authorise a tool call
9
+ * without parsing JSON-RPC — which is also why a malformed annotation is not
10
+ * a cosmetic problem: a value carrying a line feed would end the field and
11
+ * let a server's own tool definition inject a header namzu never wrote.
12
+ */
13
+ const X_MCP_HEADER = 'x-mcp-header';
14
+ /**
15
+ * HTTP field-name token syntax — RFC 9110 §5.1 `1*tchar`.
16
+ *
17
+ * Non-emptiness (`+`), the absence of CR, LF and every other control
18
+ * character, and the absence of spaces and separators all fall out of this
19
+ * one expression. They are still checked separately below, in the order the
20
+ * spec lists them, so a refusal names the constraint that was actually
21
+ * broken rather than the most general one that happens to cover it.
22
+ */
23
+ const FIELD_NAME_TOKEN = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
24
+ /** The JSON Schema keywords whose value is a MAP of schemas, not a schema. */
25
+ const SCHEMA_MAP_KEYWORDS = new Set([
26
+ 'properties',
27
+ 'patternProperties',
28
+ '$defs',
29
+ 'definitions',
30
+ 'dependentSchemas',
31
+ ]);
32
+ /**
33
+ * Keywords holding INSTANCE data rather than sub-schemas.
34
+ *
35
+ * Never descended into. A `default` of `{ "x-mcp-header": "X" }` is a
36
+ * perfectly ordinary example value for an object-typed parameter, and
37
+ * reading it as an annotation would refuse a tool over a string that was
38
+ * never a schema at all.
39
+ */
40
+ const INSTANCE_VALUE_KEYWORDS = new Set(['default', 'examples', 'example', 'const', 'enum']);
41
+ /** The parameter types a value may be mirrored from. `number` is excluded. */
42
+ const MIRRORABLE_TYPES = new Set(['string', 'boolean', 'integer']);
43
+ const NO_BINDINGS = { ok: true, bindings: [] };
44
+ function isPlainObject(value) {
45
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
46
+ }
47
+ /**
48
+ * Every property reachable from the root through `properties` keys ALONE,
49
+ * mapped to its path.
50
+ *
51
+ * This is the whole of the static-reachability rule, and writing it as its
52
+ * own walk is deliberate. The tempting implementation — resolve `$ref`s and
53
+ * flatten `allOf` first, then walk the result — accepts exactly what the
54
+ * spec forbids: a property reached through a `$ref` looks like an ordinary
55
+ * `properties` child once the reference has been followed. This walk never
56
+ * follows one, so a `$ref`-reached annotation simply is not in this map.
57
+ */
58
+ function reachableByProperties(root) {
59
+ const reachable = new Map();
60
+ // A schema is JSON and so is usually a tree, but nothing stops a caller
61
+ // building one with a shared (or cyclic) node in it, and this walk is
62
+ // depth-first.
63
+ const seen = new Set([root]);
64
+ const walk = (node, path) => {
65
+ const properties = node.properties;
66
+ if (!isPlainObject(properties))
67
+ return;
68
+ for (const [key, child] of Object.entries(properties)) {
69
+ if (!isPlainObject(child) || seen.has(child))
70
+ continue;
71
+ seen.add(child);
72
+ const childPath = [...path, key];
73
+ reachable.set(child, childPath);
74
+ walk(child, childPath);
75
+ }
76
+ };
77
+ walk(root, []);
78
+ return reachable;
79
+ }
80
+ /**
81
+ * Every `x-mcp-header` in the schema, wherever it sits.
82
+ *
83
+ * Deliberately a whole-schema scan rather than a scan of the reachable
84
+ * properties: an annotation under `items`, inside a `oneOf` branch or in
85
+ * `$defs` is not something to ignore, it is something that invalidates the
86
+ * tool. Finding only the reachable ones would silently admit exactly the
87
+ * definitions the spec says to refuse.
88
+ *
89
+ * The walk knows which keywords hold a MAP of schemas so that a parameter
90
+ * legitimately NAMED `x-mcp-header` is not mistaken for an annotation on the
91
+ * map that holds it, and refuses to descend into keywords holding instance
92
+ * data. Everything else is descended into generically, because a vendor
93
+ * keyword can nest a schema and an annotation buried in one is still
94
+ * unreachable and still invalid.
95
+ */
96
+ function annotationsIn(root) {
97
+ const reachable = reachableByProperties(root);
98
+ const found = [];
99
+ const seen = new Set();
100
+ const visit = (node, where) => {
101
+ if (Array.isArray(node)) {
102
+ node.forEach((item, index) => visit(item, `${where}[${index}]`));
103
+ return;
104
+ }
105
+ if (!isPlainObject(node) || seen.has(node))
106
+ return;
107
+ seen.add(node);
108
+ if (Object.hasOwn(node, X_MCP_HEADER)) {
109
+ found.push({
110
+ value: node[X_MCP_HEADER],
111
+ where: where === '' ? 'the schema root' : where,
112
+ path: reachable.get(node),
113
+ declaredType: node.type,
114
+ });
115
+ }
116
+ for (const [key, child] of Object.entries(node)) {
117
+ if (key === X_MCP_HEADER || INSTANCE_VALUE_KEYWORDS.has(key))
118
+ continue;
119
+ const childWhere = where === '' ? key : `${where}.${key}`;
120
+ if (SCHEMA_MAP_KEYWORDS.has(key)) {
121
+ if (!isPlainObject(child))
122
+ continue;
123
+ for (const [name, schema] of Object.entries(child))
124
+ visit(schema, `${childWhere}.${name}`);
125
+ continue;
126
+ }
127
+ visit(child, childWhere);
128
+ }
129
+ };
130
+ visit(root, '');
131
+ return found;
132
+ }
133
+ /** A value quoted into a refusal without carrying its control bytes along. */
134
+ function quoted(value) {
135
+ return typeof value === 'string' ? JSON.stringify(value) : String(value);
136
+ }
137
+ function describeType(declared) {
138
+ if (declared === undefined)
139
+ return 'a parameter with no declared `type`';
140
+ if (typeof declared !== 'string')
141
+ return `a parameter whose \`type\` is ${quoted(declared)}`;
142
+ return `a \`${declared}\` parameter`;
143
+ }
144
+ function refuse(reason) {
145
+ return { ok: false, reason };
146
+ }
147
+ /**
148
+ * Decide whether a tool may be exposed, and collect what it asked to mirror.
149
+ *
150
+ * The six constraints, in the spec's own order: non-empty; HTTP field-name
151
+ * token syntax; no control characters; case-insensitively unique across the
152
+ * whole `inputSchema`; applied only to `string`, `boolean` or `integer`
153
+ * (never `number`); and statically reachable through a chain of `properties`
154
+ * keys alone.
155
+ *
156
+ * Returns a REASON rather than throwing, because the caller's job is to drop
157
+ * one tool and keep the rest: a listing where one definition is malformed
158
+ * must still deliver the others, and an exception here would take the whole
159
+ * listing down with it.
160
+ */
161
+ export function validateMcpHeaderAnnotations(inputSchema) {
162
+ if (!isPlainObject(inputSchema))
163
+ return NO_BINDINGS;
164
+ const found = annotationsIn(inputSchema);
165
+ if (found.length === 0)
166
+ return NO_BINDINGS;
167
+ const bindings = [];
168
+ /** Lowercased name to the spelling that claimed it first. */
169
+ const claimed = new Map();
170
+ for (const annotation of found) {
171
+ const at = `at ${annotation.where}`;
172
+ const name = annotation.value;
173
+ if (typeof name !== 'string') {
174
+ return refuse(`\`x-mcp-header\` ${at} is ${quoted(name)}, which is not a string`);
175
+ }
176
+ if (name.length === 0) {
177
+ return refuse(`\`x-mcp-header\` ${at} is empty`);
178
+ }
179
+ if (/[\r\n]/.test(name)) {
180
+ return refuse(`\`x-mcp-header\` ${quoted(name)} ${at} contains a carriage return or line feed`);
181
+ }
182
+ if (!FIELD_NAME_TOKEN.test(name)) {
183
+ return refuse(`\`x-mcp-header\` ${quoted(name)} ${at} is not HTTP field-name token syntax (RFC 9110 1*tchar)`);
184
+ }
185
+ const first = claimed.get(name.toLowerCase());
186
+ if (first !== undefined) {
187
+ return refuse(`\`x-mcp-header\` ${quoted(name)} ${at} repeats ${quoted(first)}; header names are compared without regard to case`);
188
+ }
189
+ claimed.set(name.toLowerCase(), name);
190
+ if (annotation.path === undefined) {
191
+ return refuse(`\`x-mcp-header\` ${quoted(name)} ${at} is not statically reachable: the chain from the schema root must consist solely of \`properties\` keys`);
192
+ }
193
+ const declared = annotation.declaredType;
194
+ if (typeof declared !== 'string' || !MIRRORABLE_TYPES.has(declared)) {
195
+ return refuse(`\`x-mcp-header\` ${quoted(name)} ${at} annotates ${describeType(declared)}; only \`string\`, \`boolean\` and \`integer\` may be mirrored, and \`number\` is excluded`);
196
+ }
197
+ bindings.push({
198
+ header: `${MCP_PARAM_HEADER_PREFIX}${name}`,
199
+ path: annotation.path,
200
+ type: declared,
201
+ });
202
+ }
203
+ return { ok: true, bindings };
204
+ }
205
+ function readPath(root, path) {
206
+ let cursor = root;
207
+ for (const key of path) {
208
+ if (!isPlainObject(cursor))
209
+ return undefined;
210
+ cursor = cursor[key];
211
+ }
212
+ return cursor;
213
+ }
214
+ /**
215
+ * How one argument value is spelled in a header field, or `undefined` when
216
+ * it is not sent at all.
217
+ *
218
+ * Four reasons a header is omitted, and only the first two are ordinary: the
219
+ * argument is absent, or it is `null` — both of which the spec says to omit
220
+ * rather than send empty. The other two are a server contradicting its own
221
+ * schema (a value whose runtime type is not the declared one) and an integer
222
+ * outside the range the spec bounds these to, ±(2^53−1) — exactly
223
+ * JavaScript's safe-integer range, which is the range in which the number
224
+ * this client parsed is still the number the server sent. Sending either
225
+ * would put a value on the wire that disagrees with the body it mirrors,
226
+ * which is the one thing a conforming server rejects outright.
227
+ */
228
+ function headerValue(type, value) {
229
+ if (value === undefined || value === null)
230
+ return undefined;
231
+ if (type === 'string')
232
+ return typeof value === 'string' ? value : undefined;
233
+ if (type === 'boolean')
234
+ return typeof value === 'boolean' ? String(value) : undefined;
235
+ return typeof value === 'number' && Number.isSafeInteger(value) ? String(value) : undefined;
236
+ }
237
+ /**
238
+ * The `Mcp-Param-*` field values for one call's arguments, unencoded.
239
+ *
240
+ * Returns the values as the BODY carries them; wrapping a value that cannot
241
+ * be written into a header field verbatim is the envelope's job, so the
242
+ * sentinel rule lives in one place for `Mcp-Name` and `Mcp-Param-*` alike
243
+ * rather than being reimplemented here.
244
+ */
245
+ export function mcpParamHeaderValues(bindings, args) {
246
+ const headers = {};
247
+ for (const binding of bindings) {
248
+ const written = headerValue(binding.type, readPath(args, binding.path));
249
+ if (written !== undefined)
250
+ headers[binding.header] = written;
251
+ }
252
+ return headers;
253
+ }
254
+ //# sourceMappingURL=x-mcp-header.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"x-mcp-header.js","sourceRoot":"","sources":["../../../src/connector/mcp/x-mcp-header.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AAEtE;;;;;;;;;;GAUG;AACH,MAAM,YAAY,GAAG,cAAc,CAAA;AAEnC;;;;;;;;GAQG;AACH,MAAM,gBAAgB,GAAG,gCAAgC,CAAA;AAEzD,8EAA8E;AAC9E,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC;IACnC,YAAY;IACZ,mBAAmB;IACnB,OAAO;IACP,aAAa;IACb,kBAAkB;CAClB,CAAC,CAAA;AAEF;;;;;;;GAOG;AACH,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAA;AAE5F,8EAA8E;AAC9E,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAA;AA+BlE,MAAM,WAAW,GAA+B,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,E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,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IACrF,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AAC5F,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CACnC,QAA0C,EAC1C,IAAa;IAEb,MAAM,OAAO,GAA2B,EAAE,CAAA;IAC1C,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAChC,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;QACvE,IAAI,OAAO,KAAK,SAAS;YAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAA;IAC7D,CAAC;IACD,OAAO,OAAO,CAAA;AACf,CAAC"}
@@ -1,23 +1,52 @@
1
+ import type { McpLegacyVersion, McpModernVersion } from '../../types/connector/mcp.js';
1
2
  /**
2
- * The protocol version this client ADVERTISES in `initialize`.
3
+ * The MCP spec revisions this client speaks WITHOUT the `initialize`
4
+ * handshake, newest first.
3
5
  *
4
- * Deliberately the version namzu actually implements, not the newest one
5
- * published. Advertising a version whose requirements are unimplemented is
6
- * worse than advertising an older one honestly: the server tailors its
7
- * behavior to what the client claims, and the mismatch surfaces later as
8
- * a malformed exchange rather than a clean negotiation failure. Raising
9
- * this is a conformance task, not a constant edit.
6
+ * The modern era removes that handshake entirely: a connection is resolved
7
+ * by probing with `server/discover`, and every request afterwards carries
8
+ * its own protocol version, client capabilities and client info in `_meta`
9
+ * instead of inheriting them from a session. `connect()` tries the newest
10
+ * entry here FIRST and falls back to the legacy handshake below only when
11
+ * the probe says the peer does not speak it.
10
12
  */
11
- export declare const MCP_PROTOCOL_VERSION = "2024-11-05";
13
+ export declare const MCP_MODERN_VERSIONS: readonly McpModernVersion[];
12
14
  /**
13
- * Versions this client can speak if a server negotiates down (or up) to
14
- * one of them, newest first.
15
+ * Protocol versions this client offers and accepts through the legacy
16
+ * `initialize` handshake, newest first.
15
17
  *
16
- * A server is free to answer `initialize` with a version other than the one
17
- * the client asked for — that is how the handshake is specified. namzu used
18
- * to ignore the answer entirely and carry on regardless, so a server
19
- * responding with a version we cannot speak looked exactly like a
20
- * successful connection until something downstream broke oddly.
18
+ * `connect()` offers `MCP_LEGACY_VERSIONS[0]` — the newest one — in a
19
+ * single `initialize` request. A server is free to answer with any version
20
+ * in `MCP_SUPPORTED_PROTOCOL_VERSIONS` below, not only the one offered:
21
+ * that is how the handshake is specified. namzu used to advertise and
22
+ * accept only `2024-11-05`, which refused the overwhelming majority of
23
+ * servers deployed since — every one that negotiated down to 2025-03-26,
24
+ * 2025-06-18 or 2025-11-25 instead of all the way to the oldest revision.
25
+ *
26
+ * This is deliberately a single round trip, never a per-version waterfall:
27
+ * the spec's own backward-compatibility algorithm offers one version and
28
+ * honors whatever the server answers
29
+ * (https://modelcontextprotocol.io/specification/2025-11-25/basic/lifecycle).
30
+ * A three-step retry loop is three times the latency for a code path no
31
+ * server expects, and `protocol-negotiation.test.ts` counts `initialize`
32
+ * frames so nobody reintroduces one.
33
+ */
34
+ export declare const MCP_LEGACY_VERSIONS: readonly McpLegacyVersion[];
35
+ /**
36
+ * Every protocol version this client can speak, in any capacity — offered
37
+ * in `initialize`, or merely a value it will not refuse if a server
38
+ * answers with it.
39
+ *
40
+ * The single authority for "can we speak this?": a server negotiating to
41
+ * a version outside this list is refused rather than let through to break
42
+ * confusingly downstream. Advertising or accepting a version whose
43
+ * requirements are unimplemented is worse than being honest about a
44
+ * narrower set — the server tailors its behavior to what the client
45
+ * claims, and the mismatch would otherwise surface later as a malformed
46
+ * exchange instead of a clean negotiation failure. That reasoning is why
47
+ * this list once held a single entry; it now argues for the broadened set
48
+ * above, not against it, because every version listed here is one namzu
49
+ * has actually verified it can carry a legacy `initialize` handshake for.
21
50
  */
22
51
  export declare const MCP_SUPPORTED_PROTOCOL_VERSIONS: readonly string[];
23
52
  /**
@@ -30,4 +59,83 @@ export declare const MCP_SUPPORTED_PROTOCOL_VERSIONS: readonly string[];
30
59
  export declare const DEFAULT_MCP_REQUEST_TIMEOUT_MS = 30000;
31
60
  /** JSON-RPC 2.0 reserved code for an unimplemented method. */
32
61
  export declare const JSON_RPC_METHOD_NOT_FOUND = -32601;
62
+ /**
63
+ * JSON-RPC codes a server may use to say "that resource does not exist".
64
+ *
65
+ * The current spec's resource-read error path uses the application-defined
66
+ * `-32002`, but a server on an older version may still answer with the
67
+ * generic `-32602` ("Invalid params") for the same condition — and the spec
68
+ * explicitly says a client SHOULD keep accepting it. Both are listed so a
69
+ * caller distinguishing "not found" from "actually broken" does not have to
70
+ * special-case the older code itself.
71
+ */
72
+ export declare const RESOURCE_NOT_FOUND_CODES: readonly number[];
73
+ /**
74
+ * The method a modern server answers with its `DiscoverResult`.
75
+ *
76
+ * Mandatory for a 2026-07-28 server and optional for a client, which is
77
+ * exactly what makes it a usable era probe: a server that answers it speaks
78
+ * the modern protocol, and a legacy server answers it with an
79
+ * implementation-defined error — commonly `-32601` or `-32602` — or not at
80
+ * all.
81
+ */
82
+ export declare const MCP_DISCOVER_METHOD = "server/discover";
83
+ /**
84
+ * How long an era probe waits for an answer before deciding the peer is
85
+ * legacy.
86
+ *
87
+ * A heuristic with no good universal value, which is why it is
88
+ * configurable per client (`MCPClientConfig.eraProbeTimeoutMs`). Too short
89
+ * and a slow-starting server is misclassified as legacy; too long and every
90
+ * legacy server pays the wait on every connect. Two seconds is long enough
91
+ * for a process that has already spawned to answer one request and short
92
+ * enough to sit comfortably inside an operator-facing connect deadline —
93
+ * and the era cache means a given origin or command pays it once, not once
94
+ * per connection.
95
+ */
96
+ export declare const DEFAULT_MCP_ERA_PROBE_TIMEOUT_MS = 2000;
97
+ /**
98
+ * The HTTP statuses a legacy origin answers a modern request with.
99
+ *
100
+ * A status alone is NOT the fallback signal: a modern server answers an
101
+ * unknown method with `404` and a JSON-RPC `-32601` body specifically so a
102
+ * client can tell it apart from the `404` of a server that has never heard
103
+ * of the modern protocol. The body decides; this list only says which
104
+ * responses are worth reading a body from.
105
+ */
106
+ export declare const MCP_MODERN_HTTP_FALLBACK_STATUSES: readonly number[];
107
+ /**
108
+ * The reserved `_meta` keys a modern request and reply carry.
109
+ *
110
+ * `protocolVersion` and `clientCapabilities` are REQUIRED on every modern
111
+ * request; `clientInfo` is a SHOULD. `serverInfo` travels the other way —
112
+ * it is how a `DiscoverResult` names the peer, and is what `connect()`
113
+ * reads to synthesise the `MCPInitializeResult` a host still expects.
114
+ */
115
+ export declare const MCP_META_PROTOCOL_VERSION = "io.modelcontextprotocol/protocolVersion";
116
+ export declare const MCP_META_CLIENT_CAPABILITIES = "io.modelcontextprotocol/clientCapabilities";
117
+ export declare const MCP_META_CLIENT_INFO = "io.modelcontextprotocol/clientInfo";
118
+ export declare const MCP_META_SERVER_INFO = "io.modelcontextprotocol/serverInfo";
119
+ /**
120
+ * The request headers a modern Streamable HTTP request mirrors its body
121
+ * with, so an intermediary can route and authorise a call without parsing
122
+ * JSON-RPC.
123
+ *
124
+ * `MCP_PROTOCOL_VERSION_HEADER` is shared with the later legacy revisions,
125
+ * where it means the version negotiated by `initialize` rather than the one
126
+ * carried in this request's own `_meta`.
127
+ */
128
+ export declare const MCP_PROTOCOL_VERSION_HEADER = "MCP-Protocol-Version";
129
+ export declare const MCP_METHOD_HEADER = "Mcp-Method";
130
+ export declare const MCP_NAME_HEADER = "Mcp-Name";
131
+ export declare const MCP_PARAM_HEADER_PREFIX = "Mcp-Param-";
132
+ /**
133
+ * The methods whose target is named in the `Mcp-Name` header, and the
134
+ * parameter each one's name is read from.
135
+ *
136
+ * Required for compliance on Streamable HTTP: an intermediary that can see
137
+ * WHICH tool is being called without reading the body is the whole point of
138
+ * mirroring it into a header.
139
+ */
140
+ export declare const MCP_NAME_HEADER_METHODS: Readonly<Record<string, 'name' | 'uri'>>;
33
141
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/constants/mcp/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,eAAe,CAAA;AAEhD;;;;;;;;;GASG;AACH,eAAO,MAAM,+BAA+B,EAAE,SAAS,MAAM,EAAmB,CAAA;AAEhF;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B,QAAS,CAAA;AAEpD,8DAA8D;AAC9D,eAAO,MAAM,yBAAyB,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/constants/mcp/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAEtF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,gBAAgB,EAAmB,CAAA;AAE9E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,gBAAgB,EAK1D,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,+BAA+B,EAAE,SAAS,MAAM,EAG5D,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B,QAAS,CAAA;AAEpD,8DAA8D;AAC9D,eAAO,MAAM,yBAAyB,SAAS,CAAA;AAE/C;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAAqB,CAAA;AAE3E;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,oBAAoB,CAAA;AAEpD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gCAAgC,OAAQ,CAAA;AAErD;;;;;;;;GAQG;AACH,eAAO,MAAM,iCAAiC,EAAE,SAAS,MAAM,EAAoB,CAAA;AAEnF;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,4CAA4C,CAAA;AAClF,eAAO,MAAM,4BAA4B,+CAA+C,CAAA;AACxF,eAAO,MAAM,oBAAoB,uCAAuC,CAAA;AACxE,eAAO,MAAM,oBAAoB,uCAAuC,CAAA;AAExE;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,yBAAyB,CAAA;AACjE,eAAO,MAAM,iBAAiB,eAAe,CAAA;AAC7C,eAAO,MAAM,eAAe,aAAa,CAAA;AACzC,eAAO,MAAM,uBAAuB,eAAe,CAAA;AAEnD;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,CAI5E,CAAA"}
@@ -1,25 +1,61 @@
1
1
  /**
2
- * The protocol version this client ADVERTISES in `initialize`.
2
+ * The MCP spec revisions this client speaks WITHOUT the `initialize`
3
+ * handshake, newest first.
3
4
  *
4
- * Deliberately the version namzu actually implements, not the newest one
5
- * published. Advertising a version whose requirements are unimplemented is
6
- * worse than advertising an older one honestly: the server tailors its
7
- * behavior to what the client claims, and the mismatch surfaces later as
8
- * a malformed exchange rather than a clean negotiation failure. Raising
9
- * this is a conformance task, not a constant edit.
5
+ * The modern era removes that handshake entirely: a connection is resolved
6
+ * by probing with `server/discover`, and every request afterwards carries
7
+ * its own protocol version, client capabilities and client info in `_meta`
8
+ * instead of inheriting them from a session. `connect()` tries the newest
9
+ * entry here FIRST and falls back to the legacy handshake below only when
10
+ * the probe says the peer does not speak it.
10
11
  */
11
- export const MCP_PROTOCOL_VERSION = '2024-11-05';
12
+ export const MCP_MODERN_VERSIONS = ['2026-07-28'];
12
13
  /**
13
- * Versions this client can speak if a server negotiates down (or up) to
14
- * one of them, newest first.
14
+ * Protocol versions this client offers and accepts through the legacy
15
+ * `initialize` handshake, newest first.
15
16
  *
16
- * A server is free to answer `initialize` with a version other than the one
17
- * the client asked for — that is how the handshake is specified. namzu used
18
- * to ignore the answer entirely and carry on regardless, so a server
19
- * responding with a version we cannot speak looked exactly like a
20
- * successful connection until something downstream broke oddly.
17
+ * `connect()` offers `MCP_LEGACY_VERSIONS[0]` — the newest one — in a
18
+ * single `initialize` request. A server is free to answer with any version
19
+ * in `MCP_SUPPORTED_PROTOCOL_VERSIONS` below, not only the one offered:
20
+ * that is how the handshake is specified. namzu used to advertise and
21
+ * accept only `2024-11-05`, which refused the overwhelming majority of
22
+ * servers deployed since — every one that negotiated down to 2025-03-26,
23
+ * 2025-06-18 or 2025-11-25 instead of all the way to the oldest revision.
24
+ *
25
+ * This is deliberately a single round trip, never a per-version waterfall:
26
+ * the spec's own backward-compatibility algorithm offers one version and
27
+ * honors whatever the server answers
28
+ * (https://modelcontextprotocol.io/specification/2025-11-25/basic/lifecycle).
29
+ * A three-step retry loop is three times the latency for a code path no
30
+ * server expects, and `protocol-negotiation.test.ts` counts `initialize`
31
+ * frames so nobody reintroduces one.
32
+ */
33
+ export const MCP_LEGACY_VERSIONS = [
34
+ '2025-11-25',
35
+ '2025-06-18',
36
+ '2025-03-26',
37
+ '2024-11-05',
38
+ ];
39
+ /**
40
+ * Every protocol version this client can speak, in any capacity — offered
41
+ * in `initialize`, or merely a value it will not refuse if a server
42
+ * answers with it.
43
+ *
44
+ * The single authority for "can we speak this?": a server negotiating to
45
+ * a version outside this list is refused rather than let through to break
46
+ * confusingly downstream. Advertising or accepting a version whose
47
+ * requirements are unimplemented is worse than being honest about a
48
+ * narrower set — the server tailors its behavior to what the client
49
+ * claims, and the mismatch would otherwise surface later as a malformed
50
+ * exchange instead of a clean negotiation failure. That reasoning is why
51
+ * this list once held a single entry; it now argues for the broadened set
52
+ * above, not against it, because every version listed here is one namzu
53
+ * has actually verified it can carry a legacy `initialize` handshake for.
21
54
  */
22
- export const MCP_SUPPORTED_PROTOCOL_VERSIONS = ['2024-11-05'];
55
+ export const MCP_SUPPORTED_PROTOCOL_VERSIONS = [
56
+ ...MCP_MODERN_VERSIONS,
57
+ ...MCP_LEGACY_VERSIONS,
58
+ ];
23
59
  /**
24
60
  * Default deadline for one MCP JSON-RPC round trip.
25
61
  *
@@ -30,4 +66,87 @@ export const MCP_SUPPORTED_PROTOCOL_VERSIONS = ['2024-11-05'];
30
66
  export const DEFAULT_MCP_REQUEST_TIMEOUT_MS = 30_000;
31
67
  /** JSON-RPC 2.0 reserved code for an unimplemented method. */
32
68
  export const JSON_RPC_METHOD_NOT_FOUND = -32601;
69
+ /**
70
+ * JSON-RPC codes a server may use to say "that resource does not exist".
71
+ *
72
+ * The current spec's resource-read error path uses the application-defined
73
+ * `-32002`, but a server on an older version may still answer with the
74
+ * generic `-32602` ("Invalid params") for the same condition — and the spec
75
+ * explicitly says a client SHOULD keep accepting it. Both are listed so a
76
+ * caller distinguishing "not found" from "actually broken" does not have to
77
+ * special-case the older code itself.
78
+ */
79
+ export const RESOURCE_NOT_FOUND_CODES = [-32602, -32002];
80
+ /**
81
+ * The method a modern server answers with its `DiscoverResult`.
82
+ *
83
+ * Mandatory for a 2026-07-28 server and optional for a client, which is
84
+ * exactly what makes it a usable era probe: a server that answers it speaks
85
+ * the modern protocol, and a legacy server answers it with an
86
+ * implementation-defined error — commonly `-32601` or `-32602` — or not at
87
+ * all.
88
+ */
89
+ export const MCP_DISCOVER_METHOD = 'server/discover';
90
+ /**
91
+ * How long an era probe waits for an answer before deciding the peer is
92
+ * legacy.
93
+ *
94
+ * A heuristic with no good universal value, which is why it is
95
+ * configurable per client (`MCPClientConfig.eraProbeTimeoutMs`). Too short
96
+ * and a slow-starting server is misclassified as legacy; too long and every
97
+ * legacy server pays the wait on every connect. Two seconds is long enough
98
+ * for a process that has already spawned to answer one request and short
99
+ * enough to sit comfortably inside an operator-facing connect deadline —
100
+ * and the era cache means a given origin or command pays it once, not once
101
+ * per connection.
102
+ */
103
+ export const DEFAULT_MCP_ERA_PROBE_TIMEOUT_MS = 2_000;
104
+ /**
105
+ * The HTTP statuses a legacy origin answers a modern request with.
106
+ *
107
+ * A status alone is NOT the fallback signal: a modern server answers an
108
+ * unknown method with `404` and a JSON-RPC `-32601` body specifically so a
109
+ * client can tell it apart from the `404` of a server that has never heard
110
+ * of the modern protocol. The body decides; this list only says which
111
+ * responses are worth reading a body from.
112
+ */
113
+ export const MCP_MODERN_HTTP_FALLBACK_STATUSES = [400, 404, 405];
114
+ /**
115
+ * The reserved `_meta` keys a modern request and reply carry.
116
+ *
117
+ * `protocolVersion` and `clientCapabilities` are REQUIRED on every modern
118
+ * request; `clientInfo` is a SHOULD. `serverInfo` travels the other way —
119
+ * it is how a `DiscoverResult` names the peer, and is what `connect()`
120
+ * reads to synthesise the `MCPInitializeResult` a host still expects.
121
+ */
122
+ export const MCP_META_PROTOCOL_VERSION = 'io.modelcontextprotocol/protocolVersion';
123
+ export const MCP_META_CLIENT_CAPABILITIES = 'io.modelcontextprotocol/clientCapabilities';
124
+ export const MCP_META_CLIENT_INFO = 'io.modelcontextprotocol/clientInfo';
125
+ export const MCP_META_SERVER_INFO = 'io.modelcontextprotocol/serverInfo';
126
+ /**
127
+ * The request headers a modern Streamable HTTP request mirrors its body
128
+ * with, so an intermediary can route and authorise a call without parsing
129
+ * JSON-RPC.
130
+ *
131
+ * `MCP_PROTOCOL_VERSION_HEADER` is shared with the later legacy revisions,
132
+ * where it means the version negotiated by `initialize` rather than the one
133
+ * carried in this request's own `_meta`.
134
+ */
135
+ export const MCP_PROTOCOL_VERSION_HEADER = 'MCP-Protocol-Version';
136
+ export const MCP_METHOD_HEADER = 'Mcp-Method';
137
+ export const MCP_NAME_HEADER = 'Mcp-Name';
138
+ export const MCP_PARAM_HEADER_PREFIX = 'Mcp-Param-';
139
+ /**
140
+ * The methods whose target is named in the `Mcp-Name` header, and the
141
+ * parameter each one's name is read from.
142
+ *
143
+ * Required for compliance on Streamable HTTP: an intermediary that can see
144
+ * WHICH tool is being called without reading the body is the whole point of
145
+ * mirroring it into a header.
146
+ */
147
+ export const MCP_NAME_HEADER_METHODS = {
148
+ 'tools/call': 'name',
149
+ 'prompts/get': 'name',
150
+ 'resources/read': 'uri',
151
+ };
33
152
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constants/mcp/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,YAAY,CAAA;AAEhD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAsB,CAAC,YAAY,CAAC,CAAA;AAEhF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,MAAM,CAAA;AAEpD,8DAA8D;AAC9D,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,KAAK,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constants/mcp/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAgC,CAAC,YAAY,CAAC,CAAA;AAE9E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAgC;IAC/D,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,YAAY;CACZ,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAsB;IACjE,GAAG,mBAAmB;IACtB,GAAG,mBAAmB;CACtB,CAAA;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,MAAM,CAAA;AAEpD,8DAA8D;AAC9D,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,KAAK,CAAA;AAE/C;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAsB,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAA;AAE3E;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,iBAAiB,CAAA;AAEpD;;;;;;;;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