
ServiceNow
STDIO全面的ServiceNow MCP服务器集成
全面的ServiceNow MCP服务器集成
A comprehensive Model Context Protocol (MCP) server for ServiceNow integration, providing advanced ITSM operations, CMDB discovery, and intelligent similarity-based record retrieval across multiple ServiceNow tables.
This project implements a production-ready MCP server using the FastMCP framework to interact with ServiceNow instances. It supports OAuth 2.0 authentication, comprehensive ITSM operations, full CMDB discovery across 100+ Configuration Item types, and intelligent text processing for similarity-based record retrieval.
nowtest()
- Server connectivity verificationnow_test_oauth()
- OAuth 2.0 authentication testingnow_auth_info()
- Current authentication method informationnowtestauth()
- ServiceNow API endpoint validationsimilar_incidents_for_text(input_text)
- Find incidents by description similarityget_short_desc_for_incident(input_incident)
- Retrieve incident descriptionssimilar_incidents_for_incident(input_incident)
- Find related incidentsget_incident_details(input_incident)
- Complete incident informationget_incidents_by_filter(filters)
- Advanced incident filteringget_priority_incidents(priorities, **additional_filters)
- Get incidents by priority with proper ServiceNow OR syntaxsimilar_changes_for_text(input_text)
- Change request similarity searchget_short_desc_for_change(input_change)
- Change descriptionssimilar_changes_for_change(input_change)
- Related change requestsget_change_details(input_change)
- Complete change informationsimilar_ur_for_text(input_text)
- User request similarity searchget_short_desc_for_ur(input_ur)
- Request descriptionssimilar_urs_for_ur(input_ur)
- Related service requestsget_ur_details(input_ur)
- Complete request detailssimilar_knowledge_for_text(input_text)
- Article similarity searchget_knowledge_details(kb_number)
- Complete article informationget_knowledge_by_category(category)
- Category-based article retrievalget_active_knowledge_articles()
- All active knowledge articlessimilar_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)
- 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 python -m spacy download en_core_web_sm
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.json
Add 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 + SpaCy)
│ ├── 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!