ServiceNow
STDIOComprehensive ServiceNow MCP server with OAuth 2.0, ITSM operations, CMDB discovery, and intelligent record retrieval
Comprehensive ServiceNow MCP server with OAuth 2.0, ITSM operations, CMDB discovery, and intelligent record retrieval
A Model Context Protocol (MCP) server for ServiceNow integration, featuring AI-powered natural language processing, consolidated architecture, and enterprise-grade security across multiple ServiceNow tables with zero functional regression.
Version 2.0 includes significant breaking changes. If you're upgrading from v1.x:
MIGRATION_V2.md - Complete step-by-step migration instructionsCHANGELOG.md - Full list of changes and new featuresconsolidated_tools.pyNew Installations: Start directly with v2.0 - follow the setup instructions below.
consolidated_tools.py interfaceintelligent_search(query, table, context) - Natural language search: "high priority incidents from last week"build_smart_servicenow_filter(query, table, context) - Smart filter building: Convert natural language to ServiceNow syntaxexplain_servicenow_filters(filters, table) - AI explanations: Understand what complex filters will doget_servicenow_filter_templates() - Predefined templates: Ready-to-use filters for common scenariosget_query_examples() - Example queries: Natural language examples that work with intelligent searchnowtest() - Server connectivity verification with enhanced diagnosticsnow_test_oauth() - OAuth 2.0 authentication testing with detailed validationnow_auth_info() - Current authentication method information and security statusnowtestauth() - ServiceNow API endpoint validation with comprehensive checkssimilar_incidents_for_text(input_text) - AI-enhanced similarity search with confidence scoringget_short_desc_for_incident(input_incident) - Retrieve incident descriptions with intelligent validationsimilar_incidents_for_incident(input_incident) - Find related incidents using smart algorithmsget_incident_details(input_incident) - Complete incident information with optimized field selectionget_incidents_by_filter(filters) - Natural language filtering with automatic parsingget_priority_incidents(priorities, **additional_filters) - AI-enhanced priority queries with proper ServiceNow OR syntaxsimilar_changes_for_text(input_text) - Change request similarity search with compiled regex performanceget_short_desc_for_change(input_change) - Change descriptions with intelligent error handlingsimilar_changes_for_change(input_change) - Related change requests using generic algorithmsget_change_details(input_change) - Complete change information with pagination supportsimilar_ur_for_text(input_text) - User request similarity search with 5x faster processingget_short_desc_for_ur(input_ur) - Request descriptions with table-specific error messagessimilar_urs_for_ur(input_ur) - Related service requests using enhanced generic functionsget_ur_details(input_ur) - Complete request details with optimized field selectionsimilar_knowledge_for_text(input_text) - Article similarity search with AI intelligenceget_knowledge_details(kb_number) - Complete article information with smart validationget_knowledge_by_category(category) - Category-based article retrieval with natural language supportget_active_knowledge_articles() - All active knowledge articles with pagination and filteringsimilar_private_tasks_for_text(input_text) - Task similarity searchget_private_task_details(input_private_task) - Complete task informationcreate_private_task(task_data) - Create new private tasksupdate_private_task(task_number, update_data) - Update existing tasksget_private_tasks_by_filter(filters) - Advanced task filteringfind_cis_by_type(ci_type) - Find all CIs of specific type with intelligent categorizationsearch_cis_by_attributes(name, ip_address, location, status) - Natural language CI search across multiple attributesget_ci_details(ci_number) - Comprehensive CI details with enhanced field selectionsimilar_cis_for_ci(ci_number) - Find similar CIs using AI-powered algorithmsget_all_ci_types() - List all available CI types with smart organizationquick_ci_search(search_term) - 5x faster CI search by name, IP, or CI number# Natural language to ServiceNow syntax "high priority incidents from last week" → priority=1^ORpriority=2^sys_created_onBETWEEN... # Confidence scoring and explanations { "confidence": 0.92, "explanation": "Found P1 and P2 incidents from August 25-31, 2025", "sql_equivalent": "SELECT * FROM incident WHERE priority IN (1,2)...", "suggestions": ["Consider adding state filter"] }
find_cis_by_type(ci_type) - Discover CIs by type (servers, databases, etc.)search_cis_by_attributes(name, ip_address, location, status) - Multi-attribute CI searchget_ci_details(ci_number) - Comprehensive CI informationsimilar_cis_for_ci(ci_number) - Find similar configuration itemsget_all_ci_types() - List all available CI types (100+ supported)quick_ci_search(search_term) - Fast CI search by name, IP, or numberCore Infrastructure    Cloud & Virtualization    Storage & Networking
├── cmdb_ci_server      ├── cmdb_ci_vm_object      ├── cmdb_ci_storage_device
├── cmdb_ci_database    ├── cmdb_ci_vpc            ├── cmdb_ci_san
├── cmdb_ci_hardware    ├── cmdb_ci_subnet         ├── cmdb_ci_ip_network
└── cmdb_ci_service     └── cmdb_ci_cloud_*        └── cmdb_ci_load_balancer
Applications           Facilities                  Specialized Equipment  
├── cmdb_ci_appl       ├── cmdb_ci_datacenter     ├── cmdb_ci_ups_*
├── cmdb_ci_business_* ├── cmdb_ci_rack           ├── cmdb_ci_monitoring_*
└── cmdb_ci_cluster    └── cmdb_ci_computer_room  └── 80+ more types...
CLIENT_ID and CLIENT_SECRET (contact maintainer)git clone https://github.com/Papamzor/personal-mcp-servicenow.git cd personal-mcp-servicenow # Create virtual environment python -m venv venv source venv/bin/activate # On Windows: venv\\Scripts\\activate # Install dependencies pip install -r requirements.txt
Create .env file in project root:
# OAuth 2.0 Authentication (Required) SERVICENOW_INSTANCE=https://your-instance.service-now.com SERVICENOW_CLIENT_ID=your_oauth_client_id SERVICENOW_CLIENT_SECRET=your_oauth_client_secret
⚠️ OAuth 2.0 Credentials Required: This application exclusively uses OAuth 2.0 authentication for security. Contact the project maintainer to obtain OAuth client credentials for your ServiceNow instance.
See OAUTH_SETUP_GUIDE.md for complete ServiceNow OAuth configuration, or contact the maintainer for pre-configured credentials.
# Test environment setup (local test - no ServiceNow connection needed), expected result 2/3 pass (.env file should not be readable) python -m Testing.test_oauth_simple # Test actual ServiceNow connectivity by running some CMDB tools (requires valid .env configuration) python -m Testing.test_cmdb_tools # Test OAuth with your ServiceNow instance (requires OAuth setup), should return token validity details python -c "import asyncio; from utility_tools import now_test_oauth; print(asyncio.run(now_test_oauth()))"
Verification Steps Explained:
To use this MCP server with Claude Desktop, add the following configuration to your Claude Desktop settings:
Location of config file:
%APPDATA%\Claude\claude_desktop_config.json~/Library/Application Support/Claude/claude_desktop_config.jsonAdd this configuration:
{ "mcpServers": { "servicenow": { "command": "python", "args": ["/full/path/to/personal-mcp-servicenow/tools.py"], "env": { "SERVICENOW_INSTANCE": "https://your-instance.service-now.com", "SERVICENOW_CLIENT_ID": "your_oauth_client_id", "SERVICENOW_CLIENT_SECRET": "your_oauth_client_secret" } } } }
Important Notes:
/full/path/to/personal-mcp-servicenow/ with your actual installation pathAlternative: Using .env file (Recommended)
If you prefer to keep credentials in your .env file:
{ "mcpServers": { "servicenow": { "command": "python", "args": ["/full/path/to/personal-mcp-servicenow/tools.py"] } } }
To run the MCP server independently:
python tools.py
MCP Server (FastMCP Framework)
├── Authentication Layer
│   ├── OAuth 2.0 Client (oauth_client.py)
│   ├── Unified API (service_now_api_oauth.py) 
│   └── Basic Auth Fallback (service_now_api.py)
├── Table Operations
│   ├── Generic Tools (generic_table_tools.py)
│   ├── Incident Tools (incident_tools.py)
│   ├── Change Tools (change_tools.py)
│   ├── UR Tools (ur_tools.py)
│   ├── Knowledge Tools (kb_tools.py)
│   ├── Private Task Tools (vtb_task_tools.py)
│   └── CMDB Tools (cmdb_tools.py) 🆕
├── Intelligence Layer
│   ├── NLP Processing (utils.py - Lightweight Regex)
│   ├── Keyword Extraction
│   └── Similarity Matching
└── Utility & Testing
    ├── Server Utilities (utility_tools.py)
    ├── Comprehensive Test Suite (Testing/)
    └── Performance Monitoring
The project includes comprehensive testing capabilities:
# Test environment setup (offline) python -m Testing.test_oauth_simple # Test ServiceNow connectivity and CMDB functionality python -m Testing.test_cmdb_tools
# Essential fields (fast queries) ESSENTIAL_FIELDS = ["number", "short_description", "priority", "state"] # Detailed fields (comprehensive data) DETAILED_FIELDS = [..., "work_notes", "comments", "assigned_to", "sys_created_on"]
# Multiple date formats supported filters = { "sys_created_on_gte": "2024-01-01", # Standard format "sys_created_on": ">=javascript:gs.daysAgoStart(14)", # ServiceNow JS "state": "1", # Active state "priority": "1" # High priority }
The system automatically discovers all CMDB tables in your ServiceNow instance and updates the supported CI types list. No manual configuration required!
Contributions welcome! Please see Contributing Guidelines.
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License - see the LICENSE file for details.
⭐ Star this project if you find it useful!
🐛 Found a bug? Please open an issue.
💡 Have a feature request? We'd love to hear from you!