ServiceNow MCP服务器

基于Azure Functions的MCP服务器,用于与ServiceNow实例交互,提供标准化接口管理事件、变更请求、用户和其他ServiceNow资源。

  • by KodachiQube
  • C#
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 KodachiQube/ServiceNowMCP

使用说明

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凭据

配置

  1. 复制 src/ServiceNow.Functions/local.settings.json.example 向 local.settings.json
  2. 更新配置值:
{
  "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 file

MCP协议实现

服务器实现了以下MCP功能:

  • 工具:ServiceNow操作作为MCP工具公开
  • 资源:ServiceNow数据作为MCP资源公开
  • 鼓励:常见操作的预配置提示

可用工具

  • create_incident:创建新事件
  • update_incident:更新现有事件
  • get_incident:检索事件详细信息
  • create_change_request:创建新的更改请求
  • search_users:搜索ServiceNow用户
  • 还有更多。..

贡献

  1. 分叉存储库
  2. 创建要素分支
  3. 进行更改
  4. 运行测试
  5. 提交拉取请求

许可证

[在此处指定您的许可证]