@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,383 @@
|
|
|
1
|
+
# Remote operations runbook
|
|
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
|
+
This runbook is the operator contract for the private, single-owner ServiceNow
|
|
16
|
+
MCP V2 service. It covers normal operation, degradation, deployment, rollback,
|
|
17
|
+
credential rotation, rate-limit tuning, incident response, and safe support
|
|
18
|
+
collection. It does not authorize a public tunnel, public endpoint, production
|
|
19
|
+
deployment, or a change to the network boundary. Use it with
|
|
20
|
+
[Production container deployment](CONTAINER-DEPLOYMENT.md),
|
|
21
|
+
[Production security boundaries](PRODUCTION-SECURITY.md), and
|
|
22
|
+
[Profile credentials](PROFILE-CREDENTIALS.md).
|
|
23
|
+
|
|
24
|
+
## Operating model and ownership
|
|
25
|
+
|
|
26
|
+
The Node process owns `/mcp`, `/health/live`, `/health/ready`, bounded request
|
|
27
|
+
admission, graceful drain, and JSON Lines telemetry on stderr. The deployment
|
|
28
|
+
platform owns TLS, private ingress, original-client controls, restart policy,
|
|
29
|
+
resource limits, secret injection, log collection, metrics derivation, alerts,
|
|
30
|
+
and dashboards. ServiceNow remains an upstream dependency with its own
|
|
31
|
+
availability, latency, ACL, credential, and rate-limit behavior.
|
|
32
|
+
|
|
33
|
+
There is no application `/metrics` endpoint. Derive the metrics below from the
|
|
34
|
+
documented JSONL events, lifecycle probes, container/orchestrator state, and an
|
|
35
|
+
explicit low-frequency ServiceNow synthetic check. Do not add a public scrape
|
|
36
|
+
endpoint to satisfy this runbook.
|
|
37
|
+
|
|
38
|
+
## Health and dependency semantics
|
|
39
|
+
|
|
40
|
+
| Signal | Healthy response | Meaning | It deliberately does not prove |
|
|
41
|
+
| --- | --- | --- | --- |
|
|
42
|
+
| `GET` or `HEAD /health/live` | HTTP 200; GET body `{"status":"live"}` | The process can serve local HTTP. Use for restart decisions. | Startup completion, MCP authentication, profile validity, or ServiceNow reachability. |
|
|
43
|
+
| `GET` or `HEAD /health/ready` | HTTP 200; GET body `{"status":"ready"}` | Startup completed, the listener is admitting MCP work, and shutdown drain has not begun. Use for load-balancer admission. | ServiceNow reachability, ServiceNow credentials/ACLs, or successful tool execution. |
|
|
44
|
+
| `/health/ready` unavailable | HTTP 503; GET body `{"status":"not_ready"}` | The runtime is starting, closing, draining, or its local readiness gate failed closed. | That ServiceNow itself is unavailable. |
|
|
45
|
+
| Opt-in ServiceNow synthetic | Successful bounded, read-only tool call | The selected profile can authenticate, reach its instance, and perform that specific permitted read. | Every table, ACL, tool, node, or ServiceNow subsystem is healthy. |
|
|
46
|
+
|
|
47
|
+
Health requests are unauthenticated lifecycle signals, are exempt from MCP
|
|
48
|
+
rate limiting, and never construct an MCP server or contact ServiceNow. Restrict
|
|
49
|
+
them to the orchestrator or trusted proxy network. The container's internal
|
|
50
|
+
probe uses `GET /health/ready` over loopback with the reserved
|
|
51
|
+
`Host: mcp-health.internal`; that authority is valid only for the two health
|
|
52
|
+
paths from a loopback peer and must not be added to `MCP_ALLOWED_HOSTS`.
|
|
53
|
+
|
|
54
|
+
Do not make ServiceNow availability part of liveness or readiness. Doing so
|
|
55
|
+
would restart or remove every healthy MCP replica during a shared upstream
|
|
56
|
+
incident. Instead, keep the service ready, report safe typed tool failures, and
|
|
57
|
+
use the dependency telemetry and synthetic check below.
|
|
58
|
+
|
|
59
|
+
For an upstream synthetic, use a dedicated monitoring identity and a profile
|
|
60
|
+
with the minimum read access needed. Prefer a five-minute-or-slower
|
|
61
|
+
`sn_health` call with `check: "version"`, or one equivalently bounded read from
|
|
62
|
+
an approved non-sensitive table when the integration account cannot read
|
|
63
|
+
ServiceNow properties. Never use a create, update, delete, batch execution, ATF
|
|
64
|
+
run, script, attachment upload, or unrestricted query as a health check. Do not
|
|
65
|
+
persist its result payload; retain only success/failure category and latency.
|
|
66
|
+
|
|
67
|
+
## Telemetry contract
|
|
68
|
+
|
|
69
|
+
Every completed HTTP request and tool call emits one bounded JSON object per
|
|
70
|
+
line on stderr. Treat stdout/stderr as a structured stream: configure the
|
|
71
|
+
collector to parse JSON when possible and retain the bounded non-JSON startup,
|
|
72
|
+
basic-auth warning, and shutdown lines separately.
|
|
73
|
+
|
|
74
|
+
Both event types contain `schemaVersion`, `type`, `observedAtMs`, `latencyMs`,
|
|
75
|
+
`correlationId`, `ownerIdHash`, and `clientIdHash`. An `http_request` event adds
|
|
76
|
+
only `outcome`, `reason`, and `statusCode`. An `mcp_tool` event instead adds
|
|
77
|
+
`tool`, `profile`, `instance`, `outcome`, `reason`, `errorCategory`, `retry`,
|
|
78
|
+
and `retryAfterSeconds`; it has no HTTP status or request path. Owner and client
|
|
79
|
+
values are SHA-256 pseudonyms. Profile names and canonical instance origins are
|
|
80
|
+
operational metadata, not credentials, but still require restricted log access.
|
|
81
|
+
|
|
82
|
+
The application structurally excludes authorization headers, cookies, URL and
|
|
83
|
+
query strings, request and response bodies, configuration objects, credentials,
|
|
84
|
+
tokens, ciphertext, secret references, and exception text. Proxy, platform,
|
|
85
|
+
collector, and APM configuration must independently exclude the same data.
|
|
86
|
+
|
|
87
|
+
Telemetry delivery never blocks request completion. During stderr
|
|
88
|
+
backpressure, at most 256 lines are pending; excess events are summarized after
|
|
89
|
+
drain as `{"type":"telemetry_dropped","count":N}`. Any positive count is an
|
|
90
|
+
observability incident because metric denominators and forensic sequences are
|
|
91
|
+
then incomplete.
|
|
92
|
+
|
|
93
|
+
### Derived metrics
|
|
94
|
+
|
|
95
|
+
Use deployment/environment as low-cardinality collector-added labels. Do not
|
|
96
|
+
use `correlationId`, `ownerIdHash`, `clientIdHash`, `profile`, or `instance` as
|
|
97
|
+
metric labels. Keep those fields only in access-controlled logs for scoped
|
|
98
|
+
diagnosis.
|
|
99
|
+
|
|
100
|
+
| Metric | Source and aggregation |
|
|
101
|
+
| --- | --- |
|
|
102
|
+
| `servicenow_mcp_probe_live` | Gauge from `/health/live`: 1 only for the exact healthy response, otherwise 0. |
|
|
103
|
+
| `servicenow_mcp_probe_ready` | Gauge from `/health/ready`: 1 only for the exact healthy response, otherwise 0. |
|
|
104
|
+
| `servicenow_mcp_http_requests_total` | Count `http_request`, labeled by `outcome`, bounded `reason`, and status class. |
|
|
105
|
+
| `servicenow_mcp_http_duration_ms` | Histogram of `http_request.latencyMs`; calculate p50, p95, and p99. |
|
|
106
|
+
| `servicenow_mcp_tool_calls_total` | Count `mcp_tool`, labeled by `tool`, `outcome`, bounded `reason`, `errorCategory`, and `retry`. |
|
|
107
|
+
| `servicenow_mcp_tool_duration_ms` | Histogram of `mcp_tool.latencyMs`, split by `tool`; calculate p50, p95, and p99. |
|
|
108
|
+
| `servicenow_mcp_telemetry_dropped_total` | Sum `telemetry_dropped.count`. |
|
|
109
|
+
| `servicenow_mcp_dependency_check_success` | Gauge from the separate bounded read-only ServiceNow synthetic; never feed this into readiness. |
|
|
110
|
+
| `servicenow_mcp_dependency_check_duration_ms` | Histogram from the same synthetic, without retaining its response payload. |
|
|
111
|
+
| `servicenow_mcp_restarts_total` | Container/orchestrator restart count, not an application log approximation. |
|
|
112
|
+
|
|
113
|
+
### Initial alerts
|
|
114
|
+
|
|
115
|
+
These are conservative starting points, not universal SLOs. Establish a
|
|
116
|
+
fourteen-day baseline, preserve the safety bounds, and tune thresholds by tool
|
|
117
|
+
and deployment. Every ratio alert needs both a percentage and a minimum count
|
|
118
|
+
to avoid paging on one request.
|
|
119
|
+
|
|
120
|
+
| Signal | Initial condition | Action |
|
|
121
|
+
| --- | --- | --- |
|
|
122
|
+
| Liveness | Two consecutive failed probes | Page; inspect process exit/restart and platform events. |
|
|
123
|
+
| Readiness | Not ready for 2 minutes outside an announced rollout; page at 5 minutes | Stop rollout and diagnose startup/drain/configuration. Do not infer a ServiceNow outage. |
|
|
124
|
+
| Availability | HTTP 5xx at least 5% for 5 minutes with at least 20 requests | Page and split `service_unavailable`, `concurrency_limited`, and `internal_error`. |
|
|
125
|
+
| Latency | HTTP p95 above 5 seconds or tool p95 above its baseline by 2x for 10 minutes with at least 20 samples | Warn; correlate by tool and upstream category before changing capacity. |
|
|
126
|
+
| Authentication rejection | Five or more HTTP 401/403 responses in 5 minutes | Notify security/operations; verify client token coordination without logging the token. |
|
|
127
|
+
| Rate rejection | HTTP 429 at least 1% and at least 10 responses in 5 minutes | Warn; separate pre-authentication from authenticated-identity reasons and follow the tuning procedure. |
|
|
128
|
+
| Saturation | Five or more `concurrency_limited` HTTP 503 events in 5 minutes | Warn; inspect latency and memory before increasing concurrency. |
|
|
129
|
+
| Upstream failure | `mcp_tool.errorCategory` in `upstream`, `timeout`, or `rate_limit` at least 5% and at least 5 calls in 5 minutes | Page the dependency path; honor `retry` and `retryAfterSeconds`. |
|
|
130
|
+
| Credential/ACL failure | Three `authentication` or `authorization` tool errors for one scoped deployment in 5 minutes | Page the credential/ACL owner; do not retry blindly. |
|
|
131
|
+
| Internal tool failure | Three `internal` tool errors in 5 minutes | Page the service owner; correlate by tool and release without requesting exception text or payloads. |
|
|
132
|
+
| Dependency synthetic | Two consecutive failures; page if failure persists 5 minutes | Diagnose ServiceNow/DNS/egress/credentials while leaving lifecycle readiness independent. |
|
|
133
|
+
| Telemetry loss | Any increase in `servicenow_mcp_telemetry_dropped_total` | Page the logging pipeline and mark the incident window incomplete. |
|
|
134
|
+
| Certificate expiry | TLS-edge certificate has fewer than 30 days remaining; page at 7 days | Renew at the operator-managed TLS boundary. |
|
|
135
|
+
|
|
136
|
+
### Dashboard layout
|
|
137
|
+
|
|
138
|
+
Maintain one dashboard per deployment with release annotations and these rows:
|
|
139
|
+
|
|
140
|
+
1. **Lifecycle:** live/ready gauges, replicas ready/desired, restarts, rollout
|
|
141
|
+
revision, and shutdown duration.
|
|
142
|
+
2. **Traffic and latency:** request rate, success/4xx/5xx, HTTP p50/p95/p99,
|
|
143
|
+
tool call rate, and per-tool p95.
|
|
144
|
+
3. **ServiceNow dependency:** synthetic success/latency plus tool
|
|
145
|
+
`errorCategory` counts for authentication, authorization, rate limit,
|
|
146
|
+
timeout, and upstream.
|
|
147
|
+
4. **Rejection and security:** 401, 403, 429, concurrency 503, malformed input,
|
|
148
|
+
body-limit, timeout, and host/origin rejection trends.
|
|
149
|
+
5. **Telemetry quality and capacity:** dropped telemetry, log-ingest lag,
|
|
150
|
+
container memory/CPU, open connections, and configured replica count.
|
|
151
|
+
|
|
152
|
+
Do not place raw bodies, URLs, credentials, profile references, correlation IDs,
|
|
153
|
+
owner/client hashes, profile names, or instance origins in dashboard labels or
|
|
154
|
+
annotations.
|
|
155
|
+
|
|
156
|
+
### Retention and access
|
|
157
|
+
|
|
158
|
+
- Keep detailed application JSONL searchable for 14 days and delete it after
|
|
159
|
+
30 days unless an approved incident, legal, or compliance policy requires a
|
|
160
|
+
different period. Restrict it to the service operations/security roles.
|
|
161
|
+
- Keep aggregate, low-cardinality metrics and alert history for 90 days for
|
|
162
|
+
capacity and regression analysis. Aggregates must not contain profile,
|
|
163
|
+
instance, owner/client hash, or correlation labels.
|
|
164
|
+
- Keep deployment revision, image digest, validation, scan, and rollback
|
|
165
|
+
evidence for the release-retention period defined by the organization.
|
|
166
|
+
- Encrypt data in transit and at rest, audit access, and apply deletion to
|
|
167
|
+
replicas, archives, and support exports. Delete a support export when its
|
|
168
|
+
case closes, or within 7 days after closure if the support process requires a
|
|
169
|
+
short confirmation window.
|
|
170
|
+
|
|
171
|
+
## Deployment procedure
|
|
172
|
+
|
|
173
|
+
Only an authorized release process deploys externally. The commands below
|
|
174
|
+
build and validate locally; they do not publish an image, create a tunnel, or
|
|
175
|
+
create a public endpoint.
|
|
176
|
+
|
|
177
|
+
1. Freeze the exact source revision and lock file. Run `npm ci`,
|
|
178
|
+
`npm run typecheck`, `npm run lint`, `npm test -- --run --no-file-parallelism`,
|
|
179
|
+
and `npm run build`.
|
|
180
|
+
2. Build the pinned artifact with an immutable revision and run
|
|
181
|
+
`npm run container:validate`, `npm run container:scan`, and
|
|
182
|
+
`npm audit --omit=dev`. Archive only the sanitized result, image digest,
|
|
183
|
+
scanner/version/database timestamp, and source revision.
|
|
184
|
+
3. Review the rendered deployment without secret values. Confirm numeric
|
|
185
|
+
non-root identity, read-only root, dropped capabilities, bounded `/tmp`,
|
|
186
|
+
private ingress, exact Host/Origin allowlists, default-deny egress, resource
|
|
187
|
+
limits, termination grace greater than `MCP_SHUTDOWN_GRACE_MS`, and runtime
|
|
188
|
+
secret references.
|
|
189
|
+
4. Deploy the immutable image digest to a private staging environment. Do not
|
|
190
|
+
substitute a mutable tag. Verify live then ready, initialize with two
|
|
191
|
+
independent MCP clients, and verify discovery exactly matches the release
|
|
192
|
+
tool manifest/contract (names, schemas, and annotations). Exercise one
|
|
193
|
+
approved read-only synthetic, send SIGTERM, and confirm readiness drops
|
|
194
|
+
before the bounded clean exit. Verify the injected canary secret never
|
|
195
|
+
appears in collected logs.
|
|
196
|
+
5. Start a one-replica or small-percentage production canary. Confirm the same
|
|
197
|
+
signals, compare request/tool latency and rejection/upstream rates to the
|
|
198
|
+
prior revision, then increase traffic in bounded stages. Stop automatically
|
|
199
|
+
on a readiness, error-rate, telemetry-loss, or secret-redaction gate.
|
|
200
|
+
6. Record source revision, immutable image digest, configuration revision
|
|
201
|
+
without values, validation evidence, deployment time, operator, and the
|
|
202
|
+
tested rollback digest.
|
|
203
|
+
|
|
204
|
+
The local staging-equivalent gate is:
|
|
205
|
+
|
|
206
|
+
```sh
|
|
207
|
+
npm run container:build
|
|
208
|
+
npm run container:validate
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
It uses loopback only and disposable validation credentials. It verifies the
|
|
212
|
+
non-root/read-only container, health semantics, two independent MCP clients,
|
|
213
|
+
clean SIGTERM, secret-free logs, labels, and image-size ceiling. It performs no
|
|
214
|
+
ServiceNow write and does not create an external deployment. It complements,
|
|
215
|
+
but does not replace, an authorized private staging deployment.
|
|
216
|
+
|
|
217
|
+
## Rollback procedure
|
|
218
|
+
|
|
219
|
+
Rollback is a release change, not an attempt to mask a ServiceNow incident.
|
|
220
|
+
|
|
221
|
+
1. Stop rollout and remove the failing revision from admission by using its
|
|
222
|
+
truthful readiness state or the platform rollout control. Preserve the
|
|
223
|
+
bounded incident window; do not dump environment or request payloads.
|
|
224
|
+
2. Classify the failure. If live/ready and MCP protocol are healthy while only
|
|
225
|
+
ServiceNow calls fail, follow upstream incident response instead of rolling
|
|
226
|
+
replicas indefinitely.
|
|
227
|
+
3. Redeploy the last known-good immutable image digest with its compatible,
|
|
228
|
+
previously reviewed non-secret configuration revision. Never restore a
|
|
229
|
+
revoked credential, expired certificate, vulnerable artifact, or plaintext
|
|
230
|
+
secret as part of rollback.
|
|
231
|
+
4. Verify live, ready, two-client initialize/list, the approved read-only
|
|
232
|
+
synthetic, error/latency rates, and telemetry delivery. Confirm the failed
|
|
233
|
+
digest no longer receives traffic.
|
|
234
|
+
5. Record the rollback reason, digests, configuration revisions, health
|
|
235
|
+
evidence, and incident link. Keep the failed release quarantined for
|
|
236
|
+
analysis; do not silently retag it as the prior version.
|
|
237
|
+
|
|
238
|
+
## Credential and key rotation
|
|
239
|
+
|
|
240
|
+
### ServiceNow credential or secret reference
|
|
241
|
+
|
|
242
|
+
1. Create the replacement in the authoritative secret system without revoking
|
|
243
|
+
the old value. Preserve the same least-privilege ServiceNow roles.
|
|
244
|
+
2. Atomically update the secret reference or use
|
|
245
|
+
`servicenow-mcp-profile rotate` with protected stdin. Never pass a protected
|
|
246
|
+
value or reference on the command line.
|
|
247
|
+
3. Roll a staging/canary replica because environment and mounted profile files
|
|
248
|
+
are not promised to reload live. Verify live/ready, then run the scoped
|
|
249
|
+
read-only ServiceNow synthetic through the explicitly named profile.
|
|
250
|
+
4. Verify the canary marker is absent from application, proxy, platform, and
|
|
251
|
+
collector logs. Complete the rollout, then revoke the old credential.
|
|
252
|
+
5. If verification fails, restore the prior reference while it remains valid;
|
|
253
|
+
do not expose either value in the incident record.
|
|
254
|
+
|
|
255
|
+
### Profile encryption key
|
|
256
|
+
|
|
257
|
+
Re-encrypt each affected envelope through the out-of-band administration
|
|
258
|
+
workflow, inject the new `SN_PROFILE_ENCRYPTION_KEY` separately, and roll the
|
|
259
|
+
serving processes. Treat the profile file and matching key as one versioned
|
|
260
|
+
pair for rollback. Verify before retiring the prior key; never store both keys
|
|
261
|
+
in the profile file or support bundle.
|
|
262
|
+
|
|
263
|
+
### MCP bearer token
|
|
264
|
+
|
|
265
|
+
HTTP authentication is opt-in: the process requires a bearer only when
|
|
266
|
+
`MCP_BEARER_TOKEN` is set, and serves every request that reaches it when the
|
|
267
|
+
variable is absent. Confirm which mode a host is in before treating a bearer as
|
|
268
|
+
part of its boundary — `servicenow-mcp-setup doctor` reports it as
|
|
269
|
+
`http authentication`, and the service logs a warning at startup when it is
|
|
270
|
+
unauthenticated. Every deployment covered by this runbook should have it set.
|
|
271
|
+
|
|
272
|
+
The process accepts one configured bearer token. It has no dual-token overlap
|
|
273
|
+
mode. Coordinate a maintenance window or a parallel **private** endpoint:
|
|
274
|
+
deploy the new token, update the authorized client/connector, verify MCP
|
|
275
|
+
initialize/list, then remove the old private endpoint and revoke the old token.
|
|
276
|
+
Do not create a public tunnel, log either token, or leave both endpoints active
|
|
277
|
+
indefinitely.
|
|
278
|
+
|
|
279
|
+
**Unsetting `MCP_BEARER_TOKEN` does not revoke access — it removes the check.**
|
|
280
|
+
Rotation replaces the value; it never removes the line.
|
|
281
|
+
|
|
282
|
+
## Rate-limit and capacity tuning
|
|
283
|
+
|
|
284
|
+
The pre-authentication bucket defaults to 240 requests per 60 seconds per
|
|
285
|
+
direct socket source with 4096 retained sources. The authenticated bucket
|
|
286
|
+
defaults to 120 requests per 60 seconds per owner/client identity with 128
|
|
287
|
+
retained identities. Buckets are process-local and reset on restart, so an
|
|
288
|
+
N-replica deployment has approximately N times the aggregate capacity; this is
|
|
289
|
+
not a global quota.
|
|
290
|
+
|
|
291
|
+
| Setting | Valid range | Operational effect |
|
|
292
|
+
| --- | --- | --- |
|
|
293
|
+
| `MCP_PRE_AUTH_RATE_CAPACITY` | 1–1000000 | Direct-source burst/refill capacity; default 240. |
|
|
294
|
+
| `MCP_PRE_AUTH_RATE_REFILL_MS` | 1–86400000 ms | Direct-source refill period; default 60000 ms. |
|
|
295
|
+
| `MCP_PRE_AUTH_RATE_MAX_ENTRIES` | 1–100000 | Retained digested direct-source buckets; default 4096. |
|
|
296
|
+
| `MCP_IDENTITY_RATE_CAPACITY` | 1–1000000 | Owner/client burst/refill capacity; default 120. |
|
|
297
|
+
| `MCP_IDENTITY_RATE_REFILL_MS` | 1–86400000 ms | Owner/client refill period; default 60000 ms. |
|
|
298
|
+
| `MCP_IDENTITY_RATE_MAX_ENTRIES` | 1–100000 | Retained digested identity buckets; default 128. |
|
|
299
|
+
| `MCP_MAX_CONCURRENT_REQUESTS` | 1–1024 syntactically; lower memory-safety limit enforced at startup | Concurrent admitted MCP requests; excess is rejected, never queued. |
|
|
300
|
+
| `MCP_MAX_CONNECTIONS` | 1–4096 | Accepted TCP connections before excess sockets are dropped. |
|
|
301
|
+
|
|
302
|
+
Behind a reverse proxy, the application sees the proxy as the direct source.
|
|
303
|
+
Enforce original-client limits at the trusted edge and never enable forwarded
|
|
304
|
+
IP trust in the application. Tune in this order:
|
|
305
|
+
|
|
306
|
+
1. Establish request, 429, concurrency-503, latency, memory, and ServiceNow
|
|
307
|
+
rate-limit baselines by replica and authenticated identity.
|
|
308
|
+
2. Confirm retries honor HTTP `Retry-After` and typed tool `retry` guidance.
|
|
309
|
+
Remove retry storms before raising limits.
|
|
310
|
+
3. Change one capacity or refill period at a time, normally by no more than
|
|
311
|
+
25%, through reviewed configuration and a rolling restart. Observe at least
|
|
312
|
+
one peak period.
|
|
313
|
+
4. Raise concurrency only after proving memory headroom and upstream capacity;
|
|
314
|
+
startup rejects unsafe combined estimates, but that is not a substitute for
|
|
315
|
+
a container memory limit.
|
|
316
|
+
5. Roll back when latency, 5xx, upstream rate limits, memory, or telemetry loss
|
|
317
|
+
worsens. Never disable a bucket or set an extreme retained-key bound to make
|
|
318
|
+
an alert disappear.
|
|
319
|
+
|
|
320
|
+
## Incident response
|
|
321
|
+
|
|
322
|
+
| Observation | Likely scope | First actions |
|
|
323
|
+
| --- | --- | --- |
|
|
324
|
+
| Live fails | Process/container/platform | Check restart/exit reason, resource pressure, image revision, and platform events; rollback a release regression. |
|
|
325
|
+
| Live succeeds, ready fails | Startup, drain, or local configuration | Check rollout state and bounded startup/shutdown messages. Stop routing; do not blame ServiceNow without dependency evidence. |
|
|
326
|
+
| Live and ready succeed, synthetic and tool calls fail | ServiceNow, DNS/egress, credential, ACL, or upstream rate limit | Split by `errorCategory`, profile-scoped internal evidence, and retry guidance. Do not restart healthy replicas in a loop. |
|
|
327
|
+
| HTTP 401/403 | MCP caller authentication/authorization boundary | Check token rollout coordination and authorized connector configuration without collecting headers. |
|
|
328
|
+
| Tool `authentication`/`authorization` | ServiceNow credential or ACL boundary | Stop blind retries; verify secret reference version, account state, and least-privilege role changes. |
|
|
329
|
+
| HTTP 429 | Application or edge rate limit | Honor `Retry-After`, identify pre-auth versus identity reason, stop retry storms, then tune from evidence. |
|
|
330
|
+
| HTTP 503 with `concurrency_limited` | Local saturation | Reduce arrival rate, inspect per-tool latency and memory, and scale safely before changing concurrency. |
|
|
331
|
+
| Tool `rate_limit`, `timeout`, or `upstream` | ServiceNow/dependency path | Honor typed retry guidance, check ServiceNow status and egress/DNS, and use the bounded synthetic. |
|
|
332
|
+
| `telemetry_dropped` increases | Collector/stderr backpressure | Restore ingest, mark metrics incomplete, and avoid confident rate calculations for the affected window. |
|
|
333
|
+
|
|
334
|
+
For every incident: assign an incident commander, record UTC start/end and
|
|
335
|
+
release/configuration revisions, preserve only the safe evidence below, choose
|
|
336
|
+
rollback versus upstream mitigation explicitly, and verify recovery across
|
|
337
|
+
live, ready, MCP protocol, dependency synthetic, latency, errors, and telemetry.
|
|
338
|
+
|
|
339
|
+
## Least-privilege support collection
|
|
340
|
+
|
|
341
|
+
Create a case-specific, access-controlled export for the smallest UTC window
|
|
342
|
+
that reproduces the problem. The default support allowlist is:
|
|
343
|
+
|
|
344
|
+
- package version, immutable image digest, architecture, replica count, and
|
|
345
|
+
non-secret configuration **names and revision identifiers only**;
|
|
346
|
+
- live/ready status codes and exact generic bodies;
|
|
347
|
+
- aggregate counts and percentiles from the metrics table;
|
|
348
|
+
- deployment, restart, and sanitized scanner/validation timestamps;
|
|
349
|
+
- when essential, only these fields from selected structured events:
|
|
350
|
+
`schemaVersion`, `type`, `observedAtMs`, `latencyMs`, `correlationId`, `tool`,
|
|
351
|
+
`outcome`, `reason`, `statusCode`, `errorCategory`, `retry`, and
|
|
352
|
+
`retryAfterSeconds`.
|
|
353
|
+
|
|
354
|
+
Omit `profile`, `instance`, `ownerIdHash`, and `clientIdHash` from external
|
|
355
|
+
support exports by default. An internal incident responder may retain one of
|
|
356
|
+
those operational identifiers only when it is necessary to distinguish the
|
|
357
|
+
affected scope and access is already authorized.
|
|
358
|
+
|
|
359
|
+
Never collect or request bearer tokens, Authorization/cookie/API-key headers,
|
|
360
|
+
passwords, OAuth secrets, API keys, encryption keys, secret references,
|
|
361
|
+
ciphertext, environment dumps, profile/configuration files, `docker container
|
|
362
|
+
inspect`, command history, request/response bodies, attachments, raw URLs or
|
|
363
|
+
query strings, ServiceNow record payloads, or unrestricted proxy/APM traces.
|
|
364
|
+
Do not ask an operator to reproduce a secret in a ticket. If a suspected leak
|
|
365
|
+
requires confirmation, compare a one-way case-local fingerprint inside the
|
|
366
|
+
authorized environment and export only the yes/no result.
|
|
367
|
+
|
|
368
|
+
Before sending the export, have a second authorized person inspect it for the
|
|
369
|
+
forbidden classes above. Encrypt it in transit and at rest, grant it only to
|
|
370
|
+
named case responders, record access, and delete it according to the retention
|
|
371
|
+
rule. A support request to weaken redaction, widen ServiceNow roles, expose a
|
|
372
|
+
health endpoint, or create a public tunnel must be refused and escalated.
|
|
373
|
+
|
|
374
|
+
## Recovery verification checklist
|
|
375
|
+
|
|
376
|
+
- [ ] `/health/live` and `/health/ready` return their exact healthy responses.
|
|
377
|
+
- [ ] Two independent MCP clients can initialize; discovery exactly matches the release tool manifest/contract (names, schemas, and annotations).
|
|
378
|
+
- [ ] The approved read-only ServiceNow synthetic succeeds for the intended profile.
|
|
379
|
+
- [ ] HTTP/tool latency and error/rejection rates returned to baseline.
|
|
380
|
+
- [ ] No telemetry-drop count is increasing and log-ingest delay is normal.
|
|
381
|
+
- [ ] No canary or production secret appears in any collected log surface.
|
|
382
|
+
- [ ] The active immutable image digest and non-secret configuration revision are recorded.
|
|
383
|
+
- [ ] Temporary support exports and obsolete credentials/endpoints have an owner and deletion/revocation time.
|