HumioMCP
MCP服务器,用于查询Humio/LogScale仪表板和执行搜索查询。
建于 FastMCP python
特性
- list_dashboards --在Humio仓库/视图中列出所有仪表板,并可选择名称过滤
- get_dashboard_查询 --从仪表板的小部件中提取所有搜索查询(带时间范围)
- 执行搜索 --运行搜索查询并获取JSON格式的结果(默认限制:200个事件)
- 通过TOML配置支持多集群
- 两者相对时间(
24h,7d)以及ISO 8601(2024-01-01T00:00:00Z)支持
______________________________________________________________________
他人快速入门
选项A:一键VS代码配置(推荐)
不需要克隆。将此添加到您的VS代码中 settings.json 或 .vscode/mcp.json:
{
"servers": {
"humio-mcp": {
"type": "stdio",
"command": "uvx",
"args": [
"--from", "git+https://github.com/weihong-xu-hpe/humio-mcp.git",
"humio-mcp"
],
"env": {
"HUMIO_MCP_CONFIG": "${userHome}/.config/humio-mcp/config.toml"
}
}
}
}然后在以下位置创建配置文件 ~/.config/humio-mcp/config.toml:
default_cluster = "us-west-2"
[clusters.us-west-2]
url = "https://your-humio-url.example.com/logs"
token = "your-api-token"就是这样-- uvx 自动处理安装和更新。
先决条件: 紫外线 必须安装(brew install uv或curl -LsSf https://astral.sh/uv/install.sh | sh)
选项B:克隆并在本地运行
git clone https://github.com/weihong-xu-hpe/humio-mcp.git
cd humio-mcp
uv sync
cp config.example.toml config.toml
# Edit config.toml with your cluster URLs and API tokens本地克隆的VS代码配置:
{
"servers": {
"humio-mcp": {
"type": "stdio",
"command": "uv",
"args": ["run", "--directory", "/path/to/HumioMCP", "mcp", "run", "src/humio_mcp/server.py"]
}
}
}选项C:克劳德桌面
增添 ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"humio-mcp": {
"command": "uvx",
"args": [
"--from", "git+https://github.com/weihong-xu-hpe/humio-mcp.git",
"humio-mcp"
],
"env": {
"HUMIO_MCP_CONFIG": "/Users/yourname/.config/humio-mcp/config.toml"
}
}
}
}______________________________________________________________________
配置
编辑 config.toml (或 ~/.config/humio-mcp/config.toml):
default_cluster = "us-west-2"
[clusters.us-west-2]
url = "https://mira-us-west-2.cloudops.ccs.arubathena.com/logs"
token = "your-api-token"
[clusters.eu-central-1]
url = "https://mira-eu-central-1.example.com/logs"
token = "another-token"配置搜索顺序:
HUMIO_MCP_CONFIG环境变量./config.toml~/.config/humio-mcp/config.toml
发展
# MCP Inspector (interactive debugging)
uv run mcp dev src/humio_mcp/server.py
# Stdio mode
uv run mcp run src/humio_mcp/server.py工具
list_dashboards
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
| repo | str | 是 | 存储库/视图名称 |
| cluster | str | 否 | 群集名称(配置中的默认值) |
| search_filter | str | 否 | 按名称子字符串筛选 |
get_dashboard_查询
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
| repo | str | 是 | 存储库/视图名称 |
| dashboard_name | str | 是 | 仪表板名称 |
| 集群 | str | 否 | 集群名称 |
执行搜索
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
| repo | str | 是 | 存储库/视图名称 |
| query_string | str | 是 | Humio搜索查询 |
| start | str | No | 开始时间(默认值: 24h) |
| end | str | 否 | 结束时间(默认值: now) |
| 集群 | str | 否 | 集群名称 |
