openobserve-mcp

openobserve-mcp

MCP server that enables querying an OpenObserve instance for logs, traces, and metrics via tools like search_logs, search_traces, get_trace, and query_metrics, supporting natural-language-driven observability workflows.

Category
访问服务器

README

openobserve-mcp

An MCP server that lets any MCP client — Claude Code, Cursor, a custom agent — query an OpenObserve instance: logs, traces, and metrics.

Quick start

npm install
npm run build

npm run o2:up     # OpenObserve on http://localhost:5080
npm run seed      # sample logs, traces, and metrics
npm run smoke     # call every tool over a real stdio MCP session

npm run smoke should print eight ok lines. Log in to the UI at http://localhost:5080 with root@example.com / Complexpass#123.

Connecting a client

Claude Code

claude mcp add openobserve \
  --env O2_URL=http://localhost:5080 \
  --env O2_ORG=default \
  --env O2_USER=root@example.com \
  --env O2_PASSWORD='Complexpass#123' \
  -- node /absolute/path/to/openobserve-mcp/dist/index.js

Restart the client afterwards — MCP servers are loaded at session start.

Any client (JSON config)

{
  "mcpServers": {
    "openobserve": {
      "command": "node",
      "args": ["/absolute/path/to/openobserve-mcp/dist/index.js"],
      "env": {
        "O2_URL": "http://localhost:5080",
        "O2_ORG": "default",
        "O2_USER": "root@example.com",
        "O2_PASSWORD": "Complexpass#123"
      }
    }
  }
}

Configuration

Variable Default Purpose
O2_URL http://localhost:5080 Base URL of the instance
O2_ORG default Organization id
O2_USER — Login email
O2_PASSWORD — Password

See .env.example. Credentials are read from the process environment only; nothing is written to disk.

Tools

Tool Purpose
list_streams Enumerate streams, optionally filtered by type
get_schema Field names and types for a stream
get_org_summary Stream count, storage, pipelines, alerts, dashboards
search_logs Rows matching a SQL WHERE clause, newest first
aggregate_logs COUNT / AVG / GROUP BY over logs, traces, or metrics
search_traces Recent traces with root operation, duration, services
get_trace Every span of one trace, ordered by start time
query_metrics PromQL over a time range

Time ranges

Every time argument takes an ISO timestamp or relative shorthand: 30s, 15m, 2h, 7d, 1w. end_time defaults to now.

aggregate_logs table token

Write the table as the literal token stream; it is substituted with the real stream name in FROM / JOIN position only, so a column or string literal containing the word is left alone.

{
  "stream": "app_logs",
  "sql": "SELECT service, COUNT(*) AS c FROM stream GROUP BY service ORDER BY c DESC",
  "start_time": "1h"
}

Logs and traces live in separate indexes. To aggregate spans, pass "stream_type": "traces" — otherwise OpenObserve reports stream not found.

Layout

src/
  index.ts          entrypoint — stdio transport only
  server.ts         builds a wired McpServer (importable for tests)
  config.ts         environment → Config
  client.ts         OpenObserve HTTP API wrapper
  time.ts           ISO / relative range parsing → micros + seconds
  tools/
    index.ts        registers every tool
    helpers.ts      JSON result shape, SQL quoting, shared schema
    streams.ts      list_streams, get_schema, get_org_summary
    logs.ts         search_logs, aggregate_logs
    traces.ts       search_traces, get_trace
    metrics.ts      query_metrics
scripts/
  seed.mjs          sample logs, traces, metrics
  smoke.mjs         stdio MCP client — exercises every tool
docker-compose.yml  local OpenObserve

Adding a tool means one file in src/tools/ plus a line in src/tools/index.ts.

Verified against

OpenObserve public.ecr.aws/zinclabs/openobserve:latest (v0.15.x), MCP SDK 1.25, Node 22.

Endpoint paths are version-sensitive. Two in particular differ from what the API docs suggest: stream schema is /api/{org}/streams/{stream}/schema (not /api/{org}/{stream}/schema), and there is no /traces/{trace_id} endpoint — get_trace searches the trace stream by id instead. If you upgrade OpenObserve, re-run npm run smoke.

Development

npm run watch      # tsc --watch
npm run smoke      # regression check against a live instance
node scripts/smoke.mjs list                    # inspect registered tools
node scripts/smoke.mjs get_schema '{"stream":"app_logs"}'

scripts/smoke.mjs speaks the real MCP protocol over stdio, so it catches schema and transport regressions that a direct HTTP test would miss.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选