ServiceNow MCP
ServiceNow MCP सर्वर: पूर्ण REST सतह पर 65 उपकरण (तालिका, एग्रीगेट, अटैचमेंट, इम्पोर्ट सेट, बैच, CMDB/IRE, कैटलॉग, चेंज, नॉलेज, ईमेल) जिसमें स्क्रिप्ट इंटेलिजेंस, फ्लो ट्रेसिंग, ATF रन, मल्टी-इंस्टेंस प्रोफाइल और मरमेड डायग्राम शामिल हैं।
दस्तावेज़
servicenow-mcp-ai — ServiceNow MCP Server
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.
Quick demo
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.
Features
- Full Table API: query, read, create, update and delete records on any table, with encoded queries, field selection and pagination.
- Extra ServiceNow APIs: Aggregate (Stats), Attachment
(list/upload/download/delete), Import Set, Batch (many REST calls in a
single request), plus table/column metadata (
sys_db_object,sys_dictionary). - Process & plugin APIs: CMDB (class-aware CI CRUD + meta, relationship
reads from
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. - Script intelligence: read and search the instance's own code (business
rules, script includes, client scripts, UI policies/actions, scheduled jobs,
transform/REST scripts, ACLs — and, not yet verified on a live instance,
Service Portal widgets, UI pages/scripts/macros, processors, email/fix/
validation scripts, script actions, data sources, REST message functions,
transform maps/entries, catalog client scripts and dictionary calculations /
defaults) and get a table's full automation picture — all read-only over the
Table API.
servicenow_search_codereturns every matching line per artefact (up to 20, with a line of context either side) and, likeservicenow_where_used, takes an optional applicationscope.servicenow_where_usedalso finds structural references — dictionary reference fields, list and form layouts, catalog variables, flow inputs and reports — in a separatestructuralsection. - Flow tracing & code checking (Phase 8): deterministically trace what a
table operation runs (
flowspackage — business rules, flows, workflows and notifications, in order, with a Mermaid flowchart), read Flow Designer flows and run history, and lint scripts against a local rule set with an aggregate code-health report (codecheck). Run ATF tests via the CI/CD API (atf, opt-in, non-default — the run tools execute on the instance). - Journal-based undo (
revert): list the local write journal and revert one applied create/update/delete — with a drift check against later edits. - Generic artifact reads (
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. - Update-set awareness (
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. - Operations and data health (
ops, opt-in): bounded "why is it slow" reads of the system log, the scheduler queue, the outbound email queue and semaphores, plusservicenow_data_health— duplicate keys, orphaned and stale references for one table, from Aggregate API counts. - Operations reads (opt-in): a record's change history from
sys_auditandsys_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. - Self-documentation: a local Markdown knowledge base (read/write/search) plus deterministic Mermaid generators (ER diagrams from references, record-lifecycle flowcharts from business rules) so the server builds durable, reusable context.
- Prompts: ready-made workflows (incident triage, change impact analysis, document a table, diagnose a slow instance) that orchestrate the tools.
- Tool packages: load only the tool groups you need via
SN_TOOL_PACKAGES(default profilecore;allenables everything). - Basic or OAuth 2.0 authentication over HTTPS; the password/token is never echoed back.
- Least-privilege controls: table allow/deny lists and a global read-only mode.
- Resilience: per-request timeout, retry with backoff and
Retry-After, SSRF guard, and a result-size guard. - MCP tool annotations and resources, structured error payloads, and structured logging on stderr.
- Credentials in an env file (project,
~/.config, orSN_ENV_FILE), updatable at runtime viaservicenow_set_credentials.
Requirements
- Node.js 20+ (enforced:
engines+ a runtime guard with a clear message; the project targets the version in.nvmrc).
Setup
From source (for development):
npm install
npm run build
Or run the published package directly, without cloning:
npx servicenow-mcp-ai
Install in your MCP client
Every client launches the same stdio command, npx -y servicenow-mcp-ai (Node.js 20+),
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]) |
VS Code / VS Code Insiders
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"]
}
}
}
Claude Code
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 — 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
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.
Cursor
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.
Windsurf, Cline, JetBrains AI Assistant
All three take the Claude Desktop mcpServers block unchanged:
- Windsurf —
~/.codeium/windsurf/mcp_config.json(Cascade → MCP servers → View raw config), then refresh the server list. - Cline — MCP Servers icon → Configure MCP Servers opens
cline_mcp_settings.json. - JetBrains AI Assistant — Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add → As JSON, paste the block.
{
"mcpServers": {
"servicenow": {
"command": "npx",
"args": ["-y", "servicenow-mcp-ai"]
}
}
}
Zed
In Zed's settings.json (Zed → Settings → Open Settings):
{
"context_servers": {
"servicenow": {
"source": "custom",
"command": "npx",
"args": ["-y", "servicenow-mcp-ai"],
"env": {}
}
}
}
Gemini CLI
~/.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 CLI
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.
Quickstart
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.
Verify your setup
Once the three variables are set, confirm the connection before you start:
- Run the
servicenow_test_connectiontool — it reads onesys_userrecord and reportsok, HTTP status and latency. - Run
servicenow_check_capabilities— it previews which admin-restrictedsys_*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.
Configure credentials
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.
First run: the model configures itself
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
error.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 error.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.
OAuth 2.1 (Authorization Code + PKCE) — recommended
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.
Supported authentication methods
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. |
Environment variables
All settings are read from .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.
| Variable | Required | Default | Description |
|---|---|---|---|
SN_INSTANCE | yes | — | Instance name, host, or https:// URL (dev12345, dev12345.service-now.com). |
SN_USER | yes | — | ServiceNow username for Basic auth. |
SN_PASSWORD | yes | — | ServiceNow password. Never logged or returned by any tool. |
SN_TIMEOUT_MS | no | 30000 | Per-request timeout in milliseconds. |
SN_MAX_RETRIES | no | 2 | Retries for transient failures (429/5xx, network errors). Non-idempotent writes are only retried on connect errors. |
SN_MAX_RECORDS | no | 10000 | Hard cap on records returned by a fetchAll query. |
SN_MAX_RESULT_CHARS | no | 100000 | Character budget for a query result before it is truncated for the client; the truncation note names format:"file". A snapshot, compare or diagram result over the budget is returned in full with a note. |
SN_OVERSIZE_TO_FILE | no | false | S-11: write a snapshot, compare or diagram result over SN_MAX_RESULT_CHARS to a file under SN_DOCS_DIR (<profile>/exports/, <profile>/diagrams/) and return {path, bytes, preview} instead. |
SN_RETRY_AFTER_MAX_MS | no | 60000 | 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 | — | Total wall-clock budget for one logical request across retries, backoff, queue wait and OAuth re-auth; defaults to max(120000, 2 × SN_TIMEOUT_MS). A retry that cannot fit into the remaining budget is not attempted — the call fails with code DEADLINE_EXCEEDED. |
SN_ALLOWED_HOSTS | no | — | 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 | 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_AUTH | no | auto | 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 | — | ServiceNow Inbound API Key, sent as the x-sn-apikey header (enables apikey mode). |
SN_BEARER_TOKEN | no | — | A pre-obtained bearer token, sent verbatim as Authorization: Bearer … (enables token mode). |
SN_TOKEN_FILE | no | — | 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 | — | 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 | — | OAuth client id (its presence enables OAuth). |
SN_OAUTH_CLIENT_SECRET | no | — | OAuth client secret. |
SN_OAUTH_GRANT | no | password | OAuth grant: password (deprecated — ROPC), client_credentials, refresh_token or jwt_bearer. The login command sets this to refresh_token for you. |
SN_OAUTH_JWT_KEY | no | — | PEM private key for the jwt_bearer grant (or SN_OAUTH_JWT_KEY_FILE). Optional claims: SN_OAUTH_JWT_ISS (default client id), SN_OAUTH_JWT_SUB (default SN_USER), SN_OAUTH_JWT_AUD, SN_OAUTH_JWT_KID, SN_OAUTH_JWT_EXP_SEC (default 300). |
SN_OAUTH_REFRESH_TOKEN | no | — | 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 | Loopback redirect URL for the PKCE login flow. Must match the redirect registered on the OAuth endpoint. |
SN_OAUTH_SCOPE | no | — | Optional OAuth scope requested during login. |
SN_HTTPS_PROXY | no | — | 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 | — | 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 | — | 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_KEY | no | — | Private key (PEM) for the client certificate (or SN_TLS_CLIENT_KEY_FILE). |
SN_TLS_CA | no | — | 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_REJECT_UNAUTHORIZED=false disables verification (not recommended; warned once at startup). |
SN_TABLES_ALLOW | no | — | Comma-separated table allowlist; when set, only these tables are reachable. |
SN_TABLES_DENY | no | — | Comma-separated table denylist; always wins over the allowlist. |
SN_READONLY | no | false | When truthy, refuse every create/update/delete. |
SN_ALLOW_UNCONFIRMED_CREDENTIAL_CHANGE | no | false | 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. |
SN_WRITE_MODE | no | plan | 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 | off | H-3: confirmation for a destructive apply:true (delete_record, delete_attachment, a writing batch, send_email, order_catalog_item, revert_write, change_conflicts with calculate:true) in plan mode. token: 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. The 3.0 default is an owner decision (O-4). |
SN_PLAN_TOKEN_TTL_SEC | no | 600 | 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 | allow | H-4: a servicenow_batch sub-request whose REST path no tool package owns: allow checks it against the table and read-only axes only; deny refuses it (so a new plugin API cannot pass SN_PACKAGES_DENY / SN_PACKAGES_READONLY inside a batch). A nested batch is always refused. The 3.0 default is an owner decision (O-4). |
SN_BATCH_MAX_REQUESTS | no | 1000 | H-4: most sub-requests one servicenow_batch call may carry (1–1000), checked before anything is sent. |
SN_PROTECTED_TABLES_WRITE | no | allow | H-11: deny 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. Reads are unaffected. The 3.0 default is an owner decision (O-4). Per profile: SN_PROFILE_<NAME>_PROTECTED_TABLES_WRITE. |
SN_IMPORT_SET_TABLES | no | — | H-11: patterns (*, ?) the import-set staging table must match (e.g. u_*,imp_*); unset = any table the table policy allows. |
SN_MAX_WRITES_PER_SESSION | no | — | 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 = no cap. |
SN_MAX_DELETES_PER_SESSION | no | — | H-11: most applied deletes per session (WRITE_CAP). Unset = no cap. |
SN_MAX_BATCH_WRITES | no | — | H-11: most write (non-GET) sub-requests in one servicenow_batch (WRITE_CAP). Unset = no cap. |
SN_ENV | no | — | 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 | — | H-11: I_UNDERSTAND lets a prod default profile run in apply mode. |
SN_UPDATE_SET | no | — | 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 and SN_PROFILE_<NAME>_UPDATE_SET sets it per profile. 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 | — | 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 | Largest decoded attachment upload, checked on the base64 length before decoding (PAYLOAD_TOO_LARGE). |
SN_UPLOAD_MIME_ALLOW | no | — | Optional allow-list of upload content types (exact, or type/*); others fail with MIME_NOT_ALLOWED. |
SN_REDACT_FIELDS | no | — | DF-5: mask these field values before records reach the model (comma/space-separated). |
SN_REDACT_PII | no | false | DF-5: also mask email/phone/national-id patterns inside string values. Since H-5 both redaction settings apply deeply to every tool result (success and error) and to the write journal. |
SN_JOURNAL_MAX_BYTES | no | 20971520 | H-5: size (bytes, default 20 MiB) at which write-journal.jsonl rotates to write-journal.<ISO-time>.jsonl; the hash chain continues across files. |
SN_CSV_FORMULA_GUARD | no | true | H-5: prefix CSV text cells that start with =, +, -, @, tab or CR with ' so spreadsheets never evaluate them (a text -5 exports as '-5). 0 opts out. |
SN_CSV_BOM | no | true | H-5: prepend a UTF-8 BOM to format:"csv" exports so Excel decodes non-ASCII text. 0 opts out. |
SN_TRANSPORT | no | stdio | DF-6: stdio (default) or http (Streamable HTTP for remote/agent clients). |
SN_PORT | no | 3000 | DF-6: TCP port for the http transport. |
SN_HTTP_HOST | no | 127.0.0.1 | DF-6: bind address for the http transport (loopback by default). |
SN_HTTP_TOKEN | no | — | DF-6: when set, http requests must send Authorization: Bearer <token>. |
SN_LOG_LEVEL | no | info | Log verbosity on stderr: error, warn, info, debug. |
SN_LOG_FORMAT | no | json | E-5: stderr log line format — json (one object per line) or text (HH:MM:SS level message key=value). |
SN_LOG_FILE | no | — | E-5: also append every log line (JSON Lines, redacted, mode 0600) to this file, with size-based rotation (<file>.1 … <file>.5). Stderr keeps working. |
SN_LOG_FILE_MAX_BYTES | no | 10485760 | E-5: rotation threshold for SN_LOG_FILE (bytes). |
SN_METRICS | no | off | E-5: HTTP transport only — serve Prometheus metrics at GET /metrics, behind SN_HTTP_TOKEN (disabled when no token is set). |
SN_EXPERIMENTAL_TASKS | no | 0 | M-9, experimental: 1 adds an optional run_as_task:true argument to snapshot_instance, compare_instances, run_atf_test, run_atf_suite, 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_LOG_NOTIFY_RATE | no | 20 | M-8: log notifications per second and client session over the MCP logging capability (burst 50, or the rate if larger). Lines over it are counted and reported in one "N log messages suppressed" warning per minute; stderr is never throttled. 0 = no limit. |
SN_ENV_FILE | no | — | Explicit path to the env file to read/write. |
SN_TOOL_PACKAGES | no | core | Comma/space-separated tool packages or profiles to enable. Profiles: core (default), all and the presets reader | developer | admin (see Presets). Packages: table, schema, aggregate, attachment, importset, batch, catalog, change, knowledge, cmdb, scripts, flows, codecheck, docs, instance, email, atf, revert, artifacts, updatesets, ops, history, properties, directory, ui. The admin tools are always on. atf runs tests on the instance — enable it only on a non-production instance. |
SN_PACKAGES_DENY | no | — | 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 | — | Comma/space-separated packages whose write tools are not registered; their read tools stay. Per-package complement to the global SN_READONLY. |
SN_SCHEMA_CACHE_TTL_SEC | no | 300 | TTL for the near-static schema reads cache (list_tables, describe_table, get_cmdb_meta). 0 disables caching. |
SN_SCHEMA_CACHE_MAX | no | 256 | Maximum entries in the schema reads cache; when full, the least-recently-used entry is evicted. Counters (size, hits, misses, evictions) appear in get_status under schemaCache. |
SN_CAPABILITY_TTL_MS | no | 600000 | How long a successful capability probe is cached — the servicenow_check_capabilities matrix and the plugin-API availability (CI/CD, Code Search, Batch…). Pass refresh: true to re-probe sooner. |
SN_PLUGIN_NEGATIVE_TTL_MS | no | 60000 | How long a failed capability probe (HTTP 401/403/404/5xx) or a missing plugin API is cached before it is tried again. Transport errors are never cached. |
SN_MAX_CONCURRENT | no | 4 | Maximum parallel HTTP requests to the instance (simple in-process semaphore). |
SN_MAX_QUEUE | no | 64 | 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 | 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) | 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 | 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. |
SN_INCLUDE_REF_LINKS | no | false | Reference fields come back without their link URLs by default (token savings). Set true to include them. |
SN_RESULT_PRETTY | no | false | Tool results are compact JSON by default (pretty-printing ~doubles tokens). Set true for indented output. |
SN_DOCS_DIR | no | docs/instance | Directory the docs package reads/writes Markdown in. Relative paths resolve against the working directory. It also holds the per-profile write journal — add docs/instance/ to .gitignore in any repository you run the server from. |
SN_DOCS_MAX_FILE_BYTES | no | 5242880 | Per-file size cap for the docs tools: larger writes are refused, reads return the first bytes with truncated: true, search skips the file. |
SN_DOCS_STALE_DAYS | no | 30 | servicenow_docs_list flags a generated document stale when its sn_generated_at is older than this many days. |
SN_DOCS_SEARCH_MAX | no | 200 | Most matches servicenow_docs_search returns; past it the result carries truncated: true. |
SN_DIAGRAM_MAX_NODES | no | 200 | Node cap for the generated Mermaid diagrams (table flow, event trace, where-used; tables in a detailed ER diagram). Nodes past it fold into one +N more node. |
SN_SDK_MANAGED_SCOPES | no | — | P-3: comma/space-separated application scopes (namespace such as x_acme_app, or the sys_scope sys_id) you declare as managed by a ServiceNow SDK (Fluent) project. The highest source of authority for SDK-managed detection; listed in get_status / check_capabilities under sdkManaged. |
SN_SDK_MANAGED_WRITES | no | warn | P-22: writes into an SDK-managed scope (a record whose sys_scope P-3 detects as SDK-managed) from create_record, update_record, upsert_record, delete_record, set_property and revert_write: warn previews and applies with an sdkManaged block naming the Fluent alternative; deny refuses the apply with SDK_MANAGED_SCOPE (the plan says would_refuse); allow skips the check. Runs after the table policy and costs nothing unless SN_SDK_MANAGED_SCOPES or SN_SDK_PROJECT_DIRS is set. |
SN_SDK_PROJECT_DIRS | no | — | P-3: directories (separated by commas or the platform path delimiter) scanned read-only for SDK projects: each now.config.json declares its scope / scopeId as SDK-managed. Bounded (depth 4, 2000 directories, 100 config files, 256 KiB per file), never follows symbolic links, skips hidden, node_modules and build folders, and reads nothing but now.config.json. |
SN_CODESEARCH | no | false | 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_PROFILE_<NAME>_* | no | — | 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. |
SN_ACTIVE_PROFILE | no | default | Which profile tools use. Switch at runtime with servicenow_use_instance (persisted to the env file). |
Two-axis access policy
Access is controlled on two independent axes: tables and tool packages.
| Axis | Enable / deny / read-only | Example |
|---|---|---|
| Tables | SN_TABLES_ALLOW / SN_TABLES_DENY / SN_READONLY | SN_TABLES_DENY=change_request blocks the Table API and (since H-4) the Change tools, which check their backing table. |
| Packages | SN_TOOL_PACKAGES / SN_PACKAGES_DENY / SN_PACKAGES_READONLY | SN_PACKAGES_DENY=change removes the Change Management tools and blocks the sn_chg_rest plugin API, also inside a batch. |
Since H-4 the plugin-backed tools (Change, Catalog, Knowledge, Email, ATF) and attachments (through the parent record's table) obey the table axis too; the package axis still removes whole surfaces. See Security notes for the full model (including how the Batch API obeys both axes).
List syntax: table lists (SN_TABLES_ALLOW / SN_TABLES_DENY) are
comma-separated; package lists (SN_TOOL_PACKAGES, SN_PACKAGES_DENY,
SN_PACKAGES_READONLY) accept commas or whitespace. Surrounding spaces are
trimmed in both, and table matching is case-insensitive — so
SN_TABLES_DENY=Change_Request, sys_user works. Since H-11 a table entry may be
a pattern (* any run, ? one character): SN_TABLES_DENY=sys_* blocks
sys_user and leaves incident alone. The order is: an exact deny, an exact
allow, a pattern deny, the protected tables (writes, with
SN_PROTECTED_TABLES_WRITE=deny), then the allowlist's patterns. Ask
servicenow_explain_policy({table, action}) which rule decides, or read
servicenow://policy.
Run / debug
- VS Code: open the Command Palette and start the server defined in .vscode/mcp.json, then use it from Chat.
- MCP Inspector:
npm run inspector - Directly:
npm start
Observability
-
Status.
servicenow_get_statuscarries anobservabilityblock: per-tool{count, errors, p50, p95, totalMs}(percentiles in ms over each tool's last 256 calls — memory stays bounded), schema-cache hits/misses, per-host retry counters, queue limits and occupancy, circuit-breaker state and the lastX-RateLimit-*headers each host sent. It never calls the instance. -
Logs. Logs go to stderr only (stdout is the MCP protocol).
SN_LOG_FORMAT=textswitches from JSON lines to a human-readable format;SN_LOG_FILEalso appends JSON lines to a size-rotated file. Credential-named fields (password,token,authorization, …) are masked in every sink, and theSN_REDACT_FIELDS/SN_REDACT_PIIrules apply on top. -
Tracing hooks. The request loop publishes on
node:diagnostics_channel, so an OpenTelemetry (or any) subscriber can attach without a dependency on this server:Channel When Message fields servicenow-mcp:http.request.starta logical request begins id,system,method,host,telemetryKey,url, andprofile/requestId/sessionId/toolin a callservicenow-mcp:http.request.endit resolved with an OK response the start fields plus status,attempts,msservicenow-mcp:http.request.errorit failed the start fields plus attempts,ms,status,code,errorName,errorMessageservicenow-mcp:http.request.retryan attempt is replayed (backoff, 401 re-auth) id,system,method,host,url,attempt,reason,waitMsurlnever includes the query string; headers, bodies and credentials are never published, anderrorMessagepasses through the redaction rules. -
Prometheus. With the HTTP transport,
SN_METRICS=1andSN_HTTP_TOKENset,GET /metrics(same bearer token) serves the same figures in the Prometheus text format (servicenow_mcp_*families, labelled bytool/hostonly). Without a token the endpoint stays off and a warning is logged.
Command-line interface
The published servicenow-mcp-ai binary (run it directly, or via
npx servicenow-mcp-ai) starts the MCP server when it is given no command, and
otherwise runs one of the commands below and exits. Connection settings come from
environment variables / the env file (see Environment variables).
servicenow-mcp-ai --help lists everything; --version prints the version. An
unknown command or option prints the usage on stderr and exits 2 — it never
starts the server.
| Command | Options | What it does | Exit codes |
|---|---|---|---|
servicenow-mcp-ai | (none) | Starts the MCP server. The transport (stdio default, or http) is chosen by SN_TRANSPORT; runs until SIGINT/SIGTERM. stdout is the protocol channel. | 0 clean shutdown · 1 fatal startup error |
servicenow-mcp-ai init | --profile <name>, --skip-doctor | Interactive setup: asks for the instance, the auth method and its credentials (secrets through a hidden prompt), writes the env file, then runs doctor. | the doctor exit code · 0 with --skip-doctor · 2 refused / invalid answers |
servicenow-mcp-ai doctor | --json, --ascii, --profile <name> | Health check: credentials, a live connectivity probe and the capability preflight. The first line names the env file that was used. | 0 healthy · 1 degraded or unreachable · 2 not configured |
servicenow-mcp-ai login | --profile <name> | One-time OAuth 2.1 Authorization Code + PKCE login: opens the browser, captures the loopback redirect, stores a refresh token. | 0 success · 1 login failed |
servicenow-mcp-ai drift <profileA> <profileB> | (none) | DF-3 CI drift gate: compares the two instances and writes a Markdown diff report. | 0 no drift · 1 drift found · 2 usage / error |
servicenow-mcp-ai support-bundle | --out <file>, --profile <name> | Writes one JSON file for a bug report and prints its path on stdout. | 0 written · 1 write failed |
init writes through the same atomic, owner-only (0600) env-file writer as
servicenow_set_credentials, to the file doctor names (by default
~/.config/servicenow-mcp-ai/.env). It asks, in order: the instance (dev12345
or a full host; a custom domain needs SN_ALLOWED_HOSTS), the auth method
(basic / oauth / apikey / token), then that method's settings — for
oauth the grant (client_credentials, password, or authorization_code,
which ends with a hint to run login). Secrets are never echoed or logged; the
summary lists key names only. With --profile qa the keys are written as
SN_PROFILE_QA_*. An existing profile is overwritten only after a y. The
answers can be piped, one per line, which is how CI and tests drive it:
printf 'dev12345\nbasic\nalice\n%s\n' "$SN_PASSWORD" | npx servicenow-mcp-ai init
Without a terminal and without piped answers, init refuses (exit 2) and
writes nothing.
doctor prints plain ASCII ([ok] / [x] instead of check marks) with
--ascii, when stdout is not a terminal, and on Windows outside Windows Terminal.
--json prints one JSON document instead: envFile, status, summary,
checks[] (name, ok, detail), config, connection, capabilities and
serverStatus (the servicenow_get_status payload) — for example
servicenow-mcp-ai doctor --json | jq .checks. The exit codes are the same.
support-bundle collects the doctor --json payload, every SN_* setting
with secrets masked as ***, npm ls --omit=dev (best effort), the tool
manifest summary (version, tool and package counts, active tools) and the last
200 lines of SN_LOG_FILE when one is set. Every masked value is also scrubbed
from the whole file. The default path is
./servicenow-mcp-ai-support-<timestamp>.json (mode 0600). Instance and user
names are not masked — review the file before you attach it to an issue.
login operates on the active profile (SN_ACTIVE_PROFILE, default
default) and reads, for that profile:
SN_INSTANCE— required; the target instance.SN_OAUTH_CLIENT_ID— required; client id of an Authorization Code OAuth API endpoint.SN_OAUTH_CLIENT_SECRET— optional; for a confidential client.SN_OAUTH_REDIRECT_URI— optional; loopback URL, defaulthttp://localhost:53682/callback. Must match the redirect registered on the endpoint.SN_OAUTH_SCOPE— optional; requested OAuth scope.
On success it writes SN_AUTH=oauth, SN_OAUTH_GRANT=refresh_token and
SN_OAUTH_REFRESH_TOKEN back to the env file (profile-prefixed when the profile
is not default). The authorization URL is printed on stderr in case the browser
does not open automatically.
drift takes two positional profile names; each must resolve to a configured
profile (SN_PROFILE_<NAME>_*, or the bare SN_INSTANCE / SN_USER /
SN_PASSWORD keys for default). The Markdown report is written to stdout
(capture it as a CI artifact); a one-line drift summary goes to stderr.
CI drift gate (DF-3)
Compare two configured profiles and fail a pipeline on configuration drift:
servicenow-mcp-ai drift dev prod # report on stdout; exit 1 on drift, 0 if clean, 2 on error
The report shows each changed script as a diff block. The CLI compares tables,
columns, scripts, plugins and apps; record sections (sections on
servicenow_compare_instances) are opt-in, so the exit codes are unchanged.
servicenow_snapshot_instance writes the same material to the docs folder, one
file per section, at most four sections at a time. An interrupted run is marked
partial in index.json; rerun it with resume: true to skip every section whose
files are unchanged.
Develop
npm run check # full gate: build, lint, format check, coverage-gated tests, tarball guard, prod audit
npm test # unit tests only (node:test; needs a prior npm run build)
npm run lint # ESLint (flat config + typescript-eslint)
npm run format # format with Prettier
See CONTRIBUTING.md for the conventions (one commit per task, tests ship with the change, generated docs).
Tools
This table is generated from the tool registrations — edit the tool
definitions in src/tools/, then run npm run docs:readme.
| Package | Tool | Read-only | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
table | servicenow_query_table | yes | Read records from any table (Table API): encoded query, fields, paging, fetchAll | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
table | servicenow_get_record | yes | Read a single record from a table by its sys_id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
table | servicenow_create_record | no | Create a new record in a table with the given field values | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
table | servicenow_update_record | no | Update fields on an existing record identified by its sys_id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
table | servicenow_upsert_record | no | Create or update one record matched by an exact key of field/value pairs: no match creates, one updates, se… | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
table | servicenow_delete_record | no | Delete a record from a table by its sys_id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
schema | servicenow_list_tables | yes | List tables from sys_db_object, optionally filtered by a name or label fragment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
schema | servicenow_describe_table | yes | List a table's columns from sys_dictionary (name, label, type, mandatory, reference, default, read-only/uni… | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
aggregate | servicenow_aggregate | yes | Compute server-side aggregates (count, avg, min, max, sum) over a table via the Stats API, with optional gr… | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
attachment | servicenow_list_attachments | yes | List attachment metadata, optionally scoped to a specific record (table + sys_id) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
attachment | servicenow_get_attachment | yes | Read a single attachment's metadata by its sys_id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
attachment | servicenow_download_attachment | yes | Download an attachment's bytes, returned as base64 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
attachment | servicenow_upload_attachment | no | Attach a file (provided as base64) to a record identified by table + sys_id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
attachment | servicenow_delete_attachment | no | Delete an attachment by its sys_id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
importset | servicenow_insert_import_set_row | no | Insert one row into a staging table and run its transform map | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
importset | servicenow_get_import_set_row | yes | Read the transform outcome for a previously inserted staging row by its sys_id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
batch | servicenow_batch | no | Execute several ServiceNow REST sub-requests in a single HTTP round-trip via the Batch API | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
catalog | servicenow_list_catalogs | yes | List the Service Catalogs available on the instance (Service Catalog API) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
catalog | servicenow_list_catalog_categories | yes | List the categories within a service catalog | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
catalog | servicenow_list_catalog_items | yes | Search/list orderable catalog items, optionally by text or category | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
catalog | servicenow_get_catalog_item | yes | Get a catalog item, including its order variables, by sys_id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
catalog | servicenow_order_catalog_item | no | Order a catalog item directly ('order now') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
change | servicenow_list_changes | yes | List change requests through the Change Management API | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
change | servicenow_get_change | yes | Get a single change request by sys_id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
change | servicenow_create_change | no | Create a normal, standard or emergency change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
change | servicenow_update_change | no | Update fields on a change request by sys_id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
change | servicenow_change_conflicts | no | Read schedule conflicts for a change, or recalculate them (calculate=true) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
knowledge | servicenow_search_knowledge | yes | Full-text search of knowledge articles (Knowledge API), with optional encoded query and paging | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
knowledge | servicenow_get_knowledge_article | yes | Get a knowledge article (content and metadata) by sys_id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
knowledge | servicenow_knowledge_highlights | yes | List featured or most-viewed knowledge articles for the current user | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cmdb | servicenow_list_cis | yes | List configuration items of a CMDB class through the class-aware CMDB Instance API | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cmdb | servicenow_get_ci | yes | Get a CI with its attributes and inbound/outbound relations by class and sys_id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cmdb | servicenow_create_ci | no | Create a CI via the CMDB Instance API (routed through Identification & Reconciliation) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cmdb | servicenow_update_ci | no | Update a CI's attributes via the CMDB Instance API (IRE) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cmdb | servicenow_get_cmdb_meta | yes | Get the schema/metadata of a CMDB class (attributes, relationship rules) from the CMDB Meta API | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cmdb | servicenow_list_ci_relations | yes | List the relationships of one CI from cmdb_rel_ci, each oriented from that CI (outbound = it is the parent,… | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cmdb | servicenow_identify_reconcile | no | Send CIs and relationships through the Identification & Reconciliation Engine (/api/now/identifyreconcile),… | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
scripts | servicenow_list_scripts | yes | List script artefacts of one type as compact metadata (no source code); 'type' lists the standard and opt-i… | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
scripts | servicenow_get_script | yes | Read one script artefact in full, including its source code and execution context | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
scripts | servicenow_search_code | yes | Search script source for a literal substring across one or all script types | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
scripts | servicenow_table_logic | yes | Assemble the automation that runs on a table: business rules (ordered by when+order), client scripts, UI po… | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
scripts | servicenow_where_used | yes | Find references to a table, field (table.field) or script: matching lines in script sources, rules/ACLs att… | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flows | servicenow_trace_table_event | yes | Trace what would run for a table operation, in order, without executing: display/before/after/async busines… | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flows | servicenow_list_flows | yes | List Flow Designer flows (sys_hub_flow) or legacy workflows (kind: 'workflow') as compact metadata | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flows | servicenow_get_flow | yes | Get a structured view of one flow or workflow: its trigger (table/condition/when) and ordered steps | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flows | servicenow_get_flow_runs | yes | Read flow execution evidence from sys_flow_context — by flow sys_id or by the record (document) it ran agai… | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flows | servicenow_explain_flow | yes | Explain a flow/subflow (trigger, step tree with decoded inputs and pills, subflow/action calls expanded, dr… | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
codecheck | servicenow_lint_script | yes | Run deterministic code-quality rules over one script artefact (hard-coded sys_ids/URLs, unbounded or in-loo… | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
codecheck | servicenow_lint_table | yes | Lint every active business rule, client script and UI policy of a table (via table_logic), returning per-sc… | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
codecheck | servicenow_code_health | no | Code-health report: script counts by type, ACL security scan (open, public-role, scripted, elevated ACLs, p… | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
docs | servicenow_docs_list | yes | List the Markdown documents in the local instance-documentation folder (SN_DOCS_DIR), with per-file metadat… | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
docs | servicenow_docs_read | yes | Read one Markdown document or generated .json companion from the local instance-documentation folder; the r… | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
docs | servicenow_docs_search | yes | Search the local instance documentation for a substring; returns a snippet and the nearest heading per matc… | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
docs | servicenow_docs_write | no | Create or overwrite a Markdown document in the local docs folder and refresh index.md | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
docs | servicenow_generate_er_diagram | yes | Build a Mermaid erDiagram from sys_dictionary: an entity per table, a relationship per reference field | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
docs | servicenow_generate_table_flow | yes | Mermaid flowchart of a record's lifecycle on a table: active business rules by phase (display/before/after/… | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
docs | servicenow_document_table | no | Write /tables/.md + .json from metadata only: inheritance, columns, referencing columns, ER…
|