ServiceNow MCP Server

ServiceNow MCP server enables AI models to interact with ServiceNow instances, providing capabilities for IT service management, incident tracking, workflow automation, and knowledge base management through natural language.

GitHub starsPyPI version

Overview

The ServiceNow MCP Server enables AI agents to interact with ServiceNow instances through natural language. It provides secure API access for searching records, managing incidents, updating scripts, and performing IT service management operations without requiring deep knowledge of ServiceNow query syntax.

Created by:

Developed by Michael Buckner

Key Features

🗣️

Natural Language Queries

Search and update ServiceNow records using plain English without learning query syntax

🎫

Incident Management

Create, update, and track incidents with full CRUD operations and commenting

📝

Script Management

Update ServiceNow scripts, includes, and business rules directly from your development environment

🔐

Flexible Authentication

Support for basic auth, token auth, and OAuth flows for secure access

Available Tools

Quick Reference

ToolPurposeCategory
natural_language_searchSearch records using plain EnglishSearch
natural_language_updateUpdate records using natural languageWrite
search_recordsQuery records with text searchSearch
create_incidentCreate new incident recordsIncidents
update_incidentModify existing incidentsIncidents
get_recordRetrieve specific record by sys_idRead
perform_queryExecute custom ServiceNow queriesSearch
add_commentPost customer-visible commentsComments
add_work_notesAdd internal work notesComments
update_scriptManage ServiceNow scriptsScripts

Detailed Usage

natural_language_search

Search for ServiceNow records using natural language without needing to know query syntax.

use_mcp_tool({
  server_name: "servicenow",
  tool_name: "natural_language_search",
  arguments: {
    query: "find all high priority incidents about email"
  }
});

Examples: "find all incidents about SAP", "show me critical priority incidents", "get open incidents assigned to John"

natural_language_update

Update ServiceNow records using plain English commands.

use_mcp_tool({
  server_name: "servicenow",
  tool_name: "natural_language_update",
  arguments: {
    command: "Update incident INC0010001 saying I'm working on it"
  }
});

Examples: "Close INC0010001 with resolution fixed", "Set priority to high for INC0010002", "Assign INC0010003 to Jane Smith"

create_incident

Create a new incident record in ServiceNow with specified details.

use_mcp_tool({
  server_name: "servicenow",
  tool_name: "create_incident",
  arguments: {
    short_description: "Email server not responding",
    description: "Users unable to access email since 9 AM",
    priority: 2,
    category: "network",
    caller_id: "user123"
  }
});
update_incident

Modify an existing incident with updated information or status changes.

use_mcp_tool({
  server_name: "servicenow",
  tool_name: "update_incident",
  arguments: {
    sys_id: "abc123def456",
    state: "in_progress",
    assigned_to: "john.doe",
    priority: 1,
    work_notes: "Investigating root cause"
  }
});
search_records

Query ServiceNow records using text search across multiple fields.

use_mcp_tool({
  server_name: "servicenow",
  tool_name: "search_records",
  arguments: {
    table: "incident",
    query: "network outage",
    fields: ["number", "short_description", "priority", "state"],
    limit: 50
  }
});
get_record

Retrieve a specific record by its sys_id from any ServiceNow table.

use_mcp_tool({
  server_name: "servicenow",
  tool_name: "get_record",
  arguments: {
    table: "incident",
    sys_id: "abc123def456789"
  }
});
perform_query

Execute custom ServiceNow encoded queries for advanced filtering.

use_mcp_tool({
  server_name: "servicenow",
  tool_name: "perform_query",
  arguments: {
    table: "incident",
    query: "priority=1^state=2^assigned_toISNOTEMPTY",
    limit: 100
  }
});

Supports ServiceNow encoded query syntax for complex filters.

add_comment

Post a customer-visible comment to a ServiceNow record.

use_mcp_tool({
  server_name: "servicenow",
  tool_name: "add_comment",
  arguments: {
    table: "incident",
    sys_id: "abc123def456",
    comment: "Issue has been resolved. Email service restored."
  }
});

Comments are visible to end users in the customer portal.

add_work_notes

Add internal work notes to a record, visible only to IT staff.

use_mcp_tool({
  server_name: "servicenow",
  tool_name: "add_work_notes",
  arguments: {
    table: "incident",
    sys_id: "abc123def456",
    work_notes: "Restarted email server. Monitoring for 30 minutes."
  }
});

Work notes are internal and not visible to end users.

update_script

Update ServiceNow script files including script includes and business rules.

use_mcp_tool({
  server_name: "servicenow",
  tool_name: "update_script",
  arguments: {
    script_name: "IncidentUtils",
    script_type: "script_include",
    script_content: "var IncidentUtils = Class.create()..."
  }
});

Supports script includes, business rules, client scripts, and UI actions.

Available Resources

The ServiceNow MCP server provides resource endpoints for direct context access:

  • Incident Listings: Browse and filter incident records
  • Specific Incident Details: Retrieve complete incident information
  • User Directory: Access user profiles and assignments
  • Knowledge Base Articles: Browse knowledge articles
  • Table Schema: Inspect table structures and field definitions
  • Service Catalog: Access catalog items and categories

Installation

Prerequisites

  • Python 3.8 or higher
  • Active ServiceNow instance with API access
  • ServiceNow user credentials with appropriate permissions

Install from PyPI

pip install mcp-server-servicenow

Configuration

Edit your MCP client configuration file:

{
  "mcpServers": {
    "servicenow": {
      "command": "python",
      "args": [
        "-m",
        "mcp_server_servicenow.cli",
        "--url",
        "https://your-instance.service-now.com/",
        "--username",
        "your-username",
        "--password",
        "your-password"
      ]
    }
  }
}

Credentials Security:

Store credentials securely using environment variables instead of hardcoding them in configuration files.

Using Environment Variables

Set environment variables before running:

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

Then configure without credentials in the command:

{
  "mcpServers": {
    "servicenow": {
      "command": "python",
      "args": ["-m", "mcp_server_servicenow.cli"],
      "env": {
        "SERVICENOW_INSTANCE_URL": "${SERVICENOW_INSTANCE_URL}",
        "SERVICENOW_USERNAME": "${SERVICENOW_USERNAME}",
        "SERVICENOW_PASSWORD": "${SERVICENOW_PASSWORD}"
      }
    }
  }
}

Authentication Methods

Basic Authentication

The simplest method using username and password:

python -m mcp_server_servicenow.cli \
  --url "https://your-instance.service-now.com/" \
  --username "your-username" \
  --password "your-password"

Token Authentication

Use a ServiceNow access token for enhanced security:

python -m mcp_server_servicenow.cli \
  --url "https://your-instance.service-now.com/" \
  --token "your-access-token"

OAuth Flow

Configure OAuth credentials for enterprise deployments:

python -m mcp_server_servicenow.cli \
  --url "https://your-instance.service-now.com/" \
  --client-id "your-client-id" \
  --client-secret "your-client-secret" \
  --username "your-username" \
  --password "your-password"

Common Use Cases

Incident Triage

Search and prioritize incidents using natural language:

"Find all critical priority incidents opened today that are unassigned,
then assign them to the appropriate teams based on category"

Service Desk Automation

Automate common service desk operations:

"Create an incident for the password reset request from user john.doe,
set category to account access, priority to medium, and assign to the IAM team"

Knowledge Management

Access and update knowledge base articles:

"Search for knowledge articles about VPN setup and show me the top 5 results
with the most recent updates"

Script Development

Manage ServiceNow scripts from your IDE:

"Update the IncidentNotification business rule with the new email template logic
from my local script file"

ServiceNow Permissions Required

Ensure your ServiceNow user has the following roles for full functionality:

  • itil: Basic ITSM operations
  • admin: For script management and advanced operations
  • rest_api_explorer: API access
  • web_service_admin: Web service configuration

For read-only operations, the itil_read role is sufficient.

Troubleshooting

Connection Issues

If unable to connect to ServiceNow:

  1. Verify your instance URL format: https://instance-name.service-now.com/
  2. Check that API access is enabled in your ServiceNow instance
  3. Confirm your user credentials are correct
  4. Ensure your IP is not blocked by ServiceNow IP restrictions

Permission Errors

If receiving permission errors:

  1. Verify your user has the required roles
  2. Check that the table you're accessing has proper ACLs
  3. Ensure API access is granted to your user account

Python Path Issues

If the server doesn't start:

  1. Use the absolute path to your Python executable
  2. Verify the mcp-server-servicenow package is installed in that Python environment
  3. Check Python version is 3.8 or higher: python --version

Advanced Configuration

Custom Table Access

The server can access any ServiceNow table. Common tables include:

  • incident - Incident records
  • problem - Problem records
  • change_request - Change requests
  • sc_request - Service catalog requests
  • kb_knowledge - Knowledge base articles
  • cmdb_ci_* - Configuration items (servers, applications, etc.)
  • sys_user - User records

Query Optimization

For large instances, optimize queries with:

  • Specific field selection to reduce data transfer
  • Limit parameters to control result set size
  • Encoded queries for precise filtering
  • Index-based sorting for better performance

Sources