ServiceNow MCP(模型上下文协议)服务器
基于Azure Functions的MCP服务器,用于与ServiceNow实例交互。此服务器提供了一个标准化的接口,用于通过模型上下文协议管理事件、更改请求、用户和其他ServiceNow资源。
建筑
该解决方案遵循干净的架构模式,包括以下项目:
- 立即服务。核心:核心域模型、接口和常量
- 立即服务。服务:业务逻辑和ServiceNow API客户端实现
- 立即服务。函数:Azure Functions主机和MCP服务器实现
- 立即服务。测试:单元和集成测试
特性
- 事件管理:创建、更新和查询事件
- 变更请求管理:管理变更请求及其生命周期
- 用户管理:搜索和管理ServiceNow用户
- 表操作:ServiceNow表上的通用CRUD操作
- MCP协议支持:全面实施模型上下文协议
先决条件
- .NET 8.0 SDK
- Azure功能核心工具v4
- 具有API访问权限的ServiceNow实例
- 有效的ServiceNow凭据
配置
- 复制
src/ServiceNow.Functions/local.settings.json.example向local.settings.json - 更新配置值:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
"ServiceNow:InstanceUrl": "https://your-instance.service-now.com",
"ServiceNow:Username": "your-username",
"ServiceNow:Password": "your-password"
}
}运行服务器
作为Azure函数
./scripts/run-azure-function.sh作为MCP服务器
./scripts/run-mcp-server.sh测试MCP服务器
./scripts/test-mcp-server.sh发展
构建解决方案
dotnet build运行测试
dotnet test项目结构
ServiceNowMCP/
├── src/
│ ├── ServiceNow.Core/ # Core domain layer
│ ├── ServiceNow.Services/ # Business logic layer
│ ├── ServiceNow.Functions/ # Azure Functions and MCP server
│ └── ServiceNow.Tests/ # Test projects
├── scripts/ # Utility scripts
├── docs/ # Documentation
└── ServiceNow.sln # Solution fileMCP协议实现
服务器实现了以下MCP功能:
- 工具:ServiceNow操作作为MCP工具公开
- 资源:ServiceNow数据作为MCP资源公开
- 鼓励:常见操作的预配置提示
可用工具
create_incident:创建新事件update_incident:更新现有事件get_incident:检索事件详细信息create_change_request:创建新的更改请求search_users:搜索ServiceNow用户- 还有更多。..
贡献
- 分叉存储库
- 创建要素分支
- 进行更改
- 运行测试
- 提交拉取请求
许可证
\[在此处指定您的许可证\]
