Kafka MCP Server
Provides publish and consume functionalities for Kafka topics, allowing messages to be sent to and retrieved from Kafka streams. Messages consumed cannot be read again using the same group ID.
Supports environment variable configuration through .env files for Kafka connection settings and tool descriptions.
Utilizes Pydantic for settings management and validation of configuration values.
Implemented in Python with support for Python 3.8+ environments.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Kafka MCP Serverpublish 'New user registration: alice@example.com' to the users topic"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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
Related MCP server: KafkaIQ
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\activateInstall 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 stdioAvailable 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
Create-Topic
Creates a new Kafka topic with specified parameters.
Options:
--topicName of the topic to create--partitionsNumber of partitions to allocate--replication-factorReplication factor across brokers--config(optional) Topic-level configuration overrides (e.g.,retention.ms=604800000)
Delete-Topic
Deletes an existing Kafka topic.
Options:
--topicName of the topic to delete--timeout(optional) Time to wait for deletion to complete
List-Topics
Lists all topics in the cluster (or filtered by pattern).
Options:
--bootstrap-serverBroker address--pattern(optional) Regular expression to filter topic names--exclude-internal(optional) Exclude internal topics (default: true)
Topic-Configuration
Displays or alters configuration for one or more topics.
Options:
--describeShow current configs for a topic--alterModify configs (e.g.,--add-config retention.ms=86400000,--delete-config cleanup.policy)--topicName of the topic
Topic-Metadata
Retrieves metadata about a topic or the cluster.
Options:
--topic(If provided) Fetch metadata only for this topic--bootstrap-serverBroker address--include-offline(optional) Include brokers or partitions that are offline
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceEnables interaction with Apache Kafka topics, allowing users to publish messages to and read messages from Kafka instances through natural language.Last updatedApache 2.0
- Flicense-qualityDmaintenanceEnables AI assistants to manage and monitor Apache Kafka clusters through natural language, providing real-time operations, health monitoring, consumer lag analysis, and temporal trend detection for intelligent cluster management.Last updated
- Alicense-qualityFmaintenanceEnables AI agents to interact with Apache Kafka through natural language, supporting operations like producing/consuming messages, managing topics, and querying brokers, partitions, and consumer group offsets.Last updated1MIT
- Alicense-qualityAmaintenanceAn MCP server that enables AI assistants to safely interact with Apache Kafka clusters, providing tools for topic management, message operations, consumer groups, and cluster information.Last updated3MIT
Related MCP Connectors
Connect any AI agent to 11+ social platforms: schedule, publish & track posts via hosted MCP.
Build, validate, and deploy multi-agent AI solutions from any AI environment.
Phone, SMS & email for AI agents — one remote MCP endpoint, OAuth login, zero install.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/pavanjava/kafka_mcp_server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server