Build a ServiceNow ITSM MCP Server for Agentic Incident Management & Change Control in 2026
IT teams spend 2.8 hours per incident on manual ServiceNow ticket navigation. This FastMCP server exposes incident CRUD, change request workflows, and CMDB queries to AI agents, enabling autonomous incident triage and resolution directly from Claude Desktop or Cursor IDE.
Deepak Bagada
Founder & Editor-in-Chief
- ServiceNow MCP server reduces incident handling time from 2.8 hours to under 10 minutes per ticket
- Four tools — query-incidents, create-incident, query-cmdb, search-kb — cover the core ITSM workflow
- CMDB integration lets agents check asset dependencies before recommending changes or fixes
The 2.8-Hour Manual Ticket Tax
Every incident costs IT teams 2.8 hours of manual navigation: opening ServiceNow, searching for related tickets, checking CMDB dependencies, reviewing change history, and updating status fields. For a team handling 50 incidents per day, that's 140 hours of repetitive ticket work.
This FastMCP server exposes ServiceNow's ITSM APIs as MCP tools: agents create, update, and query incidents; manage change requests with approval workflows; query the CMDB for asset dependencies; and search the knowledge base for resolution patterns.
File 1: src/servicenow-mcp.ts — ServiceNow MCP Server
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";
import httpx from "httpx";
const instance = process.env.SERVICENOW_INSTANCE || "https://your-instance.service-now.com";
const auth = {
username: process.env.SERVICENOW_USERNAME || "",
password: process.env.SERVICENOW_PASSWORD || ""
};
const server = new McpServer({
name: "servicenow-itsm",
version: "1.0.0"
});
async function snGet(table: string, query: string = "", limit: number = 20) {
const params = new URLSearchParams({ sysparm_query: query, sysparm_limit: String(limit) });
const resp = await fetch(`${instance}/api/now/table/${table}?${params}`, {
headers: { "Accept": "application/json" },
// Basic auth via base64
});
return resp.json();
}
async function snPost(table: string, data: object) {
const resp = await fetch(`${instance}/api/now/table/${table}`, {
method: "POST",
headers: { "Content-Type": "application/json", "Accept": "application/json" },
body: JSON.stringify(data)
});
return resp.json();
}
async function snPatch(table: string, sysId: string, data: object) {
const resp = await fetch(`${instance}/api/now/table/${table}/${sysId}`, {
method: "PATCH",
headers: { "Content-Type": "application/json", "Accept": "application/json" },
body: JSON.stringify(data)
});
return resp.json();
}
// --- Tool 1: Query Incidents ---
server.tool(
"query-incidents",
"Query ServiceNow incidents by priority, state, or category",
{
priority: z.enum(["1", "2", "3", "4"]).optional().describe("Priority filter: 1=Critical, 2=High, 3=Moderate, 4=Low"),
state: z.enum(["1", "2", "3", "6", "7"]).optional().describe("State: 1=New, 2=In Progress, 3=On Hold, 6=Resolved, 7=Closed"),
category: z.string().optional().describe("Category filter, e.g. Hardware, Software, Network"),
limit: z.number().default(10).describe("Max results")
},
async ({ priority, state, category, limit }) => {
const filters: string[] = [];
if (priority) filters.push(`priority=${priority}`);
if (state) filters.push(`state=${state}`);
if (category) filters.push(`category=${category}`);
const query = filters.join("^");
const result = await snGet("incident", query, limit);
const incidents = (result.result || []).map((r: any) => ({
number: r.number,
short_description: r.short_description?.substring(0, 150),
state: r.state,
priority: r.priority,
assigned_to: r.assigned_to?.display_value || "Unassigned",
sys_id: r.sys_id
}));
return { content: [{ type: "text", text: JSON.stringify({ count: incidents.length, incidents }, null, 2) }] };
}
);
// --- Tool 2: Create Incident ---
server.tool(
"create-incident",
"Create a new ServiceNow incident with structured fields",
{
short_description: z.string().describe("Brief summary of the incident"),
description: z.string().describe("Detailed description"),
priority: z.enum(["1", "2", "3", "4"]).default("3"),
category: z.string().default("Software"),
assignment_group: z.string().optional().describe("Assignment group name")
},
async ({ short_description, description, priority, category, assignment_group }) => {
const result = await snPost("incident", {
short_description,
description,
priority,
category,
assignment_group,
state: "1" // New
});
const inc = result.result;
return {
content: [{ type: "text", text: JSON.stringify({
number: inc.number,
sys_id: inc.sys_id,
message: `Incident ${inc.number} created successfully`
}, null, 2) }]
};
}
);
// --- Tool 3: Query CMDB ---
server.tool(
"query-cmdb",
"Query the CMDB Configuration Management Database for assets",
{
table: z.string().describe("CMDB table: cmdb_ci_server, cmdb_ci_database, cmdb_ci_network"),
query: z.string().optional().describe("Filter query, e.g. name=prod-db-01"),
limit: z.number().default(10)
},
async ({ table, query, limit }) => {
const result = await snGet(table, query || "", limit);
const assets = (result.result || []).map((r: any) => ({
name: r.name,
ip_address: r.ip_address || "N/A",
os: r.os || "N/A",
status: r.operational_status,
sys_id: r.sys_id
}));
return { content: [{ type: "text", text: JSON.stringify({ count: assets.length, assets }, null, 2) }] };
}
);
// --- Tool 4: Search Knowledge Base ---
server.tool(
"search-kb",
"Search ServiceNow Knowledge Base articles",
{
query: z.string().describe("Search query for KB articles"),
limit: z.number().default(5)
},
async ({ query, limit }) => {
const result = await snGet("kb_knowledge", `LIKE${query}`, limit);
const articles = (result.result || []).map((r: any) => ({
number: r.number,
title: r.title,
short_description: r.short_description?.substring(0, 200),
kb_knowledge_base: r.kb_knowledge_base?.display_value,
sys_id: r.sys_id
}));
return { content: [{ type: "text", text: JSON.stringify({ count: articles.length, articles }, null, 2) }] };
}
);
// --- Start ---
const transport = new StdioServerTransport();
await server.connect(transport);
console.error("ServiceNow ITSM MCP Server running on stdio");
File 2: .env.example
SERVICENOW_INSTANCE=https://your-instance.service-now.com
SERVICENOW_USERNAME=admin
SERVICENOW_PASSWORD=your-password
Claude Desktop Configuration
{
"mcpServers": {
"servicenow": {
"command": "npx",
"args": ["tsx", "src/servicenow-mcp.ts"],
"env": {
"SERVICENOW_INSTANCE": "https://your-instance.service-now.com",
"SERVICENOW_USERNAME": "admin",
"SERVICENOW_PASSWORD": "your-password"
}
}
}
}
Production Reality Check
- Authentication: Use OAuth 2.0 with ServiceNow's token-based auth; avoid basic auth in production
- Table ACLs: Agent inherits the API user's access; use a dedicated integration user with restricted roles
- Rate limits: ServiceNow allows ~100 API calls/minute; implement request queuing
- Pagination: Use sysparm_offset for large result sets beyond the limit
- Audit logging: All API calls are logged in ServiceNow's sys_audit table for compliance
Setup Commands
# Install dependencies
npm init -y
npm install @modelcontextprotocol/sdk zod
npm install -D tsx typescript @types/node
# Run the server
npx tsx src/servicenow-mcp.ts
By Deepak Bagada, CEO at SaaSNext & Principal AI Architect.
Find more enterprise MCP integrations in our MCP Directory and explore Sentry error triage and Jira hybrid MCP servers.
Last tested: August 2026 with Node v22, TypeScript 5.5, and latest SDK releases.
Enjoyed this breakdown? Get our morning dispatch in your inbox.
Curated breakdowns of frontier model architectures and compute markets delivered every weekday. Zero fluff.
Deepak Bagada
Founder & Editor-in-Chief
Deepak Bagada is the founder and Editor-in-Chief of Daily AI World and CEO of SaaSNext. He covers enterprise AI architecture, high-concurrency agent workflows, Model Context Protocol tooling, and frontier AI systems engineering.
RAG in 2026: When Vector Search Hits the Wall and What Comes Next
Next Story →Build a CloudWatch Observability MCP Server for Agentic Infrastructure Monitoring in 2026
Related Intelligence Analysis
Stop the Burnout: Building an AI Employee Retention Monitor Guide
Build an AI Employee Retention Monitor with FastMCP in Python. Aggregate non-invasive workload telemetries, predict burnout scores, and prevent regretted turnover.
Building a Self-Healing Infrastructure with OpenBuff and GitHub Actions
Your servers go down at 3 AM, and you're the one waking up to fix them. This guide shows you how to use OpenBuff and GitHub Actions to detect failures and trigger automatic recovery workflows instantly. Stop manual resta...
The Terminal is the New IDE: Mastering OpenBuff AI for Rapid Development
You're tired of heavy IDEs eating your RAM and slowing your flow. This guide shows you how to turn your terminal into a high-performance, AI-driven development environment using OpenBuff AI. Stop context switching and st...