
Nats Trail
io.github.solsolettidev由 GitHub 帳號 solsolettidev 發布v0.6.1更新於 Oct 27, 2026
Read-only NATS and JetStream observability: trace a request across streams, rank what is broken.
概覽
唯讀的 NATS 與 JetStream 可觀測性 MCP 伺服器,讓助理跨串流追蹤單一請求、檢視拓撲並找出目前故障。
- 可以做什麼
- 探索承載流量的 subject 並推斷酬載結構,取得依嚴重度排序的健康摘要,重建某個 request_id 的因果鏈
- 搜尋訊息、檢視訊息詳情、依 request_id 或 correlation_id 追蹤、搜尋死信並執行已儲存的篩選器
- 列出串流、消費者、KV bucket 與鍵及其版本歷史,以及物件 bucket 與物件
- 檢視伺服器健康、連線、情境、連線狀態、篩選器與稽核紀錄,並為事件或 Sentry 補充情境
- 適用情境
- 適合需要除錯事件驅動 NATS 或 JetStream 系統的情況,例如查明某條流程為何失敗、跨多個串流與服務追蹤一個請求,或在不呼叫 NATS CLI 的情況下檢查死信與消費者健康。
- 執行需求
- 以 npm 套件形式透過 stdio 在本機執行,需要 Node.js 22 或更新版本。需在 NATS_TRAIL_API 提供可連線的 NATS Trail 橋接位址;未設定時伺服器只能依本機狀態回應,無法存取 JetStream。橋接啟用驗證時需設定 NATS_TRAIL_TOKEN,唯讀範圍的權杖即可。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Nats Trail,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
[NATS Trail — the agent-native observability layer for NATS and JetStream]
[npm] [License: Apache-2.0] [Node version] [TypeScript strict] [Agent surface: read-only]
Give an AI agent safe access to your production event bus.
A web UI, a CLI and an MCP server over one bounded query engine — so humans and agents debug NATS from the same source of truth.
Why this exists
Every NATS GUI answers "what is in this stream?". That is the easy question.
The hard question in an event-driven system is "why did this one flow fail?" — and answering it
means following a single request_id across four streams, three services and a dead-letter subject.
Today you do that by hand, with a terminal per stream.
NATS Trail answers that question directly, and exposes the answer to agents as a typed, bounded, read-only tool contract — so you can point Claude at production and ask.
Or, from an agent: "Why did the refresh for s3-events fail?" — and it lands on the message that actually broke, with the retry state and the correlation ids already extracted:
The part nobody else does
There are several NATS MCP servers. They shell out to the nats CLI, return raw dumps, and expose
publish and delete while describing themselves as read-only.
NATS Trail treats the agent surface as a contract, not a wrapper:
"Read-only" here means unreachable, not disabled
[The UI and CLI reach both read and write paths; the MCP runtime is wired only to the read path]
NATS Trail can write: publish, purge, delete messages, consumers and streams. Those live behind
/api/mutate, reachable from the UI and the CLI.
executeMcpTool() receives an McpRuntimeData interface that exposes only read functions. There is
no disabled publish behind a feature flag — there is no publish to call. A misconfigured
environment variable cannot purge your production stream, because the code path does not exist. CLI
write commands additionally refuse to run under --agent, and the test suite reads the source to
assert none of this has been quietly undone.
This is the only reason it is reasonable to hand an agent a prod context.
Install
Open http://127.0.0.1:4000 — one process serves the UI and the API.
Prefer containers? The compose file brings up NATS Trail next to a JetStream-enabled server:
On Kubernetes, the Helm chart declares contexts and correlation keys in values.yaml and keeps
credentials in a Secret:
See charts/nats-trail/README.md for declarative config, why it is a
single-replica StatefulSet, and how authentication is delegated to whatever fronts the service.
From source
Development with hot reload
- UI: http://localhost:5173 (proxies
/apiand/wsto the bridge) - API bridge: http://localhost:4000
npm run dev runs the TypeScript watcher, the API bridge and the UI together.
Requirements: Node.js >= 22 (for the built-in SQLite used by the correlation index) and a reachable NATS server (nats-server -js is fine).
Use it as an MCP server
Point any MCP client at the stdio server. For Claude Code:
Or wire it manually:
Twenty-five read-only tools, all returning the same envelope:
See docs/mcp-agent.md.
Three surfaces, one engine
A filter you save in the UI is the same filter nats-trail filter run executes, and the same one
natstrail.run_filter hands an agent. Configure a context once; use it everywhere.
packages/ui— React + Vite. Presentation only.packages/server— Express + WebSocket bridge. Owns connections and credentials.packages/core— the Query Engine: envelopes, limits, truncation, filters, error normalization.packages/cli— thenats-trailbinary: query commands,serve, and an interactive shell.packages/mcp— tool contracts and the stdio server.
See docs/architecture.md.
Features
Inspect — context selector (local / dev / staging / prod) with a prod confirmation gate, live subject subscription, JSON pretty print with tree view and in-payload search, stream and consumer browsing, auto-detected DLQ panel.
Understand — subject discovery infers payload shapes from real traffic, flow reconstruction
turns one request_id into a causal chain, and the health summary ranks what is actually broken.
Query — bounded stream scans with cursors and time windows, filters by subject, date, text and JSON event type, saved filters shared across all three surfaces. Binary payloads (protobuf, msgpack) are detected and shown as hex dumps rather than mojibake.
Browse — KV buckets with per-key revision history including deletes, Object Store metadata, and
server health from the monitoring port (varz / jsz / connz).
Change — publish, request/reply, purge, and delete messages, consumers and streams, from the UI and the CLI, behind confirmation. Never from the agent surface.
Integrate — read-only HTTP API under /api/integration, bearer tokens with per-token audit
identity, and POST /api/integration/enrich/sentry to attach NATS context to an error without
exposing credentials.
Full list in docs/features.md · CLI reference in docs/cli.md.
Security
Credentials live in contexts stored locally under data/ (git-ignored). The UI never holds the NATS
connection — it always goes through the bridge, which pools one connection per context.
The server binds to 127.0.0.1 by default because /api/contexts and /api/connect are
unauthenticated local endpoints. To expose the Integration API and the WebSocket, configure bearer
tokens with NATS_TRAIL_TOKENS=name:token or data/tokens.json; audit entries then record the
authenticated token name per call.
A shared deployment has no built-in login on purpose: identity comes from whatever fronts the
service (an ingress with OIDC, oauth2-proxy, Cloudflare Access, Teleport or network isolation), so no
passwords are stored here. Contexts declared through NATS_TRAIL_CONFIG resolve ${VAR} from the
environment and cannot be edited or deleted through the API.
Roadmap
Tracked in docs/roadmap.md.
Phases 0–3 are complete. npm release · KV and Object Store browsing · server health · binary payload handling · nkey auth · subject discovery · flow reconstruction · health summary · incident enrichment for Sentry, Grafana, Datadog and PagerDuty · stream, consumer and KV administration · MCP registry listing · indexed correlation search · declarative config and a Helm chart. All writes are human-only, behind scoped tokens and audited with their arguments.
Next: cluster awareness, deliberately deferred rather than pending work.
Deliberately out — protobuf and msgpack field decoding (needs a per-subject schema registry)
and competing with NUI on GUI breadth. See
docs/roadmap.md.
Planned, not started: for teams that explicitly want agent writes, a separate opt-in binary
(natstrail-mcp-write) that has to be installed on purpose. Never a flag on the read-only server:
the guarantee above is only worth something if it cannot be switched off by accident.
Contributing
Issues and PRs welcome. See docs/development.md for the build layout.
License
Apache-2.0 © Sol Soletti
來源:README.md,提交 0723270
工具
0版本歷史
3- v0.6.1最新Oct 3, 2026
- v0.6.0Oct 2, 2026
- v0.5.0Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分