案例管理协议服务器

Workzone MCP Server是一个模型上下文协议服务器,为AI助手提供Workzone案例管理功能的访问,可作为Azure函数或独立服务器运行。

  • by KodachiQube
  • C#
  • 本地部署
  • 更新于
在 GitHub 查看 kodachiqube/workzonemcp

使用说明

工作区MCP服务器

一种模型上下文协议(MCP)服务器,为AI助手提供对工作区案例管理功能的访问。此服务器既可以作为Azure功能运行,也可以作为独立的MCP服务器运行。

特性

  • 事件管理:获取、创建、更新和搜索工作区案例
  • 双模式:作为Azure Function或独立MCP服务器运行
  • 坚韧的:内置重试策略和断路器
  • 可观察对象:应用洞察集成
  • 类型安全:用C#8.0完全键入

先决条件

  • .NET 8.0 SDK
  • Azure功能核心工具v4(适用于Azure功能模式)
  • 工作区API证书

项目结构

WorkzoneMCP/
├── src/
│   ├── WorkzoneMCP.Core/          # Core models and interfaces
│   ├── WorkzoneMCP.Functions/     # Azure Functions and MCP server
│   ├── WorkzoneMCP.Services/      # Business logic and API clients
│   └── WorkzoneMCP.Tests/         # Unit and integration tests
├── scripts/                       # Utility scripts
└── docs/                         # Documentation

配置

环境变量

  • App__WorkzoneApiUrl:工作区API基本URL
  • App__WorkzoneApiKey:工作区API密钥
  • App__TimeoutSeconds:HTTP超时(默认值:30)
  • App__MaxRetryAttempts:最大重试次数(默认值:3)
  • App__RetryDelayMilliseconds:基本重试延迟(默认值:1000)

本地设置

更新 src/WorkzoneMCP.Functions/local.settings.json:

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
    "App__WorkzoneApiUrl": "https://api.workzone.com",
    "App__WorkzoneApiKey": "your-api-key-here"
  }
}

运行服务器

作为MCP服务器

# Using the script
./scripts/run-mcp-server.sh

# Or directly
cd src/WorkzoneMCP.Functions
dotnet run -- --mcp

作为Azure功能

# Using the script
./scripts/run-azure-function.sh

# Or directly
cd src/WorkzoneMCP.Functions
func start

可用工具

workzone_get_case

从Workzone按ID获取案例。

参数:

  • caseId (string,必填):要检索的案例的ID

工作区_创建_案例

在Workzone中创建新案例。

参数:

  • title (string,必填):案例标题
  • description (字符串,可选):案例描述
  • caseType (字符串,可选):案例类型

工作区更新案例

更新工作区中的现有案例。

参数:

  • caseId (string,必填):要更新的案例的ID
  • title (字符串,可选):新标题
  • description (字符串,可选):新描述
  • status (字符串,可选):新状态

工作区搜索案例

在工作区中搜索案例。

参数:

  • query (字符串,必填):搜索查询

测试

运行单元测试

cd src/WorkzoneMCP.Tests
dotnet test

测试MCP服务器

./scripts/test-mcp-server.sh

与Claude Desktop集成

添加到您的Claude Desktop配置中:

{
  "mcpServers": {
    "workzone": {
      "command": "dotnet",
      "args": ["run", "--project", "/path/to/WorkzoneMCP/src/WorkzoneMCP.Functions", "--", "--mcp"],
      "env": {
        "App__WorkzoneApiUrl": "https://api.workzone.com",
        "App__WorkzoneApiKey": "your-api-key"
      }
    }
  }
}

发展

添加新工具

  1. 在中添加工具定义 McpServer.cs
  2. 实现处理程序方法
  3. 在中添加相应的服务方法 IWorkzoneService
  4. 在中实现服务逻辑 WorkzoneService
  5. 添加测试

建筑

dotnet build

出版

dotnet publish -c Release

故障排除

常见问题

  1. 连接被拒绝:确保API工作区可访问
  2. 认证失败:检查API密钥配置
  3. 超时错误:增加 TimeoutSeconds 设置

日志记录

  • Azure功能模式:检查应用程序洞察
  • MCP模式:带有日志级别的控制台输出

许可证

[您的许可证在这里]

贡献

[您的投稿指南请点击此处]