- Home
- MCP servers
- Kafka
Kafka
- python
1
GitHub Stars
python
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"shivamxtech-kafka-mcp": {
"command": "python3",
"args": [
"/Users/I528600/Desktop/mcp/kafka-mcp/src/main.py"
],
"env": {
"MCP_TRANSPORT": "stdio",
"BOOTSTRAP_SERVERS": "localhost:9092"
}
}
}
}Kafka MCP provides a natural language interface to manage Kafka operations through MCP clients. It enables AI-driven interactions to publish, consume, and describe Kafka topics and brokers, helping you build autonomous workflows that interact with your Kafka environment.
How to use
You interact with the Kafka MCP server through an MCP client. You can ask it to publish messages to topics, consume messages, list topics, and inspect brokers or partitions. Use natural language prompts to perform these actions, and the MCP server will translate your requests into Kafka operations via the configured transport.
Key capabilities you can leverage include: listing all topics, creating or describing topics, publishing messages to a topic, consuming messages from a topic, and querying broker or partition information. Use concise prompts such as: publish a message to a topic, describe topic details, or consume messages from a topic with an optional limit.
How to install
Prerequisites:
- Python 3.8 or newer
- Access to a Kafka cluster reachable at a bootstrap server (e.g., localhost:9092)
- A command line environment with Python package management available
Create and activate a Python virtual environment
# Using venv (built-in)
python3 -m venv .venv
# Activate the virtual environment
# On Windows
.venv\Scripts\activate
# On macOS/Linux
source .venv/bin/activate
Install dependencies listed for the Kafka MCP server
# Using pip
pip install -r requirements.txt
# Or using uv (faster)
uv pip install -r requirements.txt
Set the required configurations in your environment. Use the values shown here as placeholders if you customize them.
BOOTSTRAP_SERVERS=localhost:9092
MCP_TRANSPORT=stdio
Run the Kafka MCP server locally
python3 src/main.py
# OR
uv run python3 src/main.py
If you are configuring this server to be used by an MCP client, include the following in your MCP client configuration to connect to the local server
{
"mcpServers": {
"kafka_mcp": {
"command": "python3",
"args": ["/Users/YourUser/Desktop/mcp/kafka-mcp/src/main.py"],
"env": {
"BOOTSTRAP_SERVERS": "localhost:9092",
"MCP_TRANSPORT": "stdio"
}
}
}
}
Additional notes
Tools exposed by this MCP server include a set of endpoints to interact with Kafka: a consumer tool to read messages, a producer tool to publish messages, a topic tool to list, create, delete, and describe topics, a broker tool to retrieve broker information, a partition tool to fetch partitions and offsets, and a group_offset tool to get and reset offsets.
Environment variables shown above must be provided for the server to connect to your Kafka cluster. Ensure your MCP client has access to the same bootstrap endpoints and that the MCP transport is configured as stdio when using a local process.
Example prompts you can try once the server is running include listing all topics, creating a new topic, publishing a message to a topic, consuming messages from a topic, and describing a topic.
Available tools
consumer
Reads messages from a Kafka topic using the consumer interface exposed by the MCP server.
producer
Publishes messages to a Kafka topic using the producer interface exposed by the MCP server.
topic
Lists, creates, deletes, and describes topics in the Kafka cluster.
broker
Retrieves information about Kafka brokers in the cluster.
partition
Fetches partition information and partition offsets for topics.
group_offset
Gets and resets consumer group offsets within the Kafka cluster.