Skip to main content

servicenow-platform-mcp banner

PyPI version Python versions License

servicenow-platform-mcp

A comprehensive Model Context Protocol (MCP) server for ServiceNow. Provides 14 unified tools in 11 tool groups for platform introspection, change intelligence, debugging, record management, and automated investigations.

Quick Start

1. Set environment variables:

export SERVICENOW_INSTANCE_URL=https://your-instance.service-now.com
export SERVICENOW_USERNAME=admin
export SERVICENOW_PASSWORD=your-password

2. Run the server:

uvx servicenow-platform-mcp

3. Connect your MCP client (see Configuration below).

Configuration

OpenCode

Add to ~/.config/opencode/opencode.json:

{
  "mcp": {
    "servicenow": {
      "type": "local",
      "command": ["uvx", "servicenow-platform-mcp"],
      "environment": {
        "SERVICENOW_INSTANCE_URL": "https://your-instance.service-now.com",
        "SERVICENOW_USERNAME": "admin",
        "SERVICENOW_PASSWORD": "your-password"
      }
    }
  }
}

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "servicenow": {
      "command": "uvx",
      "args": ["servicenow-platform-mcp"],
      "env": {
        "SERVICENOW_INSTANCE_URL": "https://your-instance.service-now.com",
        "SERVICENOW_USERNAME": "admin",
        "SERVICENOW_PASSWORD": "your-password"
      }
    }
  }
}

VS Code / Cursor

Add to .vscode/mcp.json:

{
  "servers": {
    "servicenow": {
      "command": "uvx",
      "args": ["servicenow-platform-mcp"],
      "env": {
        "SERVICENOW_INSTANCE_URL": "https://your-instance.service-now.com",
        "SERVICENOW_USERNAME": "admin",
        "SERVICENOW_PASSWORD": "your-password"
      }
    }
  }
}

Generic stdio

SERVICENOW_INSTANCE_URL=https://your-instance.service-now.com \
SERVICENOW_USERNAME=admin \
SERVICENOW_PASSWORD=your-password \
uvx servicenow-platform-mcp

Environment Variables

Variable Description Default Required
SERVICENOW_INSTANCE_URL Full URL (must start with https://) - Yes
SERVICENOW_API_KEY ServiceNow API key; replaces Basic Auth when set - Conditional
SERVICENOW_USERNAME ServiceNow username for Basic Auth - Conditional
SERVICENOW_PASSWORD ServiceNow password for Basic Auth - Conditional
MCP_TOOL_PACKAGE Tool package to load (full, readonly, core_readonly, none) full No
SERVICENOW_ENV Environment label (dev/test/staging/prod) dev No
MAX_ROW_LIMIT Max rows per query (1-10000) 100 No
LARGE_TABLE_NAMES_CSV Tables requiring date filters syslog,sys_audit,sys_log_transaction,sys_email_log No
SCRIPT_ALLOWED_ROOT Root dir for script_path in artifact write "" (disabled) When using script_path
HTTPX_TIMEOUT_SECONDS ServiceNow HTTP timeout in seconds (1-600) 30 No
METADATA_CACHE_TTL_SECONDS Freshness window for choices, dictionary metadata, and audit configuration 300 seconds No
SENTRY_DSN Sentry DSN for error reporting "" No
SENTRY_ENVIRONMENT Sentry environment label Falls back to SERVICENOW_ENV No

The server reads from .env and .env.local files automatically.

AI Agent Setup

Copy and paste this prompt to your AI agent (Claude Code, Cursor, OpenCode, etc.):

Install and configure servicenow-platform-mcp by following the instructions here:
https://raw.githubusercontent.com/Xerrion/servicenow-platform-mcp/refs/heads/main/INSTALL.md

Or read the Installation Guide directly. For usage examples and patterns, see Agent Recipes.

Key Features

  • Platform Introspection - Describe table schemas with describe and query records with query using encoded queries.
  • Record Management - Unified record_write and record_apply tools for create, update, and delete. Writes use preview-then-apply by default; callers can explicitly set preview=false for an immediate write.
  • Script-Bearing Records - Write Business Rules, Script Includes, UI Pages, Widgets, UI Macros, ACLs, and any other table whose dictionary fields carry executable script or markup, all via record_write with local script file support and per-field targeting (script_field). Script fields are discovered at runtime from sys_dictionary — no hardcoded artifact catalog. Read the same surface back via record_read, or enumerate a table's script fields with describe(action='list_script_fields', table='<table>').
  • Attachment Operations - Unified attachment for read operations and attachment_write for mutations.
  • Investigations - Automated analysis of system health, stale automations, performance bottlenecks, and more via investigate.
  • Label Resolution - Map human-readable choice labels to underlying values automatically with resolve_choice.
  • Service Catalog - Dispatcher-based service_catalog tool for browsing and ordering.

Example Usage

Describe a Table

await describe(table="incident")

Query Records

# Fetch high priority incidents using an encoded query
await query(
    table="incident",
    encoded_query="active=true^priority=1",
    fields="number,short_description,priority"
)

List mode requires an explicit field projection. Use a small field set for normal reads. Use fields="*" only when the full record is intentional. sys_id is always included. Successful responses include selection metadata describing the projection.

Tool Packages

Control which tools are loaded with MCP_TOOL_PACKAGE.

Package Tools Description
full 14 All unified tools, including audit, flow, and code_search (default)
readonly 11 Includes record_read, audit, flow, code_search, and attachment_write (write_gate blocks in prod)
core_readonly 5 Minimal read surface (includes attachment_write)
none 1 Just list_tool_packages

Custom packages are supported via comma-separated tool names: MCP_TOOL_PACKAGE="query,describe,attachment".

Safety

  • Table Deny List - Blocks access to sensitive system tables (sys_user_has_password, sys_credentials, etc.).
  • Sensitive Field Masking - Passwords, tokens, and secrets are automatically masked in responses.
  • Write Gating - All mutations are blocked when SERVICENOW_ENV is set to prod or production.
  • Query Safety - Enforces row limits and mandatory date filters on high-volume system tables.

These guardrails reduce risk but are not a guarantee - always validate in a sub-production environment.

See the Safety & Policy wiki page for complete details.

Development

git clone https://github.com/Xerrion/servicenow-platform-mcp.git
cd servicenow-platform-mcp
uv sync --group dev
uv run pytest                  # Run tests
uv run ruff check .            # Lint
uv run ruff format .           # Format
uv run mypy src/               # Type check

License

MIT

Release files for servicenow-platform-mcp 0.11.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for servicenow-platform-mcp 0.11.0
File Size Uploaded
servicenow_platform_mcp-0.11.0.tar.gz 326.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for servicenow-platform-mcp 0.11.0
File Interpreter ABI Platform
servicenow_platform_mcp-0.11.0-py3-none-any.whl Python 3 none any Details

Total release size: 454.3 kB

Release files / servicenow_platform_mcp-0.11.0.tar.gz

Download URL servicenow_platform_mcp-0.11.0.tar.gz
Size 326.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7597fb9ee58f60e0744152235584f23e9a891b0f38372e2066317f803422d148
BLAKE2b-256 checksum
How to use checksums
f1ee028ec50d49dffe3e95a2e0d36d837da74589558f87748b3b58298b2cfec7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / servicenow_platform_mcp-0.11.0-py3-none-any.whl

Download URL servicenow_platform_mcp-0.11.0-py3-none-any.whl
Size 128.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c57fe8f2b345c41b36b826bbd7d69c020658cbf45e5794560f03265fd473ddaa
BLAKE2b-256 checksum
How to use checksums
114f7a6f92363e846966f7b75cdf9d644cf934758af9e7777b262d3315abc715
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

2.1.0

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.0.0

2 release files

This release

0.11.0 This release

2 release files

0.10.0

2 release files

0.9.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page