Add your description here
Project description
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: venv\Scripts\activate
-
Install the required dependencies:
pip install -r requirements.txt
If 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kafka_mcp_server-0.1.1.tar.gz.
File metadata
- Download URL: kafka_mcp_server-0.1.1.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7555f4374c4b1ec35b2306b221d413957df1d72d29e161f9f9b37f7902b898d1
|
|
| MD5 |
a171d6351f184d42bd0efa5ddfef6343
|
|
| BLAKE2b-256 |
6ecbd37fd944740bc701c669b9bf5a1f248613968687fe404ed73455b25fae58
|
File details
Details for the file kafka_mcp_server-0.1.1-py3-none-any.whl.
File metadata
- Download URL: kafka_mcp_server-0.1.1-py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc7f3669b3a035a292175a9650f482959a39f591dc42035a4f92b6112922c116
|
|
| MD5 |
8558e53d1272f964965c7ea670272fb8
|
|
| BLAKE2b-256 |
9a7f3b4090f9487fc931a4be76f3fb4abfd3e083be4d4a25e87124525aa2408a
|