Overview
What is Kafka MCP Server?
A Message Context Protocol (MCP) server that integrates with Apache Kafka, providing publish and consume functionalities for LLM and agentic applications. It allows AI models to interact with Kafka topics through a standardized interface.
How to use Kafka MCP Server?
Install dependencies (pip install -r requirements.txt), configure a .env file with Kafka connection settings, then run python main.py --transport stdio. Supports stdio (default) and sse transports. Can be integrated with Claude Desktop via its MCP configuration.
Key features of Kafka MCP Server
- Publish messages to a configured Kafka topic
- Consume messages from a configured Kafka topic
- Supports configurable Kafka bootstrap servers, topic name, and consumer group
- Customizable tool descriptions via environment variables
- Runs over stdio or SSE transports
Use cases of Kafka MCP Server
- Enable an LLM to publish structured data to a Kafka topic
- Allow an AI agent to consume and process messages from a Kafka stream
- Integrate Kafka messaging into a Claude Desktop workflow
FAQ from Kafka MCP Server
What are the prerequisites?
Python 3.8+, a running Apache Kafka instance, and installation of dependencies aiokafka, python-dotenv, pydantic-settings, and mcp-server.
How do I configure the server?
Create a .env file in the project root with KAFKA_BOOTSTRAP_SERVERS, TOPIC_NAME, IS_TOPIC_READ_FROM_BEGINNING, and DEFAULT_GROUP_ID_FOR_CONSUMER. Optional TOOL_PUBLISH_DESCRIPTION and TOOL_CONSUME_DESCRIPTION can override tool descriptions.
What transport options are available?
The server supports stdio (standard input/output) and sse (Server-Sent Events). Use the --transport flag when running main.py.
Can I customize the tool names or descriptions?
Yes, by setting TOOL_PUBLISH_DESCRIPTION and TOOL_CONSUME_DESCRIPTION in the .env file you can provide custom descriptions for the publish and consume tools.
Are consumed messages re-readable?
No. Once a message is read from the topic it cannot be read again using the same consumer group. The server uses a configurable consumer group (DEFAULT_GROUP_ID_FOR_CONSUMER).