ServiceNow MCP server — 100 tools over the full REST surface, every auth method, flows, diagrams.
A Model Context Protocol server that lets an MCP client (VS Code, Claude Desktop, etc.) run commands against a ServiceNow instance through its REST APIs — Table, Aggregate, Attachment, Import Set, Batch and CMDB, plus the Service Catalog, Change Management and Knowledge plugin APIs. Credentials are kept in a local env file and can be updated at runtime through a tool.
Upgrading from 1.x? v2.0 makes writes plan-by-default:
create/update/deleteand the other record-write tools return a non-mutating preview unless you passapply: true(or setSN_WRITE_MODE=applyto restore the v1 "execute immediately" behaviour). See the CHANGELOG → 2.0.0 for the full migration note.
Contents: Quick demo · Features · Requirements · Setup · Configure credentials · Run / debug · Develop · Tools · Resources · Prompts · Project structure · Security notes · Project documentation · Support
Built and maintained in my own time — if it helps, a GitHub Sponsors tip keeps it going. Full Support options are near the end.
Three things the platform makes hard, one call each. Point your MCP client at an instance (Setup) and ask:
1. "Where is this field actually used?" — every script, business rule, client script, UI policy/action and ACL that touches it, as JSON or a Mermaid graph. The IDE-grade find usages ServiceNow has no button for:
// servicenow_where_used
{
"kind": "field", // "table" | "field" | "script"
"name": "u_cost_center",
"mermaid": true, // also render a reference graph
}
2. "What runs when I save this record?" — the full automation chain in execution order (display → before → after → async business rules, then flows, workflows and notifications), each with its condition — a logical test that runs nothing:
// servicenow_trace_table_event
{
"table": "incident",
"operation": "update", // insert | update | delete | query
}
3. "What drifted between dev and prod?" — a Markdown diff of tables, columns, scripts (matched by sys_id then name, with a unified diff of every changed script) and plugins between two configured profiles — plus, on request, properties, choices, ACLs, notifications, flows, catalog items and roles — with a CI-friendly exit code so a pipeline can block a risky deploy:
servicenow-mcp-ai drift dev prod # report on stdout; exit 1 on drift, 0 if clean
All three are read-only and work against any instance — including a free PDI — with the model and client of your choice.
sys_db_object,
sys_dictionary).cmdb_rel_ci, IRE identify-and-reconcile with an identify-only
plan),
Service Catalog (browse/order items), Change Management (typed
creation + conflict detection) and Knowledge (article search).
Plugin-scoped APIs report clearly when not active on the instance.servicenow_search_code returns every matching line per artefact
(up to 20, with a line of context either side) and, like
servicenow_where_used, takes an optional application scope.
servicenow_where_used also finds structural references — dictionary
reference fields, list and form layouts, catalog variables, flow inputs and
reports — in a separate structural section.flows package — business rules, flows, workflows and
notifications, in order, with a Mermaid flowchart), read Flow Designer flows
and run history, explain Process Automation Designer playbooks
(servicenow_explain_flow with kind: "playbook" — lanes as Mermaid
subgraphs, activities, triggers, variants), and lint scripts against a local rule set with an aggregate
code-health report (codecheck; domains: true adds the flow, Service
Portal and legacy-workflow analysers). Run ATF tests via the CI/CD API (atf,
opt-in, non-default — the run tools execute on the instance).revert): list the local write journal and revert
one applied create/update/delete — with a drift check against later edits.artifacts, opt-in): list and read any
registered artifact type — UI policies with their actions, portal pages with
their layout, flows, catalog items and more — with scope and SDK-managed
status.updatesets, opt-in): list update sets, summarise
one set per artefact, compare it with another profile or a snapshot — and
bind applied Table writes to a named update set (update_set /
SN_UPDATE_SET), restoring the user's current set afterwards.ops, opt-in): bounded "why is it slow"
reads of the system log, the scheduler queue, the outbound email queue and
semaphores, plus servicenow_check_data_health — duplicate keys, orphaned and
stale references for one table, from Aggregate API counts.sys_audit and
sys_journal_field (history — including the comments and work notes the
Table API reads back empty), system properties with masked secrets and a
journaled, revertible set (properties), and user / group / role lookups
with memberships (directory). ATF runs can wait for their result
(wait_seconds), and Import Set inserts report the transform run and maps.SN_TOOL_PACKAGES
(default profile core; all enables everything).Retry-After, SSRF
guard, and a result-size guard.~/.config, or SN_ENV_FILE), updatable
at runtime via servicenow_set_credentials.engines + a runtime guard with a clear message;
the project targets the version in .nvmrc).From source (for development):
npm install
npm run build
Or run the published package directly, without cloning:
npx servicenow-mcp-ai
Every client launches the same stdio command, npx -y servicenow-mcp-ai (Node.js 22.12+),
under the server name servicenow. The one-click links and snippets below carry no
credentials: keep them in the env file (~/.config/servicenow-mcp-ai/.env, see
Configure credentials), run the one-time
npx servicenow-mcp-ai login for OAuth, or ask the assistant to call
servicenow_set_credentials once the server is connected. A real environment variable
set in a client config overrides the env file, so only add an env block when you
mean it — and never put SN_PASSWORD or other secrets into a client config you share
or commit (see SECURITY.md).
| Client | One line | Config file |
|---|---|---|
| VS Code (Copilot Chat) | Button above, or code --add-mcp (below) — or the ServiceNow MCP extension | .vscode/mcp.json (servers) |
| VS Code Insiders | Button above, or code-insiders --add-mcp (below) | .vscode/mcp.json (servers) |
| Claude Code | claude mcp add servicenow -- npx -y servicenow-mcp-ai, or the plugin | .mcp.json (mcpServers) |
| Claude Desktop | — (edit the config file) | claude_desktop_config.json (mcpServers) |
| Cursor | Button above, or the cursor:// deeplink (below) | ~/.cursor/mcp.json or .cursor/mcp.json (mcpServers) |
| Windsurf | — (edit the config file) | ~/.codeium/windsurf/mcp_config.json (mcpServers) |
| Cline | — (MCP Servers → Configure MCP Servers) | cline_mcp_settings.json (mcpServers) |
| Zed | — (edit settings) | settings.json (context_servers) |
| JetBrains AI Assistant | — (Settings → Tools → AI Assistant → Model Context Protocol) | JSON dialog (mcpServers) |
| Gemini CLI | — (edit settings) | ~/.gemini/settings.json (mcpServers) |
| Codex CLI | codex mcp add servicenow -- npx -y servicenow-mcp-ai | ~/.codex/config.toml ([mcp_servers.servicenow]) |
The zero-config route is the ServiceNow MCP extension from the Marketplace
(code --install-extension ivanbbaev.servicenow-mcp-ai); it registers the server in
Copilot Chat (agent mode) automatically, no mcp.json. Source: extension/.
Without the extension, add the server from a terminal (user profile):
code --add-mcp '{"name":"servicenow","command":"npx","args":["-y","servicenow-mcp-ai"]}'
code-insiders --add-mcp '{"name":"servicenow","command":"npx","args":["-y","servicenow-mcp-ai"]}'
The raw deeplinks behind the buttons (paste into a browser address bar):
vscode:mcp/install?%7B%22name%22%3A%22servicenow%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22servicenow-mcp-ai%22%5D%7D
vscode-insiders:mcp/install?%7B%22name%22%3A%22servicenow%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22servicenow-mcp-ai%22%5D%7D
Or a workspace file, .vscode/mcp.json:
{
"servers": {
"servicenow": {
"type": "stdio",
"command": "npx",
"args": ["-y", "servicenow-mcp-ai"]
}
}
}
Plugin (zero-config — installs the server wired up):
/plugin marketplace add IvanBBaev/servicenow-mcp-ai
/plugin install servicenow-mcp-ai
The plugin also ships five workflow skills, two read-only subagents and three hooks — see Plugin skills.
CLI — --scope user makes it available in every project; --env sets a
non-secret variable (the instance host) and leaves the secrets in the env file. A value set
this way wins over the env file, so drop --env if you switch instances with
servicenow_set_credentials:
claude mcp add servicenow --scope user --env SN_INSTANCE=your-instance.service-now.com -- npx -y servicenow-mcp-ai
claude_desktop_config.json — macOS ~/Library/Application Support/Claude/, Windows
%APPDATA%\Claude\ (Settings → Developer → Edit Config):
{
"mcpServers": {
"servicenow": {
"command": "npx",
"args": ["-y", "servicenow-mcp-ai"]
}
}
}
Restart Claude Desktop after saving.
Use the button above, or open the deeplink directly:
cursor://anysphere.cursor-deeplink/mcp/install?name=servicenow&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsInNlcnZpY2Vub3ctbWNwLWFpIl19
Or edit ~/.cursor/mcp.json (global) / .cursor/mcp.json (project) with the same
mcpServers block as Claude Desktop.
All three take the Claude Desktop mcpServers block unchanged:
~/.codeium/windsurf/mcp_config.json (Cascade → MCP servers → View raw
config), then refresh the server list.cline_mcp_settings.json.{
"mcpServers": {
"servicenow": {
"command": "npx",
"args": ["-y", "servicenow-mcp-ai"]
}
}
}
In Zed's settings.json (Zed → Settings → Open Settings):
{
"context_servers": {
"servicenow": {
"source": "custom",
"command": "npx",
"args": ["-y", "servicenow-mcp-ai"],
"env": {}
}
}
}
~/.gemini/settings.json (user) or .gemini/settings.json (project):
{
"mcpServers": {
"servicenow": {
"command": "npx",
"args": ["-y", "servicenow-mcp-ai"]
}
}
}
Check it with /mcp inside a Gemini CLI session.
codex mcp add servicenow --env SN_INSTANCE=your-instance.service-now.com -- npx -y servicenow-mcp-ai
Or ~/.codex/config.toml:
[mcp_servers.servicenow]
command = "npx"
args = ["-y", "servicenow-mcp-ai"]
# Optional, non-secret only — secrets stay in ~/.config/servicenow-mcp-ai/.env:
# env = { SN_INSTANCE = "your-instance.service-now.com" }
Prefer a global install (npm install -g servicenow-mcp-ai)? Replace
"command": "npx", "args": ["-y", "servicenow-mcp-ai"] with
"command": "servicenow-mcp-ai" in any snippet. The
MCP Inspector works the same way:
npx @modelcontextprotocol/inspector npx -y servicenow-mcp-ai.
The one-click links are generated from package.json by scripts/install-links.mjs
(node scripts/install-links.mjs prints them); test/install-links.test.js fails if
this README or the docs site drift from the generated strings.
An MCP bundle is one .mcpb file with the
server and its dependencies; Claude Desktop (or any MCPB host) installs it in one click, with
no npm / npx. Its form asks for the connection keys (only SN_INSTANCE is required) and
SN_TOOL_PACKAGES; secrets are marked sensitive (kept in the OS keychain). An empty field
falls back to the env file. Not published yet (O-22) — build it with npm run mcpb:pack
(dist/mcpb/; -- --validate runs the official validator).
The repository ships a multi-stage Dockerfile (distroless Node 22 runtime, non-root
uid 65532). The image contains exactly what npm pack publishes plus production
dependencies, and starts the HTTP transport on 0.0.0.0:3000 by default. No image
is published to a registry yet — build it locally:
docker build -t servicenow-mcp-ai .
# Secrets as files (Docker / Kubernetes secrets), mounted read-only
mkdir -p secrets && printf '%s' 'your-password' > secrets/sn_password
openssl rand -hex 32 > secrets/sn_http_token
docker run --rm -p 127.0.0.1:3000:3000 \
-e SN_INSTANCE=your-instance.service-now.com -e SN_USER=your.user \
-e SN_PASSWORD_FILE=/run/secrets/sn_password \
-e SN_HTTP_TOKEN_FILE=/run/secrets/sn_http_token \
-v "$PWD/secrets:/run/secrets:ro" -v sn-data:/data \
servicenow-mcp-ai
SN_HTTP_TOKEN is required for any non-loopback bind. The image binds 0.0.0.0
so the published port works; without a token every client that reaches the port
drives your instance with the configured credentials (the server logs a warning).
Clients send Authorization: Bearer <token>; terminate TLS in front of the container./data holds the docs directory (SN_DOCS_DIR=/data/docs) and the env file
(SN_ENV_FILE=/data/.env); mount a volume there to keep them.<KEY>_FILE secret source is described in Secrets from files.-i -e SN_TRANSPORT=stdio
(docker run --rm -i -e SN_TRANSPORT=stdio -e SN_INSTANCE=… servicenow-mcp-ai).HEALTHCHECK is a TCP liveness probe. GET /healthz (liveness) and GET /readyz
(credentials configured) answer without the token for orchestrator probes;
GET /readyz?probe=1 also calls the instance and sits behind the token, like every
MCP route. Set SN_HTTP_ALLOWED_HOSTS to the name clients use so the Host header is
checked on a 0.0.0.0 bind.smithery.yaml describes the same image for Smithery (stdio,
config keys mapped to the SN_* settings).With SN_TRANSPORT=http every MCP session (one initialize) gets its own server:
servicenow_use_instance is session-scoped over HTTP. It switches the profile of
the calling session only; other sessions keep theirs and nothing is written. Pass
persist: true to also write SN_ACTIVE_PROFILE to the env file (journaled) — that
changes the default for sessions that have not switched. Over stdio the switch is
persisted by default, as before (persist: false makes it process-only).DELETE or after SN_HTTP_SESSION_TTL_SEC idle
(default 30 min); a request with an ended session id gets 404 and the client
re-initializes. At most SN_HTTP_MAX_SESSIONS (64) are open at once.Host header must match SN_HTTP_ALLOWED_HOSTS
(default: the loopback names on a loopback bind) and a browser Origin must match
SN_HTTP_ALLOWED_ORIGINS (default: loopback origins); otherwise 403.GET /healthz → 200 {"status":"ok"} while serving. GET /readyz →
200 when credentials are configured, 503 otherwise. Both answer without the token.
GET /readyz?probe=1 (behind the token) also reads one sys_user row and returns
503 when the instance is unreachable; the result is cached for 5 s.SN_HTTP_KEEPALIVE_MS (25 s).The fastest path is three lines of Basic auth — set these (in the env file or the real environment) and you are connected:
SN_INSTANCE=dev12345.service-now.com
SN_USER=your.username
SN_PASSWORD=your-password
Everything else is optional tuning; see the full Environment variables reference for the rest.
Past a quick try, prefer OAuth over a stored password. For anything shared or long-lived, run the one-time
npx servicenow-mcp-ai logininstead — it stores a refresh token, not your password. See Configure credentials → OAuth 2.1.
Once the three variables are set, confirm the connection before you start:
servicenow_test_connection tool — it reads one sys_user record and
reports ok, HTTP status and latency.servicenow_check_capabilities — it previews which admin-restricted sys_*
tables the connected user can actually read.Or do both from the shell in one shot:
npx servicenow-mcp-ai doctor # checks credentials, reachability and capabilities
Prefer to be asked? npx servicenow-mcp-ai init prompts for the instance, the
auth method and the credentials, writes the env file and runs doctor — see
Command-line interface.
Credentials live in .env at the project root (git-ignored):
SN_INSTANCE=your-instance.service-now.com
SN_USER=your.username@example.com
SN_PASSWORD=your-password
SN_INSTANCE accepts dev12345, dev12345.service-now.com or a full https:// URL.
You can also set or change them at runtime by calling the
servicenow_set_credentials tool — the new values are written straight back to the env file.
Moving a configured profile to a different instance requires user and password in the same
call (the stored secrets are never sent to another host), and the change must be confirmed by
the client — clients without elicitation support are refused unless
SN_ALLOW_UNCONFIRMED_CREDENTIAL_CHANGE=1 is set.
The tool also sets the auth method (auth), the OAuth client id (oauth_client_id) and grant
(oauth_grant). Secrets — the API key and the OAuth client secret — are never tool arguments:
list them in request_secrets and the server asks for them through an elicitation prompt, so
they never appear in a logged tool call, the result or the write journal. A client without
elicitation support is refused (the opt-out above does not apply to secrets); set those keys in
the env file instead. The instance-change rule follows the resulting auth method: an API-key
profile needs a new API key, an OAuth client_credentials profile a new client secret, the
OAuth password grant user, password and client secret, Basic / none user and password;
bearer-token, refresh_token and jwt_bearer profiles cannot be moved with this tool.
servicenow_get_status (authWarnings), servicenow_list_instances and doctor evaluate each
profile against its own auth method — an API-key profile needs no password — and report the
method, the OAuth grant, the refresh-token state and the write mode, never a secret value. When
the refresh-token grant returns a rotated refresh token, it is written back to the env key it
was read from; if the env file cannot be written, the new token is kept in memory (lost on
restart) and a warning is logged and shown by get_status / doctor. Values the server writes
keep Windows paths literal (backslashes are single-quoted) and a CRLF env file stays CRLF. On
Windows the env file inherits its folder's ACL — restrict it yourself (for example
icacls .env /inheritance:r /grant:r "%USERNAME%:F"); the server only warns, it never runs
icacls.
The env file is resolved in this order: SN_ENV_FILE, then
~/.config/servicenow-mcp-ai/.env (XDG) if present, then the project-root .env.
A global/npx install therefore writes to your user config rather than into
node_modules. Real environment variables always take precedence over the file.
At initialize the server sends instructions built from the live configuration: the enabled
packages and tool count, the write mode, the active profile and, when nothing is configured,
what is missing and how to fix it. Until then every instance tool fails with
code: "NOT_CONFIGURED" and a hint naming servicenow_set_credentials. A first session
with an empty env file looks like this (abridged):
instructions Credentials: NOT configured (missing instance, user, password). Instance tools
fail with code NOT_CONFIGURED until fixed. To configure: ask the user for
the instance and credentials, call servicenow_set_credentials, then
servicenow_test_connection. Never guess or echo a password.
user How many open P1 incidents do we have?
model Which instance, user and password should I connect with?
user dev12345, admin, ••••••
tool call servicenow_set_credentials { instance: "dev12345", user: "admin", password: … }
tool result { message: "Credentials saved", profile: "default", configured: true, password: "***" }
tool call servicenow_test_connection {}
tool result { ok: true, … }
tool call servicenow_aggregate { table: "incident", query: "active=true^priority=1" }
model There are 7 open P1 incidents.
servicenow_get_status then shows the live state: server version, uptime and transport,
policy.summary, limits, redaction, the docs directory, write counters, the profile source and
profileDetails (per-profile auth mode, write mode and missing keys) — never a secret value.
Register an Authorization Code OAuth API endpoint in ServiceNow with a
loopback redirect URL (e.g. http://localhost:53682/callback), set
SN_OAUTH_CLIENT_ID (and SN_OAUTH_CLIENT_SECRET for a confidential client),
then run the one-time interactive login:
npx servicenow-mcp-ai login
It opens the browser, you approve, and the obtained refresh token is stored in your env file. The server then runs non-interactively (refresh_token grant) — no password is ever stored. PKCE (S256) is always used.
The OAuth 2.0 password grant (ROPC) is deprecated in OAuth 2.1 and disabled on many instances; prefer
login.client_credentialsandrefresh_tokengrants remain supported for service accounts. See .env.example.
Every inbound REST auth method ServiceNow offers is covered:
| Method | SN_AUTH | Set | Notes |
|---|---|---|---|
| Basic | basic | SN_USER / SN_PASSWORD | Default. |
| OAuth 2.1 — Authorization Code + PKCE | oauth | npx servicenow-mcp-ai login | Recommended. Interactive, stores a refresh token. |
| OAuth — Client Credentials | oauth | SN_OAUTH_GRANT=client_credentials | Service-to-service. |
| OAuth — Refresh Token | oauth | SN_OAUTH_GRANT=refresh_token + SN_OAUTH_REFRESH_TOKEN | Set by login. |
| OAuth — JWT Bearer | oauth | SN_OAUTH_GRANT=jwt_bearer + SN_OAUTH_JWT_KEY | RS256 assertion; no password. |
| OAuth — Password (ROPC) | oauth | SN_OAUTH_GRANT=password | Deprecated. |
| API Key | apikey | SN_API_KEY | x-sn-apikey header. |
| Bearer token | token | SN_BEARER_TOKEN or SN_TOKEN_FILE | Pre-obtained token, used verbatim. A rejected token (401) re-reads SN_TOKEN_FILE once, else fails with AUTH_EXPIRED. |
| Mutual TLS (client cert) | none (or layered) | SN_TLS_CLIENT_CERT / _KEY | Cert maps to a user; needs optional undici. |
All settings are read from the env file (SN_ENV_FILE, else
~/.config/servicenow-mcp-ai/.env) or the real process environment, which takes
precedence. Only the first three are required; the rest are optional tuning knobs.
See .env.example for a template. Every value is validated at
startup: an invalid one is logged as a warning and the setting keeps its default,
or — with SN_STRICT_SETTINGS=1 — stops the server with an error.
These tables are generated from the settings manifest
(src/core/settings-manifest.ts) — edit the manifest, then run
npm run docs:env.
The instance and its credentials. Only SN_INSTANCE is always required; the auth method is auto-detected from the keys present (API key -> bearer token -> OAuth -> Basic) unless SN_AUTH names it.
| Variable | Required | Default | Since | Description |
|---|---|---|---|---|
SN_INSTANCE | yes | — | 1.0.0 | Instance name, host, or https:// URL (dev12345, dev12345.service-now.com). |
SN_USER | yes | — | 1.0.0 | ServiceNow username for Basic auth. |
SN_PASSWORD | yes | — | 1.0.0 | ServiceNow password. Never logged or returned by any tool. |
SN_AUTH | no | auto | 1.1.0 | Auth method: basic, oauth, apikey, token or none (cert-only mTLS). Auto-detected from the keys present (API key → bearer → OAuth → Basic). |
SN_API_KEY | no | — | 1.1.0 | ServiceNow Inbound API Key, sent as the x-sn-apikey header (enables apikey mode). |
SN_BEARER_TOKEN | no | — | 1.1.0 | A pre-obtained bearer token, sent verbatim as Authorization: Bearer … (enables token mode). |
SN_TOKEN_FILE | no | — | next | File holding the bearer token (enables token mode; wins over SN_BEARER_TOKEN). Re-read once when the instance rejects the token with 401, so an external issuer can rotate it; otherwise the call fails with AUTH_EXPIRED. |
SN_TOKEN_EXPIRES_AT | no | — | next | ISO 8601 expiry of the bearer token. get_status / doctor warn when less than 24 h remain, when it has passed, or when it cannot be parsed. |
SN_OAUTH_CLIENT_ID | no | — | 1.1.0 | OAuth client id (its presence enables OAuth). |
SN_OAUTH_CLIENT_SECRET | no | — | 1.1.0 | OAuth client secret. |
SN_OAUTH_GRANT | no | password | 1.1.0 | OAuth grant: password (deprecated — ROPC), client_credentials, refresh_token or jwt_bearer. The login command sets this to refresh_token for you. Any other value fails every OAuth request. |
SN_OAUTH_REFRESH_TOKEN | no | — | 1.1.0 | Refresh token for the refresh_token grant. Obtained automatically by npx servicenow-mcp-ai login (Authorization Code + PKCE). |
SN_OAUTH_REDIRECT_URI | no | http://localhost:53682/callback | 1.1.0 | Loopback redirect URL for the PKCE login flow. Must match the redirect registered on the OAuth endpoint. |
SN_OAUTH_SCOPE | no | — | 1.1.0 | Optional OAuth scope requested during login. |
SN_OAUTH_JWT_KEY | no | — | 1.1.0 | PEM private key for the jwt_bearer grant (or SN_OAUTH_JWT_KEY_FILE); the public certificate is registered on the ServiceNow JWT provider. |
SN_OAUTH_JWT_KEY_FILE | no | — | 1.1.0 | Path to the PEM private key for the jwt_bearer grant. |
SN_OAUTH_JWT_ISS | no | client id | 1.1.0 | iss claim of the JWT-bearer assertion. |
SN_OAUTH_JWT_SUB | no | SN_USER | 1.1.0 | sub claim (the user) of the JWT-bearer assertion. |
SN_OAUTH_JWT_AUD | no | https://<host>/oauth_token.do | 1.1.0 | aud claim of the JWT-bearer assertion. |
SN_OAUTH_JWT_KID | no | — | 1.1.0 | kid header of the JWT-bearer assertion, when the provider requires one. |
SN_OAUTH_JWT_EXP_SEC | no | 300 | 1.1.0 | Lifetime of the JWT-bearer assertion in seconds. |
SN_ALLOW_UNCONFIRMED_CREDENTIAL_CHANGE | no | false | next | H-2: operator opt-out — lets servicenow_set_credentials proceed on MCP clients without elicitation support (no confirmation prompt, no live server). An explicit decline is still refused. Off by default. |
Container secrets (D-5): FILE=/path loads from that file at startup (one trailing newline is trimmed). Setting both and FILE is a startup error; so is an unreadable or empty file. A value loaded this way is never written back to the env file. Per profile: SN_PROFILE_FILE for the ServiceNow secrets.
| Variable | Required | Default | Since | Description |
|---|---|---|---|---|
SN_PASSWORD_FILE | no | — | next | D-5: read SN_PASSWORD from this file (Docker / Kubernetes secrets). |
SN_API_KEY_FILE | no | — | next | D-5: read SN_API_KEY from this file (Docker / Kubernetes secrets). |
SN_BEARER_TOKEN_FILE | no | — | next | D-5: read SN_BEARER_TOKEN from this file (Docker / Kubernetes secrets). Read once at startup (SN_TOKEN_FILE, re-read on a 401, still wins). |
SN_OAUTH_CLIENT_SECRET_FILE | no | — | next | D-5: read SN_OAUTH_CLIENT_SECRET from this file (Docker / Kubernetes secrets). |
SN_OAUTH_REFRESH_TOKEN_FILE | no | — | next | D-5: read SN_OAUTH_REFRESH_TOKEN from this file (Docker / Kubernetes secrets). A rotated refresh token is then kept in memory only (update the file yourself). |
SN_HTTP_TOKEN_FILE | no | — | next | D-5: read SN_HTTP_TOKEN from this file (Docker / Kubernetes secrets). |
The bare SN_INSTANCE / SN_USER / SN_PASSWORD keys are the 'default' profile. More instances live under SN_PROFILE__* keys; switch with SN_ACTIVE_PROFILE or the servicenow_use_instance tool.
| Variable | Required | Default | Since | Description |
|---|---|---|---|---|
SN_PROFILE_<NAME>_* | no | — | 1.1.0 | Named connection profiles: SN_PROFILE_DEV_INSTANCE / _USER / _PASSWORD define profile dev. The bare SN_INSTANCE/SN_USER/SN_PASSWORD keys are the default profile. The auth, policy, write-mode, ENV, PROD_WRITES and UPDATE_SET settings take the same prefix. Example: SN_PROFILE_DEV_INSTANCE=dev12345.service-now.com, SN_PROFILE_DEV_USER=admin, SN_PROFILE_DEV_PASSWORD=dev-password. |
SN_ACTIVE_PROFILE | no | default | 1.1.0 | Which profile tools use. Switch at runtime with servicenow_use_instance (persisted to the env file). |
SN_ENV_FILE | no | ~/.config/servicenow-mcp-ai/.env | 1.1.0 | Explicit path to the env file to read/write. Otherwise the server uses $XDG_CONFIG_HOME/servicenow-mcp-ai/.env (~/.config/…); a project-root .env next to the installed package is still read when the XDG file is missing, with a deprecation warning — that fallback is removed in 3.0. doctor prints the chosen file and why. |
Timeouts, retries, the host allow-list, the outbound proxy, mutual TLS and the per-host queue and circuit breaker. They govern every REST client of the server. The proxy and mutual TLS need the optional undici package.
| Variable | Required | Default | Since | Description |
|---|---|---|---|---|
SN_TIMEOUT_MS | no | 30000 | 1.1.0 | Per-request timeout in milliseconds. |
SN_MAX_RETRIES | no | 2 | 1.1.0 | Retries for transient failures (429/5xx, network errors). Non-idempotent writes are only retried on connect errors. |
SN_RETRY_AFTER_MAX_MS | no | 60000 | next | Upper bound honoured for a Retry-After header on 429/503; a larger value is clamped so a misbehaving upstream cannot park the client for minutes. |
SN_DEADLINE_MS | no | max(120000, 2 × SN_TIMEOUT_MS) | next | Total wall-clock budget for one logical request across retries, backoff, queue wait and OAuth re-auth. A retry that cannot fit into the remaining budget is not attempted — the call fails with code DEADLINE_EXCEEDED. |
SN_ALLOWED_HOSTS | no | — | 1.1.0 | Comma-separated allow-list of permitted hosts (for custom or sovereign-cloud domains). When set, only matching hosts are contacted. When unset, only *.service-now.com instances are allowed and internal/loopback hosts are blocked (SSRF guard). An entry may carry a port (host:8443) or be a bracketed IPv6 literal ([2001:db8::1]); an explicit non-443 port or an IPv6 literal in the instance value is accepted only when such an entry matches it — never under the default policy. |
SN_MAX_BODY_BYTES | no | 52428800 | next | Largest response body (bytes) read into memory; a larger declared or streamed body fails with RESPONSE_TOO_LARGE. Redirects are never followed — a 3xx fails with REDIRECT_BLOCKED naming the target host. |
SN_HTTPS_PROXY | no | — | next | Outbound HTTPS proxy URL (http://user:pass@proxy:3128) for all ServiceNow and OAuth traffic; needs the optional undici package. When unset, the ambient HTTPS_PROXY / HTTP_PROXY variables are honoured together with NO_PROXY; SN_HTTPS_PROXY itself is explicit and ignores NO_PROXY. Proxy credentials are never logged. |
SN_USER_AGENT_SUFFIX | no | — | next | Extra token appended to the User-Agent sent on every request (servicenow-mcp-ai/<version> (node/<major>; <transport>; <client>)), e.g. a team or ticket id for correlation in the instance's transaction log. Printable ASCII, up to 80 characters. |
SN_TLS_CLIENT_CERT | no | — | 1.1.0 | Client certificate (PEM) for mutual TLS (or SN_TLS_CLIENT_CERT_FILE). With SN_TLS_CLIENT_KEY it presents a client cert; ServiceNow's mutual-auth profile maps it to a user. Needs the optional undici package (npm i undici). Cert and key must be set together — only one of them is a configuration error. |
SN_TLS_CLIENT_CERT_FILE | no | — | 1.1.0 | Path to the client certificate (PEM) for mutual TLS. |
SN_TLS_CLIENT_KEY | no | — | 1.1.0 | Private key (PEM) for the client certificate (or SN_TLS_CLIENT_KEY_FILE). |
SN_TLS_CLIENT_KEY_FILE | no | — | 1.1.0 | Path to the private key (PEM) for the client certificate. |
SN_TLS_CA | no | — | 1.1.0 | Optional CA bundle (PEM) to trust (or SN_TLS_CA_FILE) — applied with or without a client certificate; needs the optional undici package. |
SN_TLS_CA_FILE | no | — | 1.1.0 | Path to the CA bundle (PEM) to trust. |
SN_TLS_REJECT_UNAUTHORIZED | no | true | 1.1.0 | false disables TLS certificate verification (not recommended; warned once at startup). |
SN_MAX_CONCURRENT | no | 4 | 1.1.0 | Maximum parallel HTTP requests to the instance (simple in-process semaphore). |
SN_MAX_QUEUE | no | 64 | next | Maximum requests waiting per host for a free slot beyond SN_MAX_CONCURRENT. Overflow fails immediately with code BUSY instead of piling up. Diagnostics (servicenow_test_connection, doctor) bypass the queue so they still answer while it is stalled. |
SN_QUEUE_TIMEOUT_MS | no | SN_TIMEOUT_MS | next | Longest a request waits for a slot before failing with code BUSY. Wait time is not billed to the per-attempt timeout, only to SN_DEADLINE_MS. |
SN_BREAKER_THRESHOLD | no | 0 (off) | next | Opt-in per-host circuit breaker: after this many consecutive failed requests (transport error, deadline, 5xx) further requests fail fast with code CIRCUIT_OPEN until SN_BREAKER_RESET_MS passes. Diagnostics are never blocked. |
SN_BREAKER_RESET_MS | no | 30000 | next | How long an open circuit breaker rejects requests before letting a trial request through; the first failure re-opens it, the first success closes it. |
Which tools are registered. The admin tools (set_credentials, get_status, use_instance) are always on.
| Variable | Required | Default | Since | Description |
|---|---|---|---|---|
SN_TOOL_PACKAGES | no | core | 1.0.0 | Comma/space-separated tool packages or profiles to enable. Profiles: core (default), all and the presets reader \ |
SN_PACKAGES_DENY | no | — | 1.0.0 | Comma/space-separated packages to exclude even if enabled by SN_TOOL_PACKAGES. The only way to block plugin APIs (catalog, change, knowledge…) — the table policy does not see them. |
SN_PACKAGES_READONLY | no | — | 1.0.0 | Comma/space-separated packages whose write tools are not registered; their read tools stay. Per-package complement to the global SN_READONLY. |
SN_CODESEARCH | no | false | 1.1.0 | Opt in to the Code Search API (sn_codesearch) for servicenow_search_code (FT-7). When true and the plugin is active it replaces the LIKE iteration; falls back to LIKE on any failure. |
SN_EXPERIMENTAL_TASKS | no | 0 | next | M-9, experimental: 1 adds an optional run_as_task:true argument to snapshot_instance, compare_instances, run_atf_test, run_atf_suite, check_code_health and query_table (format:"file" only). Such a call returns an MCP task handle at once (_meta["io.modelcontextprotocol/related-task"]); the client polls tasks/get, reads tasks/result (kept 1 h, redacted) or stops it with tasks/cancel. Off: schemas unchanged. Built on the SDK's experimental task API. |
SN_MCP_APPS | no | 0 | next | N-50, MCP Apps (SEP-1865): 1 registers four self-contained ui://servicenow-mcp/… HTML views (text/html;profile=mcp-app: plan diff, Mermaid diagram, flow explainer, UI Builder page tree) and links the write tools with apply, the Mermaid generators, explain_flow and explain_ui_experience to them through _meta.ui.resourceUri — only for a client that advertises the io.modelcontextprotocol/ui extension. The views render the tool's own result (no network, strict CSP). Off: tools/list, resources and every result unchanged. |
SN_LEGACY_TOOL_NAMES | no | 0 | next | M-7 (B2), deprecated bridge for one minor cycle: 1 registers every tool name and parameter name renamed by the v3 naming convention as an alias of its new name (the alias dispatches to the new tool and logs a one-time deprecation warning). Off: the old names do not exist and are absent from tools/list. See the rename table in the README. |
Least-privilege table policy, plan-and-apply writes, destructive-write confirmation, per-session caps, prod profiles, update-set binding and the upload / email / SDK-managed-scope guards.
| Variable | Required | Default | Since | Description |
|---|---|---|---|---|
SN_TABLES_ALLOW | no | — | 1.1.0 | Comma-separated table allowlist; when set, only these tables are reachable. |
SN_TABLES_DENY | no | — | 1.1.0 | Comma-separated table denylist; always wins over the allowlist. |
SN_READONLY | no | false | 1.1.0 | When truthy, refuse every create/update/delete. |
SN_WRITE_MODE | no | plan | 2.0.0 | plan (default) previews a write as a before/after diff without mutating; apply executes; passing apply:true forces a single call. |
SN_DESTRUCTIVE_CONFIRM | no | token | next | H-3: confirmation for a destructive apply:true (delete_record, delete_attachment, a writing batch, send_email, order_catalog_item, revert_write, upsert_artifact, check_change_conflicts with calculate:true) in plan mode. token (the 3.0 default, B4): the plan preview returns a single-use plan_token and the apply must pass it back with the same arguments, else PLAN_REQUIRED; elicit: token plus a confirmation prompt on clients with elicitation (a decline is CONFIRM_DECLINED, journaled as refused). SN_WRITE_MODE=apply bypasses it, except on a profile marked prod (SN_ENV), which is always at least elicit and is confirmed in apply mode too. off is the explicit opt-out (the pre-3.0 behaviour). |
SN_PLAN_TOKEN_TTL_SEC | no | 600 | next | H-3: lifetime of a plan_token in seconds (30–86400). Tokens live only in the server process and are used up by the apply. |
SN_BATCH_UNMAPPED | no | deny | next | H-4: a servicenow_batch sub-request whose REST path no tool package owns: deny (the 3.0 default, B8) refuses it (so a new plugin API cannot pass SN_PACKAGES_DENY / SN_PACKAGES_READONLY inside a batch); allow is the opt-out and checks it against the table and read-only axes only. A nested batch is always refused. |
SN_BATCH_MAX_REQUESTS | no | 50 | next | H-4: most sub-requests one servicenow_batch call may carry (1–1000; 50 since 3.0), checked before anything is sent. |
SN_PROTECTED_TABLES_WRITE | no | deny | next | H-11: deny (the 3.0 default, B11) refuses writes to the built-in protected tables (identity, roles, ACLs, sys_properties, OAuth, scripts, LDAP, certificates, data sources, REST messages — servicenow_explain_policy lists them) with POLICY_DENIED; an exact SN_TABLES_ALLOW entry re-enables one; allow is the opt-out for all of them. Reads are unaffected. |
SN_IMPORT_SET_TABLES | no | u_*,imp_* | next | H-11: patterns (*, ?) the import-set staging table must match (3.0 default u_*,imp_*); * is the opt-out (any table the table policy allows). |
SN_MAX_WRITES_PER_SESSION | no | 500 per HTTP session, none on stdio | next | H-11: most applied instance writes per session (the process on stdio, one MCP session over HTTP; a batch counts its write sub-requests). Past it, writes fail with WRITE_CAP before any request; get_status.writes.caps shows the usage. Unset = 500 per HTTP session and no cap on stdio (3.0 default); 0 = no cap. |
SN_MAX_DELETES_PER_SESSION | no | 100 | next | H-11: most applied deletes per session (WRITE_CAP; 100 since 3.0). 0 = no cap. |
SN_MAX_BATCH_WRITES | no | 50 | next | H-11: most write (non-GET) sub-requests in one servicenow_batch (WRITE_CAP; 50 since 3.0). 0 = no cap. |
SN_ENV | no | — | next | H-11: marks the default profile prod, test or dev (SN_PROFILE_<NAME>_ENV for others). A prod profile stays in plan mode even when apply is configured unless SN_PROD_WRITES (SN_PROFILE_<NAME>_PROD_WRITES) is I_UNDERSTAND; its destructive applies are always confirmed (at least SN_DESTRUCTIVE_CONFIRM=elicit, also in apply mode — CONFIRM_REQUIRED for a client without elicitation); results carry _meta.environment; use_instance warns. SN_PROFILE_<NAME>_WRITE_MODE sets the write mode per profile. |
SN_PROD_WRITES | no | — | next | H-11: I_UNDERSTAND lets a prod default profile run in apply mode. |
SN_UPDATE_SET | no | — | next | S-6: update set (sys_id or exact name) that applied Table-tool writes (create / update / upsert / delete) land in; a per-call update_set overrides it. The plan names the set; the user's current update set is switched for the write and restored after it. Data-row tables are written unchanged. |
SN_EMAIL_ALLOWED_DOMAINS | no | — | next | Recipient domains servicenow_send_email may address (to/cc/bcc; a domain covers its subdomains, * allows any). When unset, every recipient must be the email of a user in the instance's own sys_user table; anything else fails with RECIPIENT_NOT_ALLOWED. |
SN_MAX_UPLOAD_BYTES | no | 10485760 | next | Largest decoded attachment upload, checked on the base64 length before decoding (PAYLOAD_TOO_LARGE). |
SN_UPLOAD_MIME_ALLOW | no | — | next | Optional allow-list of upload content types (exact, or type/*); others fail with MIME_NOT_ALLOWED. |
| `SN_SDK_ |
Source-derived launch command. Check the maintainer’s required arguments and credentials before running:
npx -y servicenow-mcp-aiMerge this template into ~/Library/Application Support/Claude/claude_desktop_config.json. Keep existing servers. Add any arguments, credentials, and permissions required by the maintainer; this template has not been install-tested.
{
"mcpServers": {
"io-github-ivanbbaev-servicenow-mcp-ai": {
"command": "npx",
"args": [
"-y",
"servicenow-mcp-ai"
]
}
}
}Restart Claude Desktop completely for changes to take effect. Confirm the server appears connected in the client’s tool list, then try a read-only example from its documentation.
Claude Desktop setup referenceservicenow-mcp-ainpmio.github.IvanBBaev/servicenow-mcp-ai works with any MCP-compatible client. Copy the config snippet from the Configuration section above and add it to the file shown for your client, then restart the application.
~/Library/Application Support/Claude/claude_desktop_config.jsonRestart Claude Desktop completely for changes to take effect.~/.cursor/mcp.jsonRestart Cursor for changes to take effect..vscode/mcp.jsonReload VS Code window for changes to take effect.~/.codeium/windsurf/mcp_config.jsonRestart Windsurf for changes to take effect..mcp.jsonSave at the project root, then start Claude Code in that project and review the MCP server approval prompt. Keep real credentials out of shared files.