Kafka Sentinel

io.github.sanjay-amu由 GitHub 帳號 sanjay-amu 發布v0.1.2更新於 Oct 27, 2026

Read-only Kafka observability MCP server: cluster health, consumer lag, and replay-readiness.

概覽

AI 產生的概覽

唯讀的 Kafka 可觀測性 MCP 伺服器,讓助理檢視叢集健康、消費延遲、分割區狀態與重播可行性。

可以做什麼
  • 列出主題與消費群組,取得名稱與狀態
  • 回報叢集健康:broker 數量、控制器狀態、副本不足與離線分割區數
  • 依群組、主題、分割區顯示消費延遲及已提交與末端位移
  • 稽核主題持久性設定,檢視分割區 leader、ISR 縮減與分布傾斜
  • 檢查指定群組與主題的重播可行性,並一次產生附時間戳的故障快照
適用情境
適合排查串流資料故障,例如消費群組停滯、延遲暴增、重平衡風暴或位移重設,也適合讓助理在完全沒有寫入或管理權限的情況下觀察並關聯 Kafka 狀態。
執行需求
以 Python 套件形式透過 pip 或 uv 本機安裝,經 stdio 啟動。需要 KAFKA_BOOTSTRAP;選用 SASL/SSL 設定透過 KAFKA_SECURITY_PROTOCOL、KAFKA_SASL_MECHANISM、KAFKA_SASL_USERNAME、KAFKA_SASL_PASSWORD 與 KAFKA_SSL_CA_LOCATION 提供。需要能連線至 broker 的網路。
安裝前請注意
需要 Kafka 憑證,包括機密項 KAFKA_SASL_PASSWORD,皆從環境變數讀取。應使用僅具 Describe 權限的最小權限帳號。每次工具呼叫都會連同參數記錄以供稽核。專案自述為早期但已測試。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Kafka Sentinel,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

kafka-sentinel-mcp

[CI] [PyPI] [Python] [License: MIT]

Give AI agents safe, read-only eyes on your Kafka clusters.

An MCP (Model Context Protocol) server that exposes Kafka cluster health, consumer lag, partition state, and replay-readiness as structured tools — so LLM agents (Claude, or any MCP client) can diagnose streaming incidents without ever being able to break anything.

Built by an engineer who spent a decade running Kafka-based financial messaging at 99.999% availability, and got tired of every "AI + Kafka" demo assuming write access to production.

Why this exists

When a consumer group stalls at 3 a.m., the questions are always the same: Is it lag? A stuck partition? A rebalance storm? An offset reset gone wrong? These are pattern-matching questions — exactly what LLM agents are good at — but no operator will hand an agent admin rights on a production cluster.

kafka-sentinel-mcp draws a hard line: every tool is read-only by design, enforced at the client-config level (no admin operations are even imported). The agent can observe, correlate, and recommend; a human executes.

Tools

ToolWhat it returns
list_topicsAll non-internal topics with partition count and replication factor — start here if you don't know a topic name
list_consumer_groupsAll consumer group IDs with state — start here if you don't know a group name
cluster_healthBroker count, controller status, under-replicated / offline partition counts
consumer_lagPer-group, per-topic, per-partition lag with committed vs end offsets
topic_auditReplication factor, min.insync.replicas, retention, and flags configs that violate durability best practice
partition_stateLeaders, ISR shrinkage, skew across brokers
replay_readinessFor a group + topic: earliest available offsets vs committed, i.e., "can we still replay what we missed?"
incident_snapshotOne-call bundle of all the above, timestamped — designed for pasting into a postmortem

Quick start

bash
pip install kafka-sentinel-mcp   # (or: uv tool install)
# Run against your cluster (read-only credentials!)KAFKA_BOOTSTRAP=localhost:9092 kafka-sentinel-mcp

Add to Claude Desktop / any MCP client:

json
{  "mcpServers": {    "kafka-sentinel": {      "command": "kafka-sentinel-mcp",      "env": { "KAFKA_BOOTSTRAP": "broker1:9092,broker2:9092" }    }  }}

Then ask your agent: "Why is the payments-consumer group falling behind, and can we still replay from where it stalled?"

Security posture

  • Read-only by construction: no produce, no topic/config mutation, no offset commits, no ACL ops. The mutation APIs are never imported, and a test in CI greps the server source on every run to keep it that way.

  • The observer consumer runs with enable.auto.commit=False and never commits — verified against a real broker, not just asserted.

  • Supports SASL/SSL; credentials are read from the environment only and never logged.

  • Every tool call is logged with its parameters for audit.

  • Least privilege: run with a principal that has only Describe on the cluster and topics, and Describe on consumer groups. When an ACL denies an operation the tool returns a structured result rather than a stack trace:

    json
    {  "error": "permission_denied",  "operation": "list_consumer_groups",  "detail": "...",  "hint": "The Kafka principal in use lacks the ACL required for this operation. ..."}

    The agent can then tell the operator which ACL is missing instead of appearing broken. Non-authorization failures are deliberately not swallowed — they propagate, because silently degrading on an unrelated error would hide real problems.

Testing

bash
pip install -e ".[dev]"
pytest -m "not integration"   # fast, fully mocked — no Docker neededpytest -m integration         # starts a real Kafka via testcontainers (needs Docker)pytest                        # both

The unit suite mocks librdkafka entirely and covers tool logic. The integration suite starts an actual broker, produces real records, and asserts the tools return correct lag, ISR state, durability flags, and replay-readiness — including that the observer leaves no committed offsets behind. Both run in CI.

Status

Early but tested. See ROADMAP.md. Issues and PRs welcome — especially war stories about what you wish an agent could have told you during an incident.

Citing this work

If you reference this project in academic work, see CITATION.cff, or use the "Cite this repository" button on GitHub.

License

MIT

來源:README.md,提交 719153d

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.1.2最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分