servicenow-mcp

mady22070/servicenow-mcp

3.1

If you are the rightful owner of servicenow-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The ServiceNow MCP Server is a comprehensive Model Context Protocol server designed to integrate AI assistants with ServiceNow, enabling automated operations and advanced troubleshooting.

ServiceNow MCP Server

License: MIT Python 3.8+ MCP Compatible

A comprehensive Model Context Protocol (MCP) server that provides AI assistants with powerful ServiceNow integration capabilities. This server enables automated operations, advanced troubleshooting, and sophisticated development workflows within ServiceNow instances.

πŸš€ Features

Core Capabilities

  • Multi-environment support (dev/test/prod)
  • Comprehensive ServiceNow operations through modular "packs"
  • Built-in security guards and workspace management
  • Advanced caching and connection pooling
  • Comprehensive error handling and logging

Senior Developer Features

  • Story-to-Implementation Pipeline: Convert user stories into executable ServiceNow plans
  • Advanced CMDB Troubleshooting: Sophisticated duplicate detection and data quality analysis
  • Root Cause Analysis: Systematic problem investigation with correlation analysis
  • Development Planning: Automated task decomposition and dependency management

Supported ServiceNow Areas

  • ITSM: Incidents, Problems, Changes, Requests
  • CMDB: Configuration items, relationships, discovery
  • Development: Scripts, business rules, UI policies, flows
  • Platform: Tables, fields, users, groups, notifications
  • Automation: Workflows, scheduled jobs, integrations
  • Quality: ATF testing, data validation, performance monitoring

πŸ“‹ Prerequisites

  • Python 3.8 or higher
  • ServiceNow instance (any version)
  • ServiceNow user account with appropriate permissions
  • MCP-compatible AI assistant (Claude Desktop, etc.)

πŸ› οΈ Installation

1. Clone the Repository

git clone https://github.com/mady22070/servicenow-mcp.git
cd servicenow-mcp

2. Set Up Virtual Environment

python3 -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

3. Install Dependencies

pip install -r requirements.txt

4. Configure Environment

Create environment variables for your ServiceNow instance:

# Development environment
export SERVICENOW_DEV_INSTANCE_URL=https://devXXX.service-now.com
export SERVICENOW_DEV_USERNAME=your_username
export SERVICENOW_DEV_PASSWORD=your_password

# Optional: Production environment
export SERVICENOW_PROD_INSTANCE_URL=https://yourinstance.service-now.com
export SERVICENOW_PROD_USERNAME=prod_username
export SERVICENOW_PROD_PASSWORD=prod_password

# Optional: Restrict table access during testing
export MCP_ALLOW_TABLES=sys_script,sys_script_include,ui_policy,ui_policy_action

πŸš€ Quick Start

For Claude Desktop Users (Most Common)

πŸ‘‰

Quick Summary:

  1. Clone this repository and install dependencies
  2. Configure your ServiceNow credentials in .env file
  3. Add MCP server to Claude Desktop configuration
  4. Restart Claude Desktop and start using ServiceNow with AI!

For Developers

1. Start the MCP Server

python mcp_adapter.py

2. Configure Your MCP Client

Add to your MCP client configuration:

{
  "mcpServers": {
    "servicenow": {
      "command": "python",
      "args": ["/path/to/servicenow-mcp/mcp_adapter.py"],
      "env": {
        "SERVICENOW_DEV_INSTANCE_URL": "https://devXXX.service-now.com",
        "SERVICENOW_DEV_USERNAME": "your_username",
        "SERVICENOW_DEV_PASSWORD": "your_password"
      }
    }
  }
}

3. Test the Connection

# Run health check
python doctor.py

πŸ“– Usage Examples

Basic Operations

# Create an incident
create_incident(
    short_description="Server outage in production",
    description="Web servers are not responding",
    additional_fields={"urgency": "1", "impact": "1"}
)

# Query records
query_table(
    table="incident",
    query="state=1^urgency=1",
    fields=["number", "short_description", "state"],
    limit=10
)

Story-Driven Development

# Convert user story to implementation plan
story_to_implementation(
    story="As a service desk agent, I want to automatically assign incidents based on category so that tickets are routed to the right team faster"
)

Advanced CMDB Analysis

# Detect and analyze CMDB duplicates
troubleshoot_cmdb_duplicates(
    ci_class="cmdb_ci_server",
    analysis_fields=["name", "ip_address", "serial_number"],
    limit=100
)

Root Cause Analysis

# Investigate system issues
root_cause_analysis(
    issue_description="Users reporting slow form loading times",
    related_table="incident",
    time_range_hours=24
)

πŸ—οΈ Architecture

The ServiceNow MCP server is built with a modular architecture:

servicenow_mcp/
β”œβ”€β”€ mcp_adapter.py          # Main MCP server entry point
β”œβ”€β”€ client_manager.py       # Connection pooling and lifecycle
β”œβ”€β”€ tool_registry.py        # Centralized tool registration
β”œβ”€β”€ config.py              # Environment configuration
β”œβ”€β”€ decorators.py           # Cross-cutting concerns
β”œβ”€β”€ packs/                 # Functional modules
β”‚   β”œβ”€β”€ query_pack.py      # Data querying and statistics
β”‚   β”œβ”€β”€ build_pack.py      # Application development
β”‚   β”œβ”€β”€ senior_dev_pack.py # Advanced development features
β”‚   β”œβ”€β”€ story_driven_pack.py # Story-to-implementation
β”‚   └── ...               # 20+ specialized packs
β”œβ”€β”€ utils/                 # Utility functions
β”‚   β”œβ”€β”€ guard.py          # Security controls
β”‚   β”œβ”€β”€ plan.py           # Multi-step execution
β”‚   └── workspace.py      # Workspace management
└── tools/                # Tool definitions by area
    └── ...

πŸ”’ Security

  • Table Guards: Configurable access controls for sensitive tables
  • Environment Isolation: Separate configurations for dev/test/prod
  • Dry Run Mode: Test operations without making changes
  • Audit Logging: Comprehensive operation tracking
  • Credential Management: Secure environment variable handling

πŸ§ͺ Testing

# Run basic health checks
python doctor.py

# Test specific functionality
python -c "from servicenow_mcp.client_manager import client_manager; print(client_manager.health_check())"

# Validate configuration
python -c "from servicenow_mcp.config import Config; print(Config.for_env('dev'))"

πŸ“š Documentation

  • - Complete step-by-step setup for Claude Desktop
  • - Common commands and usage examples
  • - Complete tool documentation
  • - Setup and environment management
  • - Real-world usage scenarios

🀝 Contributing

We welcome contributions! Please see our for details.

Development Setup

# Clone and setup
git clone https://github.com/mady22070/servicenow-mcp.git
cd servicenow-mcp
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements-dev.txt

# Run tests
python -m pytest tests/

# Format code
black servicenow_mcp/
isort servicenow_mcp/

πŸ“„ License

This project is licensed under the MIT License - see the file for details.

πŸ™ Acknowledgments

πŸ“ž Support

πŸ—ΊοΈ Roadmap

  • GraphQL API support
  • Advanced workflow automation
  • Machine learning integration
  • Performance optimization tools
  • Extended ITOM capabilities
  • Custom app scaffolding templates

Made with ❀️ for the ServiceNow community