Get the FREE Ultimate OpenClaw Setup Guide →

kafka

A comprehensive Model Context Protocol (MCP) server for Apache Kafka operations. Enables seamless Kafka cluster management through Claude Desktop and other MCP clients with support for topics, messages, consumer groups, and real-time monitoring

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio aswinayyolath-kafka-mcp-server python kafka_mcp_server.py \
  --env KAFKA_SSL_CAFILE="Path to CA certificate file for SSL (if using SSL)" \
  --env KAFKA_SSL_KEYFILE="Path to client key file for SSL (if using SSL client auth)" \
  --env KAFKA_SSL_CERTFILE="Path to client certificate file for SSL (if using SSL client auth)" \
  --env KAFKA_SASL_PASSWORD="SASL password (if required by SASL authentication)" \
  --env KAFKA_SASL_USERNAME="SASL username (if required by SASL authentication)" \
  --env KAFKA_SASL_MECHANISM="SASL mechanism if using SASL (e.g., PLAIN, SCRAM-SHA-256, SCRAM-SHA-512)" \
  --env KAFKA_BOOTSTRAP_SERVERS="Comma-separated list of Kafka bootstrap servers, e.g., localhost:9092" \
  --env KAFKA_SECURITY_PROTOCOL="Security protocol (e.g., PLAINTEXT, SASL_PLAINTEXT, SASL_SSL, SSL)"

How to use

This MCP server provides a Python-based interface for managing and interacting with an Apache Kafka cluster through the Model Context Protocol (MCP). It exposes a collection of tools to perform common Kafka operations such as cluster health checks, topic management (create, list, describe, delete), message operations (send and consume messages), and consumer group handling. The server is designed to integrate with Claude Desktop and other MCP clients, making it easy to issue MCP commands and receive structured responses. You can configure the server using environment variables to point at your Kafka cluster and to specify security settings (PLAINTEXT, SASL, SSL). The built-in tools cover cluster information, topic operations, message sending/consumption, and consumer group descriptions, with real-time metrics and health checks available for monitoring.

How to install

Prerequisites:

  • Python 3.8 or newer
  • pip (Python package manager)
  • A Kafka cluster (local or remote)

Installation steps:

  1. Clone the repository:
git clone https://github.com/aswinayyolath/kafka-mcp-server.git
cd kafka-mcp-server
  1. Create and activate a virtual environment:
python -m venv venv
# macOS/Linux
source venv/bin/activate
# Windows
venv\Scripts\activate
  1. Install dependencies:
pip install mcp kafka-python
  1. Configure environment variables (see .env.template in the repo and copy it to .env):
cp .env.template .env
# Edit .env with your Kafka configuration
  1. Run the MCP server (from the repository root):
python kafka_mcp_server.py

Optional: Run tests (if provided in the repo) after setting up environment variables as described in the README.

Additional notes

Tips and notes:

  • Always keep .env files out of version control; use .env.template as a reference.
  • For production, prefer SSL/TLS (SSL or SASL_SSL) and proper SASL credentials rather than PLAINTEXT.
  • Ensure KAFKA_BOOTSTRAP_SERVERS points to reachable Kafka brokers and that network ACLs allow access.
  • When debugging, enable verbose logging or Python debug mode as shown in the README to surface MCP interactions.
  • The server exposes a rich set of tools under Topics, Messages, Clusters, and Consumer Groups; use the provided MCP prompts to guide interactions.
  • If you encounter authentication errors, verify SASL mechanism, username/password, and SSL certificate paths in the environment.
  • Use Claude Desktop integration example as a template for configuring MCP servers in client configs.

Related MCP Servers

Sponsor this space

Reach thousands of developers