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
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:
- Clone the repository:
git clone https://github.com/aswinayyolath/kafka-mcp-server.git
cd kafka-mcp-server
- Create and activate a virtual environment:
python -m venv venv
# macOS/Linux
source venv/bin/activate
# Windows
venv\Scripts\activate
- Install dependencies:
pip install mcp kafka-python
- Configure environment variables (see .env.template in the repo and copy it to .env):
cp .env.template .env
# Edit .env with your Kafka configuration
- 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
mcp-pinecone
Model Context Protocol server to allow for reading and writing from Pinecone. Rudimentary RAG
Gitingest
mcp server for gitingest
mcp -python-template
This template provides a streamlined foundation for building Model Context Protocol (MCP) servers in Python. It's designed to make AI-assisted development of MCP tools easier and more efficient.
Convert-Markdown-PDF
Markdown To PDF Conversion MCP
mcp-coroot
MCP server for Coroot observability platform - integrate monitoring, troubleshooting, and configuration tools with AI agents
ros2_medkit_mcp
MCP server for ros2_medkit. Bridge LLM agents to the SOVD REST API for ROS 2 diagnostics and remote operations.