Skip to main content
Workflows Library MCP Directory Realtime AI News Sponsor Tier Subscribe
Front Page / AI Tools / Deep Dive

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

Deepak Bagada

CEO, SaaSNext

Aug 22, 2026 Published
|
Aug 22, 2026 Updated
|
6 Minutes Reading Time
Core Takeaways for Founders & Builders
  • 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.

Executive Briefing

Enjoyed this breakdown? Get our morning dispatch in your inbox.

Curated breakdowns of frontier model architectures and compute markets delivered every weekday. Zero fluff.

🎉 Thank You for Subscribing!

Frequently Asked Questions
ServiceNow Virtual Agent is chatbot-based with predefined flows. This MCP server exposes raw ITSM APIs to external AI agents like Claude, enabling more flexible, context-aware incident management that can reason across multiple tools and data sources.
This version covers incidents, CMDB, and knowledge base. Change request management requires additional tools for sysapproval_approver workflows. The architecture supports adding these tools with the same snPatch pattern.
ServiceNow Cloud allows 100 API calls per minute per user. For high-volume use cases, implement exponential backoff and request batching. The MCP server should queue requests and process them sequentially to stay within limits.
Deepak Bagada
Author Profile

Deepak Bagada

CEO, SaaSNext

Deepak Bagada is the CEO of SaaSNext and founder of Daily AI World. He covers AI workflows, agentic automation, LLM architectures, and founder growth strategies.

Related Intelligence Analysis

Briefing AI Tools

Vercel AI SDK Tool Calling React: 5 Steps (2026)

Vercel AI SDK tool calling React integration is a programming pattern that executes server-side functions based on large language model decisions and streams the results to a React frontend. By combining streamText with...

Deepak Bagada Deepak Bagada
12m read
Breaking AI Tools

Fact-Density vs. Word Count: The New SEO for 2026

Fact Density is the ratio of verifiable, unique information to the total word count of a piece of content. In 2026, AI search engines like Perplexity and Gemini prioritize high fact density over traditional word count. A...

Deepak Bagada Deepak Bagada
4m read
Audio Briefing
Accessibility Preferences
High Contrast Mode
Accessible Reading Font

Keyboard Shortcuts

Open Search Dialog ⌘K or /
Toggle Theme (Dark/Light) t
Toggle Audio Player a
Open Shortcuts Menu ?
Close Active Dialog Esc