这是一个与ServiceNow接口的模型上下文协议(MCP)服务器,允许AI代理通过安全的API访问和操作ServiceNow数据。此服务器使与ServiceNow进行自然语言交互变得更加容易,简化了记录搜索、更新和脚本管理的过程。
servicenow://incidents: 列出最近的事件servicenow://incidents/{number}: 根据编号获取特定事件servicenow://users: 列出用户servicenow://knowledge: 列出知识文章servicenow://tables: 列出可用表servicenow://tables/{table}: 获取特定表中的记录servicenow://schema/{table}: 获取表的模式create_incident: 创建新的事件update_incident: 更新现有事件search_records: 使用文本查询搜索记录get_record: 根据sys_id获取特定记录perform_query: 对ServiceNow执行查询add_comment: 向事件添加评论(客户可见)add_work_notes: 向事件添加工作笔记(内部)natural_language_search: 使用自然语言搜索记录(例如,“查找所有关于SAP的事件”)natural_language_update: 使用自然语言更新记录(例如,“更新事件INC0010001,说我在处理它”)update_script: 更新ServiceNow脚本文件(脚本包含、业务规则等)pip install mcp-server-servicenow
git clone https://github.com/michaelbuckner/servicenow-mcp.git
cd servicen
now-mcp
pip install -e .
使用Python模块运行服务器:
python -m mcp_server_servicenow.cli --url "https://your-instance.service-now.com/" --username "your-username" --password "your-password"
或者使用环境变量:
export SERVICENOW_INSTANCE_URL="https://your-instance.service-now.com/"
export SERVICENOW_USERNAME="your-username"
export SERVICENOW_PASSWORD="your-password"
python -m mcp_server_servicenow.cli
要使用此MCP服务器与Cline,将以下内容添加到您的MCP设置文件中:
{
"mcpServers": {
"servicenow": {
"command": "/path/to/your/python/executable",
"args": [
"-m",
"mcp_server_servicenow.cli",
"--url", "https://your-instance.service-now.com/",
"--username", "your-username",
"--password", "your-password"
],
"disabled": false,
"autoApprove": []
}
}
}
注意: 确保使用已安装mcp-server-servicenow包的Python可执行文件的完整路径。
您可以使用自然语言查询来搜索记录:
查找所有关于电子邮件的事件
搜索与网络问题相关的事件
显示所有具有高优先级的事件
您可以使用自然语言命令来更新记录:
更新事件INC0010001,说我正在处理它
将事件INC0010002设为正在进行
关闭事件INC0010003,解决办法是:解决了问题
您可以从本地文件更新ServiceNow脚本:
用hello_world.js的内容更新ServiceNow脚本包含“HelloWorld”
将utils.js上传到ServiceNow作为名为“UtilityFunctions”的脚本包含
更新@form_validation.js,这是一条名为“FormValidation”的客户端脚本
服务器支持多种认证方法:
# 克隆仓库
git clone https://github.com/michaelbuckner/servicenow-mcp.git
cd servicenow-mcp
# 创建虚拟环境
python -m venv venv
source venv/bin/activate # 在Windows上:venv\Scripts\activate
# 安装开发依赖项
pip install -e ".[dev]"
pytest
欢迎贡献!请随时提交拉取请求。
git checkout -b feature/amazing-feature)git commit -m '添加一些惊人的功能')git push origin feature/amazing-feature)本项目根据MIT许可证发布 - 查看LICENSE文件以获取详细信息。