@onlyflows/servicenow-mcp 2.2.0-dev.6 → 2.2.1

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 (269) hide show
  1. package/.env.example +6 -3
  2. package/CHANGELOG.md +404 -0
  3. package/README.md +580 -104
  4. package/dist/atf-form.d.ts +3 -15
  5. package/dist/atf-form.d.ts.map +1 -1
  6. package/dist/atf-policy.d.ts +1 -1
  7. package/dist/atf-policy.d.ts.map +1 -1
  8. package/dist/atf-policy.js +2 -0
  9. package/dist/atf-policy.js.map +1 -1
  10. package/dist/atf-result-cache.d.ts +23 -59
  11. package/dist/atf-result-cache.d.ts.map +1 -1
  12. package/dist/auth.d.ts +1 -0
  13. package/dist/auth.d.ts.map +1 -1
  14. package/dist/auth.js +17 -0
  15. package/dist/auth.js.map +1 -1
  16. package/dist/batch-limits.d.ts +18 -0
  17. package/dist/batch-limits.d.ts.map +1 -0
  18. package/dist/batch-limits.js +21 -0
  19. package/dist/batch-limits.js.map +1 -0
  20. package/dist/bounded-input.d.ts +49 -0
  21. package/dist/bounded-input.d.ts.map +1 -0
  22. package/dist/bounded-input.js +81 -0
  23. package/dist/bounded-input.js.map +1 -0
  24. package/dist/client.d.ts +25 -0
  25. package/dist/client.d.ts.map +1 -1
  26. package/dist/client.js +92 -18
  27. package/dist/client.js.map +1 -1
  28. package/dist/credential-tables.d.ts +32 -0
  29. package/dist/credential-tables.d.ts.map +1 -0
  30. package/dist/credential-tables.js +58 -0
  31. package/dist/credential-tables.js.map +1 -0
  32. package/dist/encoded-query-policy.d.ts +11 -0
  33. package/dist/encoded-query-policy.d.ts.map +1 -1
  34. package/dist/encoded-query-policy.js +18 -2
  35. package/dist/encoded-query-policy.js.map +1 -1
  36. package/dist/execution-context.d.ts +14 -0
  37. package/dist/execution-context.d.ts.map +1 -1
  38. package/dist/execution-context.js +8 -0
  39. package/dist/execution-context.js.map +1 -1
  40. package/dist/field-policy.d.ts +115 -3
  41. package/dist/field-policy.d.ts.map +1 -1
  42. package/dist/field-policy.js +909 -97
  43. package/dist/field-policy.js.map +1 -1
  44. package/dist/hidden-values.d.ts +225 -0
  45. package/dist/hidden-values.d.ts.map +1 -0
  46. package/dist/hidden-values.js +748 -0
  47. package/dist/hidden-values.js.map +1 -0
  48. package/dist/html-response.d.ts +34 -0
  49. package/dist/html-response.d.ts.map +1 -0
  50. package/dist/html-response.js +72 -0
  51. package/dist/html-response.js.map +1 -0
  52. package/dist/http-entrypoint.d.ts.map +1 -1
  53. package/dist/http-entrypoint.js +7 -0
  54. package/dist/http-entrypoint.js.map +1 -1
  55. package/dist/http-runtime.d.ts.map +1 -1
  56. package/dist/http-runtime.js +8 -0
  57. package/dist/http-runtime.js.map +1 -1
  58. package/dist/incident-journal-policy.d.ts +27 -5
  59. package/dist/incident-journal-policy.d.ts.map +1 -1
  60. package/dist/incident-journal-policy.js +34 -21
  61. package/dist/incident-journal-policy.js.map +1 -1
  62. package/dist/index.js +7 -0
  63. package/dist/index.js.map +1 -1
  64. package/dist/json-shape-limits.d.ts +71 -0
  65. package/dist/json-shape-limits.d.ts.map +1 -0
  66. package/dist/json-shape-limits.js +131 -0
  67. package/dist/json-shape-limits.js.map +1 -0
  68. package/dist/metadata-cache.d.ts +84 -21
  69. package/dist/metadata-cache.d.ts.map +1 -1
  70. package/dist/metadata-cache.js +316 -196
  71. package/dist/metadata-cache.js.map +1 -1
  72. package/dist/policy-card.d.ts +146 -0
  73. package/dist/policy-card.d.ts.map +1 -0
  74. package/dist/policy-card.js +420 -0
  75. package/dist/policy-card.js.map +1 -0
  76. package/dist/profile-manager.d.ts +19 -3
  77. package/dist/profile-manager.d.ts.map +1 -1
  78. package/dist/profile-manager.js +89 -4
  79. package/dist/profile-manager.js.map +1 -1
  80. package/dist/record-identifier-policy.d.ts +2 -8
  81. package/dist/record-identifier-policy.d.ts.map +1 -1
  82. package/dist/risky-grants.d.ts +25 -0
  83. package/dist/risky-grants.d.ts.map +1 -0
  84. package/dist/risky-grants.js +77 -0
  85. package/dist/risky-grants.js.map +1 -0
  86. package/dist/server.d.ts.map +1 -1
  87. package/dist/server.js +26 -5
  88. package/dist/server.js.map +1 -1
  89. package/dist/setup-prompts.js +1 -0
  90. package/dist/setup-prompts.js.map +1 -1
  91. package/dist/setup.d.ts +1 -1
  92. package/dist/setup.d.ts.map +1 -1
  93. package/dist/setup.js +305 -59
  94. package/dist/setup.js.map +1 -1
  95. package/dist/stdio-runtime.d.ts +15 -0
  96. package/dist/stdio-runtime.d.ts.map +1 -1
  97. package/dist/stdio-runtime.js +60 -0
  98. package/dist/stdio-runtime.js.map +1 -1
  99. package/dist/structured-query.d.ts +100 -115
  100. package/dist/structured-query.d.ts.map +1 -1
  101. package/dist/structured-query.js +138 -17
  102. package/dist/structured-query.js.map +1 -1
  103. package/dist/table-policy.d.ts +41 -4
  104. package/dist/table-policy.d.ts.map +1 -1
  105. package/dist/table-policy.js +82 -10
  106. package/dist/table-policy.js.map +1 -1
  107. package/dist/tool-error.d.ts +34 -0
  108. package/dist/tool-error.d.ts.map +1 -1
  109. package/dist/tool-error.js +109 -1
  110. package/dist/tool-error.js.map +1 -1
  111. package/dist/tool-table-access.d.ts.map +1 -1
  112. package/dist/tool-table-access.js +35 -5
  113. package/dist/tool-table-access.js.map +1 -1
  114. package/dist/tools/aggregate.d.ts +13 -19
  115. package/dist/tools/aggregate.d.ts.map +1 -1
  116. package/dist/tools/aggregate.js +4 -5
  117. package/dist/tools/aggregate.js.map +1 -1
  118. package/dist/tools/all-fields-cap.d.ts.map +1 -1
  119. package/dist/tools/all-fields-cap.js +32 -45
  120. package/dist/tools/all-fields-cap.js.map +1 -1
  121. package/dist/tools/atf-author-module.d.ts +29 -14
  122. package/dist/tools/atf-author-module.d.ts.map +1 -1
  123. package/dist/tools/atf-author-module.js +11 -5
  124. package/dist/tools/atf-author-module.js.map +1 -1
  125. package/dist/tools/atf-contracts.d.ts +135 -829
  126. package/dist/tools/atf-contracts.d.ts.map +1 -1
  127. package/dist/tools/atf-shared.js +2 -2
  128. package/dist/tools/atf-shared.js.map +1 -1
  129. package/dist/tools/atf-step-catalog.d.ts +16 -15
  130. package/dist/tools/atf-step-catalog.d.ts.map +1 -1
  131. package/dist/tools/atf-step-catalog.js +181 -10
  132. package/dist/tools/atf-step-catalog.js.map +1 -1
  133. package/dist/tools/atf.d.ts +8 -24
  134. package/dist/tools/atf.d.ts.map +1 -1
  135. package/dist/tools/atf.js +2 -2
  136. package/dist/tools/atf.js.map +1 -1
  137. package/dist/tools/attach.d.ts +6 -22
  138. package/dist/tools/attach.d.ts.map +1 -1
  139. package/dist/tools/batch.d.ts +18 -71
  140. package/dist/tools/batch.d.ts.map +1 -1
  141. package/dist/tools/batch.js +566 -100
  142. package/dist/tools/batch.js.map +1 -1
  143. package/dist/tools/catalog.d.ts +2 -2
  144. package/dist/tools/catalog.d.ts.map +1 -1
  145. package/dist/tools/catalog.js +7 -1
  146. package/dist/tools/catalog.js.map +1 -1
  147. package/dist/tools/codesearch.d.ts +1 -13
  148. package/dist/tools/codesearch.d.ts.map +1 -1
  149. package/dist/tools/create-module.d.ts +9 -14
  150. package/dist/tools/create-module.d.ts.map +1 -1
  151. package/dist/tools/create-module.js +4 -8
  152. package/dist/tools/create-module.js.map +1 -1
  153. package/dist/tools/delete.d.ts +1 -9
  154. package/dist/tools/delete.d.ts.map +1 -1
  155. package/dist/tools/delete.js +2 -3
  156. package/dist/tools/delete.js.map +1 -1
  157. package/dist/tools/discover.d.ts +6 -14
  158. package/dist/tools/discover.d.ts.map +1 -1
  159. package/dist/tools/flow-view-contracts.d.ts +1023 -0
  160. package/dist/tools/flow-view-contracts.d.ts.map +1 -0
  161. package/dist/tools/flow-view-contracts.js +570 -0
  162. package/dist/tools/flow-view-contracts.js.map +1 -0
  163. package/dist/tools/flow-view-graph.d.ts +86 -0
  164. package/dist/tools/flow-view-graph.d.ts.map +1 -0
  165. package/dist/tools/flow-view-graph.js +993 -0
  166. package/dist/tools/flow-view-graph.js.map +1 -0
  167. package/dist/tools/flow-view-gzip.d.ts +52 -0
  168. package/dist/tools/flow-view-gzip.d.ts.map +1 -0
  169. package/dist/tools/flow-view-gzip.js +179 -0
  170. package/dist/tools/flow-view-gzip.js.map +1 -0
  171. package/dist/tools/flow-view-mermaid.d.ts +37 -0
  172. package/dist/tools/flow-view-mermaid.d.ts.map +1 -0
  173. package/dist/tools/flow-view-mermaid.js +337 -0
  174. package/dist/tools/flow-view-mermaid.js.map +1 -0
  175. package/dist/tools/flow-view-module.d.ts +61 -0
  176. package/dist/tools/flow-view-module.d.ts.map +1 -0
  177. package/dist/tools/flow-view-module.js +378 -0
  178. package/dist/tools/flow-view-module.js.map +1 -0
  179. package/dist/tools/flow-view-policy.d.ts +106 -0
  180. package/dist/tools/flow-view-policy.d.ts.map +1 -0
  181. package/dist/tools/flow-view-policy.js +462 -0
  182. package/dist/tools/flow-view-policy.js.map +1 -0
  183. package/dist/tools/flow-view-renderers.d.ts +68 -0
  184. package/dist/tools/flow-view-renderers.d.ts.map +1 -0
  185. package/dist/tools/flow-view-renderers.js +513 -0
  186. package/dist/tools/flow-view-renderers.js.map +1 -0
  187. package/dist/tools/flow-view-table.d.ts +115 -0
  188. package/dist/tools/flow-view-table.d.ts.map +1 -0
  189. package/dist/tools/flow-view-table.js +1002 -0
  190. package/dist/tools/flow-view-table.js.map +1 -0
  191. package/dist/tools/get-module.d.ts +36 -42
  192. package/dist/tools/get-module.d.ts.map +1 -1
  193. package/dist/tools/health.d.ts +9 -6
  194. package/dist/tools/health.d.ts.map +1 -1
  195. package/dist/tools/incident-journal-module.d.ts +8 -7
  196. package/dist/tools/incident-journal-module.d.ts.map +1 -1
  197. package/dist/tools/index.d.ts +4 -4
  198. package/dist/tools/index.d.ts.map +1 -1
  199. package/dist/tools/index.js +118 -18
  200. package/dist/tools/index.js.map +1 -1
  201. package/dist/tools/markdown.d.ts +27 -0
  202. package/dist/tools/markdown.d.ts.map +1 -1
  203. package/dist/tools/markdown.js +104 -1
  204. package/dist/tools/markdown.js.map +1 -1
  205. package/dist/tools/nl.d.ts +1 -11
  206. package/dist/tools/nl.d.ts.map +1 -1
  207. package/dist/tools/profile.d.ts +1 -1
  208. package/dist/tools/profile.d.ts.map +1 -1
  209. package/dist/tools/profile.js +20 -1
  210. package/dist/tools/profile.js.map +1 -1
  211. package/dist/tools/query-module.d.ts +59 -71
  212. package/dist/tools/query-module.d.ts.map +1 -1
  213. package/dist/tools/query-module.js +28 -7
  214. package/dist/tools/query-module.js.map +1 -1
  215. package/dist/tools/record-write-shared.d.ts.map +1 -1
  216. package/dist/tools/record-write-shared.js +20 -2
  217. package/dist/tools/record-write-shared.js.map +1 -1
  218. package/dist/tools/relationships.d.ts +6 -22
  219. package/dist/tools/relationships.d.ts.map +1 -1
  220. package/dist/tools/result-envelope.d.ts +2255 -1357
  221. package/dist/tools/result-envelope.d.ts.map +1 -1
  222. package/dist/tools/result-envelope.js +24 -2
  223. package/dist/tools/result-envelope.js.map +1 -1
  224. package/dist/tools/schema-module.d.ts +36 -21
  225. package/dist/tools/schema-module.d.ts.map +1 -1
  226. package/dist/tools/schema-module.js +106 -65
  227. package/dist/tools/schema-module.js.map +1 -1
  228. package/dist/tools/script.d.ts +1 -11
  229. package/dist/tools/script.d.ts.map +1 -1
  230. package/dist/tools/syslog.d.ts +11 -18
  231. package/dist/tools/syslog.d.ts.map +1 -1
  232. package/dist/tools/syslog.js +2 -3
  233. package/dist/tools/syslog.js.map +1 -1
  234. package/dist/tools/table-hierarchy.d.ts +35 -0
  235. package/dist/tools/table-hierarchy.d.ts.map +1 -0
  236. package/dist/tools/table-hierarchy.js +74 -0
  237. package/dist/tools/table-hierarchy.js.map +1 -0
  238. package/dist/tools/tool-module.d.ts +40 -15
  239. package/dist/tools/tool-module.d.ts.map +1 -1
  240. package/dist/tools/tool-module.js +755 -205
  241. package/dist/tools/tool-module.js.map +1 -1
  242. package/dist/tools/update-module.d.ts +11 -17
  243. package/dist/tools/update-module.d.ts.map +1 -1
  244. package/dist/tools/update-module.js +10 -12
  245. package/dist/tools/update-module.js.map +1 -1
  246. package/dist/unknown-filter-fields.d.ts +52 -0
  247. package/dist/unknown-filter-fields.d.ts.map +1 -0
  248. package/dist/unknown-filter-fields.js +87 -0
  249. package/dist/unknown-filter-fields.js.map +1 -0
  250. package/dist/version.d.ts +1 -1
  251. package/dist/version.d.ts.map +1 -1
  252. package/dist/version.js +1 -1
  253. package/dist/version.js.map +1 -1
  254. package/dist/write-value-policy.d.ts +20 -12
  255. package/dist/write-value-policy.d.ts.map +1 -1
  256. package/dist/write-value-policy.js +179 -67
  257. package/dist/write-value-policy.js.map +1 -1
  258. package/docs/ADDING-TOOLS.md +22 -13
  259. package/docs/CLIENT-SETUP.md +110 -52
  260. package/docs/CROSS-CLIENT-RELEASE-MATRIX.md +2 -2
  261. package/docs/FLOW-VIEW.md +214 -0
  262. package/docs/PRODUCTION-SECURITY.md +218 -25
  263. package/docs/RELEASE-VALIDATION.md +2 -2
  264. package/docs/TESTING-OAUTH.md +1 -1
  265. package/docs/V2-MIGRATION.md +404 -30
  266. package/package.json +20 -6
  267. package/scripts/release-validate.mjs +56 -0
  268. package/server.json +22 -0
  269. package/tools/inspector/package-lock.json +163 -201
package/.env.example CHANGED
@@ -27,9 +27,12 @@ MCP_CLIENT_ID=example-client
27
27
 
28
28
  # Deny-by-default example policy. This permits only bounded incident reads.
29
29
  # For local exploratory read-only testing, SN_ALLOWED_READ_TABLES=* plus the
30
- # SN_FIELD_POLICY_DEFINITIONS wildcard below allows all non-hard-denied readable
31
- # tables/fields. Keep writes exact unless you intentionally want broad mutation
32
- # access.
30
+ # SN_FIELD_POLICY_DEFINITIONS wildcard below allows reads of every table and
31
+ # every field except sensitive-looking names (password, token, secret and
32
+ # similar), bounded by the account's ServiceNow ACLs. SN_FIELD_POLICY_DEFINITIONS
33
+ # applies only to this environment profile; if ~/.servicenow-mcp/config.json
34
+ # exists, setting it stops startup. Keep writes exact unless you intentionally
35
+ # want broad mutation access.
33
36
  SN_ALLOWED_READ_TABLES=incident
34
37
  SN_ALLOWED_WRITE_TABLES=
35
38
  SN_TABLE_ACCESS_TARGETS=[{"table":"incident","kind":"canonical","tools":["sn_query","sn_get"],"closureComplete":true,"relatedTables":["incident"]}]
package/CHANGELOG.md CHANGED
@@ -5,6 +5,410 @@ All notable changes to this project are documented here.
5
5
  The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.2.1] — 2026-11-16
9
+
10
+ ### Changed
11
+
12
+ - **Read tools hide `password`/`password2`-typed fields by dictionary type as
13
+ well as by name.** A field whose internal type is `password`, `password2`,
14
+ `masked` or `encrypted_text` is refused when named, left out of `fields=all`,
15
+ detailed and default reads, `"*"` responses and write echoes, refused as a
16
+ filter, order, aggregate, group-by or ATF step-condition field, and refused
17
+ as a write key, whatever it is called. A `sys_properties` row shows `value`
18
+ only when its `type` is a known non-secret type. The types come from one
19
+ cached `sys_dictionary` read per credential. While they cannot be read,
20
+ field-policy tools refuse with a message naming the access needed, unless the
21
+ profile sets `"fieldTypes": { "dictionary": "not_required" }`, which falls
22
+ back to name-only hiding and is flagged on the policy card. `tools/list` is
23
+ unchanged.
24
+
25
+ - **`sn_atf_author` checks the table, conditions and ACL setting of ATF steps
26
+ when it adds them.** A `record_query`, `record_validation`,
27
+ `field_values_validation` or `open_existing_record` step needs a read grant on
28
+ the table it names, and an `open_new_form` or `set_field_values` step a write
29
+ grant, with the same refusal as any table access (a named-only table such as
30
+ `sys_audit` must be named). The conditions of `record_query`,
31
+ `record_validation` and `field_values_validation` are checked against the
32
+ table's field policy: a field the profile may not read, a dot-walk (`a.b`), a
33
+ condition that is only a pasted step output, and a term the check does not
34
+ recognise are refused, and only the operators that compare a field with a
35
+ literal are allowed (`=`, `!=`, `<`, `<=`, `>`, `>=`, `LIKE`, `NOT LIKE`,
36
+ `STARTSWITH`, `ENDSWITH`, `IN`, `NOT IN`, `ISEMPTY`, `ISNOTEMPTY`, `BETWEEN`),
37
+ so an operator that takes a second field, such as `SAMEAS` or `GT_FIELD`, is
38
+ refused. `enforce_security: false` is refused on `record_query` and
39
+ `record_validation` with a fixed message (leave it out, or pass `true`; it
40
+ stays `true` by default). A refused step refuses the whole call, before any
41
+ write. A condition value, and a `set_field_values` value, may refer to an earlier
42
+ step's output only by record id or sys_id (`record_id`, `first_record`,
43
+ `sys_id`, `user`), and the fields a
44
+ `set_field_values` step sets must be writable on its table, as for `sn_update`.
45
+ The impersonated user's ACLs still apply on top; suites authored in the
46
+ instance are not checked by the server's table grants, and `atf.execute` stays
47
+ opt-in. The README and `docs/PRODUCTION-SECURITY.md` now also say that a
48
+ database view or extension table over one of the six named-only tables is not
49
+ covered by the name list.
50
+ - **A `"*"` write grant does not cover `sys_atf_step`, `sys_variable_value`
51
+ and `sys_element_mapping` for the generic write tools.** These tables hold the
52
+ step types, input values and pill mappings that `sn_atf_author` checks when it
53
+ adds a step. Under `"*"`,
54
+ `sn_atf_author` still writes them, but `sn_create`, `sn_update`, `sn_delete`,
55
+ `sn_batch` and attachment uploads reach them only when the profile names the
56
+ table for write, for example `servicenow-mcp-setup grant --profile <profile>
57
+ --write sys_atf_step --tools sn_update`; a refusal is the usual table-access
58
+ denial. Reads are unchanged, and no other table's access changes.
59
+ `sys_variable_value` and `sys_element_mapping` also hold other variables'
60
+ values and mappings (catalog variables, for example), so a profile that writes
61
+ those with the generic tools must now name them. The policy card lists the
62
+ three tables as outside the wildcard row's write access.
63
+ - **`sys_audit` and `sys_journal_field` are granted by name only: a `"*"` table
64
+ grant does not cover them.** Their rows hold the old and new values of other
65
+ tables' fields, comments and work notes. With `"*"` alone, `sn_query`, `sn_get`,
66
+ `sn_aggregate`, `sn_schema`, `sn_batch` and the other tools refuse them with
67
+ the usual table-access denial. To read one, name it:
68
+ `servicenow-mcp-setup grant --profile <profile> --read sys_audit --tools
69
+ sn_query`. A profile that already names a table is unaffected, and a `"*"`
70
+ grant beside the name still covers everything else. A read that names no
71
+ `fields` returns `sys_id`, `tablename`, `documentkey`, `fieldname`, `user` and
72
+ `sys_created_on` for `sys_audit`, and `sys_id`, `name`, `element_id`, `element`,
73
+ `sys_created_by` and `sys_created_on` for `sys_journal_field`; ask for
74
+ `oldvalue`, `newvalue` or `value` by name. No other table's access changes. The
75
+ policy card and the setup wizard's wildcard note say the same.
76
+ - **Four more tables are granted by name only, and a `"*"` field entry now
77
+ narrows all six.** `sys_history_line`, `sys_audit_delete`, `sys_attachment_doc`
78
+ and `sys_email` join `sys_audit` and `sys_journal_field`: a `"*"` table grant does
79
+ not cover them, for read or write, and a profile reaches one only when
80
+ `tableAccess` names it. Their rows hold history built from audit, deleted
81
+ records, attachment content and email bodies. A refusal is the usual
82
+ table-access denial. A read that names no `fields` leaves out the value
83
+ columns (`old`, `new`, `old_value` and `new_value`; `payload`; `data`; `body`,
84
+ `body_text`, `subject`, `recipients`, `copied`, `blind_copied`, `reply_to`,
85
+ `headers` and `error_string`), so ask for them by name. For field policy
86
+ the six belong to the profile, as the ITSM tables do: once a profile names one,
87
+ its `"*"` field entry narrows it, and an entry for the table itself narrows or
88
+ widens it. The 23 system tables, which a `"*"` field entry never narrows, are
89
+ unchanged. `sn_attach` is unaffected: it uses the Attachment API and never
90
+ reads `sys_attachment_doc`.
91
+ A `relatedTables` list that reaches one of the six under a `"*"` grant still
92
+ stops the profile loading, and the message now names the table and says it
93
+ must be granted by name. `sn_profile` reports these tables with the class
94
+ `named_only`.
95
+ - **`sn_batch` and `sn_query` refuse a `structured_query` filter or order on a
96
+ field the table does not have.** A confirmed `sn_batch` update or delete, its
97
+ dry run and an `sn_query` read stop with a fixed message that names the field
98
+ ("was not found on the table, or is not readable by this user") before any
99
+ record is changed or listed; for `sn_batch` that is before the sample or the
100
+ write. No extra request is made: the fields a filter or order uses are added to
101
+ the read's `sysparm_fields`, looked for in the rows that come back, and left out
102
+ of the result. A field counts as present when any returned row carries it, an
103
+ existing column with no value is still returned, and a read that returns no
104
+ rows is returned as before, since there is nothing to check. A raw encoded
105
+ `query` is not checked; it is only accepted through a policy rule that pins
106
+ the query and its fields. The extra columns add bytes to each fetched row, and
107
+ a filter on a very large text field that is not in `fields` can take a wide
108
+ read past the 1 MiB upstream response limit: the call then says so and asks for
109
+ a lower `limit`.
110
+
111
+ ### Security
112
+
113
+ - **HTTP server dependencies.** `@hono/node-server` moves from 2.1.3 to 2.1.7
114
+ and `hono` (transitive, through the MCP SDK) from 4.13.13 to 4.13.18,
115
+ clearing the advisories that `npm audit --omit=dev` reported:
116
+ GHSA-qv5m-9pm6-hqp3 and GHSA-jpvv-r467-5p4w in `@hono/node-server`, and
117
+ GHSA-4m76-xfj5-7975, GHSA-h7mg-cq63-vhpq, GHSA-3gg2-335m-rxc6,
118
+ GHSA-4h7h-rv7c-7m2v and GHSA-46wx-v44x-9hh2 in `hono`. The same releases
119
+ also carry the fixes for GHSA-7v5p-43qr-wch5 and GHSA-fj57-4f93-cfw6
120
+ (`@hono/node-server`) and GHSA-92p4-j3wq-jmqx, GHSA-39q9-qp46-w8xg and
121
+ GHSA-74fm-fwc7-3fwp (`hono`). The `tools/inspector` lock moves to `hono`
122
+ 4.13.18 and `@hono/node-server` 2.1.8. In the published package, only the
123
+ dormant HTTP transport uses these packages. One behaviour
124
+ change: a request to `/mcp` whose raw path contains a backslash (for example
125
+ `\mcp`, which the server's own path check reads as `/mcp`) now gets 400 Bad
126
+ Request.
127
+
128
+ ## [2.2.0] — 2026-10-30
129
+
130
+ 2.2.0 is the first stable release since 2.1.0. It contains everything
131
+ published on the `dev` channel as 2.2.0-dev.1 through 2.2.0-dev.6 (listed
132
+ under those versions below) plus the changes in this section. Numbers in
133
+ parentheses are the pull requests that made each change.
134
+
135
+ > **Upgrade every install: this release fixes a denial-of-service
136
+ > vulnerability.** A single oversized or deeply nested request could make the
137
+ > server exhaust its memory and stop. See **Security** below.
138
+ >
139
+ > **Read this before upgrading.** 2.2.0 can stop a working install from
140
+ > starting, and it changes what some profiles may write:
141
+ >
142
+ > - The server refuses to start while `SN_FIELD_POLICY_DEFINITIONS` is set and
143
+ > `~/.servicenow-mcp/config.json` exists.
144
+ > - A malformed or ambiguous field policy in `config.json` now stops the whole
145
+ > file from loading. The server, `servicenow-mcp-setup` and
146
+ > `servicenow-mcp-profile` all refuse it until you fix it by hand.
147
+ > - `sn_create`, `sn_update` and `sn_batch` can append `comments` and
148
+ > `work_notes` on every table a profile may write. Leaving the dedicated
149
+ > journal tools off a target no longer withholds journals.
150
+ > - `sn_create` and `sn_update` writes to `incident` are no longer limited to
151
+ > 14 typed fields: every field the profile's field policy allows, such as
152
+ > `watch_list`, can now be written.
153
+ > - `["*"]` in a field set now means every field. A profile that used it, and
154
+ > so failed every call, becomes fully open.
155
+ > - `readable: []` no longer blocks writes to its table. Add `writable: []` to
156
+ > keep writes blocked.
157
+ >
158
+ > [Upgrading to 2.2.0](docs/V2-MIGRATION.md#upgrading-to-220) lists every case
159
+ > with its remedy.
160
+
161
+ ### Security
162
+
163
+ - **Denial-of-service fix: oversized requests are rejected before
164
+ validation.** A single very large or deeply nested request could make
165
+ the server use far more memory and time than its size suggests, until it
166
+ stopped responding. Every
167
+ incoming message, over stdio and HTTP, now passes plain structural checks
168
+ before any schema runs, and one outside the limits is rejected with a short,
169
+ fixed error. The limits admit the largest call any tool accepts, so
170
+ legitimate calls are not affected. (#16)
171
+ - Messages: arrays of at most 10,000 elements, at most 52,176 array
172
+ elements and object members in total, and at most 32 levels of nesting.
173
+ Over HTTP such a message gets a 400 with JSON-RPC error `-32600`
174
+ `Request exceeds structural limits.`; over stdio a request with a usable
175
+ id gets the same error, and anything else is dropped.
176
+ - Tool arguments: at most 52,112 array elements and object members.
177
+ - `structured_query`: at most 2,048 values, 12 levels deep, arrays of 32,
178
+ objects of 8 keys, 64 conditions and 65 groups. Any query the compiler
179
+ accepts is within these.
180
+ - Existing collection limits (`sn_atf_author` `steps` and `test_sys_ids`,
181
+ `structured_query` `order_by`, group `conditions`, set `values`, ATF
182
+ name-value inputs) are checked before any element is parsed.
183
+ - **Dependency advisories.** `zod` moves to 4.6.7, pinned exactly
184
+ (GHSA-mrhx-c7xc-m3w5, CVE-2023-54404; no 3.x release is fixed).
185
+ `@modelcontextprotocol/sdk` moves to 1.32.2 (GHSA-22jm-h49p-29qw,
186
+ GHSA-6prh-2h8m-c8cw, GHSA-46jr-4wx8-v453, GHSA-rvq5-wwqv-78pq, and
187
+ GHSA-6qxp-vccf-f47h in the SDK's client-side OAuth flow, which this server
188
+ does not use). `body-parser` (GHSA-27r3-jxmh-p828), `fast-uri`
189
+ (GHSA-w74x-v6f9-j3xg), `hono`, `iconv-lite`, `ip-address`, `proxy-addr`
190
+ (GHSA-jqcg-44mw-7w3h, critical) and `qs` take their fixed releases, and `npm audit --omit=dev` reports nothing. The
191
+ container's runtime base, `gcr.io/distroless/nodejs22-debian13:nonroot`, is
192
+ pinned to a digest with `libssl3t64` 3.5.7-1~deb13u3 (CVE-2026-84782) and
193
+ Node 22.23.3. (#10, #16)
194
+ - *`@hono/node-server` 2.1.3* (GHSA-rmxm-3fg6-px4f, medium). Its
195
+ `serveStatic` decoded the request path twice, so a crafted path could skip
196
+ middleware mounted on a static prefix. This server never uses
197
+ `serveStatic`: the SDK's HTTP transport uses only the adapter's request
198
+ listener, and the stdio server does not load the adapter at all. The
199
+ upgrade keeps `npm audit` clean. The developer-only inspector's lockfile
200
+ moves to 2.1.5.
201
+ - **Redirects are no longer followed.** API calls and the OAuth token request
202
+ used to follow HTTP redirects: a cross-origin redirect forwarded an API-key
203
+ header, and a 307 re-sent the token request body, which holds the client
204
+ secret. Any 3xx now fails with "The instance redirected the request to
205
+ another location", without echoing the `Location`. (#15)
206
+ - **Omitting the journal tools no longer withholds journals.** A profile that
207
+ grants `sn_create`, `sn_update` or `sn_batch` on a table can now append
208
+ `comments` and `work_notes` there, and `sn_batch` can post one
209
+ customer-visible comment per matched record, each of which can send a
210
+ notification. To withhold comments, set `fieldPolicy.<table>.writable` to an
211
+ explicit list without `comments`, and narrow parent tables such as `task`
212
+ the same way. (#11)
213
+ - **Journal writes are never re-sent.** The HTTP client no longer retries a
214
+ `PATCH` or `PUT` that sets `comments` or `work_notes` after a 502, 503, 504
215
+ or connection error, because the first attempt may already have appended
216
+ the entry. A 429 is still retried and a 401 still refreshes once. Detection is by field
217
+ name (`comments`, `work_notes`); see
218
+ [Production security boundaries](docs/PRODUCTION-SECURITY.md#journal-content). (#11)
219
+ - `servicenow-mcp-setup grant` applies its default tools only to the tables,
220
+ and the operations, named in that command. A re-grant could widen a target
221
+ narrowed with `--tools`, or make a table reachable only as a related table
222
+ directly readable or writable. (#11)
223
+ - `sn_batch` targets each matched record once per run and stops at a 401
224
+ instead of retrying every remaining record with rejected credentials. It
225
+ always looks up its records on the instance, never in the metadata cache, so
226
+ a repeat run cannot act on an earlier run's matches. (#9, #11)
227
+ - **Metadata cache.** The cache no longer reads `sys_user` or
228
+ `sys_properties`; remove any read grant on either table that you added only
229
+ for it, because `sys_properties` rows can hold integration secrets. Cache
230
+ entries are partitioned by credential, not by the ServiceNow user it runs
231
+ as: after re-mapping a client-credentials application or API key to another
232
+ user, or restricting that user, restart the server or rotate the secret.
233
+ Table and field policy still apply on every call, cached or not. Until an
234
+ entry is refetched, a tightened ServiceNow ACL is not seen: by default up to
235
+ 24 hours for metadata (configurable to 7 days) and 5 minutes for
236
+ `sn_schema`. `sn_schema`
237
+ returns `inherited_from` only where the profile can read `super_class` on
238
+ `sys_db_object`. (#9)
239
+ - **`sn_flow_view` reads `sys_variable_value` and `var_dictionary`.**
240
+ `sys_variable_value` is a system table, so a profile's `"*"` field-policy
241
+ entry does not narrow it; name it to hide older flows' input values. Grant
242
+ the flow tables with `tools: ["sn_flow_view"]`, as `grant --flows` does, to
243
+ keep the generic read tools off them. See
244
+ [docs/FLOW-VIEW.md](docs/FLOW-VIEW.md#field-policy). (#18)
245
+
246
+ ### Added
247
+
248
+ - **`sn_flow_view`, the 24th tool.** It shows one Flow Designer flow or
249
+ subflow as a Mermaid diagram, a numbered outline and a structured graph:
250
+ trigger, steps, If / Else If / Else, loops, parallel branches, Try / Catch,
251
+ input values and data pill labels, and the subflows it calls to depth 3. It
252
+ is read-only, reads 15 `sys_hub_*` and variable tables through the Table API
253
+ under the profile's table and field policy, and never calls Flow Designer's
254
+ internal API. Input values are shown by default, with sensitive names and
255
+ password types redacted; `include_inputs: false` reads no values. The
256
+ result fits `max_response_bytes` (default 100,000). See
257
+ [docs/FLOW-VIEW.md](docs/FLOW-VIEW.md). Thanks to Jace Benson's `jsn` CLI,
258
+ whose flow inspection informed the approach; no `jsn` code is used. (#18)
259
+ - `servicenow-mcp-setup grant --flows` grants read on the `sn_flow_view`
260
+ tables, bound to `sn_flow_view` only. (#18)
261
+ - **Policy card.** `sn_profile` returns the profile's effective policy as data
262
+ (`policy`) and as a text table (`policy_card`), and
263
+ `servicenow-mcp-setup policy show --profile <name> [--json]` prints the same
264
+ card: readable and writable tables with their tools, field rules, class and
265
+ domain fields that need explicit listing, auth type, raw encoded-query
266
+ reads, ATF grants and `sn_batch` limits. It never prints a secret, key or
267
+ credential reference, and it enforces nothing new. The data is held to
268
+ 40,000 bytes and the text to 24,000; `policy.truncated` says what was cut.
269
+ (#17)
270
+ - **`sn_batch` dry runs show a sample.** A dry run also returns up to 5
271
+ matched records (`sys_id` plus a `number`, `name`, `short_description` or
272
+ `title` the profile may read), `fields_to_write` (names, never values) and a
273
+ note that `confirm` re-runs the query. The sample costs one extra read; if
274
+ it fails or takes more than 5 seconds, the dry run still returns the count.
275
+ A target granted only `sn_batch` can therefore now see up to 5 display
276
+ values in a dry run, where before it saw a count. (#17)
277
+ - **Warnings on risky grants.** `servicenow-mcp-setup grant` and the setup
278
+ wizard warn when a grant gives write access to a privilege-sensitive table:
279
+ roles, groups, delegation, ACLs, approvals, scripts, `sys_properties`,
280
+ `sys_user`, `sys_user_group` and authentication tables. The wizard also
281
+ warns on the `"*"` write wildcard, which `grant` rejects. The grant still
282
+ goes ahead; `grant --json` carries the text in `warnings`. (#17)
283
+ - **Journal fields through the generic write tools, on every table.**
284
+ `sn_create`, `sn_update` and `sn_batch` accept `comments` and `work_notes`
285
+ on every table granted for writes, with the dedicated tools' bounds, and
286
+ field policy decides permission. The dedicated tools remain. (#11)
287
+ - `sn_batch` results carry a `message` saying how many records were not
288
+ confirmed or not sent, and why the run stopped. (#11)
289
+ - **MCP Registry metadata.** `package.json` declares `mcpName`
290
+ `io.github.onlyflowstech/servicenow-mcp`, and the package ships the
291
+ `server.json` manifest for the official MCP Registry. (#14)
292
+ - The README leads with what the server controls and what it does not, lists
293
+ the tools by area, and documents per-profile field policy. `AGENTS.md`
294
+ describes how contributors' AI agents work in this repository. (#11, #13,
295
+ #14)
296
+ - From the 2.2.0 dev builds: the ATF tools `sn_atf_author`, `sn_atf_run`,
297
+ `sn_atf_results` and `sn_atf_readiness`, with `setup grant --atf`;
298
+ Windows support in `servicenow-mcp-setup`; and the npm `dev` channel for
299
+ prereleases (`npm install -g @onlyflows/servicenow-mcp@dev`). Details are
300
+ under 2.2.0-dev.1 through 2.2.0-dev.6 below.
301
+
302
+ ### Changed
303
+
304
+ - **Field policy and journal rules (breaking for some profiles).** Each item
305
+ below has its remedy in
306
+ [Upgrading to 2.2.0](docs/V2-MIGRATION.md#upgrading-to-220). (#11)
307
+ - `SN_FIELD_POLICY_DEFINITIONS` configures only the `SN_PROFILE_NAME`
308
+ environment profile. While it is set and a config file supplies the
309
+ profiles, the server, `servicenow-mcp-setup` and `servicenow-mcp-profile`
310
+ refuse to start and say how to move the policy into each profile's
311
+ `fieldPolicy`.
312
+ - Field policy is validated when profiles load. A malformed `fieldPolicy`,
313
+ `readableTableFields` or `writableTableFields` used to deny every call on
314
+ its profile, or narrow nothing; it now stops startup with the profile, key
315
+ path and table named and no configured value repeated. One bad profile
316
+ stops the whole file from loading.
317
+ - A profile's `"*"` field-policy entry now reaches `incident`,
318
+ `change_request`, `problem`, `sc_request`, `sc_req_item`, `sc_task`,
319
+ `task`, `cmdb_ci`, `cmdb_ci_server`, `cmdb_ci_computer`, `kb_knowledge`
320
+ and every custom table, so `{"*": {"writable": []}}` now denies writes to
321
+ them. The 23 built-in system tables still never take it.
322
+ - `sys_class_name`, `sys_class_path`, `sys_domain` and `sys_domain_path`
323
+ are written only where a profile lists them by name; no wildcard covers
324
+ them.
325
+ - `sn_incident_add_comment` and `sn_incident_add_work_note` are denied when
326
+ the incident's `writable` set leaves out `comments` or `work_notes`.
327
+ - `incident` accepts every field the profile allows, not only the 14 typed
328
+ fields; those 14 keep their typed checks.
329
+ - `["*"]` in a field set means every field; it used to fail every call.
330
+ `readable: []` no longer blocks writes as a side effect; add
331
+ `writable: []` for that.
332
+ - A dot-walked or `variables.*` write key is denied with the reason
333
+ `unsupported_field_path`, and a write-value denial names the field and
334
+ table, never the value.
335
+ - **`sn_batch` uses the ServiceNow REST Batch API and never re-sends a batch
336
+ that may have reached the instance.** Confirmed updates and deletes go up to
337
+ 50 records per request, with each request kept under 4 MiB unless one
338
+ record alone exceeds about 3 MiB, which is then sent on its own. A batch
339
+ sub-request that fails with a server error is reported as unconfirmed, not
340
+ retried. The run falls back to one Table API call per record only when the
341
+ instance refuses a batch request (401, 403 or 404), and only for that
342
+ batch's records and the ones after it. That fallback follows the HTTP
343
+ client's retry rules: an ordinary update or delete is retried up to twice
344
+ after a 502, 503, 504 or connection error, and a journal write is re-sent
345
+ only after a 429 or a 401 credential refresh, when ServiceNow has not
346
+ processed it. A rate limit (429) that persists through the client's retries
347
+ stops the run with the `Retry-After` hint. Unconfirmed records count as
348
+ neither processed nor failed; records not sent count as failed. (#11)
349
+ - `servicenow-mcp-setup grant --write incident` also binds the two incident
350
+ journal tools; comments are customer-visible. An explicit `--tools` list
351
+ withholds them. Existing profiles are not changed. (#11)
352
+ - `sn_update` advertises `idempotentHint: false`, because a journal field
353
+ appends an entry on every call. (#11)
354
+ - **Metadata caching works in every auth mode.** Freshness is checked against
355
+ the table's row count and newest `sys_updated_on`, so OAuth
356
+ `client_credentials` and API-key profiles, where the cache used to turn
357
+ itself off, now cache too. `sn_schema` results are reused for 5 minutes
358
+ (`schemaCacheTtlMs` / `SN_SCHEMA_CACHE_TTL_MS`, up to 1 hour), and
359
+ `force_recache: true` refreshes one read. (#9)
360
+ - **zod 4 is visible to clients in three ways.** Input validation errors
361
+ reported by the MCP SDK use zod 4's wording (for example `Invalid input:
362
+ expected string, received undefined` instead of `Required`); tool schemas
363
+ are served inline instead of with internal `$ref`s, which adds about 18 KB
364
+ to `tools/list`; and integer fields in output schemas state the
365
+ safe-integer range. Tools accept and reject the same input as before. (#16)
366
+ - **Less memory at startup.** The startup tool-catalog check no longer
367
+ compiles output-schema validators it never uses, which saves about 6 MB of
368
+ idle memory in a stdio server. Validation of real calls is unchanged. (#19)
369
+
370
+ ### Fixed
371
+
372
+ - A hibernating developer instance, and any other HTML page returned instead
373
+ of an API response (single sign-on, maintenance, proxy), now gives a clear
374
+ error instead of a generic upstream failure: "The ServiceNow instance
375
+ <host> appears to be hibernating ... wake it at
376
+ https://developer.servicenow.com", or a fixed "returned an HTML page"
377
+ message. A 200 response that is not valid JSON gets a fixed message too,
378
+ and none of these repeats response text. The setup wizard and
379
+ `servicenow-mcp-setup doctor --live` no longer print raw error messages, and
380
+ `doctor --live` checks profiles concurrently with a 10-second timeout. (#15)
381
+ - `incident` fields outside the 14 typed ones, such as `cmdb_ci`,
382
+ `business_service`, `watch_list`, `hold_reason` and every `u_`/`x_` custom
383
+ field, are writable. Incident `description`, `close_notes`, choice fields
384
+ and the reference fields `caller_id`, `assignment_group` and `assigned_to`
385
+ can be cleared with `""` or `null`. (#11)
386
+ - Generic writes accept `null`, finite decimals such as `12.5`, arrays for
387
+ list fields such as `watch_list`, and the `{value, display_value, link}`
388
+ read shape. (#11)
389
+ - `sn_batch` applies the same value policy as `sn_update` and sends the
390
+ canonical values; it used to send the caller's values unchecked. It now
391
+ uses the documented REST Batch API shape, so a batch the instance had
392
+ already applied is no longer replayed one record at a time, and a large
393
+ batch no longer becomes a request of tens of megabytes. (#11)
394
+ - Write responses always include the written record's `sys_id`, so a
395
+ successful create no longer reads as a failure that invites a duplicate
396
+ retry. (#11)
397
+ - The metadata cache no longer serves stale rows on accounts east of UTC, and
398
+ it detects deletes. A table whose newest row is dated in the future is not
399
+ cached. (#9)
400
+ - `sn_schema` and `fields: "all"` follow a table's parents by name instead of
401
+ by label, so hierarchies such as `alm_hardware` keep their inherited
402
+ fields. (#9)
403
+ - `servicenow-mcp-setup` offers a table's parent by name, not by label, and
404
+ fetches one OAuth token for its parent lookups. The `relatedTables`
405
+ documentation, `grant` output and `--related` help now say what
406
+ `grant --related` adds. (#12)
407
+ - From the 2.2.0 dev builds: tool schemas no longer declare JSON Schema
408
+ draft-07, which clients on the current MCP specification refused
409
+ (2.2.0-dev.6), and `servicenow-mcp-setup` finds client CLIs and registers
410
+ clients on native Windows (2.2.0-dev.6).
411
+
8
412
  ## [2.2.0-dev.6] — 2026-09-16
9
413
 
10
414
  ### Fixed