ServiceNow MCP Server

ServiceNow MCP Server

A Model Context Protocol server that enables AI assistants and development tools to interact with ServiceNow instances, providing comprehensive API coverage for incident management, change management, CMDB, and other ServiceNow modules.

Category
访问服务器

README

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

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选