GLPI MCP Server v2
GLPI MCP Server v2
🌐 English version · 葡萄牙语(巴西)
基于 TypeScript/Node 的 MCP(Model Context Protocol)服务器,用于与 GLPI 集成。它使用 GLPI v2.3 API(通过 OAuth2)直接向 AI 代理提供 ITIL 覆盖和集成工具(tickets、problems、changes、knowledgebase、stats、assets、administration)。
本项目整合了多个工具,避免重复请求,并以适合 LLM 消费的优化格式提供数据。
🌟 鸣谢与致谢
本项目借鉴了以下项目的结构和工具覆盖范围:
GMS64260/mcp-glpi (MIT)
它们已适配新的 GLPI v2.3 API(OAuth2)。感谢原作者(GMS64260 和 DevSkillsIT)在架构设计和 ITIL 映射业务逻辑方面带来的启发。
Related MCP server: mcp-itop
🚀 功能 (Tools)
提供专注于生产力的工具,包括:
Assistance:创建、更新、搜索(使用 RSQL 过滤器)以及完整读取(包括 1 个请求中的 timeline)Tickets、Problems 和 Changes。统计数据和添加 follow-ups。
Knowledgebase:搜索和读取文章。
Assets:列出和读取 Computers(带有包含详细规格的 flag)。
Administration:搜索用户、读取用户上下文和列出组。
🛠 安装
克隆仓库或下载文件。
安装依赖:
npm install编译项目:
npm run build
⚙️ 配置 (.env)
在项目根目录创建基于 .env.example 文件的 .env 文件:
GLPI_BASE_URL=http://localhost:8080
GLPI_CLIENT_ID=seu_client_id_oauth2
GLPI_CLIENT_SECRET=seu_client_secret_oauth2
GLPI_USERNAME=usuario_glpi
GLPI_PASSWORD=senha_glpi如何在 GLPI 中创建 OAuth2 API 客户端
访问 GLPI(版本 11 / 已启用 v2.3)。
进入 配置 → OAuth 客户端(
/front/oauthclient.php)。添加一个新客户端。
在 授权 中添加
Senha(password grant — 推荐用于脚本/代理)。在 范围 中,至少选择
api(如果使用用户上下文相关工具,还要选择user)。保存并复制所保存条目中显示的 Client ID(identifier)和 Client Secret。
🔌 在 MCP 客户端中注册
服务器通过 stdio 运行(node dist/index.js + 环境变量),因此任何兼容的 MCP 客户端都可以注册它。以下是各客户端的示例。
Claude Desktop / Claude Code
文件 claude_desktop_config.json(Desktop)或 .mcp.json(Claude Code,位于项目根目录):
{
"mcpServers": {
"glpi-v2": {
"command": "node",
"args": [
"caminho/absoluto/para/glpi-mcp-v2/dist/index.js"
],
"env": {
"GLPI_BASE_URL": "http://localhost:8080",
"GLPI_CLIENT_ID": "seu_client_id_oauth2",
"GLPI_CLIENT_SECRET": "seu_client_secret_oauth2",
"GLPI_USERNAME": "usuario_glpi",
"GLPI_PASSWORD": "senha_glpi"
}
}
}
}Antigravity (IDE 和 CLI)
文件 ~/.gemini/config/mcp_config.json(全局)或 .agents/mcp_config.json(按工作区):
{
"mcpServers": {
"glpi-v2": {
"command": "node",
"args": [
"caminho/absoluto/para/glpi-mcp-v2/dist/index.js"
],
"env": {
"GLPI_BASE_URL": "http://localhost:8080",
"GLPI_CLIENT_ID": "seu_client_id_oauth2",
"GLPI_CLIENT_SECRET": "seu_client_secret_oauth2",
"GLPI_USERNAME": "usuario_glpi",
"GLPI_PASSWORD": "senha_glpi"
}
}
}
}Codex CLI (OpenAI)
文件 ~/.codex/config.toml(全局)或 .codex/config.toml(按项目,在受信任环境中):
[mcp_servers.glpi-v2]
command = "node"
args = ["caminho/absoluto/para/glpi-mcp-v2/dist/index.js"]
[mcp_servers.glpi-v2.env]
GLPI_BASE_URL = "http://localhost:8080"
GLPI_CLIENT_ID = "seu_client_id_oauth2"
GLPI_CLIENT_SECRET = "seu_client_secret_oauth2"
GLPI_USERNAME = "usuario_glpi"
GLPI_PASSWORD = "senha_glpi"或者通过 codex mcp add glpi-v2 --command node --args caminho/absoluto/para/glpi-mcp-v2/dist/index.js(交互式,用于设置环境变量)。
Hermes Agent
hermes mcp add glpi-v2 --command "node caminho/absoluto/para/glpi-mcp-v2/dist/index.js"环境变量(GLPI_BASE_URL、GLPI_CLIENT_ID 等)必须在运行 Hermes 的环境中可用,或者通过项目目录中的 .env 文件配置(如果适用,服务器会通过 dotenv 加载这些变量 — 参见 src/config.ts)。
OpenClaw
文件 ~/.openclaw/openclaw.json:
{
"mcp": {
"servers": {
"glpi-v2": {
"command": "node",
"args": [
"caminho/absoluto/para/glpi-mcp-v2/dist/index.js"
],
"transport": "stdio",
"env": {
"GLPI_BASE_URL": "http://localhost:8080",
"GLPI_CLIENT_ID": "seu_client_id_oauth2",
"GLPI_CLIENT_SECRET": "seu_client_secret_oauth2",
"GLPI_USERNAME": "usuario_glpi",
"GLPI_PASSWORD": "senha_glpi"
}
}
}
}
}注意: 上面关于 Hermes Agent 和 OpenClaw 的示例在编写时遵循了各项目的公开文档,但尚未直接针对此服务器进行测试。在生产环境中使用前,请先在本地验证连接(列出暴露的 tools)。
替代方案:HTTP 传输
如果客户端不支持 stdio,服务器还提供 StreamableHTTPServerTransport(参见 src/httpServer.ts)。在进程的环境变量中设置 MCP_TRANSPORT=http,并可选择设置 MCP_HTTP_PORT(默认 3000)。端点位于 http://localhost:<porta>/mcp(POST)— 将客户端指向该 URL,而不是本地命令。
📄 OpenAPI Spec (开发参考)
swagger-v2.3.json 文件(API v2.3 的完整 OpenAPI spec,由 GLPI 动态生成)不受版本控制(git 忽略 — 4.6MB,生成文件)。要从正在运行的 GLPI 实例重新生成:
curl -s "http://SEU_GLPI/api.php/doc.json" -o swagger-v2.3.json🌐 HTTP 模式 (Express)
服务器可选地支持通过 HTTP 通信,使用推荐的无状态端点(POST /mcp)。
要启用此模式,请设置以下环境变量:
MCP_TRANSPORT=http(默认为stdio)MCP_HTTP_PORT=3000(可选,定义 Express 服务器的端口)
使用 curl 列出工具的请求示例:
curl -X POST http://localhost:3000/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}'许可证
MIT
Available Tools
30 toolsglpi_add_change_followupA
Adiciona um followup (acompanhamento) à timeline de um change.
Inputs: id (required), content (required), is_private.
glpi_add_problem_followupB
Adiciona um followup (acompanhamento) à timeline de um problem.
Inputs: id (required), content (required), is_private.
glpi_add_ticket_followupC
Adiciona um followup (acompanhamento) à timeline de um ticket.
Inputs: id (required), content (required), is_private.
glpi_create_changeC
Cria um novo change.
Inputs: input (required).
glpi_create_problemC
Cria um novo problem.
Inputs: input (required).
glpi_create_ticketB
Cria um novo ticket.
Inputs: input (required).
glpi_get_asset_statsC
Retorna estatísticas de ativos (assets) associados a chamados, mudanças ou problemas.
Inputs: itemtype (required), date_end, date_start.
glpi_get_changeA
Retorna o contexto completo de UM change, incluindo timeline, sem precisar de múltiplas chamadas.
Inputs: id (required).
glpi_get_change_statsC
Retorna as estatísticas de um change.
Inputs: id (required).
glpi_get_change_timelineB
Retorna a timeline de UM change (followups, tasks, etc).
Inputs: id (required).
glpi_get_computerC
Retorna o contexto completo de UM computador, incluindo especificações de hardware (CPU, memória, disco, rede) e software instalado.
Inputs: id (required).
glpi_get_knowbase_itemA
Retorna o conteúdo completo de um artigo da base de conhecimento.
Inputs: id (required), language.
glpi_get_problemC
Retorna o contexto completo de UM problem, incluindo timeline, sem precisar de múltiplas chamadas.
Inputs: id (required).
glpi_get_problem_statsC
Retorna as estatísticas de um problem.
Inputs: id (required).
glpi_get_problem_timelineA
Retorna a timeline de UM problem (followups, tasks, etc).
Inputs: id (required).
glpi_get_ticketA
Retorna o contexto completo de UM ticket, incluindo timeline, sem precisar de múltiplas chamadas.
Inputs: id (required).
glpi_get_ticket_statsC
Retorna as estatísticas de um ticket.
Inputs: id (required).
glpi_get_ticket_timelineA
Retorna a timeline de UM ticket (followups, tasks, etc).
Inputs: id (required).
glpi_get_user_contextC
Retorna o contexto de UM usuário, incluindo itens usados e gerenciados.
Inputs: id (required).
glpi_list_computersC
Busca e lista computadores (Assets). Permite paginação (start, limit) e filtros (filter em RSQL).
Inputs: limit, start, filter, include_specs.
glpi_list_groupsA
Busca e lista grupos (Groups). Permite paginação e filtros.
Inputs: limit, start, filter.
glpi_search_changesC
Busca e lista changes. Permite paginação (start, limit) e filtros (filter em RSQL).
Inputs: limit, start, filter.
glpi_search_faqA
Busca artigos marcados como FAQ na base de conhecimento (is_faq=true). Use para dúvidas rápidas de uso do GLPI antes de abrir ticket.
Inputs: limit, query, start, language.
glpi_search_knowbaseA
Busca artigos na base de conhecimento (Knowledgebase). Permite paginação (start, limit) e filtros (filter).
Inputs: limit, start, filter, language.
glpi_search_problemsA
Busca e lista problems. Permite paginação (start, limit) e filtros (filter em RSQL).
Inputs: limit, start, filter.
glpi_search_ticketsB
Busca e lista tickets. Permite paginação (start, limit) e filtros (filter em RSQL).
Inputs: limit, start, filter.
glpi_search_userA
Busca e lista usuários (Users). Permite paginação e filtros.
Inputs: limit, start, filter.
glpi_update_changeA
Atualiza campos de um change existente.
Inputs: id (required), input (required).
glpi_update_problemC
Atualiza campos de um problem existente.
Inputs: id (required), input (required).
glpi_update_ticketC
Atualiza campos de um ticket existente.
Inputs: id (required), input (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 30 tools
Tools mostly target distinct resources and actions: tickets, problems, changes, knowledgebase, computers, users, and groups are clearly named. Some overlap exists between full-context getters and standalone timeline getters, and between knowledgebase search and FAQ search, but the descriptions help disambiguate them.
Nearly all tools follow glpi_verb_entity snake_case with consistent create/update/search/get/add patterns for the main ITSM entities. Minor deviations include list_computers/list_groups versus search_* for the other collections, and get_knowbase_item versus get_computer/get_ticket.
At 30 tools, this is above the 25-tool heavy threshold and the set includes redundant timeline endpoints that duplicate the full-context getters. A leaner set around 20-22 tools could cover the same GLPI modules without extra selection burden.
The core ticket/problem/change lifecycle is well covered with search, get, create, update, and followup, and there is read access to knowledgebase, computers, users, and groups. However, there are no create/update/delete operations for computers, users, or groups, no knowledgebase write tools, and no task/solution-specific endpoints for tickets, problems, or changes.
Maintenance
Related MCP Connectors
MCP server for GLPI: tickets, ITIL, assets, knowledge base. GLPI 10/11. Not affiliated with Teclib'.
MCP server for Support & Service Management
MCP server for Getfly CRM — customers, opportunities, orders, tickets and tasks.
Gleap's official MCP server: tickets, contacts, CRM, help center and support stats. OAuth sign-in.
Related MCP Servers
- AlicenseBqualityCmaintenanceMCP server allowing an AI assistant to interact directly with your GLPI instance via its REST API, enabling ticket management, knowledge base operations, and statistics.404-
- FlicenseNot gradedqualityDmaintenanceMCP server for iTop ITSM that provides 19 tools for analytics, ticket management, comments, knowledge base, and CI impact analysis, enabling AI assistants to interact with iTop.1-
- AlicenseAqualityDmaintenanceMCP server to manage GestSup tickets via an LLM, with tools for creating, reading, commenting, and searching tickets.13MIT
- FlicenseNot gradedqualityDmaintenanceMCP server for ticketing automation that exposes tools to create, search, and update IT helpdesk tickets, with metrics tracking.-