Kafka MCP Server
A Message Context Protocol (MCP) server that integrates with Apache Kafka to provide publish and consume functionalities for LLM and Agentic applications.
Overview
This project implements a server that allows AI models to interact with Kafka topics through a standardized interface. It supports:
- Publishing messages to Kafka topics
- Consuming messages from Kafka topics
Prerequisites
- Python 3.8+
- Apache Kafka instance
- Python dependencies (see Installation section)
Installation
Clone the repository:
git clone <repository-url> cd <repository-directory>Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows, use: venvScriptsactivateInstall the required dependencies:
pip install -r requirements.txtIf no requirements.txt exists, install the following packages:
pip install aiokafka python-dotenv pydantic-settings mcp-server
Configuration
Create a .env file in the project root with the following variables:
# Kafka Configuration
KAFKA_BOOTSTRAP_SERVERS=localhost:9092
TOPIC_NAME=your-topic-name
IS_TOPIC_READ_FROM_BEGINNING=False
DEFAULT_GROUP_ID_FOR_CONSUMER=kafka-mcp-group
# Optional: Custom Tool Descriptions
# TOOL_PUBLISH_DESCRIPTION="Custom description for the publish tool"
# TOOL_CONSUME_DESCRIPTION="Custom description for the consume tool"
Usage
Running the Server
You can run the server using the provided main.py script:
python main.py --transport stdio
Available transport options:
stdio: Standard input/output (default)sse: Server-Sent Events
Integrating with Claude Desktop
To use this Kafka MCP server with Claude Desktop, add the following configuration to your Claude Desktop configuration file:
{
"mcpServers": {
"kafka": {
"command": "python",
"args": [
"<PATH TO PROJECTS>/main.py"
]
}
}
}
Replace <PATH TO PROJECTS> with the absolute path to your project directory.
Project Structure
main.py: Entry point for the applicationkafka.py: Kafka connector implementationserver.py: MCP server implementation with tools for Kafka interactionsettings.py: Configuration management using Pydantic
Available Tools
kafka-publish
Publishes information to the configured Kafka topic.
kafka-consume
consume information from the configured Kafka topic.
- Note: once a message is read from the topic it can not be read again using the same groupid
Kafka MCP Server
Project Details
- pavanjava/kafka_mcp_server
- Apache License 2.0
- Last Updated: 4/11/2025
Categories
Recomended MCP Servers
Memory Bank is an MCP server that helps teams create, manage, and access structured project documentation. It generates...
A powerful Model Context Protocol (MCP) server providing comprehensive Google Maps API integration with LLM processing capabilities.
为 Cursor、Windsurf、Cline 和其他 AI 驱动的编码工具提供访问飞书文档的能力,基于 Model Context Protocol 服务器实现。
An Anthropic MCP server (with OpenAI Function calling compatibility) for the Coingecko Pro API
A NL2SQL plugin based on FocusSearch keyword parsing, offering greater accuracy, higher speed, and more reliability!
A mcp server for tracking cryptocurrency whale transactions.
A Model Context Protocol (MCP) server implementation for Notion integration, providing a standardized interface for interacting with Notion's...
Model Context Protocol Server for Apache OpenDAL™
Allows LLM agents to control a local chrome instance without taking screenshots
🔍 This project implements a Model Context Protocol (MCP) server for interacting with the Semantic Scholar API. It...





