OTRS MCP Server
OTRS MCP Server
一个用于 OTRS(开放工单请求系统)API 集成的 Model Context Protocol(MCP)服务器。
这通过标准化的 MCP 接口提供对 OTRS 工单管理的访问,使 AI 助手能够创建、搜索和管理工单。
功能特性
创建、读取、更新和搜索工单
访问工单历史记录和详细信息
可配置的工单默认值
支持 Docker 容器化
支持 SSL/TLS 及证书验证选项
为 AI 助手提供交互式工具
工具列表是可配置的,因此您可以选择要提供给 MCP 客户端的工具。
Related MCP server: tickiti-mcp
前提条件
OTRS 服务器配置
在使用此 MCP 服务器之前,您需要配置您的 OTRS 实例:
步骤 1:访问 OTRS 管理面板
URL:
https://your-otrs-server/otrs/index.pl?Action=Admin使用您的管理员凭据登录
步骤 2:配置 Web 服务
导航到:系统管理 → Web 服务
创建或确认您有一个包含以下操作的 Web 服务(例如“TestInterface”):
✅ SessionCreate
✅ TicketCreate
✅ TicketGet
✅ TicketSearch
✅ TicketUpdate
✅ TicketHistoryGet
步骤 3:记下您的 Web 服务 URL
您的 Web 服务 URL 应类似于:
https://your-otrs-server/otrs/nph-genericinterface.pl/Webservice/YourWebserviceName
步骤 4:确保用户权限
确保您的 OTRS 用户具有适当的权限,以便:
创建和更新工单
访问配置项
使用通用接口
使用方法
Docker(推荐)
使用 Claude Desktop 运行 otrs-mcp 的最简单方式是使用 Docker。如果您尚未安装 Docker,可以从 Docker 官方网站 获取。
使用预构建镜像
您可以使用 GitHub Container Registry 中的预构建 Docker 镜像:
{
"mcpServers": {
"otrs": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"-e",
"OTRS_BASE_URL=https://your-otrs-server/otrs/nph-genericinterface.pl/Webservice/TestInterface",
"-e",
"OTRS_USERNAME=your-username",
"-e",
"OTRS_PASSWORD=your-password",
"-e",
"OTRS_VERIFY_SSL=false",
"-e",
"OTRS_DEFAULT_QUEUE=Raw",
"-e",
"OTRS_DEFAULT_STATE=new",
"-e",
"OTRS_DEFAULT_PRIORITY=3 normal",
"ghcr.io/eduardoantoniojunior/otrs-mcp-server:latest"
]
}
}
}本地构建
如果您希望本地构建镜像:
# Clone the repository
git clone https://github.com/eduardoantoniojunior/otrs-mcp-server.git
cd otrs-mcp-server
# Build the Docker image
docker build -t otrs-mcp-server .
# Run the container
docker run --rm -i \
-e OTRS_BASE_URL="https://your-otrs-server/otrs/nph-genericinterface.pl/Webservice/TestInterface" \
-e OTRS_USERNAME="your-username" \
-e OTRS_PASSWORD="your-password" \
-e OTRS_VERIFY_SSL="false" \
otrs-mcp-server使用 UV 运行
或者,您可以直接使用 UV 运行服务器。首先,设置您的环境变量:
export OTRS_BASE_URL="https://your-otrs-server/otrs/nph-genericinterface.pl/Webservice/TestInterface"
export OTRS_USERNAME="your-username"
export OTRS_PASSWORD="your-password"
export OTRS_VERIFY_SSL="false"
export OTRS_DEFAULT_QUEUE="Raw"
export OTRS_DEFAULT_STATE="new"
export OTRS_DEFAULT_PRIORITY="3 normal"
export OTRS_DEFAULT_TYPE="Unclassified"然后编辑您的 Claude Desktop 配置文件并添加服务器配置:
{
"mcpServers": {
"otrs": {
"command": "uv",
"args": [
"--directory",
"<full path to otrs-mcp-server directory>",
"run",
"src/otrs_mcp/main.py"
],
"env": {
"OTRS_BASE_URL": "https://your-otrs-server/otrs/nph-genericinterface.pl/Webservice/TestInterface",
"OTRS_USERNAME": "your-username",
"OTRS_PASSWORD": "your-password",
"OTRS_VERIFY_SSL": "false"
}
}
}
}注意:如果您在 Claude Desktop 中看到
Error: spawn uv ENOENT,您可能需要指定uv的完整路径,或在配置中设置环境变量NO_UV=1。
环境变量
变量 | 必需 | 默认值 | 描述 |
| ✅ | - | OTRS Web 服务的基础 URL |
| ✅ | - | OTRS 用户名 |
| ✅ | - | OTRS 密码 |
| ❌ |
| 启用 SSL 证书验证 |
| ❌ |
| 新工单的默认队列 |
| ❌ |
| 新工单的默认状态 |
| ❌ |
| 新工单的默认优先级 |
| ❌ |
| 新工单的默认类型 |
开发
欢迎贡献!如果您有任何建议或改进,请提出问题或提交拉取请求。
此项目面向 Python 3.12(请参阅 pyproject.toml 中的 requires-python),并已在该版本上验证可用于生产环境。
此项目使用 uv 管理依赖项。请按照适用于您平台的说明安装 uv:
curl -LsSf https://astral.sh/uv/install.sh | sh安装 Python 3.12(如果您尚未安装)并使用固定的依赖项创建虚拟环境:
# Install the interpreter (managed by uv)
uv python install 3.12
# Create the environment and install dependencies from uv.lock
uv sync --python 3.12 --extra dev或者,使用经典工作流程:
uv venv --python 3.12
source .venv/bin/activate # On Unix/macOS
.venv\Scripts\activate # On Windows
uv pip install -e .测试
测试您的 OTRS 连接和 API 功能:
# Set environment variables
export OTRS_BASE_URL="https://your-otrs-server/otrs/nph-genericinterface.pl/Webservice/TestInterface"
export OTRS_USERNAME="your-username"
export OTRS_PASSWORD="your-password"
export OTRS_VERIFY_SSL="false"
# Run connectivity test
uv run python tests/connectivity_test.py
# Run API functionality test
uv run python tests/test_working_api.py
# Run debug diagnostics
uv run python tests/debug_test.py项目包含测试脚本,可帮助您验证 OTRS 配置和 API 连接。
使用 pytest 运行测试:
# Install development dependencies
uv pip install -e ".[dev]"
# Run the tests
pytest
# Run with coverage report
pytest --cov=src --cov-report=term-missing发布 Docker 镜像
要将 Docker 镜像发布到 GitHub Container Registry 以供公开使用:
前提条件
GitHub 账户,并拥有此项目的仓库
GitHub 个人访问令牌,具有
write:packages权限本地安装 Docker
分步发布
创建 GitHub 个人访问令牌:
转到 GitHub 设置 → 开发者设置 → 个人访问令牌 → 令牌(经典)
生成具有
write:packages和read:packages权限的新令牌安全保存令牌
登录 GitHub Container Registry:
echo $GITHUB_TOKEN | docker login ghcr.io -u yourusername --password-stdin构建并标记镜像:
# Build the image docker build -t otrs-mcp-server . # Tag for GitHub Container Registry docker tag otrs-mcp-server ghcr.io/yourusername/otrs-mcp-server:latest docker tag otrs-mcp-server ghcr.io/yourusername/otrs-mcp-server:v0.1.0推送到注册表:
# Push latest tag docker push ghcr.io/yourusername/otrs-mcp-server:latest # Push version tag docker push ghcr.io/yourusername/otrs-mcp-server:v0.1.0将包设为公开(可选):
转到您的 GitHub 仓库
导航到“包”部分
点击您的包
转到“包设置”
将可见性更改为“公开”
使用 GitHub Actions 自动发布
创建 .github/workflows/docker-publish.yml:
name: Build and Push Docker Image
on:
push:
branches: [main]
tags: ["v*"]
pull_request:
branches: [main]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}替代方案:Docker Hub
要改为发布到 Docker Hub:
# Login to Docker Hub
docker login
# Tag for Docker Hub
docker tag otrs-mcp-server yourusername/otrs-mcp-server:latest
docker tag otrs-mcp-server yourusername/otrs-mcp-server:v0.1.0
# Push to Docker Hub
docker push yourusername/otrs-mcp-server:latest
docker push yourusername/otrs-mcp-server:v0.1.0然后更新 Claude Desktop 配置以使用:
"ghcr.io/yourusername/otrs-mcp-server:latest"或
"yourusername/otrs-mcp-server:latest"可用工具
🎫 工单管理
create_ticket- 在 OTRS 中创建新工单get_ticket- 获取特定工单的详细信息search_tickets- 根据各种条件搜索工单update_ticket- 更新现有工单的属性get_ticket_history- 获取工单的完整历史记录
📊 资源
otrs://ticket/{ticket_id}- 直接访问工单数据otrs://ticket/{ticket_id}/history- 访问工单历史记录otrs://search/tickets- 最近工单的概览
故障排除
常见问题
SSL 证书错误:对于自签名证书,设置
OTRS_VERIFY_SSL=falseHTTP 301 重定向:如果您的 OTRS 服务器将 HTTP 重定向到 HTTPS,请确保使用 HTTPS URL
身份验证失败:验证您的用户名、密码和 Web 服务配置
缺少操作:检查您的 OTRS Web 服务是否包含所有必需的操作
调试模式
运行调试脚本以诊断连接问题:
uv run python tests/debug_test.py这将测试 HTTP 和 HTTPS 连接,并提供详细的错误信息。
示例工作配置
供参考,以下是一个可用的配置示例:
# Environment variables
export OTRS_BASE_URL="https://your-otrs-server/otrs/nph-genericinterface.pl/Webservice/TestInterface"
export OTRS_USERNAME="your-username"
export OTRS_PASSWORD="your-password"
export OTRS_VERIFY_SSL="false"
export OTRS_DEFAULT_QUEUE="Raw"
export OTRS_DEFAULT_STATE="new"
export OTRS_DEFAULT_PRIORITY="3 normal"
export OTRS_DEFAULT_TYPE="Unclassified"OTRS Web 服务操作
您的 OTRS Web 服务应包含以下操作:
操作名称 | 控制器 | 描述 |
TicketCreate | Ticket::TicketCreate | 创建新工单 |
TicketGet | Ticket::TicketGet | 检索工单详细信息 |
TicketSearch | Ticket::TicketSearch | 搜索工单 |
TicketUpdate | Ticket::TicketUpdate | 更新现有工单 |
TicketHistoryGet | Ticket::TicketHistoryGet | 获取工单历史记录 |
许可证
Apache-2.0
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseCqualityCmaintenanceAn MCP server that enables AI assistants to interact with JIRA, allowing for querying issue details, creating and updating work items, and managing attachments through a standardized interface.124MIT

tickiti-mcpofficial
AlicenseBqualityBmaintenanceAn MCP server that exposes the Tickiti helpdesk API to AI assistants, enabling ticket management and helpdesk operations via natural language.11MIT- AlicenseAqualityDmaintenanceMCP server for Otobo ITSM enabling AI assistants to search, create, update, and manage tickets via the Generic Interface REST API.10111MIT
- AlicenseNot gradedqualityBmaintenanceAn MCP server that connects AI assistants to Zammad, providing tools for managing tickets, users, organizations, and attachments.38AGPL 3.0
Related MCP Connectors
MCP server for AI access to Swagger by SmartBear.
MCP server for AI access to SmartBear tools, including BugSnag, Reflect, Swagger, PactFlow, QTM4J.
An MCP server that integrates with Discord to provide AI-powered features.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/eduardoantoniojunior/otrs-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server