Mcp Kafka

io.github.dockndevai由 GitHub 帳號 dockndevai 發布v0.3.3更新於 Oct 28, 2026

Apache Kafka monitoring & management for AI agents (with consumer lag) — governed.

已驗證STDIO僅桌面資料庫安全與監控

概覽

AI 產生的概覽

針對 Apache Kafka 的在地 MCP 伺服器,讓助理檢視叢集、主題、位移與消費延遲,並可選擇執行受控管的寫入與管理操作。

可以做什麼
  • 檢視叢集資訊:broker、controller、叢集 ID,以及依允許清單過濾的主題名稱
  • 檢查主題:分割區、副本、同步副本、非預設設定,以及各分割區的最早與最新位移
  • 檢視消費群組:列出消費群組與協定類型、描述其狀態,並計算各分割區與整體的消費延遲
  • 在讀寫模式下管理主題:建立主題、增加分割區、修改主題設定、重設消費群組位移
  • 在管理模式刪除主題或消費群組,且需明確開啟刪除開關
適用情境
適合讓助理回答 Kafka 叢集的維運問題,例如哪些消費群組延遲最高、某個主題如何分割,或在聊天用戶端中進行範圍受限的主題變更。僅需監控時以唯讀模式啟動即可。
執行需求
透過 npx 從 npm 套件以 stdio 在本機執行,需要 Node.js。必須提供 KAFKA_BROKERS(以逗號分隔的 host:port 清單),可選 KAFKA_MODE(read-only、read-write 或 admin,預設唯讀)。需要能連線 broker 的網路;支援明文、TLS 與 SASL PLAIN/SCRAM 驗證。
安裝前請注意
讀寫與管理模式可建立主題、增加分割區、修改設定、重設消費群組位移,以及刪除主題或消費群組(刪除還需開啟刪除開關)。除非確實需要變更,否則保持唯讀,並搭配主題允許清單、受保護主題、試執行與稽核日誌。broker 憑證與 TLS/SASL 設定透過環境變數提供。

安裝

在 SourceWeft 中

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

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

其他 MCP 客戶端

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

README

mcp-kafka

[CI] [License: MIT] [npm]

A Model Context Protocol server for Apache Kafka. It lets an MCP-capable client (Claude Desktop, Claude Code, etc.) monitor and manage Kafka clusters — topics, partitions, configs, and consumer groups (including lag) — with behaviour controlled entirely by flags.

Safe by default: it starts read-only, can be scoped to an allowlist of topics, protects internal/critical topics from mutation, and gates destructive operations behind an explicit opt-in.

Features

  • Monitoring — cluster/broker info, topic metadata and offsets, consumer groups, and per-partition + total consumer lag.
  • Management — create topics, add partitions, alter topic configs, reset group offsets; delete topics/groups (admin).
  • Access modes — read-only → read-write → admin, layered so a mode never exposes tools above its level.
  • Security flags — topic allowlist, protected/internal topics, delete gating, dry-run, and JSON audit logging (see below).
  • Auth — plaintext, TLS, and SASL (PLAIN / SCRAM-SHA-256 / SCRAM-SHA-512).

Security model

ConcernFlagDefaultEffect
What can the server do?KAFKA_MODEread-onlyread-only exposes only monitoring; read-write adds management; admin adds deletes. Tools above the mode are never registered.
Which topics are in scope?KAFKA_TOPIC_ALLOWLIST(all)When set, operations on other topics are refused.
Protect internal topicsKAFKA_PROTECT_INTERNAL_TOPICStrueTopics starting with _ can be read but never mutated.
Protect specific topicsKAFKA_PROTECTED_TOPICS(none)Additional read-only-forever topics.
Can it delete?KAFKA_ALLOW_DELETEfalsedelete_topic / delete_consumer_group need this and admin mode.
Preview without touching the clusterKAFKA_DRY_RUNfalseWrite/admin tools validate + log intent, then return.
Audit trailKAFKA_AUDIT_LOGtrueEmits a JSON line to stderr per guarded operation.
Interactive confirmation(automatic)—Destructive & high-impact actions prompt the human to approve via MCP elicitation before running; clients without elicitation fall back to the *_ALLOW_* gate.

Tools

Read (read-only+): cluster_info, list_topics, describe_topic, topic_offsets, list_consumer_groups, describe_consumer_group (with lag)

Write (read-write+): create_topic, create_partitions, alter_topic_config, reset_consumer_group_offsets

Admin (admin): delete_topic, delete_consumer_group (both need KAFKA_ALLOW_DELETE)

Quickstart — add to your agent

Published on npm as @dockndevai/mcp-kafka. No clone or build needed — your MCP client runs it on demand with npx. Start in read-only mode; see .env.example for every variable and docs/CLIENTS.md for the full per-client guide.

Claude Code (CLI)

bash
claude mcp add kafka -e KAFKA_BROKERS="localhost:9092" -e KAFKA_MODE="read-only" -- npx -y @dockndevai/mcp-kafka

Claude Desktop · Cursor · Windsurf — same block in claude_desktop_config.json, .cursor/mcp.json, or ~/.codeium/windsurf/mcp_config.json:

json
{  "mcpServers": {    "kafka": {      "command": "npx",      "args": [        "-y",        "@dockndevai/mcp-kafka"      ],      "env": {        "KAFKA_BROKERS": "localhost:9092",        "KAFKA_MODE": "read-only"      }    }  }}

OpenAI Codex CLI — in ~/.codex/config.toml:

toml
[mcp_servers.kafka]command = "npx"args = ["-y", "@dockndevai/mcp-kafka"]env = { KAFKA_BROKERS = "localhost:9092", KAFKA_MODE = "read-only" }

VS Code (GitHub Copilot, Agent mode) — in .vscode/mcp.json:

json
{  "servers": {    "kafka": {      "type": "stdio",      "command": "npx",      "args": [        "-y",        "@dockndevai/mcp-kafka"      ],      "env": {        "KAFKA_BROKERS": "localhost:9092",        "KAFKA_MODE": "read-only"      }    }  }}

Example prompts

  • "Which consumer groups have the most lag right now?"
  • "Describe the orders topic and show its offsets."
  • "Create a topic events with 6 partitions and 7-day retention." (needs read-write)

Run from source (development)

Prefer the published package above. To run from a clone:

bash
npm installnpm run buildnode dist/index.js   # with the environment variables set

Develop

bash
npm run devnpm testnpm run typecheck

Publishing

This server ships a server.json for the official MCP registry and an mcpName for npm ownership validation. See PUBLISHING.md for publishing to npm and listing on the MCP registry, Smithery, Glama, Cursor, and PulseMCP.

License

MIT

來源:README.md,提交 4996b18

工具

6

cluster_info

Cluster info

Describe the Kafka cluster: brokers, controller, and cluster id.

無需輸入參數。

list_topics

List topics

List topic names. Topics outside the allowlist are filtered out.

輸入參數includeInternal

describe_topic

Describe topic

Partitions, replicas, in-sync replicas, and non-default configs for a topic.

輸入參數topic必填

topic_offsets

Topic offsets

Earliest and latest offsets per partition for a topic (message backlog view).

輸入參數topic必填

list_consumer_groups

List consumer groups

List consumer groups and their protocol types.

無需輸入參數。

describe_consumer_group

Describe consumer group (with lag)

Describe a consumer group's state and compute per-partition and total lag across its topics.

輸入參數groupId必填

版本歷史

3
  1. v0.3.3最新Oct 26, 2026
  2. v0.3.0Sep 29, 2026
  3. v0.2.2Sep 16, 2026

評分

已滿足適用檢查項的 90%

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

  • 近 30 天內可連通25 分
  • 已宣告認證方式10 分

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

  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分