@onlyflows/servicenow-mcp 1.0.0 → 2.1.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 (281) hide show
  1. package/.env.example +56 -0
  2. package/CHANGELOG.md +214 -0
  3. package/README.md +939 -101
  4. package/dist/auth.d.ts +88 -0
  5. package/dist/auth.d.ts.map +1 -0
  6. package/dist/auth.js +396 -0
  7. package/dist/auth.js.map +1 -0
  8. package/dist/client.d.ts +111 -17
  9. package/dist/client.d.ts.map +1 -1
  10. package/dist/client.js +554 -79
  11. package/dist/client.js.map +1 -1
  12. package/dist/config.d.ts +41 -4
  13. package/dist/config.d.ts.map +1 -1
  14. package/dist/config.js +44 -34
  15. package/dist/config.js.map +1 -1
  16. package/dist/encoded-query-policy.d.ts +72 -0
  17. package/dist/encoded-query-policy.d.ts.map +1 -0
  18. package/dist/encoded-query-policy.js +409 -0
  19. package/dist/encoded-query-policy.js.map +1 -0
  20. package/dist/execution-context.d.ts +235 -0
  21. package/dist/execution-context.d.ts.map +1 -0
  22. package/dist/execution-context.js +441 -0
  23. package/dist/execution-context.js.map +1 -0
  24. package/dist/field-policy.d.ts +117 -0
  25. package/dist/field-policy.d.ts.map +1 -0
  26. package/dist/field-policy.js +1684 -0
  27. package/dist/field-policy.js.map +1 -0
  28. package/dist/http-auth.d.ts +131 -0
  29. package/dist/http-auth.d.ts.map +1 -0
  30. package/dist/http-auth.js +347 -0
  31. package/dist/http-auth.js.map +1 -0
  32. package/dist/http-entrypoint.d.ts +26 -0
  33. package/dist/http-entrypoint.d.ts.map +1 -0
  34. package/dist/http-entrypoint.js +255 -0
  35. package/dist/http-entrypoint.js.map +1 -0
  36. package/dist/http-observability.d.ts +147 -0
  37. package/dist/http-observability.d.ts.map +1 -0
  38. package/dist/http-observability.js +711 -0
  39. package/dist/http-observability.js.map +1 -0
  40. package/dist/http-request-policy.d.ts +72 -0
  41. package/dist/http-request-policy.d.ts.map +1 -0
  42. package/dist/http-request-policy.js +463 -0
  43. package/dist/http-request-policy.js.map +1 -0
  44. package/dist/http-request-signal.d.ts +12 -0
  45. package/dist/http-request-signal.d.ts.map +1 -0
  46. package/dist/http-request-signal.js +39 -0
  47. package/dist/http-request-signal.js.map +1 -0
  48. package/dist/http-runtime.d.ts +77 -0
  49. package/dist/http-runtime.d.ts.map +1 -0
  50. package/dist/http-runtime.js +1321 -0
  51. package/dist/http-runtime.js.map +1 -0
  52. package/dist/incident-journal-policy.d.ts +22 -0
  53. package/dist/incident-journal-policy.d.ts.map +1 -0
  54. package/dist/incident-journal-policy.js +115 -0
  55. package/dist/incident-journal-policy.js.map +1 -0
  56. package/dist/index.d.ts +14 -4
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +140 -36
  59. package/dist/index.js.map +1 -1
  60. package/dist/metadata-cache.d.ts +71 -0
  61. package/dist/metadata-cache.d.ts.map +1 -0
  62. package/dist/metadata-cache.js +397 -0
  63. package/dist/metadata-cache.js.map +1 -0
  64. package/dist/profile-admin.d.ts +64 -0
  65. package/dist/profile-admin.d.ts.map +1 -0
  66. package/dist/profile-admin.js +351 -0
  67. package/dist/profile-admin.js.map +1 -0
  68. package/dist/profile-credentials.d.ts +68 -0
  69. package/dist/profile-credentials.d.ts.map +1 -0
  70. package/dist/profile-credentials.js +329 -0
  71. package/dist/profile-credentials.js.map +1 -0
  72. package/dist/profile-manager.d.ts +187 -0
  73. package/dist/profile-manager.d.ts.map +1 -0
  74. package/dist/profile-manager.js +1026 -0
  75. package/dist/profile-manager.js.map +1 -0
  76. package/dist/record-identifier-policy.d.ts +39 -0
  77. package/dist/record-identifier-policy.d.ts.map +1 -0
  78. package/dist/record-identifier-policy.js +203 -0
  79. package/dist/record-identifier-policy.js.map +1 -0
  80. package/dist/runtime-environment.d.ts +23 -0
  81. package/dist/runtime-environment.d.ts.map +1 -0
  82. package/dist/runtime-environment.js +58 -0
  83. package/dist/runtime-environment.js.map +1 -0
  84. package/dist/server.d.ts +33 -0
  85. package/dist/server.d.ts.map +1 -0
  86. package/dist/server.js +73 -0
  87. package/dist/server.js.map +1 -0
  88. package/dist/servicenow-identifiers.d.ts +8 -0
  89. package/dist/servicenow-identifiers.d.ts.map +1 -0
  90. package/dist/servicenow-identifiers.js +22 -0
  91. package/dist/servicenow-identifiers.js.map +1 -0
  92. package/dist/setup-prompts.d.ts +7 -0
  93. package/dist/setup-prompts.d.ts.map +1 -0
  94. package/dist/setup-prompts.js +123 -0
  95. package/dist/setup-prompts.js.map +1 -0
  96. package/dist/setup.d.ts +109 -0
  97. package/dist/setup.d.ts.map +1 -0
  98. package/dist/setup.js +1903 -0
  99. package/dist/setup.js.map +1 -0
  100. package/dist/startup.d.ts +43 -0
  101. package/dist/startup.d.ts.map +1 -0
  102. package/dist/startup.js +75 -0
  103. package/dist/startup.js.map +1 -0
  104. package/dist/stdio-runtime.d.ts +106 -0
  105. package/dist/stdio-runtime.d.ts.map +1 -0
  106. package/dist/stdio-runtime.js +231 -0
  107. package/dist/stdio-runtime.js.map +1 -0
  108. package/dist/structured-query.d.ts +187 -0
  109. package/dist/structured-query.d.ts.map +1 -0
  110. package/dist/structured-query.js +503 -0
  111. package/dist/structured-query.js.map +1 -0
  112. package/dist/table-defaults.d.ts +28 -0
  113. package/dist/table-defaults.d.ts.map +1 -0
  114. package/dist/table-defaults.js +85 -0
  115. package/dist/table-defaults.js.map +1 -0
  116. package/dist/table-policy.d.ts +71 -0
  117. package/dist/table-policy.d.ts.map +1 -0
  118. package/dist/table-policy.js +290 -0
  119. package/dist/table-policy.js.map +1 -0
  120. package/dist/tool-error.d.ts +48 -0
  121. package/dist/tool-error.d.ts.map +1 -0
  122. package/dist/tool-error.js +139 -0
  123. package/dist/tool-error.js.map +1 -0
  124. package/dist/tool-table-access.d.ts +19 -0
  125. package/dist/tool-table-access.d.ts.map +1 -0
  126. package/dist/tool-table-access.js +388 -0
  127. package/dist/tool-table-access.js.map +1 -0
  128. package/dist/tools/aggregate.d.ts +22 -42
  129. package/dist/tools/aggregate.d.ts.map +1 -1
  130. package/dist/tools/aggregate.js +103 -47
  131. package/dist/tools/aggregate.js.map +1 -1
  132. package/dist/tools/all-fields-cap.d.ts +45 -0
  133. package/dist/tools/all-fields-cap.d.ts.map +1 -0
  134. package/dist/tools/all-fields-cap.js +151 -0
  135. package/dist/tools/all-fields-cap.js.map +1 -0
  136. package/dist/tools/atf.d.ts +21 -60
  137. package/dist/tools/atf.d.ts.map +1 -1
  138. package/dist/tools/atf.js +180 -116
  139. package/dist/tools/atf.js.map +1 -1
  140. package/dist/tools/attach.d.ts +31 -45
  141. package/dist/tools/attach.d.ts.map +1 -1
  142. package/dist/tools/attach.js +175 -137
  143. package/dist/tools/attach.js.map +1 -1
  144. package/dist/tools/batch.d.ts +78 -42
  145. package/dist/tools/batch.d.ts.map +1 -1
  146. package/dist/tools/batch.js +172 -68
  147. package/dist/tools/batch.js.map +1 -1
  148. package/dist/tools/catalog.d.ts +6 -0
  149. package/dist/tools/catalog.d.ts.map +1 -0
  150. package/dist/tools/catalog.js +203 -0
  151. package/dist/tools/catalog.js.map +1 -0
  152. package/dist/tools/codesearch.d.ts +14 -25
  153. package/dist/tools/codesearch.d.ts.map +1 -1
  154. package/dist/tools/codesearch.js +60 -48
  155. package/dist/tools/codesearch.js.map +1 -1
  156. package/dist/tools/create-module.d.ts +48 -0
  157. package/dist/tools/create-module.d.ts.map +1 -0
  158. package/dist/tools/create-module.js +98 -0
  159. package/dist/tools/create-module.js.map +1 -0
  160. package/dist/tools/create.d.ts +2 -38
  161. package/dist/tools/create.d.ts.map +1 -1
  162. package/dist/tools/create.js +9 -41
  163. package/dist/tools/create.js.map +1 -1
  164. package/dist/tools/delete.d.ts +13 -23
  165. package/dist/tools/delete.d.ts.map +1 -1
  166. package/dist/tools/delete.js +30 -33
  167. package/dist/tools/delete.js.map +1 -1
  168. package/dist/tools/discover.d.ts +15 -27
  169. package/dist/tools/discover.d.ts.map +1 -1
  170. package/dist/tools/discover.js +103 -60
  171. package/dist/tools/discover.js.map +1 -1
  172. package/dist/tools/get-module.d.ts +85 -0
  173. package/dist/tools/get-module.d.ts.map +1 -0
  174. package/dist/tools/get-module.js +221 -0
  175. package/dist/tools/get-module.js.map +1 -0
  176. package/dist/tools/get.d.ts +2 -51
  177. package/dist/tools/get.d.ts.map +1 -1
  178. package/dist/tools/get.js +9 -49
  179. package/dist/tools/get.js.map +1 -1
  180. package/dist/tools/handler-result.d.ts +14 -0
  181. package/dist/tools/handler-result.d.ts.map +1 -0
  182. package/dist/tools/handler-result.js +177 -0
  183. package/dist/tools/handler-result.js.map +1 -0
  184. package/dist/tools/health.d.ts +12 -15
  185. package/dist/tools/health.d.ts.map +1 -1
  186. package/dist/tools/health.js +55 -36
  187. package/dist/tools/health.js.map +1 -1
  188. package/dist/tools/incident-journal-module.d.ts +12 -0
  189. package/dist/tools/incident-journal-module.d.ts.map +1 -0
  190. package/dist/tools/incident-journal-module.js +61 -0
  191. package/dist/tools/incident-journal-module.js.map +1 -0
  192. package/dist/tools/index.d.ts +47 -36
  193. package/dist/tools/index.d.ts.map +1 -1
  194. package/dist/tools/index.js +814 -35
  195. package/dist/tools/index.js.map +1 -1
  196. package/dist/tools/nl.d.ts +10 -24
  197. package/dist/tools/nl.d.ts.map +1 -1
  198. package/dist/tools/nl.js +37 -147
  199. package/dist/tools/nl.js.map +1 -1
  200. package/dist/tools/profile.d.ts +37 -0
  201. package/dist/tools/profile.d.ts.map +1 -0
  202. package/dist/tools/profile.js +39 -0
  203. package/dist/tools/profile.js.map +1 -0
  204. package/dist/tools/query-module.d.ts +119 -0
  205. package/dist/tools/query-module.d.ts.map +1 -0
  206. package/dist/tools/query-module.js +324 -0
  207. package/dist/tools/query-module.js.map +1 -0
  208. package/dist/tools/query.d.ts +2 -72
  209. package/dist/tools/query.d.ts.map +1 -1
  210. package/dist/tools/query.js +8 -72
  211. package/dist/tools/query.js.map +1 -1
  212. package/dist/tools/record-write-shared.d.ts +7 -0
  213. package/dist/tools/record-write-shared.d.ts.map +1 -0
  214. package/dist/tools/record-write-shared.js +65 -0
  215. package/dist/tools/record-write-shared.js.map +1 -0
  216. package/dist/tools/relationships.d.ts +21 -42
  217. package/dist/tools/relationships.d.ts.map +1 -1
  218. package/dist/tools/relationships.js +70 -56
  219. package/dist/tools/relationships.js.map +1 -1
  220. package/dist/tools/result-envelope.d.ts +603 -0
  221. package/dist/tools/result-envelope.d.ts.map +1 -0
  222. package/dist/tools/result-envelope.js +770 -0
  223. package/dist/tools/result-envelope.js.map +1 -0
  224. package/dist/tools/schema-module.d.ts +64 -0
  225. package/dist/tools/schema-module.d.ts.map +1 -0
  226. package/dist/tools/schema-module.js +367 -0
  227. package/dist/tools/schema-module.js.map +1 -0
  228. package/dist/tools/schema.d.ts +2 -37
  229. package/dist/tools/schema.d.ts.map +1 -1
  230. package/dist/tools/schema.js +6 -57
  231. package/dist/tools/schema.js.map +1 -1
  232. package/dist/tools/script.d.ts +33 -27
  233. package/dist/tools/script.d.ts.map +1 -1
  234. package/dist/tools/script.js +43 -37
  235. package/dist/tools/script.js.map +1 -1
  236. package/dist/tools/syslog.d.ts +19 -46
  237. package/dist/tools/syslog.d.ts.map +1 -1
  238. package/dist/tools/syslog.js +101 -67
  239. package/dist/tools/syslog.js.map +1 -1
  240. package/dist/tools/tool-module.d.ts +143 -0
  241. package/dist/tools/tool-module.d.ts.map +1 -0
  242. package/dist/tools/tool-module.js +1095 -0
  243. package/dist/tools/tool-module.js.map +1 -0
  244. package/dist/tools/update-module.d.ts +51 -0
  245. package/dist/tools/update-module.d.ts.map +1 -0
  246. package/dist/tools/update-module.js +111 -0
  247. package/dist/tools/update-module.js.map +1 -0
  248. package/dist/tools/update.d.ts +2 -45
  249. package/dist/tools/update.d.ts.map +1 -1
  250. package/dist/tools/update.js +9 -41
  251. package/dist/tools/update.js.map +1 -1
  252. package/dist/utils.d.ts +68 -1
  253. package/dist/utils.d.ts.map +1 -1
  254. package/dist/utils.js +114 -16
  255. package/dist/utils.js.map +1 -1
  256. package/dist/version.d.ts +10 -0
  257. package/dist/version.d.ts.map +1 -0
  258. package/dist/version.js +13 -0
  259. package/dist/version.js.map +1 -0
  260. package/dist/write-value-policy.d.ts +56 -0
  261. package/dist/write-value-policy.d.ts.map +1 -0
  262. package/dist/write-value-policy.js +310 -0
  263. package/dist/write-value-policy.js.map +1 -0
  264. package/docs/ADDING-TOOLS.md +227 -0
  265. package/docs/CLIENT-SETUP.md +914 -0
  266. package/docs/CONTAINER-DEPLOYMENT.md +310 -0
  267. package/docs/CROSS-CLIENT-RELEASE-MATRIX.md +63 -0
  268. package/docs/ENTERPRISE-RELEASE-BOUNDARY.md +149 -0
  269. package/docs/OPERATIONS-RUNBOOK.md +383 -0
  270. package/docs/PRIVATE-CHATGPT-CONNECTIVITY.md +347 -0
  271. package/docs/PRODUCTION-SECURITY.md +368 -0
  272. package/docs/PROFILE-CREDENTIALS.md +126 -0
  273. package/docs/RELEASE-VALIDATION.md +140 -0
  274. package/docs/TESTING-OAUTH.md +101 -0
  275. package/docs/V2-MIGRATION.md +493 -0
  276. package/package.json +60 -13
  277. package/scripts/inspector.mjs +140 -0
  278. package/scripts/release-validate.mjs +201 -0
  279. package/scripts/smoke-test.mjs +274 -0
  280. package/tools/inspector/package-lock.json +3812 -0
  281. package/tools/inspector/package.json +12 -0
@@ -0,0 +1,310 @@
1
+ # Production container deployment
2
+
3
+ > [!IMPORTANT]
4
+ > **This document describes the dormant HTTP transport, not the shipped one.**
5
+ > The product exposes stdio only: an MCP client spawns `servicenow-mcp` and
6
+ > speaks JSON-RPC over that process's stdin and stdout. There is no endpoint to
7
+ > configure, no service to start, and no bearer token to set, and
8
+ > `servicenow-mcp-setup` registers every client that way. The HTTP runtime this
9
+ > document assumes still compiles and is still tested, but nothing on the CLI
10
+ > path reaches it — see
11
+ > [the dormant HTTP transport](ENTERPRISE-RELEASE-BOUNDARY.md#the-dormant-http-transport).
12
+ > Sections about profiles, credentials, table access, field policy, and tool
13
+ > behavior are transport-independent and remain accurate.
14
+
15
+ The SNSDK-39 artifact is a portable OCI image for the HTTP-only, single-owner
16
+ ServiceNow MCP service. It is not coupled to ChatGPT, Claude, or another AI
17
+ host: any standards-compliant MCP client uses the same authenticated `/mcp`
18
+ URL without rebuilding the image.
19
+
20
+ This document covers the artifact boundary. TLS termination, trusted proxies,
21
+ network topology, full operational response, and provider-specific tunnel or
22
+ secret-manager adapters remain separate deployment concerns.
23
+
24
+ ## Artifact contract
25
+
26
+ The root `Dockerfile` uses an immutable Node 22.21.1 multi-architecture index
27
+ for its discarded build stage and an immutable distroless Node 22 Debian 13
28
+ multi-architecture index for runtime. The build stage performs `npm ci` from
29
+ the lock file with strict Node-engine enforcement, compiles TypeScript, and
30
+ prunes development dependencies. The runtime has no shell or package manager
31
+ and contains only the Node runtime,
32
+ compiled service, production dependencies, package metadata, and the
33
+ dependency-free healthcheck.
34
+
35
+ The resulting image:
36
+
37
+ - runs as numeric UID/GID `10001:10001`;
38
+ - starts Node directly as PID 1 and handles `SIGTERM`/`SIGINT` through the
39
+ application's bounded drain and shutdown coordinator;
40
+ - listens on `0.0.0.0:3000` inside the container;
41
+ - exposes `/mcp`, `/health/live`, and `/health/ready`;
42
+ - has an OCI version, revision, creation time, source, license, and pinned-base
43
+ label;
44
+ - contains no profile configuration, bearer token, ServiceNow credential,
45
+ encryption key, provider credential, dotenv file, or local Git data; and
46
+ - is validated with a read-only root filesystem, all Linux capabilities
47
+ dropped, `no-new-privileges`, a PID limit, and a bounded `/tmp` tmpfs.
48
+
49
+ The image does not contain TLS, tunnel, gateway, or cloud secret-manager
50
+ logic. Attach those as independently reviewed deployment adapters.
51
+
52
+ ## Deterministic local build
53
+
54
+ Docker with BuildKit/buildx is required. The default local tag is derived from
55
+ `package.json`; a supplied version cannot differ from the package version.
56
+ The build does not invoke Git. Release automation must pass the immutable
57
+ source revision explicitly.
58
+
59
+ ```sh
60
+ SOURCE_DATE_EPOCH=0 \
61
+ MCP_CONTAINER_REVISION=release-source-revision \
62
+ npm run container:build
63
+ ```
64
+
65
+ PowerShell on Windows uses the same platform-neutral Node hook:
66
+
67
+ ```powershell
68
+ $env:SOURCE_DATE_EPOCH = "0"
69
+ $env:MCP_CONTAINER_REVISION = "release-source-revision"
70
+ $env:MCP_CONTAINER_PLATFORM = "linux/amd64"
71
+ npm run container:build
72
+ ```
73
+
74
+ Docker Desktop on macOS/Windows builds the Linux OCI target; native Linux uses
75
+ Docker Engine or another BuildKit-compatible frontend. The hook never invokes
76
+ a POSIX shell, Git, or a client-specific command.
77
+
78
+ Optional settings are:
79
+
80
+ | Setting | Default | Contract |
81
+ |---|---|---|
82
+ | `MCP_CONTAINER_IMAGE` | `servicenow-mcp:<package version>` | Local image name/tag; never a credential-bearing value. |
83
+ | `MCP_CONTAINER_REVISION` | `local` | OCI source-revision label. Release builds supply an immutable revision. |
84
+ | `MCP_CONTAINER_PLATFORM` | Docker's active Linux platform | `linux/amd64` or `linux/arm64`. |
85
+ | `MCP_CONTAINER_NO_CACHE` | `0` | Set to `1` for an independent BuildKit execution during reproducibility evidence. |
86
+ | `SOURCE_DATE_EPOCH` | `0` | Bounded Unix timestamp used by BuildKit and the OCI creation label. |
87
+
88
+ Reproducibility is an evidence gate, not an assumption. Build twice from the
89
+ same source, lock file, platform, revision, and epoch, then compare the image
90
+ IDs:
91
+
92
+ ```sh
93
+ MCP_CONTAINER_NO_CACHE=1 npm run container:build
94
+ docker image inspect servicenow-mcp:1.2.0 --format '{{.Id}}'
95
+ MCP_CONTAINER_NO_CACHE=1 npm run container:build
96
+ docker image inspect servicenow-mcp:1.2.0 --format '{{.Id}}'
97
+ ```
98
+
99
+ A differing ID blocks release until the changed input is identified. A pinned
100
+ multi-architecture index makes each target architecture stable, but amd64 and
101
+ arm64 images correctly have different image IDs.
102
+
103
+ ## Runtime configuration boundaries
104
+
105
+ The only values baked into the image are non-secret runtime defaults:
106
+ `NODE_ENV=production`, `MCP_HOST=0.0.0.0`, `MCP_PORT=3000`, and the non-root
107
+ home directory. Supply every owner identity, bearer token, ServiceNow setting,
108
+ profile, key, and provider credential at runtime.
109
+
110
+ > **`MCP_BEARER_TOKEN` is required for a container deployment, but the process
111
+ > will not enforce that for you.** HTTP authentication became opt-in in 2.0: a
112
+ > container started without it serves every request that reaches port 3000, and
113
+ > `MCP_HOST` defaults to `0.0.0.0` in this image. Treat a missing
114
+ > `MCP_BEARER_TOKEN` as a failed deployment. The service logs a warning at
115
+ > startup when it is unauthenticated; alert on it.
116
+
117
+ ### Secret-managed `SN_*` profile
118
+
119
+ The simplest portable deployment injects the documented `SN_*` variables from
120
+ the orchestrator's secret mechanism. `SN_PROFILE_NAME` creates the explicit
121
+ process-local mapping; calls pass that exact name and no default is inferred.
122
+
123
+ ```text
124
+ MCP_BEARER_TOKEN=<32-4096-character owner bearer secret>
125
+ MCP_OWNER_ID=<stable non-secret owner id>
126
+ MCP_CLIENT_ID=<stable non-secret client id>
127
+ SN_PROFILE_NAME=prod
128
+ SN_INSTANCE=https://instance.service-now.com
129
+ SN_USER=<integration account>
130
+ SN_PASSWORD=<injected ServiceNow secret>
131
+ ```
132
+
133
+ `SN_PROFILE_NAME` is the explicit name callers must pass as `profile`; without
134
+ it, bare connection variables create no profile. `SN_AUTH_TYPE=oauth` plus `SN_CLIENT_ID`/`SN_CLIENT_SECRET`, or
135
+ `SN_AUTH_TYPE=apikey` plus `SN_API_KEY`, are supported alternatives. Inject
136
+ these through the container platform, never as `docker build` arguments,
137
+ Dockerfile `ENV`, labels, image annotations, or source files. Environment
138
+ injection is visible to operators with container-inspection authority, so that
139
+ authority is part of the secret boundary.
140
+
141
+ ### Encrypted or provider-referenced profile mount
142
+
143
+ For named profiles, prepare an owner-only host directory with this layout:
144
+
145
+ ```text
146
+ runtime-home/ uid 10001, mode 0700
147
+ └── .servicenow-mcp/ uid 10001, mode 0700
148
+ └── config.json uid 10001, mode 0600
149
+ ```
150
+
151
+ Mount `runtime-home` read-only at `/home/servicenow-mcp`. The profile loader
152
+ opens the file without following symlinks, verifies regular-file type,
153
+ ownership, modes, size, and stable parent/final identities, and can read an
154
+ already-secure file from a read-only mount without attempting to rewrite its
155
+ modes. Broken/final/parent symlinks are fatal and never trigger `SN_*` fallback.
156
+
157
+ Encrypted envelopes require `SN_PROFILE_ENCRYPTION_KEY` to be injected
158
+ separately at runtime. Secret references require the corresponding
159
+ deployment-provided resolver credential and adapter. Neither the key nor
160
+ provider credential belongs in `config.json` or the image. See
161
+ [Profile credentials and out-of-band administration](PROFILE-CREDENTIALS.md).
162
+
163
+ POSIX ownership checks make this bind-mount form most direct on Linux. Docker
164
+ Desktop on macOS/Windows may not preserve numeric bind-mount ownership; use the
165
+ orchestrator's secret environment injection or a Linux-managed volume prepared
166
+ with UID/GID 10001 rather than weakening file validation.
167
+
168
+ ## Least-privilege run example
169
+
170
+ Create an owner-only runtime environment file outside the repository, populate
171
+ it from a secret manager, and remove it after the container platform has read
172
+ it. The values below are placeholders only:
173
+
174
+ ```sh
175
+ docker run --detach \
176
+ --name servicenow-mcp \
177
+ --read-only \
178
+ --cap-drop=ALL \
179
+ --security-opt=no-new-privileges \
180
+ --pids-limit=128 \
181
+ --memory=512m \
182
+ --tmpfs /tmp:rw,noexec,nosuid,nodev,size=16m,uid=10001,gid=10001,mode=1700 \
183
+ --publish 127.0.0.1:3000:3000 \
184
+ --env-file /protected/path/servicenow-mcp.env \
185
+ servicenow-mcp:1.2.0
186
+ ```
187
+
188
+ For a named-profile mount, add:
189
+
190
+ ```sh
191
+ --mount type=bind,src=/protected/runtime-home,dst=/home/servicenow-mcp,readonly
192
+ ```
193
+
194
+ Do not publish port 3000 directly to an untrusted network. Bind it to loopback
195
+ or a private boundary and configure exact `MCP_ALLOWED_HOSTS` and, for browser
196
+ clients, `MCP_ALLOWED_ORIGINS`. TLS and proxy policy are tracked separately by
197
+ SNSDK-40.
198
+
199
+ ## Health and shutdown
200
+
201
+ The OCI healthcheck makes an unauthenticated, bounded loopback request to
202
+ `GET /health/ready` with the reserved `Host: mcp-health.internal` authority and
203
+ requires exactly `200 {"status":"ready"}`. The request boundary accepts that
204
+ authority only for `/health/live` and `/health/ready` when the socket peer is
205
+ loopback; it is rejected for `/mcp` and for external peers. Do not add it to
206
+ `MCP_ALLOWED_HOSTS`. This keeps the internal probe working when public clients
207
+ use an unrelated exact authority such as `mcp.example.com:443`, without
208
+ broadening the public Host allowlist. It never contacts ServiceNow or
209
+ constructs an MCP server. Use:
210
+
211
+ ```sh
212
+ curl --fail http://127.0.0.1:3000/health/live
213
+ curl --fail http://127.0.0.1:3000/health/ready
214
+ ```
215
+
216
+ Liveness means the process can serve local HTTP. Readiness remains false until
217
+ startup completes and flips false synchronously when draining begins. Configure
218
+ the platform termination grace period to exceed `MCP_SHUTDOWN_GRACE_MS`
219
+ (default 10 seconds). `docker stop` sends the image's `SIGTERM`; Node is PID 1,
220
+ stops admission, drains accepted work to the bound, closes MCP resources and
221
+ sockets, and exits zero on success.
222
+
223
+ ## Validation, identity, provenance, and scanning
224
+
225
+ Build and validate the local artifact:
226
+
227
+ ```sh
228
+ npm run container:build
229
+ npm run container:validate
230
+ npm run container:scan
231
+ npm audit --omit=dev
232
+ ```
233
+
234
+ `container:validate` inspects the image and starts it with the least-privilege
235
+ flags above. It proves numeric non-root execution, writable bounded `/tmp`, a
236
+ read-only root, liveness/readiness, two independent MCP clients against the
237
+ same `/mcp` endpoint, clean `SIGTERM`, secret-free logs, required labels, and a
238
+ 300 MiB image-size ceiling. It prints sanitized timing and size evidence.
239
+
240
+ `container:scan` selects Trivy, Grype, or Docker Scout (or honors
241
+ `MCP_CONTAINER_SCANNER`) and fails on high or critical findings. If none is
242
+ installed, it fails: scanner absence is never a passing release result. Owners
243
+ must archive the scanner name/version, database timestamp, image digest, and
244
+ result with release evidence. The application `npm audit --omit=dev` gate is
245
+ separate and includes moderate production dependency findings.
246
+
247
+ If a local scanner is unavailable, Linux and Docker Desktop operators can run
248
+ the same fail-closed gate with the pinned Trivy container (the digest prevents
249
+ an unreviewed scanner substitution):
250
+
251
+ ```sh
252
+ docker run --rm \
253
+ -v /var/run/docker.sock:/var/run/docker.sock \
254
+ aquasec/trivy:0.67.2@sha256:e2b22eac59c02003d8749f5b8d9bd073b62e30fefaef5b7c8371204e0a4b0c08 \
255
+ image --scanners vuln --severity HIGH,CRITICAL --exit-code 1 --no-progress \
256
+ servicenow-mcp:1.2.0
257
+ ```
258
+
259
+ Create a local multi-platform OCI archive with maximum BuildKit provenance and
260
+ an SBOM attestation:
261
+
262
+ ```sh
263
+ MCP_CONTAINER_REVISION=release-source-revision \
264
+ SOURCE_DATE_EPOCH=0 \
265
+ npm run container:provenance
266
+ ```
267
+
268
+ The hook refuses to overwrite output and writes only a new
269
+ `artifacts/servicenow-mcp-<version>.oci.tar`. Keep provenance and SBOM attached
270
+ when a separately authorized release process later imports or publishes it.
271
+ This task does not publish to a registry.
272
+
273
+ `artifacts/` must be a real owner-only directory beneath the canonical
274
+ repository path, not a symlink. BuildKit writes into a validated owner-only
275
+ `0700` operating-system temporary directory. Publication opens the resulting
276
+ regular archive without following symlinks and validates that held descriptor
277
+ against the staged path. It opens the canonical final name directly with
278
+ `O_CREAT|O_EXCL|O_NOFOLLOW` and mode `0600`. The held staged descriptor is the
279
+ only read authority and the held final descriptor is the only write authority
280
+ while exact bytes are copied, flushed, and verified by descriptor size and
281
+ identity. Parent and final-path identities are checked before success. A
282
+ concurrent file or symlink at the requested name causes failure without
283
+ overwrite, and a safely verifiable partial destination is removed on an
284
+ ordinary build error. Parent or path swaps are detected and never turn
285
+ attacker-controlled content into a successful artifact.
286
+
287
+ Direct exclusive creation deliberately does not promise rename-style atomic
288
+ visibility: the final pathname exists while bytes are copied, and an
289
+ unrecoverable process or host crash can leave an incomplete `0600` file. Treat
290
+ the build command's successful exit as the publication commit point. After a
291
+ crash, inspect and remove the incomplete named artifact before retrying. This
292
+ tradeoff avoids using any validated pathname as a later hard-link source
293
+ authority.
294
+
295
+ The runtime payload normalizes file timestamps to `SOURCE_DATE_EPOCH`; repeated
296
+ no-cache local builds with identical inputs therefore produce the same platform
297
+ manifest digest. The local validation build disables BuildKit's implicit,
298
+ time-varying attestation. The provenance build explicitly adds a fresh maximum
299
+ provenance statement and SBOM, so compare its platform manifest digest—not the
300
+ outer attestation index—when verifying payload reproducibility.
301
+
302
+ Inspect owner-visible identity without starting the image:
303
+
304
+ ```sh
305
+ docker image inspect servicenow-mcp:1.2.0 \
306
+ --format '{{index .Config.Labels "org.opencontainers.image.version"}} {{.Id}}'
307
+ ```
308
+
309
+ Changing an AI client changes only client configuration: the HTTPS MCP URL and
310
+ bearer token. It never changes the image build inputs.
@@ -0,0 +1,63 @@
1
+ # Cross-client protocol release matrix
2
+
3
+ This is the release contract for the HTTP MCP surface. A release must expose
4
+ one immutable server artifact at `/mcp` and pass the same contract through both
5
+ the official Model Context Protocol SDK client and an independent Fetch
6
+ JSON-RPC client. The required production catalog contains exactly 19 tools.
7
+ User-facing configuration and examples for both clients are in
8
+ `docs/CLIENT-SETUP.md`.
9
+
10
+ The core gate is deterministic and local. It never contacts ServiceNow, never
11
+ uses a live credential, and does not depend on a provider tunnel. Private
12
+ ChatGPT tunnel validation is a separate, optional provider integration check;
13
+ it cannot replace this protocol gate. The packaged server has no stdio
14
+ transport.
15
+
16
+ ## Release matrix
17
+
18
+ | Contract | Required evidence | Blocking evidence |
19
+ | --- | --- | --- |
20
+ | One artifact and endpoint | Both clients initialize, list, and invoke the same runtime at `/mcp`; the container check repeats discovery against one image ID | `test/snsdk-55-release-matrix.test.ts`, `scripts/container-validate.mjs` |
21
+ | Exact discovery parity | Both clients return the same sorted 20 tool names, input schemas, output schemas, and annotations; every input schema requires non-empty `profile` | `test/snsdk-55-release-matrix.test.ts`, `test/http-cross-client.test.ts`, `scripts/container-validate.mjs` |
22
+ | Profile boundary | Missing and unknown profiles fail before configuration or client construction; `sn_profile` succeeds without ServiceNow access or secret disclosure | `test/snsdk-55-release-matrix.test.ts`, `test/http-cross-client.test.ts`, `scripts/container-validate.mjs` |
23
+ | Selected-instance isolation | Crossed read/write calls from both clients bind only to the selected profile's fake ServiceNow adapter | `test/snsdk-55-release-matrix.test.ts`, `test/execution-context.test.ts` |
24
+ | Representative read and controlled write | Each client executes `sn_query` and the dedicated append-only incident journal tool against local fakes | `test/snsdk-55-release-matrix.test.ts`, `test/http-cross-client.test.ts` |
25
+ | Structured result and audit | Successful results and audit records contain the resolved profile and canonical instance while excluding credentials | `test/snsdk-55-release-matrix.test.ts`, `test/http-cross-client.test.ts` |
26
+ | Authentication and negotiation | Authentication precedes request parsing/server construction; Accept, Content-Type, protocol-version, origin, host, and CORS rules fail closed | `test/http-auth.test.ts`, `test/http-request-policy.test.ts`, `test/http-runtime.test.ts`, `test/http-cross-client.test.ts` |
27
+ | Malformed and batch requests | Invalid JSON, unsupported protocol versions, and JSON-RPC batch behavior are deterministic for the HTTP surface | `test/http-cross-client.test.ts`, `test/http-runtime.test.ts` |
28
+ | Cancellation and deadlines | Client abort, body/auth/parser/tool deadlines, and hung factories release their resources | `test/http-request-policy.test.ts`, `test/http-runtime.test.ts` |
29
+ | Concurrency, admission, and rate limits | Concurrent request IDs remain isolated; admission and identity/pre-auth rate limits fail closed and recover capacity | `test/http-runtime.test.ts`, `test/http-entrypoint.test.ts` |
30
+ | Drain and shutdown | Readiness changes during drain, accepted requests complete within grace, forced close is bounded, and SIGINT/SIGTERM are clean | `test/http-health.test.ts`, `test/http-runtime.test.ts`, `test/http-cross-client.test.ts`, `test/http-entrypoint.test.ts`, `scripts/container-validate.mjs` |
31
+
32
+ ## Commands and release interpretation
33
+
34
+ Run the focused portable protocol gate while developing protocol changes:
35
+
36
+ ```bash
37
+ npm run test:protocol
38
+ ```
39
+
40
+ Pull-request CI runs `npm test`, which includes every file in the focused gate
41
+ and the SNSDK-55 matrix. CI intentionally does not invoke `test:protocol` a
42
+ second time, so the same expensive suites are not duplicated. A failure in any
43
+ matrix row therefore blocks the ordinary release pipeline.
44
+
45
+ Before publishing the production image, build it once and validate that same
46
+ tag without replacing or restarting it between clients:
47
+
48
+ ```bash
49
+ npm run container:build
50
+ npm run container:validate
51
+ ```
52
+
53
+ The container validator uses a synthetic local profile. `sn_profile`, missing
54
+ profile, and unknown profile calls are safe because they must finish before a
55
+ ServiceNow client or outbound request exists. The validator compares a
56
+ canonical projection of every name, input schema, output schema, and annotation
57
+ returned to both clients, and it fails if a bearer token or configured secret
58
+ appears in results or logs.
59
+
60
+ Provider-tunnel evidence belongs to the private-connectivity procedure in
61
+ `docs/PRIVATE-CHATGPT-CONNECTIVITY.md`. That procedure may be required by a
62
+ specific hosted integration, but is not portable and is not part of this local
63
+ release matrix.
@@ -0,0 +1,149 @@
1
+ # V2 and future enterprise release boundary
2
+
3
+ This decision records the SNSDK-43 product boundary. ServiceNow MCP V2 is a
4
+ private, single-owner developer service and is independently releasable on that
5
+ basis. Undecided enterprise requirements do not block a V2 implementation
6
+ ticket, release candidate, or release decision.
7
+
8
+ The possible paid enterprise release is a separately funded future product.
9
+ This document is only a concise boundary that may seed its own PRD. It is not
10
+ that PRD, an implementation plan, an estimate, enterprise acceptance criteria,
11
+ or a delivery commitment. Those artifacts must stay outside the V2 release
12
+ plan and release gate.
13
+
14
+ ## V2 release boundary
15
+
16
+ One V2 deployment belongs to one owner. It may contain several explicitly
17
+ named ServiceNow profiles, but every tool call selects exactly one profile and
18
+ uses the deployment's universal fail-closed policy. The owner may authorize
19
+ more than one private client; `clientId` distinguishes those clients for
20
+ request context and audit, but it is not a user, group, role, tenant, or
21
+ delegated ServiceNow identity.
22
+
23
+ V2 is complete when its approved single-owner Jira scope and release gates are
24
+ complete. A V2 ticket must not acquire an enterprise dependency or be held open
25
+ because a future enterprise product has not decided its identity, tenancy,
26
+ authorization, administration, compliance, packaging, or commercial model.
27
+
28
+ The following capabilities are explicitly excluded from V2 and are not
29
+ required for release:
30
+
31
+ | Excluded capability | V2 rule |
32
+ | --- | --- |
33
+ | Shared deployments | A deployment has one owner; it is not a shared organization service. |
34
+ | User and group administration | V2 has no user directory, group lifecycle, invitations, membership, or user-administration surface. |
35
+ | RBAC and per-profile access control | V2 has no roles, grants, entitlements, or caller-specific profile permissions. Its restricted policy applies universally within the owner deployment. |
36
+ | Tenant isolation | V2 has no tenant model, tenant routing, tenant-scoped storage, or cross-tenant administration. Multiple ServiceNow profiles are routing targets, not tenants. |
37
+ | Delegated ServiceNow identity | A profile resolves its configured integration credentials. V2 does not impersonate or delegate the human caller's ServiceNow identity. |
38
+ | Compliance administration | V2 operational security, audit, retention, and support controls do not constitute enterprise governance, legal hold, discovery, residency, policy administration, or compliance reporting. |
39
+ | Public distribution | V2 is a private owner service. It is not a public, marketplace, or generally shared multi-user offering. |
40
+
41
+ Private provider-adapter validation does not change this boundary. In
42
+ particular, a private ChatGPT draft app connected through an outbound Secure
43
+ MCP Tunnel remains a single-owner deployment option.
44
+
45
+ ## The dormant HTTP transport
46
+
47
+ The product exposes exactly one transport: **stdio**. A client spawns
48
+ `servicenow-mcp` and speaks JSON-RPC over that process's stdin and stdout.
49
+ There is no listening socket, no endpoint, and no service to start. That is the
50
+ whole shipped surface, and `servicenow-mcp-setup` registers every client that
51
+ way.
52
+
53
+ A complete Streamable HTTP runtime nevertheless remains in the tree, compiling
54
+ and under test:
55
+
56
+ | Module | What it holds |
57
+ | --- | --- |
58
+ | [`src/http-entrypoint.ts`](../src/http-entrypoint.ts) | The composition that starts the listener. Not a `bin` entry; nothing on the CLI path imports it. |
59
+ | [`src/http-runtime.ts`](../src/http-runtime.ts) | Per-request MCP server construction, admission, deadlines, cancellation, graceful drain. |
60
+ | [`src/http-auth.ts`](../src/http-auth.ts) | The bearer/identity boundary evaluated before MCP parsing. |
61
+ | [`src/http-request-policy.ts`](../src/http-request-policy.ts) | `Host`/`Origin` allowlists, content-type and body bounds. |
62
+ | [`src/http-observability.ts`](../src/http-observability.ts) | Structured request and tool events. stdio reuses its tool half. |
63
+
64
+ It is kept, rather than deleted, because a listening service is the shape an
65
+ enterprise deployment would need — a shared host, a reverse proxy, a bearer or
66
+ delegated identity — and rebuilding admission control, rate limiting,
67
+ `Host`/`Origin` handling, and per-request server isolation from nothing would
68
+ be materially harder than keeping them exercised. Its tests run on every build
69
+ (`test/http-runtime.test.ts`, `test/http-entrypoint.test.ts`,
70
+ `test/http-auth.test.ts`, `test/http-request-policy.test.ts`,
71
+ `test/http-cross-client.test.ts`), so it does not rot.
72
+
73
+ **Dormant means unreachable, not configurable.** There is deliberately no
74
+ transport environment variable and no CLI flag. Running
75
+ `node dist/http-entrypoint.js` starts it, which is how its tests drive it, and
76
+ that is the only way. An operator following the documentation cannot turn it on
77
+ by accident.
78
+
79
+ Re-exposing it is a product decision, not a configuration change, and it would
80
+ carry the questions this document exists to defer: who may connect, how they
81
+ authenticate, whose ServiceNow identity a request acts as, and what the
82
+ `Host`/`Origin` and TLS boundary is on a machine that is no longer the only
83
+ caller. None of those is answered by the single-owner V2 model, and none of the
84
+ excluded capabilities above becomes available by starting a listener.
85
+
86
+ An authenticated **public ChatGPT** offering cannot promote V2's private
87
+ static bearer, owner/client labels, or tunnel procedure into a multi-user
88
+ security model. It requires a separately designed multi-user
89
+ authorization/OAuth architecture, including its own identity and authorization
90
+ boundaries, token lifecycle, consent and revocation model, tenant binding, and
91
+ ServiceNow identity decision. That work belongs to the future product and is
92
+ not implicit in V2.
93
+
94
+ ### The container image, and its CI status
95
+
96
+ The OCI image serves this transport, not the stdio server 2.0 ships, so it
97
+ launches `dist/http-entrypoint.js`. Running `dist/index.js` there would start a
98
+ stdio server with no stdin attached: it would do nothing and still look
99
+ healthy, which is why the entrypoint is asserted in both the artifact test and
100
+ `scripts/container-validate.mjs`.
101
+
102
+ The image sets `MCP_HOST=0.0.0.0`, and HTTP authentication is opt-in. That
103
+ combination is a ServiceNow proxy open to the network whose failure mode is a
104
+ *working* deployment, so the entrypoint refuses to start when the host is not
105
+ loopback and no `MCP_BEARER_TOKEN` is set, rather than warning.
106
+
107
+ `container-release` runs in both workflows but gates neither: it validates an
108
+ artifact 2.0 does not ship, and a red check there must not block a stdio
109
+ release or the npm publish that delivers it. In `ci.yml` it is
110
+ `continue-on-error`; in `publish.yml` it is additionally absent from the
111
+ `publish` job's `needs`, because a hard dependency there would stop the package
112
+ users install from shipping over an image they never receive. It is kept
113
+ running so the image does not rot. Restore both when this transport is
114
+ re-exposed — at which point its failures become release-blocking, as they
115
+ should be.
116
+
117
+ ## Concrete seams V2 preserves
118
+
119
+ V2 preserves only the boundaries already needed by its single-owner design.
120
+ They are useful inputs to later design work, but none is an enterprise feature
121
+ or a promise that enterprise requirements can be added without redesign.
122
+
123
+ | Existing seam | Concrete V2 contract | What it does not mean |
124
+ | --- | --- | --- |
125
+ | [Request owner/client authentication](../src/http-auth.ts) | `HttpAuthenticationProvider` authenticates before MCP parsing, profile lookup, credentials, or tool dispatch and produces one immutable `ownerId`/`clientId` identity. Under stdio there is nothing to authenticate — the caller already had to be able to spawn the process — so `MCP_OWNER_ID`/`MCP_CLIENT_ID` are labels, and the seam sits dormant with the rest of the HTTP path. | `clientId` is not a user directory, role, tenant, OAuth subject, or delegated identity. |
126
+ | [Explicit request/profile context](../src/execution-context.ts) | Each invocation binds immutable request metadata, exactly one resolved profile, an effective policy, cancellation, result identity, and audit correlation. | A profile is not a tenant or entitlement, and context construction is not per-user authorization. |
127
+ | [Policy-provider boundary](../src/execution-context.ts) | `EffectivePolicyProvider` selects the deployment's fail-closed policy; table, field, encoded-query, record-identifier, and journal modules enforce concrete resource rules. | Deployment policy is not RBAC, a grants service, or per-profile/caller access control. |
128
+ | [Secret references](../src/profile-credentials.ts) | `SecretReference` and `SecretResolver` keep profile credential resolution provider-neutral and separate from stored configuration. | Secret resolution does not delegate a human identity or provide tenant-scoped credential brokering. |
129
+ | [Provider-neutral MCP construction](../src/server.ts) | The MCP server is created independently of any transport; `createMcpServer` never imports, constructs, or connects one. The shipped runtime binds it to stdio, and the dormant HTTP runtime binds the same server to Streamable HTTP. | Compatibility with a provider or tunnel is not public distribution, provider identity, or enterprise authorization. |
130
+
131
+ Preserving these seams means keeping their current responsibilities explicit
132
+ and avoiding provider-specific coupling. It does **not** authorize new tenant,
133
+ user, group, role, grant, OAuth-provider, compliance-administrator, or delegated
134
+ identity abstractions in the V2 runtime. Such abstractions require their own
135
+ approved product requirements and architecture.
136
+
137
+ ## Boundary for a later PRD
138
+
139
+ A separately authorized enterprise initiative may use this exclusion list and
140
+ the concrete seam inventory as starting context. Its own PRD must decide the
141
+ customers and deployment model, identity authority, authorization and
142
+ per-profile entitlement model, tenant and data-isolation guarantees,
143
+ ServiceNow identity/delegation model, administrator and compliance surfaces,
144
+ public-channel threat model, operations, support, and commercial packaging.
145
+
146
+ No answer is selected here. No enterprise estimate, milestone, acceptance
147
+ criterion, funding promise, or delivery date belongs in the V2 roadmap. Until
148
+ a separate product decision exists, the V2 behavior stays private and
149
+ single-owner and all listed enterprise capabilities stay excluded.