Model Context Protocol (MCP) server for AI-driven ServiceNow table data export to XML attachments.
Project description
๐ ServiceNow MCP Server - AI-Powered Data Export Tool
๐ฏ Transform ServiceNow data access with natural language commands
Export ServiceNow table data effortlessly using voice commands and AI - no complex APIs needed!
๐ Quick Start โข ๐ Documentation โข ๐ก Examples โข ๐ค Contributing
๐ Table of Contents
- ๐ Overview
- โจ Key Features
- ๐๏ธ Architecture
- โก Quick Start
- ๐ง Installation
- โ๏ธ Configuration
- ๐ก Usage Examples
- ๐๏ธ Available Tools
- ๐ Supported Formats
- ๐บ๏ธ Table Mappings
- ๐ Authentication
- ๐ Troubleshooting
- ๐ค Contributing
- ๐ License
๐ Overview
The ServiceNow MCP Server is a cutting-edge Model Context Protocol server that revolutionizes how you interact with ServiceNow data. By combining the power of AI with intuitive natural language processing, this tool transforms complex ServiceNow API operations into simple conversational commands.
graph TD
A[๐ค User Voice Command] --> B[๐ค Claude AI]
B --> C[๐ง MCP Server]
C --> D[๐ ServiceNow API]
D --> E[๐ Data Processing]
E --> F[๐ File Export]
F --> G[๐พ Downloads Folder]
๐ฏ Why Choose ServiceNow MCP Server?
- ๐ฃ๏ธ Voice-Controlled: Use natural language commands instead of complex API calls
- ๐ง AI-Powered: Intelligent table name resolution from conversational descriptions
- โก Lightning Fast: Optimized async operations for rapid data retrieval
- ๐ Secure: Built-in authentication and error handling
- ๐ฑ Cross-Platform: Works on Windows, macOS, and Linux
- ๐จ Multiple Formats: Export to CSV, XML, or both simultaneously
โจ Key Features
๐๏ธ Architecture
๐ Click to expand architecture details
System Components
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Claude AI โโโโโถโ MCP Server โโโโโถโ ServiceNow โ
โ โ โ โ โ โ
โ โข NL Processing โ โ โข Table Mapping โ โ โข REST API โ
โ โข Tool Calling โ โ โข Data Export โ โ โข Authenticationโ
โ โข User Interfaceโ โ โข File Generationโ โ โข Data Storage โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโ
โ Local File Systemโ
โ โ
โ โข Downloads Folderโ
โ โข CSV/XML Files โ
โ โข Auto Naming โ
โโโโโโโโโโโโโโโโโโโโ
Data Flow
- Input: User provides natural language command
- Processing: Claude AI interprets and calls appropriate MCP tool
- Resolution: MCP server resolves table names and builds queries
- Retrieval: Secure API calls to ServiceNow instance
- Transformation: Data converted to requested format(s)
- Output: Files saved to Downloads folder with confirmation
โก Quick Start
๐ 1-Minute Setup
# Clone the repository
git clone https://github.com/yourusername/servicenow-mcp-server.git
cd servicenow-mcp-server
# Install dependencies
pip install -r requirements.txt
# Configure environment
cp .env.example .env
# Edit .env with your ServiceNow credentials
# Run the server
python main.py
๐ฏ First Export
Once configured, try these natural language commands:
"Export the server table"
"Get me incident data in XML format"
"Export users with both CSV and XML"
๐ง Installation
Prerequisites
| Requirement | Version | Purpose |
|---|---|---|
| Python | 3.8+ | Runtime environment |
| ServiceNow Instance | Any | Data source |
| Claude AI Access | Latest | Natural language interface |
Step-by-Step Installation
๐ฆ Detailed Installation Guide
-
Clone Repository
git clone https://github.com/yourusername/servicenow-mcp-server.git cd servicenow-mcp-server
-
Create Virtual Environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install Dependencies
pip install -r requirements.txt
-
Environment Setup
cp .env.example .env
Edit
.envfile:SERVICENOW_INSTANCE=https://your-instance.service-now.com SERVICENOW_USERNAME=your_username SERVICENOW_PASSWORD=your_password
-
Verify Installation
python -c "import main; print('โ Installation successful!')"
Requirements
# Core dependencies
fastmcp>=0.1.0
httpx>=0.24.0
python-dotenv>=1.0.0
# Optional enhancements
rich>=13.0.0 # Better console output
typer>=0.9.0 # CLI interface
pytest>=7.0.0 # Testing framework
โ๏ธ Configuration
Environment Variables
| Variable | Description | Example | Required |
|---|---|---|---|
SERVICENOW_INSTANCE |
Your ServiceNow instance URL | https://dev12345.service-now.com |
โ |
SERVICENOW_USERNAME |
ServiceNow username | admin |
โ |
SERVICENOW_PASSWORD |
ServiceNow password | your_password |
โ |
๐ค Voice Commands
| Command | Result | Format |
|---|---|---|
| "Export the server table" | โก๏ธ cmdb_ci_server_export.csv |
CSV |
| "Get incident data as XML" | โก๏ธ incident_export.xml |
XML |
| "Export users in both formats" | โก๏ธ Both CSV & XML files | Both |
๐ Detailed Examples
๐ Click to see detailed examples
Basic Export
# Command: "Export the server table"
# Result: Downloads/cmdb_ci_server_export_20241201_143022.csv
Filtered Export
# Command: "Export active incidents from last week"
# Translates to query filter and exports matching records
Multi-Format Export
# Command: "Export user data in both CSV and XML"
# Creates:
# - Downloads/sys_user_export_20241201_143022.csv
# - Downloads/sys_user_export_20241201_143022.xml
Custom Fields
# Advanced usage through tool parameters:
# - table_description: "server table"
# - fields: "name,ip_address,sys_id"
# - max_records: 500
๐ง Primary Tools
| Tool | Purpose | Input | Output |
|---|---|---|---|
export_servicenow_data |
๐ฏ Main export with bracket syntax | "[table_name] command" | XML attachment |
export_with_bracket_syntax |
๐ Specialized bracket parser | Bracket syntax command | XML file |
export_table_to_xml |
๐ Direct XML export | Table name | XML file |
list_common_tables |
๐ Show table mappings | None | Table reference |
๐ New Features for Unlimited Data Export
1. Unlimited Record Processing
# Now handles ANY number of records - 10K, 100K, 1M+
"Export ALL data from Server[cmdb_ci_server] table"
# Automatically uses pagination to fetch ALL records
2. Memory-Efficient Processing
# Chunked processing prevents memory overload
# - Fetches data in 1000-record chunks
# - Processes CSV in 5000-record chunks
# - Progress tracking for large datasets
3. Performance Optimizations
# Smart processing based on dataset size
# - Small datasets: Direct processing
# - Large datasets: Chunked processing with progress tracking
# - Memory management and garbage collection
4. Enterprise-Scale Support
# Production-ready for enterprise environments
# - Handles ServiceNow instances with millions of records
# - Automatic pagination and memory management
# - Robust error handling and recovery
๐ Authentication
๐ก๏ธ Security Best Practices
| โ Recommended | โ Avoid |
|---|---|
| Environment variables | Hardcoded credentials |
| Dedicated service account | Personal accounts |
| Minimal required permissions | Admin privileges |
| Regular password rotation | Static passwords |
ServiceNow Permissions
Required roles and permissions:
rest_service- Access REST APIstable_reader- Read table data- Read access to target tables (e.g.,
cmdb_ci_server,incident) itil- For incident management tables
๐ง Detailed Permission Setup
-
Create Service Account
Navigate to: User Administration > Users Create new user with appropriate roles -
Assign Roles
Required roles: - rest_service - table_reader - Custom roles for specific tables if needed -
Test Access
curl -u username:password \ "https://your-instance.service-now.com/api/now/table/incident?sysparm_limit=1"
๐ Troubleshooting
๐ Common Issues
โ Authentication Errors
Problem: HTTP 401 Unauthorized
Solutions:
- โ
Verify credentials in
.envfile - โ Check ServiceNow instance URL format
- โ Ensure account has required roles
- โ Test with ServiceNow's REST API Explorer
โ Table Not Found
Problem: Table 'xyz' doesn't exist
Solutions:
- โ
Use
list_common_tablestool to see available mappings - โ Check table name spelling
- โ Verify table exists in your instance
- โ Ensure read permissions on the table
โ Export Failures
Problem: Export process fails or incomplete
Solutions:
- โ Check network connectivity
- โ
Reduce
max_recordsparameter - โ Verify Downloads folder permissions
- โ Review ServiceNow instance performance
๐ง Debug Mode
Enable detailed logging:
export DEBUG=1
python main.py
๐ Support
Need help? Check these resources:
๐ Development Setup
๐ง Development Environment Setup
# Clone and setup
git clone https://github.com/yourusername/servicenow-mcp-server.git
cd servicenow-mcp-server
# Development environment
python -m venv dev-env
source dev-env/bin/activate # Windows: dev-env\Scripts\activate
# Install dev dependencies
uv sync
๐ License
๐ Made with โค๏ธ by Divya Shah
โญ Star this repo โข ๐ Report Bug โข โจ Request Feature
Connect with me:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_server_table-0.1.0.tar.gz.
File metadata
- Download URL: mcp_server_table-0.1.0.tar.gz
- Upload date:
- Size: 25.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb9225b078cc3706fa2d841100b1764890cfc2b8bd933df4875b0f214a20bd7b
|
|
| MD5 |
d4659f8e08bdb3ecd40080753a7e4eb4
|
|
| BLAKE2b-256 |
4e7457af0177081284f1f09ddb95ba2f68dd758d47354081a17a3424d9174980
|
Provenance
The following attestation bundles were made for mcp_server_table-0.1.0.tar.gz:
Publisher:
publish-to-pypi.yml on divyashah0510/mcp-servicenow-exporter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_server_table-0.1.0.tar.gz -
Subject digest:
bb9225b078cc3706fa2d841100b1764890cfc2b8bd933df4875b0f214a20bd7b - Sigstore transparency entry: 293596522
- Sigstore integration time:
-
Permalink:
divyashah0510/mcp-servicenow-exporter@229cf183cd5d2d98f5a0da428d6f2e71856afa42 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/divyashah0510
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@229cf183cd5d2d98f5a0da428d6f2e71856afa42 -
Trigger Event:
release
-
Statement type:
File details
Details for the file mcp_server_table-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mcp_server_table-0.1.0-py3-none-any.whl
- Upload date:
- Size: 21.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0002c711815e8be70fb33fd2f926a0d2caa77c5145cf15f4c202df8d28eff8df
|
|
| MD5 |
890e6f59a81e3105c0f9d621769e8fa8
|
|
| BLAKE2b-256 |
f775acafe9e09206cb0799f9e5d13263975f019f1575f668448daf7f26eba38b
|
Provenance
The following attestation bundles were made for mcp_server_table-0.1.0-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on divyashah0510/mcp-servicenow-exporter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_server_table-0.1.0-py3-none-any.whl -
Subject digest:
0002c711815e8be70fb33fd2f926a0d2caa77c5145cf15f4c202df8d28eff8df - Sigstore transparency entry: 293596524
- Sigstore integration time:
-
Permalink:
divyashah0510/mcp-servicenow-exporter@229cf183cd5d2d98f5a0da428d6f2e71856afa42 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/divyashah0510
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@229cf183cd5d2d98f5a0da428d6f2e71856afa42 -
Trigger Event:
release
-
Statement type: