Cover image
Try Now
2025-03-20

Mirror ofhttps://github.com/pavanjava/kafka_mcp_server

3 years

Works with Finder

0

Github Watches

0

Github Forks

0

Github Stars

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

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • Yasir Eryilmaz
  • AI scriptwriting assistant for short, engaging video content.

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Daren White
  • A supportive coach for mastering all Spanish tenses.

  • https://zenepic.net
  • Embark on a thrilling diplomatic quest across a galaxy on the brink of war. Navigate complex politics and alien cultures to forge peace and avert catastrophe in this immersive interstellar adventure.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://reddgr.com
  • Delivers concise Python code and interprets non-English comments

  • huahuayu
  • A unified API gateway for integrating multiple etherscan-like blockchain explorer APIs with Model Context Protocol (MCP) support for AI assistants.

  • deemkeen
  • control your mbot2 with a power combo: mqtt+mcp+llm

  • zhaoyunxing92
  • 本项目是一个钉钉MCP(Message Connector Protocol)服务,提供了与钉钉企业应用交互的API接口。项目基于Go语言开发,支持员工信息查询和消息发送等功能。

  • justmywyw
  • Short and sweet example MCP server / client implementation for Tools, Resources and Prompts.

  • KasarLabs
  • Build powerful and secure AI Agents powered by Starknet.

    Reviews

    5 (1)
    Avatar
    user_rCzUAugn
    2025-04-17

    I recently started using the pavanjava_kafka_mcp_server by MCP-Mirror and I must say, it has revolutionized my message queue management. The integration with Kafka is seamless, and the setup was straightforward thanks to the clear instructions. The GitHub repository provided all the necessary information. Highly recommend this server for anyone looking to streamline their processes! Check it out here: https://github.com/MCP-Mirror/pavanjava_kafka_mcp_server