Get the FREE Ultimate OpenClaw Setup Guide →

mcp-kafka

A Model Context Protocol Server to perform Kafka client operations

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio kanapuli-mcp-kafka docker run -i kanapuli/mcp-kafka

How to use

mcp-kafka provides a bridge between AI assistants and Apache Kafka, enabling you to perform common Kafka operations directly through the Model Context Protocol. It supports creating, listing, describing, and deleting topics, as well as producing messages with optional keys and headers and consuming messages with a configurable timeout. The server exposes these capabilities through the MCP interface so your AI assistant can issue natural language requests that are translated into Kafka client actions. When used with Claude Desktop or other MCP-enabled tooling, you can reference the kafka server in your claude_desktop_config.json and pass the appropriate flags to connect to your Kafka cluster. For authentication, the tool supports SASL/PLAINTEXT setups; SASL_SSL is not indicated as supported in the current configuration, so ensure your cluster is reachable over PLAINTEXT or SASL_PLAINTEXT as described in the configuration notes.

Typical workflows include: creating a topic with a specified number of partitions and replication factor, listing topics to verify cluster state, producing messages with an optional key and headers, and consuming messages with a user-defined timeout to fetch batches of records for processing or analysis. The MCP interface abstracts the kilobyte-scale Kafka client logic behind natural language requests, making it convenient for AI agents to interact with topics and messages without manual CLI usage.

How to install

Prerequisites:

  • Docker installed and running (for the recommended container-based run) or build environment if you prefer a native binary path.
  • Access to a Kafka cluster (default: localhost:9092).
  • Optional: for local builds, Go 1.24 or higher if you choose to build from source.

Installation steps (containerized option):

  1. Pull and run the MCP Kafka container: docker pull kanapuli/mcp-kafka docker run -i --rm -p 8080:8080 kanapuli/mcp-kafka

  2. Configure your MCP tool (Claude Desktop or equivalent) to point at the running container. The configuration JSON should reference the server name (for example, kafka) and the container command/params you used. See the example in the repository for the claude_desktop_config.json fragment.

Installation steps (from source, Go-based build):

  1. Clone the repository: git clone https://github.com/kanapuli/mcp-kafka.git cd mcp-kafka

  2. Build the application (requires Go 1.24+): make build

  3. If you want to target a specific platform: make build GOOS=darwin GOARCH=arm64

  4. After building, follow the Claude Desktop Tool Installation Guide referenced in the README to hook the executable into Claude Desktop, placing the binary on your PATH or in a dedicated tools directory.

Note: The README provides guidance for installing and configuring the tool for Claude Desktop usage; adapt the commands to your environment if you are deploying outside Claude Desktop.

Additional notes

Notes and tips:

  • The default Kafka connection is localhost:9092; adjust bootstrap servers as needed via CLI flags.
  • SASL_PLAINTEXT is supported according to the current configuration notes; SASL_SSL is not supported in the provided configuration.
  • The configuration parameters (topic, num_partitions, replication_factor, produce_message_key, produce_message_value, produce_message_headers, consumer_timeout) are derived from natural language inputs and mapped to Kafka client operations by the MCP server.
  • If you deploy via Docker, ensure the container has network access to your Kafka cluster and expose any required ports to the host if you need external access.
  • When using Claude Desktop, provide the correct path to the mcp-kafka executable in claude_desktop_config.json and ensure credentials (username/password) are set for SASL if required by your cluster.
  • For production deployments, consider running with a properly configured security context and ensuring the container or binary has the necessary network permissions to reach your Kafka cluster.

Related MCP Servers

Sponsor this space

Reach thousands of developers