Skip to main content
Glama
darrylsarkisian-debug

ServiceNow MCP Demo — Incident Assistant

ServiceNow MCP Demo — Incident Assistant

一个端到端的 Model Context Protocol 演示,将 Claude 连接到 ServiceNow Incident Management。项目旨在展示 MCP 核心概念(servers、clients、tools、resources、stdio transport、agent loops)如何应用于真实的 ITSM 工作流。

架构

┌─────────────────────────────┐        ┌───────────────────────────────┐        ┌────────────────┐
│  Web Client (Streamlit)     │  MCP   │  MCP Server (FastMCP)         │  REST  │  ServiceNow    │
│  - MCP host + client        │◄──────►│  - create_incident            │◄──────►│  Table API     │
│  - Claude agent loop        │ stdio  │  - get_incident               │        │  (or mock mode)│
│  - Incident cards in UI     │JSON-RPC│  - list_recent_incidents      │        │                │
│                             │        │  - update_incident_state      │        │                │
│                             │        │  - resolve_incident           │        │                │
│                             │        │  - search_knowledge_articles  │        │                │
│                             │        │  - resource: priority         │        │                │
│                             │        │    matrix reference           │        │                │
└─────────────────────────────┘        └───────────────────────────────┘        └────────────────┘

“我的笔记本电脑无法启动,帮我开一张工单”的处理流程:

  1. Web 客户端将你的消息连同它在启动时从 MCP 服务器发现到的工具 schema(tools/list)一起发送给 Claude。

  2. Claude 决定调用 create_incident,并传入推断出的 urgency/impact/category。

  3. 客户端通过 MCP(tools/call)转发该调用;服务器调用 ServiceNow Table API(或内存 mock)。

  4. 结果返回后,Claude 确认事件编号;UI 渲染出事件卡片。

Related MCP server: ServiceNow MCP Server (SSE)

快速开始

# 1. Create a virtual environment
python -m venv .venv
source .venv/bin/activate        # Windows: .venv\Scripts\activate

# 2. Install dependencies
pip install -r requirements.txt

# 3. Configure
cp .env.example .env             # then edit: add your ANTHROPIC_API_KEY
                                 # leave SERVICENOW_MODE=mock for a no-setup demo

# 4. Run the web client (it launches the MCP server automatically)
streamlit run client/app.py

打开 http://localhost:8501,然后试试:

  • “我的笔记本电脑无法启动,一小时后我还有客户演示——帮我开一张工单。”

  • “显示最近 5 条事件。”

  • “将 INC0010001 移至 In Progress,并附上一条 work note,说明技术人员已在上门途中。”

  • “有没有关于笔记本电脑无法开机的 KB 文章?”

  • “修好了——解决 INC0010001,标记为 solved permanently,已更换充电器。”

ServiceNow 实时模式

  1. https://developer.servicenow.com 申请一个免费的 Personal Developer Instance(PDI)(约需 ~2 分钟)。

  2. .env 中设置 SERVICENOW_MODE=live,并填写 SERVICENOW_INSTANCESERVICENOW_USERSERVICENOW_PASSWORD

  3. 重启应用。创建的事件会出现在你的 PDI 的 Incident > All 中——非常适合在演示期间在真实的 ServiceNow UI 里展示工单。

PDI 闲置一段时间后会休眠。请在面试前 ~15 分钟唤醒你的实例,并把 mock 模式留作后备方案。

search_knowledge_articles 会直接查询 PDI 的 kb_knowledge 表——在实时模式下演示之前,请先在那里预置 2–3 篇已发布的 KB 文章,标题要与你的演示场景相匹配(例如“笔记本电脑无法开机”),否则实时搜索会返回空结果。mock 模式自带 3 篇预置文章,开箱即用。

单独测试服务器(无 UI)

MCP Inspector 是证明服务器能独立工作的最快方式:

npx @modelcontextprotocol/inspector python server/servicenow_server.py

你也可以将服务器添加到 Claude Desktopclaude_desktop_config.json):

{
  "mcpServers": {
    "servicenow": {
      "command": "python",
      "args": ["/absolute/path/to/server/servicenow_server.py"]
    }
  }
}

项目结构

servicenow-mcp-demo/
├── server/servicenow_server.py   # FastMCP server: 6 tools + 1 resource, mock/live backends
├── client/app.py                 # Streamlit web app: MCP client + Claude agent loop
├── requirements.txt
├── .env.example
├── PROJECT_PLAN.md               # Phase-by-phase build plan and status
└── DEMO_SCRIPT.md                # 5-minute recorded-demo script

演示的 MCP 概念

  • Server:使用 FastMCP 构建,工具带有类型化参数,schema 由 docstring 驱动

  • Resourceservicenow://reference/priority-matrix)——只读上下文,与 tools 不同

  • stdio transport——客户端启动服务器子进程,并通过 JSON-RPC 通信

  • Capability discovery——客户端从不硬编码工具,而是调用 tools/list

  • Agent loop——与 Claude 进行多轮工具调用,直到得到最终文本回答

  • Separation of concerns——同一个服务器无需任何修改,即可用于这个 Web 客户端、Claude Desktop 或 MCP Inspector

Maintenance

ActivityMaintained
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol server that enables AI assistants and development tools to interact with ServiceNow instances, providing comprehensive API coverage for incident management, change management, CMDB, and other ServiceNow modules.
    3
    MIT
  • F
    license
    Not graded
    quality
    B
    maintenance
    A local gateway that exposes ServiceNow REST APIs as MCP tools, enabling natural language interaction with ServiceNow incidents, changes, CMDB, and scripts via Claude and other MCP clients.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/darrylsarkisian-debug/servicenow-mcp-demo'

If you have feedback or need assistance with the MCP directory API, please join our Discord server