Kafka MCP (kafka-mcp-741d577d)

MCP运维云端

提供方 wklee610

运维云端 stdio · 本地进程 无需鉴权 社区 / 第三方 Claude DesktopClaude
查看接入方式

一个用于管理和与Kafka集群交互的MCP服务器实现,支持集群、主题、配置、消费者组和消息管理。

一句话选型结论

按资料字段整理

Kafka MCP (kafka-mcp-741d577d) 属于运维云端类 MCP 服务器,stdio · 本地进程,无需鉴权,可直接接入 Claude Desktop、Claude,有可直接复制的远程端点配置。接入前先确认权限范围;涉及写入、删除或付款的操作,建议先在测试环境验证。

分类运维云端 传输方式stdio · 本地进程 鉴权无需鉴权 部署方式支持远程部署
GitHub 星标 11 仓库热度,无公开仓库时显示未标注
工具数 16 暴露给模型的工具数量
资源 / 提示词 0 / 0 资源与提示词模板数量
维护方 社区 / 第三方 核验等级 仅资料核对

工具与能力

运维云端
数量来自来源目录的标注,具体工具清单以官方文档为准
工具数量16暴露给模型可调用的工具个数
资源数量0可读取的资源条目
提示词数量0内置提示词模板数量

能力标签

支持客户端

适用场景

Kafka管理Python本地部署集群操作消息队列分布式系统自动化工具

安装与配置

stdio · 本地进程 无需鉴权
客户端在本机拉起子进程,数据不出本机
uv run kafka-mcp

这条命令只是入口,具体启动参数请按官方文档补齐,不要直接照搬到别的服务器。

  1. 1
    准备运行环境

    确认你的客户端支持远程端点,并拿到服务地址。

  2. 2
    安装服务

    复制上面的安装命令执行;命令里带占位符的位置,换成自己的密钥或路径。

  3. 3
    写入客户端配置

    在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,让新配置生效。

  4. 4
    验证是否可用

    连接成功后客户端会列出约 16 个工具,随便调一个只读工具确认能返回结果。

典型使用场景

3 类
按分类与标签整理的常见用法,具体以官方文档为准
云资源查询

查实例、存储、账单等云上资源状态。

部署与发布

把部署、重启、回滚这类操作接进对话。

监控与告警

拉取监控指标,异常时让模型帮你判断。

选择建议

选之前先看这几条
按条目字段给出的判断,不替你决定用不用

值得选的地方

  • 资料标注 16 个工具,覆盖面较广,能满足多种调用。
  • 有现成的安装命令,不用自己找入口,照着跑就能起服务。
  • 已适配 Claude Desktop、Claude,换客户端不用重新研究配置。
  • 资料标注无需鉴权,装好就能连。

先想清楚的地方

  • stdio 方式要求本地装好运行时(如 Node.js),换机器要重新装一遍。
  • 版本更新与行为细节以官方仓库为准。

更适合

  • 需要在运维云端场景里让模型直接调用外部能力的人。
  • 已经在用 Claude Desktop、Claude 的用户,接入路径最短。
  • 想先快速试一下、能接受在本地或自有环境跑服务的人。

不太适合

  • 完全不想在本地装环境的人。
  • 需要厂商级 SLA 和技术支持的生产环境。

同类对比

6 个同类
同分类里挑最接近的几条,字段以各自详情页为准
MCP 服务器工具数传输方式部署方式安装命令最后核验
Kafka MCP (kafka-mcp-741d577d)当前 16 stdio · 本地进程 支持远程部署 有 2026-05-17
lobehub 未标注 stdio · 本地进程 本地部署 有 2026-04-11
TrendRadar 未标注 stdio · 本地进程 本地部署 有 2026-04-13
Ui Tars Desktop 8a825770 未标注 stdio · 本地进程 本地部署 有 2026-05-17
ruflo 未标注 stdio · 本地进程 本地部署 有 2026-04-13
FastGPT 未标注 stdio · 本地进程 本地部署 有 2026-04-11

服务器档案

运维云端
字段来自项目仓库与公开索引,中文说明由本站标注
提供方wklee610上游标注的维护方 wklee610
分类运维云端本站按上游分类展示
连接方式stdio · 本地进程客户端在本机拉起子进程,数据不出本机
鉴权方式无需鉴权远程服务建议用最小权限凭据
维护方社区 / 第三方核验等级 仅资料核对
包名 / 运行时未标注 · Python本地安装时用到的包标识与运行时
部署类型支持远程部署上游给出的部署形态
最近核验2026-05-17上游最后核验时间

详细介绍

10.7 KB
来自项目仓库与上游目录的原文,未做删改

Kafka MCP Server


An MCP server implementation for Kafka, allowing LLMs to interact with and manage Kafka clusters.

Features

  • Cluster Management: View broker details describe_cluster, describe_brokers.
  • Topic Management: List list_topics, create create_topic, delete delete_topic, describe describe_topic, and increase partitions create_partitions.
  • Configuration Management: View describe_configs and modify alter_configs dynamic configs for topics, brokers, and groups.
  • Consumer Groups: List list_consumer_groups, describe describe_consumer_group, and securely manage offsets with reset_consumer_group_offset and rewind_consumer_group_offset_by_timestamp. Advanced tools include state validation, dry runs, and execution audit logging.
  • Messaging: Consume messages consume_messages (from beginning, latest, or specific offsets) and produce messages produce_message.
  • Secure Connections: Connect with TLS/mTLS and SASL PLAIN, SCRAM-SHA-256, SCRAM-SHA-512, GSSAPI, or OAUTHBEARER.
  • JMX Monitoring: Read broker and topic metrics from one or more Prometheus JMX Exporter endpoints and summarize cluster health.

Prerequisites

  • Python 3.10+
  • uv package manager (recommended)
  • A running Kafka cluster (e.g., local Docker, Confluent Cloud, etc.)

Installation

  1. Clone the repository.
  2. Install dependencies:bash uv sync

Configuration

Only KAFKA_BOOTSTRAP_SERVERS is required. Existing PLAINTEXT configurations remain unchanged.

Variable Required Description
KAFKA_BOOTSTRAP_SERVERS Yes Comma-separated broker addresses, such as localhost:9092.
KAFKA_CLIENT_ID No Kafka client ID. Defaults to kafka-mcp.
KAFKA_SECURITY_PROTOCOL No PLAINTEXT, SSL, SASL_PLAINTEXT, or SASL_SSL. librdkafka defaults to PLAINTEXT when omitted.
KAFKA_CLIENT_CONFIG_JSON No JSON object of additional scalar confluent-kafka/librdkafka client properties. Explicit variables and connection safety settings take precedence.

SASL

Set KAFKA_SASL_MECHANISM to PLAIN, SCRAM-SHA-256, SCRAM-SHA-512, GSSAPI, or OAUTHBEARER whenever a SASL security protocol is used.

PLAIN and SCRAM use:```bash
export KAFKA_SECURITY_PROTOCOL=SASL_SSL
export KAFKA_SASL_MECHANISM=SCRAM-SHA-512
export KAFKA_SASL_USERNAME="$KAFKA_USERNAME"
export KAFKA_SASL_PASSWORD="$KAFKA_PASSWORD"


GSSAPI/Kerberos supports these optional variables:

| Variable | librdkafka property |
|----------|---------------------|
| `KAFKA_SASL_KERBEROS_SERVICE_NAME` | `sasl.kerberos.service.name` |
| `KAFKA_SASL_KERBEROS_PRINCIPAL` | `sasl.kerberos.principal` |
| `KAFKA_SASL_KERBEROS_KEYTAB` | `sasl.kerberos.keytab` |
| `KAFKA_SASL_KERBEROS_KINIT_CMD` | `sasl.kerberos.kinit.cmd` |
| `KAFKA_SASL_KERBEROS_MIN_TIME_BEFORE_RELOGIN` | `sasl.kerberos.min.time.before.relogin` |

The prebuilt `confluent-kafka` wheels do not include GSSAPI. Kerberos deployments outside Docker must install `confluent-kafka` against a librdkafka build compiled with SASL GSSAPI support; the provided Docker image builds that variant from source and includes the Kerberos runtime tools.

OAUTHBEARER supports librdkafka's built-in OIDC flow:```bash
export KAFKA_SECURITY_PROTOCOL=SASL_SSL
export KAFKA_SASL_MECHANISM=OAUTHBEARER
export KAFKA_SASL_OAUTHBEARER_METHOD=oidc
export KAFKA_SASL_OAUTHBEARER_CLIENT_ID="$OAUTH_CLIENT_ID"
export KAFKA_SASL_OAUTHBEARER_CLIENT_SECRET="$OAUTH_CLIENT_SECRET"
export KAFKA_SASL_OAUTHBEARER_TOKEN_ENDPOINT_URL=https://idp.example.com/oauth/token
export KAFKA_SASL_OAUTHBEARER_SCOPE=kafka

KAFKA_SASL_OAUTHBEARER_EXTENSIONS is optional. librdkafka's default unsecured-token handler is for development and testing only; it requires both KAFKA_SASL_OAUTHBEARER_CONFIG and KAFKA_ENABLE_SASL_OAUTHBEARER_UNSECURE_JWT=true instead of the OIDC variables.

Metadata and client-assertion flows are also supported. Set KAFKA_SASL_OAUTHBEARER_METADATA_AUTHENTICATION_TYPE=azure_imds for Azure IMDS. AWS IAM uses aws_iam with KAFKA_SASL_OAUTHBEARER_CONFIG; it additionally requires confluent-kafka[oauthbearer-aws] 2.15 or newer. JWT assertion properties such as sasl.oauthbearer.grant.type and sasl.oauthbearer.assertion.private.key.file can be passed through KAFKA_CLIENT_CONFIG_JSON, so the base 2.13 client remains compatible.

TLS and mTLS

The following variables map directly to librdkafka TLS settings:

Variable Description
KAFKA_SSL_CA_LOCATION CA certificate path. The system CA store is used when omitted.
KAFKA_SSL_CERTIFICATE_LOCATION Client certificate path for mTLS.
KAFKA_SSL_KEY_LOCATION Client private key path for mTLS.
KAFKA_SSL_KEY_PASSWORD Optional private key password.
KAFKA_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM Hostname verification algorithm, usually https.
KAFKA_SSL_CRL_LOCATION Certificate revocation list path.

The client certificate and key must be configured together. Less common librdkafka properties, including PKCS#12 keystores and cipher controls, can be supplied through KAFKA_CLIENT_CONFIG_JSON:```bash
export KAFKA_SECURITY_PROTOCOL=SSL
export KAFKA_CLIENT_CONFIG_JSON='{"ssl.keystore.location":"/run/secrets/client.p12","ssl.keystore.password":"secret"}'


### JMX Exporter

JMX monitoring is optional and does not affect the Kafka tools. Run Prometheus JMX Exporter as a Java agent on each broker, then provide its HTTP `/metrics` endpoints. Keeping Java RMI disabled avoids exposing Kafka's unauthenticated remote JMX port.```bash
export KAFKA_JMX_EXPORTER_ENDPOINTS='{
  "broker-1": "http://broker-1:7071/metrics",
  "broker-2": "http://broker-2:7071/metrics",
  "broker-3": "http://broker-3:7071/metrics"
}'

The value may also be a JSON array, a comma-separated URL list, or a comma-separated name=url list. For HTTPS or an authenticated reverse proxy, use:

Variable Description
KAFKA_JMX_TIMEOUT_SECONDS Per-request timeout. Defaults to 5.
KAFKA_JMX_VERIFY_SSL Verify HTTPS certificates. Defaults to true.
KAFKA_JMX_CA_LOCATION Custom CA certificate path.
KAFKA_JMX_CLIENT_CERTIFICATE_LOCATION HTTPS client certificate path.
KAFKA_JMX_CLIENT_KEY_LOCATION HTTPS client key path.
KAFKA_JMX_CLIENT_KEY_PASSWORD Optional HTTPS client key password.
KAFKA_JMX_USERNAME / KAFKA_JMX_PASSWORD HTTP Basic authentication.
KAFKA_JMX_BEARER_TOKEN HTTP Bearer authentication.
KAFKA_JMX_HEADERS_JSON Additional HTTP headers as a JSON object of strings.

Basic and Bearer authentication are mutually exclusive. JMX tools return a structured not_configured response when no exporter endpoints are set.

Usage

Running the Server

You can run the server directly using uv or python, or use Docker.

Using uv (Recommended)```bash

export KAFKA_BOOTSTRAP_SERVERS=localhost:9092
uv run kafka-mcp


#### Using Docker

The image supports TLS, PLAIN, SCRAM, OAUTHBEARER/OIDC, and GSSAPI. Its multi-stage build compiles the Python client against a checksum-verified librdkafka release with Kerberos support.

1. Build the Docker image:```bash
   docker build -t kafka-mcp .
   ```

2. Run the container:```bash
   docker run -i --rm -e KAFKA_BOOTSTRAP_SERVERS=host.docker.internal:9092 kafka-mcp
   ```
   *(Note: Use `host.docker.internal` instead of `localhost` if your Kafka cluster is running on the host machine.)*

### Claude Desktop Configuration

Add the following to your Claude Desktop configuration file (claude_desktop_config.json):```json
{
  "mcpServers": {
    "kafka": {
      "command": "<uv PATH>",
      "args": [
        "--directory",
        "<kafka-mcp PATH>",
        "run",
        "kafka-mcp"
      ],
      "env": {
        "KAFKA_BOOTSTRAP_SERVERS": "localhost:9092"
      }
    }
  }
}

Debugging / Development

To verify that the server can start and connect to your Kafka cluster (ensure your Kafka is running first):```bash

Set your bootstrap server

export KAFKA_BOOTSTRAP_SERVERS=localhost:9092

Run a quick check

uv run python -c "from src.kafka_mcp import main; print('Imports successful')"


### Available Tools

| Category | Tool Name | Description |
|----------|-----------|-------------|
| **Cluster** | `describe_cluster` | Get cluster metadata (controller, brokers). |
| | `describe_brokers` | List all brokers. |
| **Metrics** | `describe_cluster_health` | Summarize replication, ISR, controller, log-directory, and broker reachability signals. |
| | `get_broker_metrics` | Read curated broker metrics or filtered raw exporter samples. |
| | `get_topic_metrics` | Read metrics carrying the requested topic label. |
| **Topics** | `list_topics` | List all available topics. |
| | `describe_topic` | Get detailed info (partitions, replicas) for a topic. |
| | `create_topic` | Create a new topic with partitions/replication factor. |
| | `delete_topic` | Delete a topic. |
| | `create_partitions` | Increase partitions for a topic. |
| **Configs** | `describe_configs` | View dynamic configs for topic/broker/group. |
| | `alter_configs` | Update dynamic configs. |
| **Consumers** | `list_consumer_groups` | List all active consumer groups. |
| | `describe_consumer_group` | Get members and state of a group. |
| | `get_consumer_group_offsets` | Get committed offset, high/low watermarks, and calculate total lag for a topic. |
| | `reset_consumer_group_offset` | Safely change consumer group offsets to earliest, latest, or a specific offset. |
| | `rewind_consumer_group_offset_by_timestamp` | Rewind/advance consumer group offsets securely based on a timestamp. |
| **Messages** | `consume_messages` | Consume messages from a topic (supports offsets, limits). |
| | `produce_message` | Send a message to a topic. |

## Project Structure```
src/kafka_mcp/
├── configs/       # Configuration handling
├── connections/   # Kafka client factories (singleton)
├── metrics/       # Prometheus JMX Exporter client and parser
├── tools/         # Tool implementations
│   ├── admin.py     # Topic & Config management
│   ├── cluster.py   # Cluster metadata
│   ├── consumer.py  # Consumer group & message consumption
│   ├── metrics.py   # Broker, topic, and cluster health metrics
│   └── producer.py  # Message production
└── main.py        # Entry point & MCP tool registration

Troubleshooting

  • Connection Refused: Ensure KAFKA_BOOTSTRAP_SERVERS is correct and reachable.
  • SASL Authentication Failed: Verify the security protocol, mechanism, credentials, and CA trust path together.
  • JMX Status Is Unknown: Ensure the exporter rules include Kafka broker/controller MBeans. Raw samples remain available through get_broker_metrics(include_raw=true).

常见问题

8 问
答案由本站依据条目字段整理,不引用上游原文
Kafka MCP (kafka-mcp-741d577d) 怎么安装?

在客户端按下面的安装命令接入:uv run kafka-mcp。装完在客户端配置里引用同一个包或端点。

Kafka MCP (kafka-mcp-741d577d) 怎么在 Claude Desktop、Claude 里配置?

它的传输方式是stdio · 本地进程,在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,配置才会生效。

Kafka MCP (kafka-mcp-741d577d) 收费吗?

本站不代收费用,也没有标注具体价格。是否收费取决于服务本身和背后的接口额度,正式使用前按官方说明确认。

Kafka MCP (kafka-mcp-741d577d) 需要 API Key 吗?

资料标注为无需认证,装好就能连;如果实际调用时报鉴权错误,按官方文档补上凭据。

Kafka MCP (kafka-mcp-741d577d) 支持哪些客户端?

资料标注支持 Claude Desktop、Claude;其他客户端只要能配置 MCP Server,也能用同样的命令或地址接入。

Kafka MCP (kafka-mcp-741d577d) 能提供哪些能力?

资料显示约 16 个工具;能力标签包括 分布式系统、Python、Claude。具体工具清单以官方文档为准。

Kafka MCP (kafka-mcp-741d577d) 需要什么运行环境?

运行时为 Python;属于本地进程,需要在本机装好运行环境。

Kafka MCP (kafka-mcp-741d577d) 是本地还是远程?

它是本地进程(stdio),由客户端在本机拉起。传输方式为stdio · 本地进程。

热门专题

按标签挑服务器
全部专题 →

服务器信息以作者仓库与官方文档为准;分类、传输方式与鉴权方式的中文说明为中文整理,最近核验 2026-05-17。