Kafka MCP Server

Integrations

  • Supports environment variable configuration through .env files for Kafka connection settings and tool descriptions.

  • 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.

  • Utilizes Pydantic for settings management and validation of configuration values.

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

  1. Clone the repository:
    git clone <repository-url> cd <repository-directory>
  2. Create a virtual environment and activate it:
    python -m venv venv source venv/bin/activate # On Windows, use: venv\Scripts\activate
  3. 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 application
  • kafka.py: Kafka connector implementation
  • server.py: MCP server implementation with tools for Kafka interaction
  • settings.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
-
security - not tested
A
license - permissive license
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Enables AI models to publish and consume messages from Apache Kafka topics through a standardized interface, making it easy to integrate Kafka messaging with LLM and agent applications.

  1. Overview
    1. Prerequisites
      1. Installation
        1. Configuration
          1. Usage
            1. Running the Server
            2. Integrating with Claude Desktop
          2. Project Structure
            1. Available Tools
              1. kafka-publish
              2. kafka-consume

            Related MCP Servers

            • A
              security
              A
              license
              A
              quality
              Enables AI models to interact with messages from various messaging platforms (Mobile, Mail, WhatsApp, LinkedIn, Slack, Twitter, Telegram, Instagram, Messenger) through a standardized interface.
              Last updated -
              3
              3
              Python
              MIT License
              • Linux
            • -
              security
              F
              license
              -
              quality
              Enables AI and LLM systems to interact with the Buttondown newsletter service, supporting email drafting, scheduling, analytics retrieval, and list management through a Model Context Protocol interface.
              Last updated -
              TypeScript
            • -
              security
              -
              license
              -
              quality
              An MCP-based messaging system that allows AI systems to interact with various messaging platforms through standardized tools for sending text, images, documents, buttons, and alerts.
              Last updated -
              Python
            • A
              security
              A
              license
              A
              quality
              An MCP server implementation built to interact with Confluent Kafka and Confluent Cloud REST APIs.
              Last updated -
              24
              20
              26
              TypeScript
              MIT License
              • Apple

            View all related MCP servers

            ID: 8ohdumy56r