@onlyflows/servicenow-mcp 2.2.0-dev.5 → 2.2.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 (251) hide show
  1. package/.env.example +6 -3
  2. package/CHANGELOG.md +312 -0
  3. package/README.md +504 -101
  4. package/dist/atf-form.d.ts +3 -15
  5. package/dist/atf-form.d.ts.map +1 -1
  6. package/dist/atf-result-cache.d.ts +23 -59
  7. package/dist/atf-result-cache.d.ts.map +1 -1
  8. package/dist/auth.d.ts +1 -0
  9. package/dist/auth.d.ts.map +1 -1
  10. package/dist/auth.js +17 -0
  11. package/dist/auth.js.map +1 -1
  12. package/dist/batch-limits.d.ts +18 -0
  13. package/dist/batch-limits.d.ts.map +1 -0
  14. package/dist/batch-limits.js +21 -0
  15. package/dist/batch-limits.js.map +1 -0
  16. package/dist/bounded-input.d.ts +49 -0
  17. package/dist/bounded-input.d.ts.map +1 -0
  18. package/dist/bounded-input.js +81 -0
  19. package/dist/bounded-input.js.map +1 -0
  20. package/dist/client.d.ts +25 -0
  21. package/dist/client.d.ts.map +1 -1
  22. package/dist/client.js +92 -18
  23. package/dist/client.js.map +1 -1
  24. package/dist/command-resolution.d.ts +53 -0
  25. package/dist/command-resolution.d.ts.map +1 -0
  26. package/dist/command-resolution.js +154 -0
  27. package/dist/command-resolution.js.map +1 -0
  28. package/dist/encoded-query-policy.d.ts +11 -0
  29. package/dist/encoded-query-policy.d.ts.map +1 -1
  30. package/dist/encoded-query-policy.js +10 -1
  31. package/dist/encoded-query-policy.js.map +1 -1
  32. package/dist/field-policy.d.ts +82 -3
  33. package/dist/field-policy.d.ts.map +1 -1
  34. package/dist/field-policy.js +609 -80
  35. package/dist/field-policy.js.map +1 -1
  36. package/dist/html-response.d.ts +34 -0
  37. package/dist/html-response.d.ts.map +1 -0
  38. package/dist/html-response.js +72 -0
  39. package/dist/html-response.js.map +1 -0
  40. package/dist/http-runtime.d.ts.map +1 -1
  41. package/dist/http-runtime.js +8 -0
  42. package/dist/http-runtime.js.map +1 -1
  43. package/dist/incident-journal-policy.d.ts +27 -5
  44. package/dist/incident-journal-policy.d.ts.map +1 -1
  45. package/dist/incident-journal-policy.js +34 -21
  46. package/dist/incident-journal-policy.js.map +1 -1
  47. package/dist/json-shape-limits.d.ts +71 -0
  48. package/dist/json-shape-limits.d.ts.map +1 -0
  49. package/dist/json-shape-limits.js +131 -0
  50. package/dist/json-shape-limits.js.map +1 -0
  51. package/dist/metadata-cache.d.ts +46 -21
  52. package/dist/metadata-cache.d.ts.map +1 -1
  53. package/dist/metadata-cache.js +228 -195
  54. package/dist/metadata-cache.js.map +1 -1
  55. package/dist/policy-card.d.ts +131 -0
  56. package/dist/policy-card.d.ts.map +1 -0
  57. package/dist/policy-card.js +409 -0
  58. package/dist/policy-card.js.map +1 -0
  59. package/dist/profile-admin.d.ts.map +1 -1
  60. package/dist/profile-admin.js +3 -0
  61. package/dist/profile-admin.js.map +1 -1
  62. package/dist/profile-manager.d.ts +17 -3
  63. package/dist/profile-manager.d.ts.map +1 -1
  64. package/dist/profile-manager.js +98 -6
  65. package/dist/profile-manager.js.map +1 -1
  66. package/dist/record-identifier-policy.d.ts +2 -8
  67. package/dist/record-identifier-policy.d.ts.map +1 -1
  68. package/dist/risky-grants.d.ts +25 -0
  69. package/dist/risky-grants.d.ts.map +1 -0
  70. package/dist/risky-grants.js +77 -0
  71. package/dist/risky-grants.js.map +1 -0
  72. package/dist/server.d.ts.map +1 -1
  73. package/dist/server.js +74 -0
  74. package/dist/server.js.map +1 -1
  75. package/dist/setup-prompts.js +1 -0
  76. package/dist/setup-prompts.js.map +1 -1
  77. package/dist/setup.d.ts +8 -1
  78. package/dist/setup.d.ts.map +1 -1
  79. package/dist/setup.js +492 -111
  80. package/dist/setup.js.map +1 -1
  81. package/dist/stdio-runtime.d.ts +15 -0
  82. package/dist/stdio-runtime.d.ts.map +1 -1
  83. package/dist/stdio-runtime.js +60 -0
  84. package/dist/stdio-runtime.js.map +1 -1
  85. package/dist/structured-query.d.ts +100 -115
  86. package/dist/structured-query.d.ts.map +1 -1
  87. package/dist/structured-query.js +132 -16
  88. package/dist/structured-query.js.map +1 -1
  89. package/dist/table-policy.d.ts +10 -4
  90. package/dist/table-policy.d.ts.map +1 -1
  91. package/dist/table-policy.js +1 -1
  92. package/dist/table-policy.js.map +1 -1
  93. package/dist/tool-error.d.ts +18 -0
  94. package/dist/tool-error.d.ts.map +1 -1
  95. package/dist/tool-error.js +69 -0
  96. package/dist/tool-error.js.map +1 -1
  97. package/dist/tool-table-access.d.ts.map +1 -1
  98. package/dist/tool-table-access.js +32 -2
  99. package/dist/tool-table-access.js.map +1 -1
  100. package/dist/tools/aggregate.d.ts +13 -19
  101. package/dist/tools/aggregate.d.ts.map +1 -1
  102. package/dist/tools/aggregate.js +2 -3
  103. package/dist/tools/aggregate.js.map +1 -1
  104. package/dist/tools/all-fields-cap.d.ts.map +1 -1
  105. package/dist/tools/all-fields-cap.js +3 -38
  106. package/dist/tools/all-fields-cap.js.map +1 -1
  107. package/dist/tools/atf-author-module.d.ts +28 -7
  108. package/dist/tools/atf-author-module.d.ts.map +1 -1
  109. package/dist/tools/atf-author-module.js +4 -2
  110. package/dist/tools/atf-author-module.js.map +1 -1
  111. package/dist/tools/atf-contracts.d.ts +135 -829
  112. package/dist/tools/atf-contracts.d.ts.map +1 -1
  113. package/dist/tools/atf-shared.js +2 -2
  114. package/dist/tools/atf-shared.js.map +1 -1
  115. package/dist/tools/atf-step-catalog.d.ts +3 -7
  116. package/dist/tools/atf-step-catalog.d.ts.map +1 -1
  117. package/dist/tools/atf-step-catalog.js +12 -5
  118. package/dist/tools/atf-step-catalog.js.map +1 -1
  119. package/dist/tools/atf.d.ts +8 -24
  120. package/dist/tools/atf.d.ts.map +1 -1
  121. package/dist/tools/atf.js +2 -2
  122. package/dist/tools/atf.js.map +1 -1
  123. package/dist/tools/attach.d.ts +6 -22
  124. package/dist/tools/attach.d.ts.map +1 -1
  125. package/dist/tools/batch.d.ts +18 -71
  126. package/dist/tools/batch.d.ts.map +1 -1
  127. package/dist/tools/batch.js +544 -96
  128. package/dist/tools/batch.js.map +1 -1
  129. package/dist/tools/catalog.d.ts +2 -2
  130. package/dist/tools/catalog.d.ts.map +1 -1
  131. package/dist/tools/catalog.js +7 -1
  132. package/dist/tools/catalog.js.map +1 -1
  133. package/dist/tools/codesearch.d.ts +1 -13
  134. package/dist/tools/codesearch.d.ts.map +1 -1
  135. package/dist/tools/create-module.d.ts +9 -14
  136. package/dist/tools/create-module.d.ts.map +1 -1
  137. package/dist/tools/create-module.js +4 -8
  138. package/dist/tools/create-module.js.map +1 -1
  139. package/dist/tools/delete.d.ts +1 -9
  140. package/dist/tools/delete.d.ts.map +1 -1
  141. package/dist/tools/delete.js +2 -3
  142. package/dist/tools/delete.js.map +1 -1
  143. package/dist/tools/discover.d.ts +6 -14
  144. package/dist/tools/discover.d.ts.map +1 -1
  145. package/dist/tools/flow-view-contracts.d.ts +1023 -0
  146. package/dist/tools/flow-view-contracts.d.ts.map +1 -0
  147. package/dist/tools/flow-view-contracts.js +570 -0
  148. package/dist/tools/flow-view-contracts.js.map +1 -0
  149. package/dist/tools/flow-view-graph.d.ts +86 -0
  150. package/dist/tools/flow-view-graph.d.ts.map +1 -0
  151. package/dist/tools/flow-view-graph.js +993 -0
  152. package/dist/tools/flow-view-graph.js.map +1 -0
  153. package/dist/tools/flow-view-gzip.d.ts +52 -0
  154. package/dist/tools/flow-view-gzip.d.ts.map +1 -0
  155. package/dist/tools/flow-view-gzip.js +179 -0
  156. package/dist/tools/flow-view-gzip.js.map +1 -0
  157. package/dist/tools/flow-view-mermaid.d.ts +37 -0
  158. package/dist/tools/flow-view-mermaid.d.ts.map +1 -0
  159. package/dist/tools/flow-view-mermaid.js +337 -0
  160. package/dist/tools/flow-view-mermaid.js.map +1 -0
  161. package/dist/tools/flow-view-module.d.ts +61 -0
  162. package/dist/tools/flow-view-module.d.ts.map +1 -0
  163. package/dist/tools/flow-view-module.js +378 -0
  164. package/dist/tools/flow-view-module.js.map +1 -0
  165. package/dist/tools/flow-view-policy.d.ts +106 -0
  166. package/dist/tools/flow-view-policy.d.ts.map +1 -0
  167. package/dist/tools/flow-view-policy.js +461 -0
  168. package/dist/tools/flow-view-policy.js.map +1 -0
  169. package/dist/tools/flow-view-renderers.d.ts +68 -0
  170. package/dist/tools/flow-view-renderers.d.ts.map +1 -0
  171. package/dist/tools/flow-view-renderers.js +513 -0
  172. package/dist/tools/flow-view-renderers.js.map +1 -0
  173. package/dist/tools/flow-view-table.d.ts +115 -0
  174. package/dist/tools/flow-view-table.d.ts.map +1 -0
  175. package/dist/tools/flow-view-table.js +1002 -0
  176. package/dist/tools/flow-view-table.js.map +1 -0
  177. package/dist/tools/get-module.d.ts +36 -42
  178. package/dist/tools/get-module.d.ts.map +1 -1
  179. package/dist/tools/health.d.ts +9 -6
  180. package/dist/tools/health.d.ts.map +1 -1
  181. package/dist/tools/incident-journal-module.d.ts +8 -7
  182. package/dist/tools/incident-journal-module.d.ts.map +1 -1
  183. package/dist/tools/index.d.ts +4 -4
  184. package/dist/tools/index.d.ts.map +1 -1
  185. package/dist/tools/index.js +43 -6
  186. package/dist/tools/index.js.map +1 -1
  187. package/dist/tools/markdown.d.ts +27 -0
  188. package/dist/tools/markdown.d.ts.map +1 -1
  189. package/dist/tools/markdown.js +104 -1
  190. package/dist/tools/markdown.js.map +1 -1
  191. package/dist/tools/nl.d.ts +1 -11
  192. package/dist/tools/nl.d.ts.map +1 -1
  193. package/dist/tools/profile.d.ts +1 -1
  194. package/dist/tools/profile.d.ts.map +1 -1
  195. package/dist/tools/profile.js +19 -1
  196. package/dist/tools/profile.js.map +1 -1
  197. package/dist/tools/query-module.d.ts +59 -71
  198. package/dist/tools/query-module.d.ts.map +1 -1
  199. package/dist/tools/query-module.js +2 -2
  200. package/dist/tools/query-module.js.map +1 -1
  201. package/dist/tools/record-write-shared.d.ts.map +1 -1
  202. package/dist/tools/record-write-shared.js +19 -2
  203. package/dist/tools/record-write-shared.js.map +1 -1
  204. package/dist/tools/relationships.d.ts +6 -22
  205. package/dist/tools/relationships.d.ts.map +1 -1
  206. package/dist/tools/result-envelope.d.ts +2255 -1357
  207. package/dist/tools/result-envelope.d.ts.map +1 -1
  208. package/dist/tools/result-envelope.js +24 -2
  209. package/dist/tools/result-envelope.js.map +1 -1
  210. package/dist/tools/schema-module.d.ts +36 -21
  211. package/dist/tools/schema-module.d.ts.map +1 -1
  212. package/dist/tools/schema-module.js +106 -65
  213. package/dist/tools/schema-module.js.map +1 -1
  214. package/dist/tools/script.d.ts +1 -11
  215. package/dist/tools/script.d.ts.map +1 -1
  216. package/dist/tools/syslog.d.ts +11 -18
  217. package/dist/tools/syslog.d.ts.map +1 -1
  218. package/dist/tools/syslog.js +2 -3
  219. package/dist/tools/syslog.js.map +1 -1
  220. package/dist/tools/table-hierarchy.d.ts +35 -0
  221. package/dist/tools/table-hierarchy.d.ts.map +1 -0
  222. package/dist/tools/table-hierarchy.js +74 -0
  223. package/dist/tools/table-hierarchy.js.map +1 -0
  224. package/dist/tools/tool-module.d.ts +40 -15
  225. package/dist/tools/tool-module.d.ts.map +1 -1
  226. package/dist/tools/tool-module.js +755 -205
  227. package/dist/tools/tool-module.js.map +1 -1
  228. package/dist/tools/update-module.d.ts +11 -17
  229. package/dist/tools/update-module.d.ts.map +1 -1
  230. package/dist/tools/update-module.js +10 -12
  231. package/dist/tools/update-module.js.map +1 -1
  232. package/dist/version.d.ts +1 -1
  233. package/dist/version.d.ts.map +1 -1
  234. package/dist/version.js +1 -1
  235. package/dist/version.js.map +1 -1
  236. package/dist/write-value-policy.d.ts +20 -12
  237. package/dist/write-value-policy.d.ts.map +1 -1
  238. package/dist/write-value-policy.js +179 -67
  239. package/dist/write-value-policy.js.map +1 -1
  240. package/docs/ADDING-TOOLS.md +22 -13
  241. package/docs/CLIENT-SETUP.md +110 -52
  242. package/docs/CROSS-CLIENT-RELEASE-MATRIX.md +2 -2
  243. package/docs/FLOW-VIEW.md +214 -0
  244. package/docs/PRODUCTION-SECURITY.md +154 -25
  245. package/docs/RELEASE-VALIDATION.md +2 -2
  246. package/docs/TESTING-OAUTH.md +1 -1
  247. package/docs/V2-MIGRATION.md +404 -30
  248. package/package.json +21 -6
  249. package/scripts/release-validate.mjs +56 -0
  250. package/server.json +22 -0
  251. package/tools/inspector/package-lock.json +163 -201
@@ -11,6 +11,12 @@ running: every call names a profile, and table access is granted rather than
11
11
  inherited from the credential. Those two are the migration; the rest apply only
12
12
  if you used the affected surface.
13
13
 
14
+ **Already on 2.x?** 2.2.0 changes how field policy
15
+ loads and who may write journal fields, and it can refuse to start on a
16
+ configuration that loads today. Read
17
+ [Upgrading to 2.2.0](#upgrading-to-220) before you
18
+ upgrade.
19
+
14
20
  ## Breaking changes at a glance
15
21
 
16
22
  | # | Change | Before (1.0.0) | After (2.0.0) |
@@ -20,8 +26,8 @@ if you used the affected surface.
20
26
  | 3 | Table access | any table the credential could reach | deny-by-default per profile; explicit allowlist plus target entries |
21
27
  | 4 | Attachments | host `file_path` / `output_path` | inline base64 both directions; no host filesystem access, and no flag restores it |
22
28
  | 5 | Queries | raw ServiceNow encoded queries | structured filters; raw reads are opt-in per tool/table |
23
- | 6 | Incident journals | `sn_update` accepted `comments` / `work_notes` | dedicated `sn_incident_add_comment` / `sn_incident_add_work_note` |
24
- | 7 | Tool surface | 17 tools, one `bin` | 19 tools, three `bin` entries; `sn_script` withdrawn |
29
+ | 6 | Incident journals | `sn_update` accepted `comments` / `work_notes` | dedicated `sn_incident_add_comment` / `sn_incident_add_work_note`; from [2.2.0](#upgrading-to-220) the generic write tools accept both fields again, on every table, under field policy |
30
+ | 7 | Tool surface | 17 tools, one `bin` | 19 tools, three `bin` entries; `sn_script` withdrawn (2.2.0 adds four ATF tools and `sn_flow_view`, for 24) |
25
31
  | 8 | Field selection limit | `MAX_FIELDS_PER_OPERATION` was `32`; over-selection raised `excessive_field_selection` | limit is `10_000`; `excessive_field_selection` is removed from the exported `FieldPolicyFailureReason` union |
26
32
  | 9 | Capabilities | `tools` only | adds `prompts` (`servicenow-mcp.add-profile`) |
27
33
 
@@ -44,10 +50,9 @@ earlier 2.0 pre-release did move to HTTP — if you configured against that, see
44
50
  - **Append-only incident journal tools.** `sn_incident_add_comment` and
45
51
  `sn_incident_add_work_note`.
46
52
  - **Metadata caching.** Per-instance-and-identity caching of dictionary and
47
- schema reads, off by default for tables you do not name. It requires a
48
- resolvable session timezone, so it is **disabled for OAuth
49
- client_credentials and API-key profiles**, which carry no username — see
50
- [Metadata caching prerequisites](CLIENT-SETUP.md#metadata-caching-prerequisites).
53
+ schema reads, off by default for tables you do not name. It works in every
54
+ auth mode, including OAuth client_credentials and API key — see
55
+ [Metadata caching](CLIENT-SETUP.md#metadata-caching).
51
56
  - **Bounded unrestricted field selection.** `fields=all` and
52
57
  `response_format: "detailed"` are capped at 100 columns instead of dropping
53
58
  `sysparm_fields` and risking a failed call on a wide table.
@@ -255,9 +260,17 @@ end of this document.
255
260
 
256
261
  **Before:** `sn_update` on `incident` with `{"comments": "…"}`.
257
262
 
258
- **After:** `sn_incident_add_comment` with `{profile, sys_id, content}` for a
259
- customer-visible comment, or `sn_incident_add_work_note` for an internal note.
260
- `sn_update` rejects both fields before credentials are resolved.
263
+ **After (2.0.0 through 2.2.0-dev.6):** `sn_incident_add_comment` with
264
+ `{profile, sys_id, content}` for a customer-visible comment, or
265
+ `sn_incident_add_work_note` for an internal note. `sn_update` rejects both
266
+ fields before credentials are resolved.
267
+
268
+ **After ([2.2.0](#upgrading-to-220)):** both shapes
269
+ work. `sn_create`, `sn_update` and `sn_batch` accept `comments` and
270
+ `work_notes` again, on `incident` and every other table granted for writes,
271
+ and the configured field policy decides whether a profile may write them,
272
+ through either route. The dedicated tools remain. See
273
+ [Incident journal migration](#incident-journal-migration).
261
274
 
262
275
  ### 7. Tool surface and executables
263
276
 
@@ -265,6 +278,8 @@ customer-visible comment, or `sn_incident_add_work_note` for an internal note.
265
278
  `sn_profile` are added, and `sn_script` is removed. `sn_script` never executed
266
279
  anything in 1.0.0 — it returned an explanatory error — so removing it changes
267
280
  `tools/list` but no working behavior. Use `sn_query` and `sn_batch` instead.
281
+ The 2.0.0 and 2.1.0 releases list 19 tools; 2.2.0 adds `sn_atf_author`,
282
+ `sn_atf_run`, `sn_atf_results`, `sn_atf_readiness` and `sn_flow_view`, for 24.
268
283
 
269
284
  One `bin` becomes three:
270
285
 
@@ -416,21 +431,35 @@ are independent: a table listed for reads is not writable, and a table listed
416
431
  for writes is not implicitly readable. Every caller-addressable name must also
417
432
  have a trusted entry in `SN_TABLE_ACCESS_TARGETS` unless the relevant operation
418
433
  uses `*`. Target entries still narrow permitted tools when present, and identify whether the table is canonical,
419
- an alias, a view, or an extension and listing every backing/ancestor table it
420
- can reach, including descendant tables reachable through base-table access.
421
- Each entry must explicitly set `closureComplete: true`, and each related table
422
- needs the same operation permission. A related permission does not make that
423
- table caller-addressable unless it also has its own target entry. Omit the
424
- target—and therefore deny direct access—when the metadata closure cannot be
425
- proven complete.
426
-
427
- Table allowlists are paired with a separate field-policy gate. Built-in field
428
- policy remains finite for known tables, and operators can extend/override it
429
- with `SN_FIELD_POLICY_DEFINITIONS`, keyed by exact table name or `*` for a
430
- generic fallback. Each entry may define `defaults`, `readable`, and `writable`;
431
- `readable`/`writable` accept exact field arrays or `"*"`. Sensitive field-name
432
- families remain denied even when wildcard field access is configured. Example
433
- read-only custom-table exploration:
434
+ an alias, a view, or an extension. Each entry must set the literal
435
+ `closureComplete: true` and list in `relatedTables` the table itself plus any
436
+ backing or parent tables the operator declares; an alias, view, or extension
437
+ must name at least one backing table. The loader checks that list for
438
+ consistency: each related table needs every operation permission the target
439
+ has. `servicenow-mcp-setup grant --related` keeps that true by adding each
440
+ related table to the allowlist of every operation its target has, including
441
+ one a later grant adds. The loader does not derive the list from the
442
+ instance, and the list grants no access. A related table is not caller-addressable unless it also has its own
443
+ target entry or that operation's allowlist is `*`. Inherited fields are read
444
+ through the child table's own endpoint, so a self-only list, or the immediate
445
+ parent, is enough. A grant on a base table reaches the records of the tables
446
+ that extend it whether or not they are listed, so grant a base table only when
447
+ those records should be reachable. Likewise, a view or alias returns data from
448
+ every table it reads, whatever `relatedTables` lists: declare each of those
449
+ tables, so the loader requires each to carry the same permission, and grant
450
+ the view only when all of that data should be reachable.
451
+
452
+ Table allowlists are paired with a separate field-policy gate. Field policy
453
+ narrows what a granted table exposes; it never denies the table itself. Each
454
+ `config.json` profile states its own with `fieldPolicy`, or with
455
+ `readableTableFields` and `writableTableFields`; for the `SN_PROFILE_NAME`
456
+ environment profile, `SN_FIELD_POLICY_DEFINITIONS` supplies it. Entries are
457
+ keyed by exact table name or `*`, and each may define `defaults`, `readable`,
458
+ and `writable` as exact field lists or `"*"`. Sensitive field-name families
459
+ remain denied even when wildcard field access is configured. The
460
+ [field policy reference](../README.md#field-policy) covers the forms, the `*`
461
+ entry, and the fields that must be listed explicitly. Example read-only
462
+ exploration on the environment profile, with no `config.json`:
434
463
 
435
464
  ```sh
436
465
  export SN_ALLOWED_READ_TABLES='*'
@@ -438,8 +467,11 @@ export SN_ALLOWED_WRITE_TABLES=''
438
467
  export SN_FIELD_POLICY_DEFINITIONS='{"*":{"defaults":["sys_id"],"readable":"*","writable":[]}}'
439
468
  ```
440
469
 
441
- Use `writable:"*"` only when broad mutation access is intentional; write field
442
- wildcards do not imply read field access or table write access.
470
+ `SN_ALLOWED_WRITE_TABLES=''` is what makes this read-only: the `*` entry never
471
+ reaches the built-in system tables, so `writable: []` alone does not stop
472
+ every write. Use `writable:"*"` only when broad mutation access is
473
+ intentional; write field wildcards do not imply read field access or table
474
+ write access.
443
475
 
444
476
  The service normalizes identifiers and rejects malformed entries. It does not
445
477
  refuse any particular table: since 2.0 there is no built-in deny list, so a
@@ -453,10 +485,29 @@ side-effect plan. Legacy ATF execution actions return migration guidance; use
453
485
 
454
486
  ### Incident journal migration
455
487
 
456
- Generic `sn_update` no longer accepts the append-only incident fields
457
- `comments` or `work_notes`. Those inputs fail before profile credentials or a
458
- ServiceNow client are resolved and direct the caller to the matching dedicated
459
- tool:
488
+ **[2.2.0](#upgrading-to-220) reverses the
489
+ generic-write rule below.** From 2.0.0 through 2.2.0-dev.6 the generic write
490
+ tools rejected `comments` and `work_notes` by name, on every table, ahead of
491
+ field policy, and no configuration could lift the rejection. Tables other than
492
+ `incident` had no journal route at all. From 2.2.0:
493
+
494
+ - `sn_create`, `sn_update` and `sn_batch` write `comments` and `work_notes`
495
+ on any table granted for writes. A Table API write to a journal field
496
+ appends one entry; it cannot rewrite earlier entries.
497
+ - Each value gets the same content bounds as the dedicated tools (below).
498
+ - Field policy decides permission, for the generic tools and the dedicated
499
+ tools alike. With no field policy, every write-granted table accepts both
500
+ fields. To withhold customer-visible comments from a profile, set
501
+ `writable` to an explicit list without `comments`; on `incident` this also
502
+ denies `sn_incident_add_comment`. See
503
+ [Journal fields and the dedicated tools](#journal-fields-and-the-dedicated-tools).
504
+ - Calls written for 2.0 keep working, except where field policy now denies a
505
+ dedicated tool.
506
+
507
+ From 2.0.0 through 2.2.0-dev.6, generic `sn_update` did not accept the
508
+ append-only incident fields `comments` or `work_notes`. Those inputs failed
509
+ before profile credentials or a ServiceNow client were resolved and directed
510
+ the caller to the matching dedicated tool:
460
511
 
461
512
  - use `sn_incident_add_comment` with `{profile, sys_id, content}` for a
462
513
  customer-visible comment;
@@ -491,3 +542,326 @@ The server parses every opted-in query and still rejects OR/NQ/order/group
491
542
  control tokens, JavaScript values, unsupported fields/operators, malformed
492
543
  Unicode, and any request exceeding the rule. Policy errors never echo the raw
493
544
  query value. There is no stdio or transport-specific exception.
545
+
546
+ ## Upgrading to 2.2.0
547
+
548
+ This section is for installs already on 2.x, from 2.0.0 through
549
+ 2.2.0-dev.6, that upgrade to 2.2.0. Its release notes are under `[2.2.0]` in
550
+ the [CHANGELOG](../CHANGELOG.md).
551
+
552
+ Check this table before you upgrade. The first two rows can stop the server
553
+ from starting.
554
+
555
+ | Change | Affects you if | What to do |
556
+ |---|---|---|
557
+ | [`SN_FIELD_POLICY_DEFINITIONS` applies only to the environment profile](#sn_field_policy_definitions-and-configjson) | the variable is set and `~/.servicenow-mcp/config.json` exists | Move the policy into each profile's `fieldPolicy`, then unset the variable |
558
+ | [Field policy is validated at load](#field-policy-load-errors) | a profile states `fieldPolicy`, `readableTableFields` or `writableTableFields` | Fix any load error by editing `config.json` |
559
+ | [Journal fields through the generic write tools](#journal-fields-and-the-dedicated-tools) | a profile grants `sn_create`, `sn_update` or `sn_batch` on a table | State an explicit `writable` list wherever comments must be withheld |
560
+ | [The dedicated journal tools follow field policy](#journal-fields-and-the-dedicated-tools) | a profile narrows `writable` on `incident` or on a `"*"` entry | List `comments` or `work_notes` wherever the matching tool must keep working |
561
+ | [`incident` accepts every field](#incident-accepts-every-field) | a profile grants `sn_create` or `sn_update` on `incident` without an explicit `writable` list | If you relied on the old 14-field limit, set `fieldPolicy.incident.writable` (or a `"*"` entry's `writable`) to the fields agents may set |
562
+ | [A `"*"` entry reaches the ITSM and custom tables](#the--entry-reaches-the-itsm-and-custom-tables) | a profile has a `"*"` entry that states `readable` or `writable` | State the key on each table that must stay open |
563
+ | [`["*"]` now means every field](#a-wildcard-list-now-means-every-field) | a profile used `["*"]` in a field set, so every call on it failed | Replace it with an explicit list unless every field is intended |
564
+ | [Class and domain fields must be listed](#class-and-domain-fields) | anything writes `sys_class_name`, `sys_class_path`, `sys_domain` or `sys_domain_path` | List each field in the table's `writable` |
565
+ | [`readable: []` no longer blocks writes](#readable--and-writable-) | a profile uses `readable: []` to hide a table | Add `writable: []`, or leave the table out of `tableAccess` |
566
+ | [Setup grant defaults](#setup-grant-defaults) | you run `servicenow-mcp-setup grant` | Review the incident target after `--write incident` |
567
+ | [Metadata caching no longer reads `sys_user` or `sys_properties`](#metadata-caching-in-every-auth-mode) | you granted reads on `sys_user` or `sys_properties` only so the metadata cache could resolve a time zone | Remove those grants; `sys_properties` can hold integration secrets |
568
+ | [OAuth client_credentials and API-key profiles start caching](#metadata-caching-in-every-auth-mode) | a profile uses OAuth `client_credentials` or an API key | After re-mapping its credential to another ServiceNow user, or tightening that user's roles or ACLs, restart the server or rotate the secret |
569
+
570
+ The [field policy reference](../README.md#field-policy) describes the
571
+ settings these changes refer to.
572
+
573
+ ### `SN_FIELD_POLICY_DEFINITIONS` and `config.json`
574
+
575
+ Through 2.2.0-dev.6, `SN_FIELD_POLICY_DEFINITIONS` narrowed every profile that
576
+ stated no field policy of its own, including the profiles in `config.json`.
577
+ It now configures only the `SN_PROFILE_NAME` environment profile, the one used
578
+ when no `config.json` exists, the same way the `SN_ALLOWED_*` variables do.
579
+
580
+ Ignoring the variable would silently widen any `config.json` profile it used
581
+ to narrow. So when `config.json` exists and the variable is set to anything
582
+ but a blank value, the server refuses to start:
583
+
584
+ ```text
585
+ [servicenow-mcp] Fatal stdio startup error: SN_FIELD_POLICY_DEFINITIONS is set, but profiles are loaded from the config file; it now applies only to the SN_PROFILE_NAME environment profile. Move the policy into each profile's fieldPolicy, or unset the variable.
586
+ ```
587
+
588
+ `servicenow-mcp-setup` and `servicenow-mcp-profile` refuse the same way when
589
+ the variable is set in their own environment.
590
+
591
+ To fix it:
592
+
593
+ 1. Copy the variable's value into each `config.json` profile it should narrow.
594
+ A table map such as `{"*": {...}, "incident": {...}}` becomes that
595
+ profile's `fieldPolicy`. A value that holds the profile keys
596
+ (`fieldPolicy`, or `readableTableFields` and `writableTableFields`)
597
+ supplies those keys.
598
+ 2. Remove the variable everywhere the server reads it: the client's `env`
599
+ block, your shell profile, and `~/.servicenow-mcp/server.env`, which the
600
+ server reads at startup.
601
+ 3. Restart the client, which starts the server again.
602
+
603
+ If no profile relied on the variable, step 2 is enough.
604
+
605
+ The environment profile still takes the variable. It is now read once, at
606
+ startup, and a malformed value stops startup with the key named, instead of
607
+ denying every request.
608
+
609
+ ### Field-policy load errors
610
+
611
+ `fieldPolicy`, `readableTableFields` and `writableTableFields` are validated
612
+ when profiles load, with the same rules each request applies. A malformed
613
+ entry used to load and then deny every call on its profile, and a few
614
+ mistakes loaded and narrowed nothing. Each case below now stops startup.
615
+
616
+ One bad profile stops the whole `config.json` from loading, so every profile
617
+ in the file is unavailable until you fix it. `servicenow-mcp-setup` and
618
+ `servicenow-mcp-profile` load the same file and refuse it too, and
619
+ `servicenow-mcp-setup doctor` reports the message under its `profiles` check,
620
+ so fix the file by hand.
621
+
622
+ For a `config.json` profile the server prints:
623
+
624
+ ```text
625
+ [servicenow-mcp] Fatal stdio startup error: Profile configuration is invalid: profile "<name>": <message>
626
+ ```
627
+
628
+ A message names the key path and table, never a configured value. For the
629
+ environment profile there is no prefix, and the key path starts with
630
+ `SN_FIELD_POLICY_DEFINITIONS` instead of `fieldPolicy`. Under the dormant HTTP
631
+ transport, these load errors and the `SN_FIELD_POLICY_DEFINITIONS` refusal
632
+ print only `[servicenow-mcp] Fatal HTTP service startup error.`; run the stdio
633
+ server with the same environment, or `servicenow-mcp-setup doctor`, to see the
634
+ full message.
635
+
636
+ | Configuration | Message (after the prefix) |
637
+ |---|---|
638
+ | A field that is not a field name: a pattern such as `"u_*"`, or `"*"` mixed with names | `fieldPolicy.u_audit.writable[0] is not a field name. List exact field names (letters, digits, and underscores, starting with a letter, at most 80 characters), or use "*" on its own for every field; patterns such as "u_*" are not supported.` |
639
+ | The same field twice in one set, ignoring case | `fieldPolicy.incident.writable[4] repeats the field "state".` |
640
+ | A field set that is neither `"*"` nor a list | `fieldPolicy.incident.writable must be "*" or a list of field names.` |
641
+ | `fieldPolicy` that is not an object | `fieldPolicy must be an object that maps table names to { defaults, readable, writable }.` |
642
+ | A table key that is not a table name | `fieldPolicy key 2 is not a valid table name. Use a table name (letters, digits, and underscores, starting with a letter, at most 80 characters) or "*".` |
643
+ | A table entry that is not an object | `fieldPolicy.incident must be an object with defaults, readable, or writable.` |
644
+ | `defaults` outside `readable`, including a named table's `defaults` outside a `"*"` entry's `readable` | `fieldPolicy.incident.defaults lists "caller_id", which fieldPolicy.incident.readable does not allow.` |
645
+ | `defaults: "*"` beside a narrowed `readable` | `fieldPolicy.u_card.defaults is "*" (every field), which fieldPolicy.u_card.readable does not allow. List the default fields, or make readable "*".` |
646
+ | `fieldPolicy` together with one or both table lists | `fieldPolicy cannot be combined with readableTableFields. State the field policy in one form: fieldPolicy alone, or readableTableFields and writableTableFields without fieldPolicy.` |
647
+ | An unknown key in a table entry | `fieldPolicy.incident has an unknown key "writeable". A table entry accepts only defaults, readable, and writable.` |
648
+ | Two table keys that differ only in case | `fieldPolicy key 2 names table "incident" again (table names are case-insensitive); it repeats key 1. State each table once.` |
649
+ | A table list that is not a list | `writableTableFields must be a list of { table, fields } entries.` |
650
+ | A list entry that is not an object | `writableTableFields[0] must be an object with table and fields.` |
651
+ | An unknown key in a list entry | `writableTableFields[0] (table "incident") has an unknown key "writable". A list entry accepts only table and fields.` |
652
+ | One table twice in the same list, ignoring case | `writableTableFields[2] (table "incident") repeats a table already listed at writableTableFields[0]. List each table once.` |
653
+
654
+ An unknown key is named only when it is a valid identifier. Any other key,
655
+ including a comment key such as `_comment`, is reported by position, as in
656
+ `fieldPolicy.incident has an unknown key at position 2.` There is no
657
+ exemption for comment keys, so keep notes outside the policy.
658
+
659
+ `SN_FIELD_POLICY_DEFINITIONS` can also fail on its own:
660
+
661
+ | Value | Message |
662
+ |---|---|
663
+ | Set while `config.json` exists | The refusal [above](#sn_field_policy_definitions-and-configjson) |
664
+ | Not valid JSON | `SN_FIELD_POLICY_DEFINITIONS is not valid JSON.` |
665
+ | Valid JSON, but not an object | `SN_FIELD_POLICY_DEFINITIONS must be a JSON object.` |
666
+ | Longer than 65,536 characters | `SN_FIELD_POLICY_DEFINITIONS exceeds 65536 characters.` |
667
+ | Table keys mixed with the profile keys | `SN_FIELD_POLICY_DEFINITIONS mixes table keys with the profile keys writableTableFields. Use either a table map or the profile keys (fieldPolicy, readableTableFields, writableTableFields), not both.` |
668
+
669
+ ### Journal fields and the dedicated tools
670
+
671
+ `sn_create`, `sn_update` and `sn_batch` now append `comments` and
672
+ `work_notes` on every table a profile may write
673
+ ([Incident journal migration](#incident-journal-migration)). Two consequences
674
+ need a decision before you upgrade.
675
+
676
+ **Omitting the dedicated tools no longer withholds journals.** In 2.x
677
+ releases up to 2.2.0-dev.6, a profile whose `incident` target listed
678
+ `sn_update` but not `sn_incident_add_comment` could not post comments. After
679
+ the upgrade it can, through `sn_update`, `sn_create` and, where granted,
680
+ `sn_batch`, and on every other write-granted table too. To withhold
681
+ customer-visible comments, set `writable` to an explicit list without
682
+ `comments`. With no field policy, the effective list is every field, so there
683
+ is nothing to leave a field out of until you write one:
684
+
685
+ ```json
686
+ {
687
+ "fieldPolicy": {
688
+ "incident": {
689
+ "writable": ["short_description", "description", "state", "assigned_to", "assignment_group", "work_notes"]
690
+ }
691
+ }
692
+ }
693
+ ```
694
+
695
+ State it on every table that needs it, or once on a `"*"` entry, which also
696
+ reaches the other ITSM tables and every custom table. Field policy is
697
+ evaluated against the table a call names, so narrow write-granted parent
698
+ tables such as `task` the same way, or do not grant writes on them.
699
+
700
+ **The dedicated tools now follow field policy.** `sn_incident_add_comment` is
701
+ denied when the incident's effective `writable` set leaves out `comments`, and
702
+ `sn_incident_add_work_note` when it leaves out `work_notes`. The effective set
703
+ comes from `fieldPolicy.incident.writable`, or from a `"*"` entry's
704
+ `writable` when `incident` does not state one. A profile that already narrows
705
+ either without the journal fields loses the matching tool, with a denial that
706
+ names the field and `fieldPolicy.incident.writable`. To keep a tool, add its
707
+ field to the list, for example `"incident": {"writable": [..., "comments"]}`.
708
+
709
+ ### `incident` accepts every field
710
+
711
+ Through 2.2.0-dev.6, `sn_create` and `sn_update` accepted only the 14
712
+ `incident` fields with typed checks (`short_description`, `description`,
713
+ `caller_id`, `assignment_group`, `assigned_to`, `impact`, `urgency`,
714
+ `priority`, `category`, `subcategory`, `state`, `close_code`, `close_notes`
715
+ and `contact_type`), whatever the field policy said. (`sn_batch` applied no
716
+ value checks at all then, so it was never limited this way.) Every other
717
+ incident field is now writable wherever field policy allows it, with the
718
+ generic value bounds: for example `watch_list`, `active`, `parent_incident`,
719
+ `opened_by`, `company`, `cmdb_ci`, and every `u_` or `x_` field. The 14 keep
720
+ their typed checks.
721
+
722
+ So a profile with no field policy that grants `sn_create` or `sn_update` on
723
+ `incident` can now write all of them. Combined with journal
724
+ writes, a profile that may write both `watch_list` and `comments` can direct
725
+ comment notifications to any address (see
726
+ [Production security boundaries](PRODUCTION-SECURITY.md#writing-journals)).
727
+ If you relied on the old limit, list the fields agents may set:
728
+
729
+ ```json
730
+ {
731
+ "fieldPolicy": {
732
+ "incident": {
733
+ "writable": ["short_description", "description", "state", "assigned_to", "assignment_group", "work_notes"]
734
+ }
735
+ }
736
+ }
737
+ ```
738
+
739
+ A `"*"` entry's `writable` list covers `incident` too, when `incident` does
740
+ not state its own.
741
+
742
+ ### A wildcard list now means every field
743
+
744
+ `["*"]` in `defaults`, `readable` or `writable`, or as a list entry's
745
+ `fields`, now means the same as `"*"`. Through 2.2.0-dev.6 it was read as a
746
+ field named `*`, which is not a field name, so every call on the profile
747
+ failed. After the upgrade, a profile that used it is fully open for that set.
748
+ If you did not intend every field, replace it with an explicit list. Only the
749
+ exact form `["*"]` is widened: `["*", "number"]` and similar look-alikes now
750
+ fail at load.
751
+
752
+ ### The `"*"` entry reaches the ITSM and custom tables
753
+
754
+ Through 2.2.0-dev.6, a profile's `"*"` entry applied only to tables that had
755
+ no entry of their own, built-in or named. The 34 built-in tables were never
756
+ narrowed by it, and a custom table the profile named took its unstated keys
757
+ from the open default.
758
+
759
+ Now `readable` and `writable` resolve key by key, from the table's own entry,
760
+ then the `"*"` entry, then every field, on:
761
+
762
+ - the 11 ITSM tables: `incident`, `change_request`, `problem`, `sc_request`,
763
+ `sc_req_item`, `sc_task`, `task`, `cmdb_ci`, `cmdb_ci_server`,
764
+ `cmdb_ci_computer`, `kb_knowledge`;
765
+ - every table without a built-in entry, named in the policy or not.
766
+
767
+ The other 23 built-in tables are system tables, listed in the
768
+ [field policy reference](../README.md#field-policy). A `"*"` entry never
769
+ reaches them, named or not.
770
+
771
+ What changes:
772
+
773
+ - `{"*": {"writable": []}}` on a profile that grants writes on `incident` used
774
+ to allow incident writes, and now denies them, including the dedicated
775
+ journal tools.
776
+ - `{"*": {"writable": []}, "u_x": {"readable": ["sys_id", "name"]}}` used to
777
+ leave `u_x` writable, and now denies writes to it.
778
+ - A named custom table that states only `defaults`, under a `"*"` entry that
779
+ states `readable`, now fails to load if its defaults fall outside that
780
+ readable set.
781
+ - The ITSM tables' default read projections are trimmed to a narrowed `"*"`
782
+ `readable` set.
783
+
784
+ To keep a key open on one table, state it on that table:
785
+
786
+ ```json
787
+ {
788
+ "fieldPolicy": {
789
+ "*": { "writable": [] },
790
+ "incident": { "writable": "*" },
791
+ "u_x": { "readable": ["sys_id", "name"], "writable": "*" }
792
+ }
793
+ }
794
+ ```
795
+
796
+ A `"*"` entry still does not make a profile read-only, because it never
797
+ reaches the system tables. Use `tableAccess.writeTables: []` for that.
798
+
799
+ ### Class and domain fields
800
+
801
+ `sys_class_name`, `sys_class_path`, `sys_domain` and `sys_domain_path` move a
802
+ record to another class or domain. No writable wildcard covers them any more,
803
+ including the open default of a profile with no field policy. Up to
804
+ 2.2.0-dev.6, any table except `incident` accepted them under a wildcard.
805
+
806
+ To allow one, list it by name in the table's `writable`, or in a `"*"`
807
+ entry's `writable` for a table that entry reaches. Listing `sys_domain` does
808
+ not list `sys_domain_path`, and the reverse. Otherwise the write is denied
809
+ with:
810
+
811
+ ```text
812
+ Write denied by policy: field "sys_domain" on "incident" changes the record's class or domain, so a writable wildcard never covers it. List it explicitly in fieldPolicy.incident.writable to allow this write.
813
+ ```
814
+
815
+ ### `readable: []` and `writable: []`
816
+
817
+ `readable: []` used to block writes to a table as a side effect: the write
818
+ was denied while its response projection was prepared, before anything was
819
+ sent. Writes to such a table now succeed and
820
+ return only the record's `sys_id`. Reads stay denied, and `sn_batch` still
821
+ cannot run there, because it reads the matching `sys_id`s first.
822
+
823
+ If you used `readable: []` to hide a table entirely, add `writable: []`, or
824
+ leave the table out of `tableAccess`.
825
+
826
+ Every write response now includes the written record's `sys_id`, even when
827
+ the readable set leaves it out. Every other field, `number` included, follows
828
+ the readable set.
829
+
830
+ ### Setup grant defaults
831
+
832
+ - Without `--tools`, `servicenow-mcp-setup grant --write incident` now binds
833
+ `sn_incident_add_comment` and `sn_incident_add_work_note` to the incident
834
+ target, next to `sn_create` and `sn_update`. Existing profiles are not
835
+ changed on upgrade; re-run the grant to add the tools.
836
+ - Defaults apply only to the tables, and the operations, named in that
837
+ command. A read grant adds no write tools and a write grant adds no read
838
+ tools, including on a table that was reachable only as another target's
839
+ related table.
840
+
841
+ See [Granting table access](CLIENT-SETUP.md#granting-table-access) for the
842
+ opt-outs.
843
+
844
+ ### Metadata caching in every auth mode
845
+
846
+ Through 2.2.0-dev.6, the metadata cache needed the session time zone. It read
847
+ `sys_user.time_zone` for the profile's username, falling back to the
848
+ `glide.sys.default.tz` property in `sys_properties`, and it turned itself off
849
+ for OAuth `client_credentials` and API-key profiles, which have no username.
850
+ It now checks freshness against the cached table's own row count and newest
851
+ row, so it reads neither table and works the same in every auth mode.
852
+
853
+ - **Remove grants made only for the old cache.** If you granted read access
854
+ to `sys_user` or `sys_properties` only for this lookup, whether in
855
+ `tableAccess.readTables`, in `SN_ALLOWED_READ_TABLES`, or as a role on the
856
+ integration user, remove it. `sys_properties` rows routinely hold
857
+ integration secrets.
858
+ - **Client-credentials and API-key profiles start caching.** Cache entries are
859
+ partitioned by credential, not by the ServiceNow user it runs as, and a hit
860
+ re-reads only the table's watermark. After you re-map the OAuth application
861
+ or API key to another user, or tighten that user's roles or ACLs, restart
862
+ the server or rotate the secret; until then, rows cached earlier can be
863
+ served for up to one TTL. A profile's `tableAccess` and `fieldPolicy` still
864
+ apply on every call.
865
+
866
+ See [Metadata caching](CLIENT-SETUP.md#metadata-caching) for how the
867
+ watermark works and what it can miss.
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@onlyflows/servicenow-mcp",
3
- "version": "2.2.0-dev.5",
4
- "description": "stdio ServiceNow MCP server with 23 tools for CRUD, CMDB traversal, ATF testing, and explicit multi-instance profiles.",
3
+ "mcpName": "io.github.onlyflowstech/servicenow-mcp",
4
+ "version": "2.2.0",
5
+ "description": "Governed stdio ServiceNow MCP server for production: 24 tools with per-profile table and field policy, dry-run bulk changes, activity events, multi-instance profiles, CMDB traversal, ATF testing and read-only Flow Designer flow views.",
5
6
  "main": "dist/index.js",
6
7
  "types": "dist/index.d.ts",
7
8
  "bin": {
@@ -35,12 +36,23 @@
35
36
  },
36
37
  "keywords": [
37
38
  "servicenow",
39
+ "servicenow-mcp",
38
40
  "mcp",
41
+ "mcp-server",
39
42
  "model-context-protocol",
40
43
  "stdio",
44
+ "claude",
45
+ "claude-code",
46
+ "cursor",
47
+ "codex",
48
+ "vscode",
41
49
  "itsm",
42
50
  "itom",
43
51
  "cmdb",
52
+ "now-platform",
53
+ "atf",
54
+ "governance",
55
+ "security",
44
56
  "ai-tools"
45
57
  ],
46
58
  "author": "OnlyFlows <support@onlyflows.tech> (https://onlyflows.tech)",
@@ -57,17 +69,18 @@
57
69
  "node": ">=20"
58
70
  },
59
71
  "dependencies": {
60
- "@hono/node-server": "2.0.12",
61
- "@modelcontextprotocol/sdk": "1.30.0",
72
+ "@hono/node-server": "2.1.3",
73
+ "@modelcontextprotocol/sdk": "1.32.2",
62
74
  "parse5": "7.3.0",
63
- "zod": "^3.25.76"
75
+ "zod": "4.6.7"
64
76
  },
65
77
  "overrides": {
66
- "@hono/node-server": "2.0.12"
78
+ "@hono/node-server": "2.1.3"
67
79
  },
68
80
  "devDependencies": {
69
81
  "@eslint/js": "9.39.5",
70
82
  "@types/node": "^20.11.0",
83
+ "ajv": "8.18.0",
71
84
  "eslint": "9.39.5",
72
85
  "globals": "17.8.0",
73
86
  "typescript": "^5.3.0",
@@ -84,6 +97,7 @@
84
97
  "docs/CONTAINER-DEPLOYMENT.md",
85
98
  "docs/CROSS-CLIENT-RELEASE-MATRIX.md",
86
99
  "docs/ENTERPRISE-RELEASE-BOUNDARY.md",
100
+ "docs/FLOW-VIEW.md",
87
101
  "docs/OPERATIONS-RUNBOOK.md",
88
102
  "docs/PRIVATE-CHATGPT-CONNECTIVITY.md",
89
103
  "docs/PRODUCTION-SECURITY.md",
@@ -96,6 +110,7 @@
96
110
  "scripts/smoke-test.mjs",
97
111
  "tools/inspector/package.json",
98
112
  "tools/inspector/package-lock.json",
113
+ "server.json",
99
114
  "CHANGELOG.md",
100
115
  "README.md",
101
116
  "LICENSE"
@@ -50,6 +50,7 @@ export function validateReleaseContract(options = {}) {
50
50
  packageLock.packages?.[""]?.version === packageJson.version,
51
51
  "root lock package version differs from package version"
52
52
  );
53
+ validateServerJson(JSON.parse(read("server.json")), packageJson);
53
54
  const tag = options.tag ?? releaseTagFromEnvironment(options.environment ?? process.env);
54
55
  if (tag !== undefined) {
55
56
  assert(tag === `v${packageJson.version}`, "release tag must exactly match package version");
@@ -81,6 +82,7 @@ export function validateReleaseContract(options = {}) {
81
82
  "scripts/inspector.mjs",
82
83
  "scripts/release-validate.mjs",
83
84
  "scripts/smoke-test.mjs",
85
+ "server.json",
84
86
  "docs/RELEASE-VALIDATION.md",
85
87
  "tools/inspector/package.json",
86
88
  "tools/inspector/package-lock.json",
@@ -166,6 +168,60 @@ export function validateReleaseContract(options = {}) {
166
168
  });
167
169
  }
168
170
 
171
+ /**
172
+ * Fail closed on the official-registry manifest: it must describe exactly one
173
+ * stdio npm package that is this package at this version, with nothing that
174
+ * could add a remote endpoint, environment, or launch arguments.
175
+ */
176
+ export function validateServerJson(serverJson, packageJson) {
177
+ const keys = (value) => Object.keys(value ?? {});
178
+ const allowedTop = new Set([
179
+ "$schema", "name", "title", "description", "repository", "version", "packages",
180
+ ]);
181
+ for (const key of keys(serverJson)) {
182
+ assert(allowedTop.has(key), `server.json has unexpected field ${key}`);
183
+ }
184
+ assert(
185
+ typeof packageJson.mcpName === "string" &&
186
+ typeof serverJson?.name === "string" &&
187
+ serverJson.name === packageJson.mcpName &&
188
+ serverJson.name.startsWith("io.github.onlyflowstech/"),
189
+ "server.json name and package.json mcpName must match and start with io.github.onlyflowstech/"
190
+ );
191
+ assert(
192
+ serverJson.version === packageJson.version,
193
+ "server.json version differs from package.json"
194
+ );
195
+ assert(
196
+ Array.isArray(serverJson.packages) && serverJson.packages.length === 1,
197
+ "server.json must list exactly one package"
198
+ );
199
+ const [entry] = serverJson.packages;
200
+ const allowedPackage = new Set([
201
+ "registryType", "identifier", "version", "runtimeHint", "transport",
202
+ ]);
203
+ for (const key of keys(entry)) {
204
+ assert(allowedPackage.has(key), `server.json package has unexpected field ${key}`);
205
+ }
206
+ assert(entry.runtimeHint === "npx", 'server.json runtimeHint must be "npx"');
207
+ const repo = serverJson.repository;
208
+ assert(
209
+ repo?.url === "https://github.com/onlyflowstech/servicenow-mcp" &&
210
+ repo.source === "github" &&
211
+ keys(repo).length === 2,
212
+ "server.json repository must be exactly the onlyflowstech/servicenow-mcp GitHub URL"
213
+ );
214
+ assert(entry.registryType === "npm", "server.json package must be registryType npm");
215
+ assert(
216
+ entry.identifier === packageJson.name && entry.version === packageJson.version,
217
+ "server.json package identifier or version differs from package.json"
218
+ );
219
+ assert(
220
+ entry.transport?.type === "stdio" && keys(entry.transport).length === 1,
221
+ "server.json package transport must be exactly stdio"
222
+ );
223
+ }
224
+
169
225
  /** Only reviewed stable and dev channels can be published. */
170
226
  export function releaseChannel(version) {
171
227
  const match = /^(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)(-dev\.(?:0|[1-9][0-9]*))?$/u.exec(version);