Skip to main content

A highly customizable MCP server for ServiceNow API integration

Project description

ServiceNow MCP Server

Python Version License: MIT MCP Version CI Status Code style: black

A highly customizable Model Context Protocol (MCP) server for ServiceNow API integration. This server enables AI assistants and development tools to interact with ServiceNow instances through a standardized interface.

Enterprise-grade ServiceNow integration - Connect ServiceNow with modern development tools and automation frameworks through the Model Context Protocol.

Features

  • Comprehensive ServiceNow API Coverage

    • Incident Management
    • Change Management
    • Problem Management
    • Configuration Management Database (CMDB)
    • Service Catalog
    • Knowledge Base
    • User Management
    • Custom Table Operations
  • Highly Customizable

    • Feature flags to enable/disable modules
    • Environment-based configuration
    • JSON configuration files with override support
    • Flexible authentication options
  • Production Ready

    • Async/await support for high performance
    • Retry logic with exponential backoff
    • Comprehensive error handling
    • Structured JSON logging
    • Rate limit handling
  • Easy Integration

    • Compatible with Claude Desktop, VS Code, Cursor, and other MCP clients
    • Standard MCP protocol implementation
    • Simple CLI interface

Installation

Prerequisites

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

Install from Source

# Clone the repository
git clone https://github.com/asklokesh/servicenow-mcp-server.git
cd servicenow-mcp-server

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

# Install the package
pip install -e .

Install from PyPI (coming soon)

pip install servicenow-mcp-server

Configuration

Quick Start with Environment Variables

  1. Copy the example environment file:

    cp .env.example .env
    
  2. Edit .env with your ServiceNow credentials:

    SERVICENOW_INSTANCE=your-instance.service-now.com
    SERVICENOW_USERNAME=your-username
    SERVICENOW_PASSWORD=your-password
    
  3. Run the server:

    servicenow-mcp
    

Advanced Configuration

The server supports multiple configuration methods with the following precedence:

  1. Environment variables (highest priority)
  2. config/local.json (local overrides)
  3. config/default.json (base configuration)

Configuration Options

{
  "servicenow": {
    "instance": "your-instance.service-now.com",
    "username": "your-username",
    "password": "your-password",
    "api_version": "v2",
    "timeout": 30,
    "max_retries": 3
  },
  "features": {
    "incident_management": true,
    "change_management": true,
    "problem_management": true,
    "service_catalog": true,
    "knowledge_base": true,
    "user_management": true,
    "cmdb": true,
    "custom_tables": true
  },
  "logging": {
    "level": "INFO",
    "format": "json",
    "file": "logs/servicenow-mcp.log"
  }
}

Integration with MCP Clients

Desktop Configuration

Add to your MCP client configuration:

{
  "mcpServers": {
    "servicenow": {
      "command": "servicenow-mcp",
      "env": {
        "SERVICENOW_INSTANCE": "your-instance.service-now.com",
        "SERVICENOW_USERNAME": "your-username",
        "SERVICENOW_PASSWORD": "your-password"
      }
    }
  }
}

VS Code / Cursor

Add to your workspace settings:

{
  "mcp.servers": {
    "servicenow": {
      "command": "servicenow-mcp",
      "args": ["--config-dir", "./config"],
      "env": {
        "SERVICENOW_INSTANCE": "your-instance.service-now.com",
        "SERVICENOW_USERNAME": "your-username",
        "SERVICENOW_PASSWORD": "your-password"
      }
    }
  }
}

Available Tools

Table Operations

  • query_table - Query any ServiceNow table with filters
  • get_record - Retrieve a single record by sys_id
  • create_record - Create new records
  • update_record - Update existing records
  • delete_record - Delete records

Incident Management

  • incident_create - Create new incidents
  • incident_update - Update incidents (state, notes, resolution)
  • incident_search - Search incidents with multiple filters

Change Management

  • change_create - Create change requests
  • change_search - Search change requests

CMDB Operations

  • ci_search - Search configuration items
  • ci_relationships - Get CI relationships

User Management

  • user_search - Search users by various criteria

Knowledge Base

  • kb_search - Search knowledge articles

Service Catalog

  • catalog_items - List catalog items

Analytics

  • get_stats - Get aggregate statistics from any table

Usage Examples

Creating an Incident

{
  "tool": "incident_create",
  "arguments": {
    "short_description": "Email server down",
    "description": "Production email server is not responding",
    "urgency": 1,
    "impact": 1,
    "assignment_group": "Email Support"
  }
}

Searching for Configuration Items

{
  "tool": "ci_search",
  "arguments": {
    "name": "*prod*",
    "class": "cmdb_ci_server",
    "operational_status": 1,
    "limit": 50
  }
}

Custom Table Query

{
  "tool": "query_table",
  "arguments": {
    "table": "u_custom_application",
    "query": "active=true^u_environment=production",
    "fields": ["name", "u_version", "u_owner"],
    "order_by": "-sys_updated_on"
  }
}

Security Considerations

  • Never commit credentials to version control
  • Use environment variables or secure secret management
  • Implement least-privilege access for ServiceNow users
  • Enable audit logging in production environments
  • Consider using OAuth instead of basic auth for production

Development

Setting Up Development Environment

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run linting
ruff check src/
black src/ --check

# Type checking
mypy src/

Running Tests

# Run all tests
pytest

# Run with coverage
pytest --cov=servicenow_mcp --cov-report=html

# Run specific test file
pytest tests/test_client.py

Troubleshooting

Common Issues

  1. Authentication Failed

    • Verify credentials are correct
    • Check if user has API access permissions
    • Ensure instance URL is correct (with or without https://)
  2. Connection Timeout

    • Increase timeout in configuration
    • Check network connectivity
    • Verify ServiceNow instance is accessible
  3. Rate Limiting

    • Server automatically handles rate limits with retry
    • Consider reducing request frequency
    • Check ServiceNow rate limit settings

Debug Mode

Enable debug logging:

servicenow-mcp --log-level DEBUG

Or set in environment:

export MCP_LOG_LEVEL=DEBUG

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Ensure all tests pass
  5. Submit a pull request

License

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

Support

Acknowledgments

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

servicenow_mcp_server-0.1.1.tar.gz (30.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

servicenow_mcp_server-0.1.1-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file servicenow_mcp_server-0.1.1.tar.gz.

File metadata

  • Download URL: servicenow_mcp_server-0.1.1.tar.gz
  • Upload date:
  • Size: 30.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for servicenow_mcp_server-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3c76cd95c73a94a587a596f8f2b57de2a82c6a41ddb663272bea8b3011a50775
MD5 8ff2f4f33d8a9500c5cbad042f54eb18
BLAKE2b-256 aaf9e39dc4f17cf1d8c9c152116e0349d55ff77d6c2e7f226d55f5efb8c1de47

See more details on using hashes here.

File details

Details for the file servicenow_mcp_server-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for servicenow_mcp_server-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ec4282c74e7ca66fcd3723b4cf0f81766d34bc98e56b2e1614d5551f55298150
MD5 742536ecf8b0e59be6cbff094db03edd
BLAKE2b-256 a0fbc2cf415c9c95e2dfb7aa2db170455f284e2810e75175894b1846ed911763

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page