ServiceNow CMDB MCP Server

ServiceNow CMDB MCP Server

Connects AI assistants to ServiceNow CMDB via natural language, enabling querying, dependency analysis, health auditing, CI lifecycle management, and configurable inspection.

Category
访问服务器

README

ServiceNow CMDB MCP Server

A Python MCP server that connects AI assistants (Claude Code, Claude Desktop, Cursor) to a ServiceNow CMDB instance via natural language. Enables querying, dependency analysis, health auditing, CI lifecycle management, and configurable inspection — all through the Model Context Protocol.

What makes this different

  • Deep CMDB focus with relationship traversal, impact analysis, path finding, and dependency mapping
  • display_value support — reference fields return human-readable names, not opaque sys_ids
  • ASCII tree visualization for dependency graphs directly in the terminal
  • Dynamic schema powered by the Data Model Navigator plugin (no hardcoded class hierarchies)
  • Full configurable inspection (business rules, flows, flow logic, client scripts, script includes, ACLs) with credential redaction
  • Discovery, IRE rules, and import set visibility
  • Two-phase write confirmation for safe CI mutations
  • Rich server instructions that guide LLM behavior (workflow patterns, smart defaults, disambiguation)
  • Tool annotations for smart auto-approval in Claude Code

Requirements

  • Python 3.11+
  • uv package manager
  • ServiceNow instance (Xanadu+) with an OAuth 2.0 application and service account

Setup

  1. Clone the repository and install dependencies:
uv sync
  1. Copy .env.example to .env and fill in your ServiceNow credentials:
cp .env.example .env
SN_INSTANCE_URL=https://your-instance.service-now.com
SN_CLIENT_ID=your-oauth-client-id
SN_CLIENT_SECRET=your-oauth-client-secret
SN_USERNAME=your-service-account
SN_PASSWORD=your-password
  1. Run the server:
uv run servicenow-cmdb-mcp

Claude Code integration

Add to your .mcp.json in the project root:

{
  "mcpServers": {
    "servicenow-cmdb": {
      "command": "uv",
      "args": ["run", "servicenow-cmdb-mcp"],
      "cwd": "/path/to/mcp-cmdb",
      "env": {
        "SN_INSTANCE_URL": "https://your-instance.service-now.com",
        "SN_CLIENT_ID": "your-oauth-client-id",
        "SN_CLIENT_SECRET": "your-oauth-client-secret",
        "SN_USERNAME": "your-service-account",
        "SN_PASSWORD": "your-password"
      }
    }
  }
}

Recommended ServiceNow roles

The service account needs these roles for full functionality:

Role What it unlocks
cmdb_read CMDB CI queries, relationships, health tools
itil Standard ITSM tables, basic platform access
fd_read Flow Designer read access (flow details, triggers)
personalize Client scripts, UI policies

Optional roles for deeper inspection:

Role What it unlocks
flow_designer Flow overview listing
script_include_admin Script include read access
business_rule_admin Business rule scripts

Tools (38 total)

Domain Tools Description
Queries search_cis, query_cis_raw, get_ci_details, count_cis, suggest_table, list_ci_classes, describe_ci_class Search, inspect, and explore CMDB classes. Supports display_value for human-readable reference fields
Relationships get_ci_relationships, find_related_cis, list_relationship_types, get_dependency_tree, get_impact_summary, find_ci_path Traverse CI relationships, visualize dependency trees (ASCII format), find shortest paths between CIs. Supports class_filter to focus on specific CI types
Health find_orphan_cis, find_duplicate_cis, find_stale_cis, cmdb_health_summary Audit CMDB data quality
Mutations preview_ci_create, confirm_ci_create, preview_ci_update, confirm_ci_update Safe two-phase CI writes
Configurables get_business_rules, get_flows, get_flow_details, get_client_scripts, get_acls, get_script_includes, analyze_configurables Inspect automation, flow logic, and security config
Discovery list_discovery_schedules, get_discovery_status, get_discovery_errors Monitor discovery operations
IRE get_identification_rules, get_reconciliation_rules, explain_duplicate Inspect identification and reconciliation
Imports list_data_sources, get_import_set_runs, get_transform_errors Monitor data imports and transforms
Utilities check_connection, refresh_metadata_cache, _diag_probe_table Connectivity check, cache management, table access diagnostics

Key features

Display values

Query tools support display_value="true" to return human-readable names instead of sys_ids for reference fields (location, assigned_to, company, etc.).

Tree visualization

get_dependency_tree supports format="ascii_tree" to return pre-rendered text trees, and class_filter to show only specific CI types (e.g., servers only, no disks/memory).

Flow inspection

get_flow_details parses the internal label_cache from Flow Designer to show flow triggers, steps, referenced tables, and data flow — without needing admin access.

Path finding

find_ci_path finds the shortest relationship path between any two CIs using BFS traversal.

Development

# Run unit tests
uv run pytest tests/ -v

# Run smoke tests (requires live ServiceNow instance)
uv run python smoke_tests/smoke_test.py

# Type check
uv run mypy src/

# Lint
uv run ruff check src/

# Fallback if uv run fails with "file in use" on Windows
.venv/Scripts/python.exe -m pytest tests/ -v

Architecture

See ARCHITECTURE.md for the full design document covering authentication, security, tool patterns, and API usage.

Tech stack

  • FastMCP (mcp[cli]) — MCP server framework with decorator-based tool registration
  • httpx — Async HTTP client for ServiceNow REST APIs
  • pydantic / pydantic-settings — Configuration and validation
  • OAuth 2.0 — Password grant against ServiceNow /oauth_token.do
  • STDIO transport — Local deployment for Claude Code / Claude Desktop / Cursor

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选