@onlyflows/servicenow-mcp 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +56 -0
- package/CHANGELOG.md +153 -0
- package/README.md +939 -101
- package/dist/auth.d.ts +88 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +396 -0
- package/dist/auth.js.map +1 -0
- package/dist/client.d.ts +111 -17
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +554 -79
- package/dist/client.js.map +1 -1
- package/dist/config.d.ts +41 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +44 -34
- package/dist/config.js.map +1 -1
- package/dist/encoded-query-policy.d.ts +72 -0
- package/dist/encoded-query-policy.d.ts.map +1 -0
- package/dist/encoded-query-policy.js +409 -0
- package/dist/encoded-query-policy.js.map +1 -0
- package/dist/execution-context.d.ts +235 -0
- package/dist/execution-context.d.ts.map +1 -0
- package/dist/execution-context.js +439 -0
- package/dist/execution-context.js.map +1 -0
- package/dist/field-policy.d.ts +117 -0
- package/dist/field-policy.d.ts.map +1 -0
- package/dist/field-policy.js +1684 -0
- package/dist/field-policy.js.map +1 -0
- package/dist/http-auth.d.ts +131 -0
- package/dist/http-auth.d.ts.map +1 -0
- package/dist/http-auth.js +347 -0
- package/dist/http-auth.js.map +1 -0
- package/dist/http-entrypoint.d.ts +26 -0
- package/dist/http-entrypoint.d.ts.map +1 -0
- package/dist/http-entrypoint.js +255 -0
- package/dist/http-entrypoint.js.map +1 -0
- package/dist/http-observability.d.ts +147 -0
- package/dist/http-observability.d.ts.map +1 -0
- package/dist/http-observability.js +703 -0
- package/dist/http-observability.js.map +1 -0
- package/dist/http-request-policy.d.ts +72 -0
- package/dist/http-request-policy.d.ts.map +1 -0
- package/dist/http-request-policy.js +463 -0
- package/dist/http-request-policy.js.map +1 -0
- package/dist/http-request-signal.d.ts +12 -0
- package/dist/http-request-signal.d.ts.map +1 -0
- package/dist/http-request-signal.js +39 -0
- package/dist/http-request-signal.js.map +1 -0
- package/dist/http-runtime.d.ts +77 -0
- package/dist/http-runtime.d.ts.map +1 -0
- package/dist/http-runtime.js +1321 -0
- package/dist/http-runtime.js.map +1 -0
- package/dist/incident-journal-policy.d.ts +22 -0
- package/dist/incident-journal-policy.d.ts.map +1 -0
- package/dist/incident-journal-policy.js +115 -0
- package/dist/incident-journal-policy.js.map +1 -0
- package/dist/incident-write-policy.d.ts +20 -0
- package/dist/incident-write-policy.d.ts.map +1 -0
- package/dist/incident-write-policy.js +196 -0
- package/dist/incident-write-policy.js.map +1 -0
- package/dist/index.d.ts +14 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +140 -36
- package/dist/index.js.map +1 -1
- package/dist/metadata-cache.d.ts +71 -0
- package/dist/metadata-cache.d.ts.map +1 -0
- package/dist/metadata-cache.js +397 -0
- package/dist/metadata-cache.js.map +1 -0
- package/dist/profile-admin.d.ts +64 -0
- package/dist/profile-admin.d.ts.map +1 -0
- package/dist/profile-admin.js +351 -0
- package/dist/profile-admin.js.map +1 -0
- package/dist/profile-credentials.d.ts +68 -0
- package/dist/profile-credentials.d.ts.map +1 -0
- package/dist/profile-credentials.js +329 -0
- package/dist/profile-credentials.js.map +1 -0
- package/dist/profile-manager.d.ts +187 -0
- package/dist/profile-manager.d.ts.map +1 -0
- package/dist/profile-manager.js +1026 -0
- package/dist/profile-manager.js.map +1 -0
- package/dist/record-identifier-policy.d.ts +39 -0
- package/dist/record-identifier-policy.d.ts.map +1 -0
- package/dist/record-identifier-policy.js +203 -0
- package/dist/record-identifier-policy.js.map +1 -0
- package/dist/runtime-environment.d.ts +23 -0
- package/dist/runtime-environment.d.ts.map +1 -0
- package/dist/runtime-environment.js +58 -0
- package/dist/runtime-environment.js.map +1 -0
- package/dist/server.d.ts +33 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +73 -0
- package/dist/server.js.map +1 -0
- package/dist/servicenow-identifiers.d.ts +8 -0
- package/dist/servicenow-identifiers.d.ts.map +1 -0
- package/dist/servicenow-identifiers.js +22 -0
- package/dist/servicenow-identifiers.js.map +1 -0
- package/dist/setup-prompts.d.ts +7 -0
- package/dist/setup-prompts.d.ts.map +1 -0
- package/dist/setup-prompts.js +123 -0
- package/dist/setup-prompts.js.map +1 -0
- package/dist/setup.d.ts +109 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/setup.js +1903 -0
- package/dist/setup.js.map +1 -0
- package/dist/startup.d.ts +43 -0
- package/dist/startup.d.ts.map +1 -0
- package/dist/startup.js +75 -0
- package/dist/startup.js.map +1 -0
- package/dist/stdio-runtime.d.ts +106 -0
- package/dist/stdio-runtime.d.ts.map +1 -0
- package/dist/stdio-runtime.js +231 -0
- package/dist/stdio-runtime.js.map +1 -0
- package/dist/structured-query.d.ts +187 -0
- package/dist/structured-query.d.ts.map +1 -0
- package/dist/structured-query.js +503 -0
- package/dist/structured-query.js.map +1 -0
- package/dist/table-defaults.d.ts +28 -0
- package/dist/table-defaults.d.ts.map +1 -0
- package/dist/table-defaults.js +85 -0
- package/dist/table-defaults.js.map +1 -0
- package/dist/table-policy.d.ts +71 -0
- package/dist/table-policy.d.ts.map +1 -0
- package/dist/table-policy.js +290 -0
- package/dist/table-policy.js.map +1 -0
- package/dist/tool-error.d.ts +48 -0
- package/dist/tool-error.d.ts.map +1 -0
- package/dist/tool-error.js +139 -0
- package/dist/tool-error.js.map +1 -0
- package/dist/tool-table-access.d.ts +19 -0
- package/dist/tool-table-access.d.ts.map +1 -0
- package/dist/tool-table-access.js +388 -0
- package/dist/tool-table-access.js.map +1 -0
- package/dist/tools/aggregate.d.ts +22 -42
- package/dist/tools/aggregate.d.ts.map +1 -1
- package/dist/tools/aggregate.js +103 -47
- package/dist/tools/aggregate.js.map +1 -1
- package/dist/tools/all-fields-cap.d.ts +45 -0
- package/dist/tools/all-fields-cap.d.ts.map +1 -0
- package/dist/tools/all-fields-cap.js +151 -0
- package/dist/tools/all-fields-cap.js.map +1 -0
- package/dist/tools/atf.d.ts +21 -60
- package/dist/tools/atf.d.ts.map +1 -1
- package/dist/tools/atf.js +180 -116
- package/dist/tools/atf.js.map +1 -1
- package/dist/tools/attach.d.ts +31 -45
- package/dist/tools/attach.d.ts.map +1 -1
- package/dist/tools/attach.js +175 -137
- package/dist/tools/attach.js.map +1 -1
- package/dist/tools/batch.d.ts +78 -42
- package/dist/tools/batch.d.ts.map +1 -1
- package/dist/tools/batch.js +172 -68
- package/dist/tools/batch.js.map +1 -1
- package/dist/tools/catalog.d.ts +6 -0
- package/dist/tools/catalog.d.ts.map +1 -0
- package/dist/tools/catalog.js +203 -0
- package/dist/tools/catalog.js.map +1 -0
- package/dist/tools/codesearch.d.ts +14 -25
- package/dist/tools/codesearch.d.ts.map +1 -1
- package/dist/tools/codesearch.js +60 -48
- package/dist/tools/codesearch.js.map +1 -1
- package/dist/tools/create-module.d.ts +48 -0
- package/dist/tools/create-module.d.ts.map +1 -0
- package/dist/tools/create-module.js +94 -0
- package/dist/tools/create-module.js.map +1 -0
- package/dist/tools/create.d.ts +2 -38
- package/dist/tools/create.d.ts.map +1 -1
- package/dist/tools/create.js +9 -41
- package/dist/tools/create.js.map +1 -1
- package/dist/tools/delete.d.ts +13 -23
- package/dist/tools/delete.d.ts.map +1 -1
- package/dist/tools/delete.js +30 -33
- package/dist/tools/delete.js.map +1 -1
- package/dist/tools/discover.d.ts +15 -27
- package/dist/tools/discover.d.ts.map +1 -1
- package/dist/tools/discover.js +103 -60
- package/dist/tools/discover.js.map +1 -1
- package/dist/tools/get-module.d.ts +85 -0
- package/dist/tools/get-module.d.ts.map +1 -0
- package/dist/tools/get-module.js +221 -0
- package/dist/tools/get-module.js.map +1 -0
- package/dist/tools/get.d.ts +2 -51
- package/dist/tools/get.d.ts.map +1 -1
- package/dist/tools/get.js +9 -49
- package/dist/tools/get.js.map +1 -1
- package/dist/tools/handler-result.d.ts +14 -0
- package/dist/tools/handler-result.d.ts.map +1 -0
- package/dist/tools/handler-result.js +177 -0
- package/dist/tools/handler-result.js.map +1 -0
- package/dist/tools/health.d.ts +12 -15
- package/dist/tools/health.d.ts.map +1 -1
- package/dist/tools/health.js +55 -36
- package/dist/tools/health.js.map +1 -1
- package/dist/tools/incident-journal-module.d.ts +12 -0
- package/dist/tools/incident-journal-module.d.ts.map +1 -0
- package/dist/tools/incident-journal-module.js +61 -0
- package/dist/tools/incident-journal-module.js.map +1 -0
- package/dist/tools/incident-write-shared.d.ts +6 -0
- package/dist/tools/incident-write-shared.d.ts.map +1 -0
- package/dist/tools/incident-write-shared.js +64 -0
- package/dist/tools/incident-write-shared.js.map +1 -0
- package/dist/tools/index.d.ts +47 -36
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +795 -35
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/nl.d.ts +10 -24
- package/dist/tools/nl.d.ts.map +1 -1
- package/dist/tools/nl.js +37 -147
- package/dist/tools/nl.js.map +1 -1
- package/dist/tools/profile.d.ts +37 -0
- package/dist/tools/profile.d.ts.map +1 -0
- package/dist/tools/profile.js +39 -0
- package/dist/tools/profile.js.map +1 -0
- package/dist/tools/query-module.d.ts +119 -0
- package/dist/tools/query-module.d.ts.map +1 -0
- package/dist/tools/query-module.js +324 -0
- package/dist/tools/query-module.js.map +1 -0
- package/dist/tools/query.d.ts +2 -72
- package/dist/tools/query.d.ts.map +1 -1
- package/dist/tools/query.js +8 -72
- package/dist/tools/query.js.map +1 -1
- package/dist/tools/relationships.d.ts +21 -42
- package/dist/tools/relationships.d.ts.map +1 -1
- package/dist/tools/relationships.js +70 -56
- package/dist/tools/relationships.js.map +1 -1
- package/dist/tools/result-envelope.d.ts +603 -0
- package/dist/tools/result-envelope.d.ts.map +1 -0
- package/dist/tools/result-envelope.js +767 -0
- package/dist/tools/result-envelope.js.map +1 -0
- package/dist/tools/schema-module.d.ts +64 -0
- package/dist/tools/schema-module.d.ts.map +1 -0
- package/dist/tools/schema-module.js +367 -0
- package/dist/tools/schema-module.js.map +1 -0
- package/dist/tools/schema.d.ts +2 -37
- package/dist/tools/schema.d.ts.map +1 -1
- package/dist/tools/schema.js +6 -57
- package/dist/tools/schema.js.map +1 -1
- package/dist/tools/script.d.ts +33 -27
- package/dist/tools/script.d.ts.map +1 -1
- package/dist/tools/script.js +43 -37
- package/dist/tools/script.js.map +1 -1
- package/dist/tools/syslog.d.ts +19 -46
- package/dist/tools/syslog.d.ts.map +1 -1
- package/dist/tools/syslog.js +101 -67
- package/dist/tools/syslog.js.map +1 -1
- package/dist/tools/tool-module.d.ts +143 -0
- package/dist/tools/tool-module.d.ts.map +1 -0
- package/dist/tools/tool-module.js +1095 -0
- package/dist/tools/tool-module.js.map +1 -0
- package/dist/tools/update-module.d.ts +51 -0
- package/dist/tools/update-module.d.ts.map +1 -0
- package/dist/tools/update-module.js +107 -0
- package/dist/tools/update-module.js.map +1 -0
- package/dist/tools/update.d.ts +2 -45
- package/dist/tools/update.d.ts.map +1 -1
- package/dist/tools/update.js +9 -41
- package/dist/tools/update.js.map +1 -1
- package/dist/utils.d.ts +68 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +114 -16
- package/dist/utils.js.map +1 -1
- package/dist/version.d.ts +10 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +13 -0
- package/dist/version.js.map +1 -0
- package/docs/ADDING-TOOLS.md +227 -0
- package/docs/CLIENT-SETUP.md +914 -0
- package/docs/CONTAINER-DEPLOYMENT.md +310 -0
- package/docs/CROSS-CLIENT-RELEASE-MATRIX.md +63 -0
- package/docs/ENTERPRISE-RELEASE-BOUNDARY.md +149 -0
- package/docs/OPERATIONS-RUNBOOK.md +383 -0
- package/docs/PRIVATE-CHATGPT-CONNECTIVITY.md +347 -0
- package/docs/PRODUCTION-SECURITY.md +368 -0
- package/docs/PROFILE-CREDENTIALS.md +126 -0
- package/docs/RELEASE-VALIDATION.md +140 -0
- package/docs/TESTING-OAUTH.md +101 -0
- package/docs/V2-MIGRATION.md +493 -0
- package/package.json +60 -13
- package/scripts/inspector.mjs +140 -0
- package/scripts/release-validate.mjs +201 -0
- package/scripts/smoke-test.mjs +274 -0
- package/tools/inspector/package-lock.json +3812 -0
- package/tools/inspector/package.json +12 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Live test plan — ServiceNow OAuth through V2 HTTP
|
|
2
|
+
|
|
3
|
+
This is an opt-in plan for a PDI or sub-production ServiceNow instance. The
|
|
4
|
+
normal unit and HTTP contract suites use deterministic fakes and do not need
|
|
5
|
+
ServiceNow credentials or network access.
|
|
6
|
+
|
|
7
|
+
## 1. Configure ServiceNow OAuth
|
|
8
|
+
|
|
9
|
+
1. Enable `glide.oauth.inbound.client.credential.grant_type.enabled` on the
|
|
10
|
+
test instance if client-credentials is required.
|
|
11
|
+
2. Create a dedicated web-service account with the minimum roles needed for
|
|
12
|
+
the checks. Do not use a personal administrator identity.
|
|
13
|
+
3. Create an OAuth API endpoint application in **System OAuth → Application
|
|
14
|
+
Registry**, bind its OAuth Application User to that service account, and
|
|
15
|
+
copy the client ID and secret into a secret store.
|
|
16
|
+
4. Confirm the instance token endpoint independently before debugging this
|
|
17
|
+
service. Never paste tokens or secrets into test output or issue comments.
|
|
18
|
+
|
|
19
|
+
## 2. Start the authenticated V2 service
|
|
20
|
+
|
|
21
|
+
Use an out-of-band named profile, or explicitly map canonical `SN_*` variables
|
|
22
|
+
to an environment profile:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
export MCP_OWNER_ID="oauth-test-owner"
|
|
26
|
+
export MCP_CLIENT_ID="oauth-test-client"
|
|
27
|
+
export SN_PROFILE_NAME="oauth-test"
|
|
28
|
+
export SN_INSTANCE="https://devXXXXXX.service-now.com"
|
|
29
|
+
export SN_AUTH_TYPE="oauth"
|
|
30
|
+
export SN_CLIENT_ID="service-now-oauth-client-id"
|
|
31
|
+
npm ci
|
|
32
|
+
npm run build
|
|
33
|
+
npm test
|
|
34
|
+
npm start
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The approved test supervisor, keychain, or secret manager must inject
|
|
38
|
+
`MCP_BEARER_TOKEN` and `SN_CLIENT_SECRET` directly into the service process
|
|
39
|
+
before those non-secret commands run. Never type either value into shell input,
|
|
40
|
+
an argument, a dotenv file, or command history.
|
|
41
|
+
|
|
42
|
+
These OAuth checks run against an authenticated service, so `MCP_BEARER_TOKEN`
|
|
43
|
+
must be set: without it the endpoint is unauthenticated and the rejection checks
|
|
44
|
+
below cannot fire. Startup must fail when the MCP bearer secret, owner ID, or
|
|
45
|
+
client ID is present but invalid. The service listens at
|
|
46
|
+
`http://127.0.0.1:3000/mcp` unless `MCP_HOST` or `MCP_PORT` is explicitly set.
|
|
47
|
+
|
|
48
|
+
## 3. Run the HTTP smoke client
|
|
49
|
+
|
|
50
|
+
In a second terminal whose process environment already receives the same
|
|
51
|
+
bearer from the approved injection mechanism, select the non-secret profile
|
|
52
|
+
and endpoint explicitly:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
export MCP_PROFILE="oauth-test"
|
|
56
|
+
export MCP_URL="http://127.0.0.1:3000/mcp"
|
|
57
|
+
npm run smoke
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The smoke client uses the official MCP Streamable HTTP client and verifies:
|
|
61
|
+
|
|
62
|
+
- initialization and discovery over `/mcp`;
|
|
63
|
+
- exactly 19 tools;
|
|
64
|
+
- every discovered schema requires a non-empty `profile`;
|
|
65
|
+
- `sn_profile` returns `structuredContent.profile` without credentials;
|
|
66
|
+
- a version health check and a bounded incident query return that same resolved
|
|
67
|
+
profile through OAuth; and
|
|
68
|
+
- each MCP operation is cancellation-aware and bounded to 30 seconds by default
|
|
69
|
+
(`MCP_SMOKE_TIMEOUT_MS` accepts 1000 through 120000).
|
|
70
|
+
|
|
71
|
+
To opt into a create / incident work-note append / delete round trip on a
|
|
72
|
+
disposable PDI only:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npm run smoke -- --write --confirm-write-profile=oauth-test
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The confirmation must exactly equal `MCP_PROFILE`. Never use `--write` against
|
|
79
|
+
production or a shared instance. The smoke client reads the created identifier
|
|
80
|
+
from `structuredContent.data.sys_id` and attempts deletion in `finally`; a
|
|
81
|
+
cleanup failure is a failed run and requires authorized manual cleanup.
|
|
82
|
+
|
|
83
|
+
## 4. OAuth lifecycle checks
|
|
84
|
+
|
|
85
|
+
- After several read calls, the ServiceNow OAuth token table should show one
|
|
86
|
+
cached access token rather than one token per call.
|
|
87
|
+
- Revoke the test token, then repeat a read. The client should refresh once and
|
|
88
|
+
retry without exposing the token response.
|
|
89
|
+
- Start the service once with an intentionally invalid ServiceNow client secret.
|
|
90
|
+
The tool call must fail with a sanitized error; the secret must not appear in
|
|
91
|
+
the MCP result, service output, or audit record.
|
|
92
|
+
- With `MCP_BEARER_TOKEN` configured, send an absent or invalid MCP bearer
|
|
93
|
+
header. The HTTP boundary must return a
|
|
94
|
+
generic 401 before parsing MCP input or touching any profile credential.
|
|
95
|
+
|
|
96
|
+
## 5. Shutdown check
|
|
97
|
+
|
|
98
|
+
While one request is in flight, send SIGTERM (and repeat with SIGINT). The
|
|
99
|
+
listener must stop accepting new work, accepted work may drain only within
|
|
100
|
+
`MCP_SHUTDOWN_GRACE_MS`, and the process must release its owned HTTP/MCP
|
|
101
|
+
resources at the deadline.
|
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
# Migrating to 2.0
|
|
2
|
+
|
|
3
|
+
2.0 is a local, single-owner stdio server, the same launch shape as 1.x: your
|
|
4
|
+
client spawns `servicenow-mcp` and speaks to it over that process's stdin and
|
|
5
|
+
stdout. Nothing listens on a port. Every published release before it is
|
|
6
|
+
`1.0.0`, so this guide is written for a 1.0.0 install.
|
|
7
|
+
|
|
8
|
+
**Your transport does not change.** A 1.0.0 client entry that launches the
|
|
9
|
+
package still launches it. What changes is what the server expects once it is
|
|
10
|
+
running: every call names a profile, and table access is granted rather than
|
|
11
|
+
inherited from the credential. Those two are the migration; the rest apply only
|
|
12
|
+
if you used the affected surface.
|
|
13
|
+
|
|
14
|
+
## Breaking changes at a glance
|
|
15
|
+
|
|
16
|
+
| # | Change | Before (1.0.0) | After (2.0.0) |
|
|
17
|
+
|---|--------|----------------|---------------|
|
|
18
|
+
| 1 | Transport | stdio; the client spawns `servicenow-mcp` | unchanged — stdio; the client spawns `servicenow-mcp` |
|
|
19
|
+
| 2 | Profile selection | implicit, from `SN_*` in the client's env | every tool call carries an explicit `profile` |
|
|
20
|
+
| 3 | Table access | any table the credential could reach | deny-by-default per profile; explicit allowlist plus target entries |
|
|
21
|
+
| 4 | Attachments | host `file_path` / `output_path` | inline base64 both directions; no host filesystem access, and no flag restores it |
|
|
22
|
+
| 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 |
|
|
25
|
+
| 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
|
+
| 9 | Capabilities | `tools` only | adds `prompts` (`servicenow-mcp.add-profile`) |
|
|
27
|
+
|
|
28
|
+
Each is expanded below. Items 2 and 3 require action on every install; the rest
|
|
29
|
+
apply only if you used the affected surface. Item 1 is listed because an
|
|
30
|
+
earlier 2.0 pre-release did move to HTTP — if you configured against that, see
|
|
31
|
+
[Transport](#1-transport-unchanged).
|
|
32
|
+
|
|
33
|
+
## Also new in 2.0
|
|
34
|
+
|
|
35
|
+
- **Inline base64 attachments.** `sn_attach` uploads and downloads file content
|
|
36
|
+
in the tool call itself, with no host filesystem access on either side. See
|
|
37
|
+
breaking change 4 — this is the replacement for the removed path arguments.
|
|
38
|
+
- **`servicenow-mcp-setup`.** A bootstrap that generates the local server
|
|
39
|
+
environment, registers the clients that have a CLI, emits copy-pasteable
|
|
40
|
+
config for the rest, writes least-privilege table-access rules onto a profile,
|
|
41
|
+
and diagnoses an install end to end with `doctor`.
|
|
42
|
+
- **`servicenow-mcp.add-profile` prompt.** A guided profile-creation flow that
|
|
43
|
+
never asks for a secret in chat.
|
|
44
|
+
- **Append-only incident journal tools.** `sn_incident_add_comment` and
|
|
45
|
+
`sn_incident_add_work_note`.
|
|
46
|
+
- **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).
|
|
51
|
+
- **Bounded unrestricted field selection.** `fields=all` and
|
|
52
|
+
`response_format: "detailed"` are capped at 100 columns instead of dropping
|
|
53
|
+
`sysparm_fields` and risking a failed call on a wide table.
|
|
54
|
+
- **Journal content is readable on request.** `comments` and `work_notes` are
|
|
55
|
+
returned by `fields=all`, `response_format: "detailed"`, an explicit
|
|
56
|
+
`fields=comments`, and `sn_schema`. The default projection still excludes
|
|
57
|
+
them. Journal content on real instances routinely contains customer PII, so
|
|
58
|
+
asking for all fields on `incident` now returns customer-visible commentary.
|
|
59
|
+
|
|
60
|
+
### 1. Transport (unchanged)
|
|
61
|
+
|
|
62
|
+
Your 1.0.0 client entry keeps working. The server still runs as a subprocess of
|
|
63
|
+
the client, framed over stdin and stdout:
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"mcpServers": {
|
|
68
|
+
"servicenow": {
|
|
69
|
+
"command": "npx",
|
|
70
|
+
"args": ["-y", "@onlyflows/servicenow-mcp"],
|
|
71
|
+
"env": { "SN_PROFILE_NAME": "dev", "SN_INSTANCE": "https://yourinstance.service-now.com", "SN_USER": "u", "SN_PASSWORD": "p" }
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
The one addition is `SN_PROFILE_NAME`. 1.x inferred a single implicit
|
|
78
|
+
connection from the bare `SN_*` variables; 2.0 requires you to name it, because
|
|
79
|
+
every tool call now carries a profile (breaking change 2) and the name in the
|
|
80
|
+
call has to match something. Bare `SN_*` without `SN_PROFILE_NAME` is refused
|
|
81
|
+
rather than guessed at.
|
|
82
|
+
|
|
83
|
+
You do not have to keep credentials in your client config. `servicenow-mcp-setup`
|
|
84
|
+
writes them to an owner-only `~/.servicenow-mcp` instead, verifies them against
|
|
85
|
+
your instance before saving, and registers your clients for you — after which
|
|
86
|
+
the client entry carries no secret at all:
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"mcpServers": {
|
|
91
|
+
"servicenow-mcp": {
|
|
92
|
+
"type": "stdio",
|
|
93
|
+
"command": "servicenow-mcp"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Per-client syntax is in [CLIENT-SETUP.md](CLIENT-SETUP.md#7-mcp-client-configuration).
|
|
100
|
+
|
|
101
|
+
**If you configured against a 2.0 pre-release that served HTTP**, that
|
|
102
|
+
transport still exists but is dormant: no CLI path reaches it, it is not a
|
|
103
|
+
`bin` entry, and setup never registers a client against a URL. Replace a
|
|
104
|
+
`"type": "http"` entry with the stdio entry above. The endpoint, the readiness
|
|
105
|
+
check, and the service you had to keep running are all gone.
|
|
106
|
+
The `/mcp` endpoint is unauthenticated unless you set `MCP_BEARER_TOKEN`. See the
|
|
107
|
+
[enterprise boundary](ENTERPRISE-RELEASE-BOUNDARY.md#the-dormant-http-transport)
|
|
108
|
+
for why it is kept.
|
|
109
|
+
|
|
110
|
+
### 2. Explicit profile on every call
|
|
111
|
+
|
|
112
|
+
**Before:** `{"table": "incident", "limit": 5}`
|
|
113
|
+
|
|
114
|
+
**After:** `{"profile": "dev", "table": "incident", "limit": 5}`
|
|
115
|
+
|
|
116
|
+
There is no default, active, current, or session-selected profile, and no
|
|
117
|
+
switch operation. Missing, empty, unknown, or invalid names fail before
|
|
118
|
+
credential resolution or ServiceNow client construction. Successful results
|
|
119
|
+
carry the resolved name in `structuredContent.profile`.
|
|
120
|
+
|
|
121
|
+
### 3. Deny-by-default table access
|
|
122
|
+
|
|
123
|
+
**Before:** no MCP-side table policy; the integration account's ACLs were the
|
|
124
|
+
only boundary.
|
|
125
|
+
|
|
126
|
+
**After:** a profile with no rules denies every tool call. Grant explicitly:
|
|
127
|
+
|
|
128
|
+
```sh
|
|
129
|
+
servicenow-mcp-setup grant --profile dev --read incident,problem --write incident
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
`SN_ALLOWED_READ_TABLES`, `SN_ALLOWED_WRITE_TABLES`, and
|
|
133
|
+
`SN_TABLE_ACCESS_TARGETS` configure the `SN_PROFILE_NAME` environment profile,
|
|
134
|
+
and **only when `~/.servicenow-mcp/config.json` does not exist**. If you have a
|
|
135
|
+
profile file, those variables are ignored and the rules must live on the
|
|
136
|
+
profile. `servicenow-mcp-setup doctor` reports this case explicitly.
|
|
137
|
+
|
|
138
|
+
### 4. Attachments: no host filesystem paths
|
|
139
|
+
|
|
140
|
+
`sn_attach` no longer accepts `file_path` or `output_path`. The tool holds no
|
|
141
|
+
filesystem access at all — there is no `readFileSync`, no path parameter, and
|
|
142
|
+
no flag that restores the old behavior. Uploads take inline base64; downloads
|
|
143
|
+
return inline base64.
|
|
144
|
+
|
|
145
|
+
This is deliberate hardening, not a regression. The server touches no host
|
|
146
|
+
filesystem, so behavior is identical whether it runs on a desktop or in a
|
|
147
|
+
container. Under the old contract a `file_path` that worked on a laptop
|
|
148
|
+
silently failed once the same server ran in a container against the same
|
|
149
|
+
client — exactly the kind of environment-dependent break that makes an install
|
|
150
|
+
hard to trust.
|
|
151
|
+
|
|
152
|
+
**Upload — before:**
|
|
153
|
+
|
|
154
|
+
```json
|
|
155
|
+
{ "action": "upload", "table": "incident", "sys_id": "…", "file_path": "/local/report.pdf" }
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**Upload — after.** Encode the file yourself and send the bytes inline:
|
|
159
|
+
|
|
160
|
+
```json
|
|
161
|
+
{
|
|
162
|
+
"profile": "dev",
|
|
163
|
+
"action": "upload",
|
|
164
|
+
"table": "incident",
|
|
165
|
+
"sys_id": "0123456789abcdef0123456789abcdef",
|
|
166
|
+
"file_name": "report.pdf",
|
|
167
|
+
"content_base64": "JVBERi0xLjcKJc…"
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
`file_name` must be a safe leaf name — no directory separators. To produce the
|
|
172
|
+
payload:
|
|
173
|
+
|
|
174
|
+
```sh
|
|
175
|
+
base64 report.pdf # macOS / BSD
|
|
176
|
+
base64 -w0 report.pdf # GNU coreutils, single line
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
`base64` wraps at 76 columns by default. That is fine: the tool tolerates
|
|
180
|
+
whitespace in `content_base64`, so either form works.
|
|
181
|
+
|
|
182
|
+
**Download — before:**
|
|
183
|
+
|
|
184
|
+
```json
|
|
185
|
+
{ "action": "download", "table": "incident", "sys_id": "…", "output_path": "/local/out.pdf" }
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Download — after.** The result carries the bytes; decode them client-side:
|
|
189
|
+
|
|
190
|
+
```json
|
|
191
|
+
{
|
|
192
|
+
"profile": "dev",
|
|
193
|
+
"action": "download",
|
|
194
|
+
"table": "incident",
|
|
195
|
+
"sys_id": "0123456789abcdef0123456789abcdef",
|
|
196
|
+
"attachment_sys_id": "…"
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
The result returns `content_base64`, `file_name`, `content_type`, and
|
|
201
|
+
`size_bytes`. Write the file yourself:
|
|
202
|
+
|
|
203
|
+
```sh
|
|
204
|
+
# from a saved result document
|
|
205
|
+
jq -r '.structuredContent.content_base64' result.json | base64 -d > out.pdf
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Download also requires the owning `table` and record `sys_id`; both are
|
|
209
|
+
policy-authorized and verified against ServiceNow's attachment metadata before
|
|
210
|
+
any bytes are returned.
|
|
211
|
+
|
|
212
|
+
**Size.** Both directions travel inside the 1 MiB `/mcp` JSON request envelope,
|
|
213
|
+
and base64 inflates a file by roughly a third on the way in, so the effective
|
|
214
|
+
ceiling is well under a megabyte — far below the 10 MiB decoded cap the tool
|
|
215
|
+
also enforces, which is therefore never the binding constraint over HTTP. The
|
|
216
|
+
tool's own `content_base64` schema description carries the current figure;
|
|
217
|
+
read it there rather than from this guide, because reconciling the two limits
|
|
218
|
+
is still in flight for 2.0. An oversized upload is rejected with HTTP `413`
|
|
219
|
+
before the tool runs. Treat `sn_attach` as suitable for logs, configs,
|
|
220
|
+
screenshots, and small documents rather than bulk transfer.
|
|
221
|
+
|
|
222
|
+
### 5. Structured queries
|
|
223
|
+
|
|
224
|
+
**Before:** `{"query": "active=true^priority=1"}`
|
|
225
|
+
|
|
226
|
+
**After:**
|
|
227
|
+
|
|
228
|
+
```json
|
|
229
|
+
{
|
|
230
|
+
"profile": "dev",
|
|
231
|
+
"table": "incident",
|
|
232
|
+
"structured_query": {
|
|
233
|
+
"filter": {
|
|
234
|
+
"type": "group",
|
|
235
|
+
"operator": "and",
|
|
236
|
+
"conditions": [
|
|
237
|
+
{ "type": "equality", "field": "active", "operator": "eq", "value": true },
|
|
238
|
+
{ "type": "equality", "field": "priority", "operator": "eq", "value": 1 }
|
|
239
|
+
]
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
Condition types are `equality`, `set`, `range`, `between`, `text`, and `null`;
|
|
246
|
+
groups nest three levels deep at most. Field names are restricted to
|
|
247
|
+
`^[a-z][a-z0-9_]{0,79}$`, so dot-walking is not expressible.
|
|
248
|
+
|
|
249
|
+
`sn_batch` now requires `structured_query.filter`. Create, update, delete, ATF,
|
|
250
|
+
aggregate, and syslog have no raw encoded-query input at all. Raw reads on
|
|
251
|
+
`sn_query` are opt-in through `SN_ENCODED_QUERY_READ_POLICY`, described at the
|
|
252
|
+
end of this document.
|
|
253
|
+
|
|
254
|
+
### 6. Incident journal fields
|
|
255
|
+
|
|
256
|
+
**Before:** `sn_update` on `incident` with `{"comments": "…"}`.
|
|
257
|
+
|
|
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.
|
|
261
|
+
|
|
262
|
+
### 7. Tool surface and executables
|
|
263
|
+
|
|
264
|
+
17 tools become 19: `sn_incident_add_comment`, `sn_incident_add_work_note`, and
|
|
265
|
+
`sn_profile` are added, and `sn_script` is removed. `sn_script` never executed
|
|
266
|
+
anything in 1.0.0 — it returned an explanatory error — so removing it changes
|
|
267
|
+
`tools/list` but no working behavior. Use `sn_query` and `sn_batch` instead.
|
|
268
|
+
|
|
269
|
+
One `bin` becomes three:
|
|
270
|
+
|
|
271
|
+
- `servicenow-mcp` — the stdio server your client spawns (and `servicenow-mcp setup`)
|
|
272
|
+
- `servicenow-mcp-profile` — out-of-band profile administration
|
|
273
|
+
- `servicenow-mcp-setup` — bootstrap, client config, grants, and diagnosis
|
|
274
|
+
|
|
275
|
+
### 8. Field-selection limit
|
|
276
|
+
|
|
277
|
+
`MAX_FIELDS_PER_OPERATION` rises from `32` to `10_000`, and
|
|
278
|
+
`excessive_field_selection` is removed from the exported
|
|
279
|
+
`FieldPolicyFailureReason` union. Code that switched on that member no longer
|
|
280
|
+
compiles, and a selection that previously failed now succeeds.
|
|
281
|
+
|
|
282
|
+
### 9. New `prompts` capability
|
|
283
|
+
|
|
284
|
+
The server advertises `prompts` and registers `servicenow-mcp.add-profile`,
|
|
285
|
+
which guides safe profile creation without asking for secrets in chat. This is
|
|
286
|
+
additive, but it changes the advertised capability set, which matters if you
|
|
287
|
+
assert on it.
|
|
288
|
+
|
|
289
|
+
### Client behavior
|
|
290
|
+
|
|
291
|
+
`MCP_MAX_CONCURRENT_REQUESTS` defaults to `2` and there is no admission queue:
|
|
292
|
+
a third concurrent request receives HTTP `503` immediately. Clients and agents
|
|
293
|
+
must cap their own parallelism at two and honor `Retry-After` on `429` and
|
|
294
|
+
`503`. See
|
|
295
|
+
[client behavior requirements](CLIENT-SETUP.md#client-behavior-requirements).
|
|
296
|
+
|
|
297
|
+
## Required client change
|
|
298
|
+
|
|
299
|
+
**None for the transport.** A 1.0.0 entry that launches `servicenow-mcp` with a
|
|
300
|
+
`command` keeps working — see [Transport](#1-transport-unchanged). Local stdio
|
|
301
|
+
configuration is the supported shape, not a deprecated one.
|
|
302
|
+
|
|
303
|
+
Two things do change inside the calls your client makes:
|
|
304
|
+
|
|
305
|
+
- **Name a profile on every tool call.** See
|
|
306
|
+
[Profile-call change](#profile-call-change).
|
|
307
|
+
- **Grant table access.** A profile with no rules denies every call. See
|
|
308
|
+
[Table-policy change](#table-policy-change).
|
|
309
|
+
|
|
310
|
+
The simplest path is to let setup do it:
|
|
311
|
+
|
|
312
|
+
```bash
|
|
313
|
+
npm install -g @onlyflows/servicenow-mcp
|
|
314
|
+
servicenow-mcp-setup
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
It asks for your instance and credential, verifies the credential against the
|
|
318
|
+
instance before writing anything, asks which tables to grant, writes an
|
|
319
|
+
owner-only profile, and registers the clients whose CLI it can find. Your
|
|
320
|
+
client entry then carries no credential at all.
|
|
321
|
+
|
|
322
|
+
For official SDK and independent examples, explicit profile selection, two
|
|
323
|
+
isolated named profiles, and safe result/audit verification, see
|
|
324
|
+
[V2 service and client setup](CLIENT-SETUP.md).
|
|
325
|
+
|
|
326
|
+
## Starting the server
|
|
327
|
+
|
|
328
|
+
You do not. Each registered client spawns its own `servicenow-mcp` when it
|
|
329
|
+
needs one and stops it when the session ends. There is no daemon, no port, no
|
|
330
|
+
readiness probe, and nothing to keep running between sessions.
|
|
331
|
+
|
|
332
|
+
To check an install without a client:
|
|
333
|
+
|
|
334
|
+
```bash
|
|
335
|
+
servicenow-mcp-setup doctor --profile dev
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
That verifies the Node version, that `servicenow-mcp` resolves on `PATH` — the
|
|
339
|
+
command every client is registered with — the config directory and file modes,
|
|
340
|
+
the profile, its credential resolution, and its table-access rules.
|
|
341
|
+
|
|
342
|
+
## Profile-call change
|
|
343
|
+
|
|
344
|
+
Every one of the 19 `sn_*` tools now requires a non-empty `profile` argument.
|
|
345
|
+
Missing, empty, unknown, or invalid profiles fail before ServiceNow client or
|
|
346
|
+
credential initialization. There is no omitted-profile or session-active
|
|
347
|
+
fallback.
|
|
348
|
+
|
|
349
|
+
Named profiles remain in `~/.servicenow-mcp/config.json`, and canonical `SN_*`
|
|
350
|
+
variables remain supported through explicit configuration. If no profile file
|
|
351
|
+
exists, set `SN_PROFILE_NAME` to the desired profile name alongside the
|
|
352
|
+
canonical connection variables, then pass that same name on every tool call.
|
|
353
|
+
Without `SN_PROFILE_NAME`, bare connection variables create no profile. There
|
|
354
|
+
is no synthetic `default`, active selection, or omitted-profile fallback.
|
|
355
|
+
|
|
356
|
+
Successful tool results include the resolved profile in
|
|
357
|
+
`structuredContent.profile`.
|
|
358
|
+
|
|
359
|
+
There is no release, Inspector, smoke, environment, or migration escape hatch
|
|
360
|
+
for this selector. CI invokes every advertised tool without `profile` and
|
|
361
|
+
requires rejection, then proves every successful catalog probe returns the
|
|
362
|
+
resolved profile. The same rule applies to interactive Inspector calls and the
|
|
363
|
+
second-client smoke check. See
|
|
364
|
+
[Provider-neutral release validation](RELEASE-VALIDATION.md).
|
|
365
|
+
|
|
366
|
+
Profile changes are now an out-of-band operator action. After installing the
|
|
367
|
+
package, use the `servicenow-mcp-profile` executable to create, inspect, rotate,
|
|
368
|
+
or remove profiles; it rejects secret-bearing command-line arguments and reads
|
|
369
|
+
sensitive values from a protected prompt or bounded standard input. For local
|
|
370
|
+
encrypted sources, inject exactly 32 random bytes encoded as base64 or base64url
|
|
371
|
+
through `SN_PROFILE_ENCRYPTION_KEY`. Keep that key in the deployment secret
|
|
372
|
+
mechanism or OS keychain, separate from `config.json`, logs, and command history.
|
|
373
|
+
See [Profile credentials and out-of-band administration](PROFILE-CREDENTIALS.md)
|
|
374
|
+
for command syntax and recovery guidance.
|
|
375
|
+
|
|
376
|
+
## Attachment-call change
|
|
377
|
+
|
|
378
|
+
V2 attachment transfers do not accept host `file_path` or `output_path`
|
|
379
|
+
arguments. For upload, send a safe leaf `file_name` and `content_base64`; for
|
|
380
|
+
download, read `content_base64` from the tool result and decode it client-side.
|
|
381
|
+
The 1 MiB `/mcp` JSON request envelope, not the tool schema's advertised cap,
|
|
382
|
+
sets the practical size limit; see
|
|
383
|
+
[Attachments: no host filesystem paths](#4-attachments-no-host-filesystem-paths)
|
|
384
|
+
for worked before/after examples. List, upload, and download require the owning
|
|
385
|
+
`table` and record `sys_id`; downloads verify those values against ServiceNow
|
|
386
|
+
attachment metadata before returning bytes.
|
|
387
|
+
|
|
388
|
+
## Lifecycle and shutdown
|
|
389
|
+
|
|
390
|
+
The server's lifetime is its client's. The client spawns it, and it exits when
|
|
391
|
+
stdin closes or the client stops it. There is no health endpoint, no readiness
|
|
392
|
+
gate, no drain period, and nothing to signal — a stopped client leaves nothing
|
|
393
|
+
behind.
|
|
394
|
+
|
|
395
|
+
The health contract, the `MCP_SHUTDOWN_GRACE_MS` drain, and the OCI artifact
|
|
396
|
+
all belong to the
|
|
397
|
+
[dormant HTTP transport](ENTERPRISE-RELEASE-BOUNDARY.md#the-dormant-http-transport)
|
|
398
|
+
and do not apply to a 2.0 install. They are documented in
|
|
399
|
+
[Production container deployment](CONTAINER-DEPLOYMENT.md) for the enterprise
|
|
400
|
+
shape that will use them.
|
|
401
|
+
|
|
402
|
+
## Table-policy change
|
|
403
|
+
|
|
404
|
+
V2 denies table access unless the service operator configures per-profile table
|
|
405
|
+
rules. File-backed profiles use a `tableAccess` object in
|
|
406
|
+
`~/.servicenow-mcp/config.json`; the explicit `SN_PROFILE_NAME` environment
|
|
407
|
+
profile maps `SN_ALLOWED_READ_TABLES` and `SN_ALLOWED_WRITE_TABLES` into that
|
|
408
|
+
one profile only when no profile file exists. A profile with no table rules
|
|
409
|
+
denies all. Use exact table names or the literal `*` for a broad grant. There is
|
|
410
|
+
no built-in list of tables the server refuses unconditionally: `tableAccess`
|
|
411
|
+
plus ServiceNow's own per-user ACLs decide everything, so a granted table is
|
|
412
|
+
reachable and least privilege lives in the grant and in the integration
|
|
413
|
+
account's roles. Both
|
|
414
|
+
variables are comma-separated and default to an empty allowlist. Read and write grants
|
|
415
|
+
are independent: a table listed for reads is not writable, and a table listed
|
|
416
|
+
for writes is not implicitly readable. Every caller-addressable name must also
|
|
417
|
+
have a trusted entry in `SN_TABLE_ACCESS_TARGETS` unless the relevant operation
|
|
418
|
+
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
|
+
|
|
435
|
+
```sh
|
|
436
|
+
export SN_ALLOWED_READ_TABLES='*'
|
|
437
|
+
export SN_ALLOWED_WRITE_TABLES=''
|
|
438
|
+
export SN_FIELD_POLICY_DEFINITIONS='{"*":{"defaults":["sys_id"],"readable":"*","writable":[]}}'
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
Use `writable:"*"` only when broad mutation access is intentional; write field
|
|
442
|
+
wildcards do not imply read field access or table write access.
|
|
443
|
+
|
|
444
|
+
The service normalizes identifiers and rejects malformed entries. It does not
|
|
445
|
+
refuse any particular table: since 2.0 there is no built-in deny list, so a
|
|
446
|
+
credential, authentication, or role-grant table configured in `tableAccess` is
|
|
447
|
+
granted, bounded only by the integration account's ServiceNow roles.
|
|
448
|
+
Multi-table tools must have their complete operation plan authorized before the
|
|
449
|
+
first ServiceNow client access. `sn_nl`
|
|
450
|
+
and ATF `run`/`run-suite` are temporarily denied at this boundary because they
|
|
451
|
+
do not yet expose complete typed side-effect plans; select typed CRUD/query
|
|
452
|
+
tools or non-executing ATF actions directly.
|
|
453
|
+
|
|
454
|
+
### Incident journal migration
|
|
455
|
+
|
|
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:
|
|
460
|
+
|
|
461
|
+
- use `sn_incident_add_comment` with `{profile, sys_id, content}` for a
|
|
462
|
+
customer-visible comment;
|
|
463
|
+
- use `sn_incident_add_work_note` with `{profile, sys_id, content}` for an
|
|
464
|
+
internal work note.
|
|
465
|
+
|
|
466
|
+
Both tools always PATCH the `incident` table and send exactly one journal
|
|
467
|
+
field. Content must be non-whitespace, contain valid Unicode without unsafe
|
|
468
|
+
control/format characters, and fit both the 8,000-character and 16,384-byte
|
|
469
|
+
UTF-8 limits. Each call appends a new journal entry and is intentionally not
|
|
470
|
+
idempotent: invoking the same request twice appends twice. Operators must grant
|
|
471
|
+
the selected dedicated tool on the exact `incident` target and grant that table
|
|
472
|
+
write access; neither tool bypasses table or field policy.
|
|
473
|
+
|
|
474
|
+
## Encoded-query change
|
|
475
|
+
|
|
476
|
+
Structured filters are the V2 query interface. `sn_batch` now requires
|
|
477
|
+
`structured_query.filter`; raw `query` selectors are rejected for dry runs and
|
|
478
|
+
confirmed writes alike. Create, update, delete, ATF, aggregate, and syslog also
|
|
479
|
+
have no raw encoded-query input surface.
|
|
480
|
+
|
|
481
|
+
Legacy raw reads on `sn_query` are disabled by default. An operator may opt in
|
|
482
|
+
only through `SN_ENCODED_QUERY_READ_POLICY`, whose JSON rules name one exact
|
|
483
|
+
`sn_query`/table pair and bound query length and complexity, readable query
|
|
484
|
+
fields, operators, pagination, and output bytes. For example:
|
|
485
|
+
|
|
486
|
+
```sh
|
|
487
|
+
export SN_ENCODED_QUERY_READ_POLICY='{"rules":[{"tool":"sn_query","table":"incident","maxLength":256,"maxTerms":8,"fields":["active","priority"],"operators":["=","!="],"maxLimit":100,"maxOffset":1000,"maxResponseBytes":100000}]}'
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
The server parses every opted-in query and still rejects OR/NQ/order/group
|
|
491
|
+
control tokens, JavaScript values, unsupported fields/operators, malformed
|
|
492
|
+
Unicode, and any request exceeding the rule. Policy errors never echo the raw
|
|
493
|
+
query value. There is no stdio or transport-specific exception.
|