Kafka MCP Server
Kafka MCP Server
Ein Message Context Protocol (MCP)-Server, der in Apache Kafka integriert ist, um Veröffentlichungs- und Konsumfunktionen für LLM- und Agentic-Anwendungen bereitzustellen.
Überblick
Dieses Projekt implementiert einen Server, der es KI-Modellen ermöglicht, über eine standardisierte Schnittstelle mit Kafka-Themen zu interagieren. Es unterstützt:
Veröffentlichen von Nachrichten zu Kafka-Themen
Nachrichten aus Kafka-Themen nutzen
Related MCP server: KafkaIQ
Voraussetzungen
Python 3.8+
Apache Kafka-Instanz
Python-Abhängigkeiten (siehe Abschnitt „Installation“)
Installation
Klonen Sie das Repository:
git clone <repository-url> cd <repository-directory>Erstellen Sie eine virtuelle Umgebung und aktivieren Sie sie:
python -m venv venv source venv/bin/activate # On Windows, use: venv\Scripts\activateInstallieren Sie die erforderlichen Abhängigkeiten:
pip install -r requirements.txtWenn keine Datei „requirements.txt“ vorhanden ist, installieren Sie die folgenden Pakete:
pip install aiokafka python-dotenv pydantic-settings mcp-server
Konfiguration
Erstellen Sie im Projektstammverzeichnis eine .env Datei mit den folgenden Variablen:
# 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"Verwendung
Ausführen des Servers
Sie können den Server mit dem bereitgestellten main.py -Skript ausführen:
python main.py --transport stdioVerfügbare Transportmöglichkeiten:
stdio: Standardeingabe/-ausgabe (Standard)sse: Vom Server gesendete Ereignisse
Integration mit Claude Desktop
Um diesen Kafka MCP-Server mit Claude Desktop zu verwenden, fügen Sie Ihrer Claude Desktop-Konfigurationsdatei die folgende Konfiguration hinzu:
{
"mcpServers": {
"kafka": {
"command": "python",
"args": [
"<PATH TO PROJECTS>/main.py"
]
}
}
}Ersetzen Sie <PATH TO PROJECTS> durch den absoluten Pfad zu Ihrem Projektverzeichnis.
Projektstruktur
main.py: Einstiegspunkt für die Anwendungkafka.py: Implementierung des Kafka-Konnektorsserver.py: MCP-Serverimplementierung mit Tools für die Kafka-Interaktionsettings.py: Konfigurationsverwaltung mit Pydantic
Verfügbare Tools
Kafka-Publish
Veröffentlicht Informationen zum konfigurierten Kafka-Thema.
Kafka-Konsum
Informationen aus dem konfigurierten Kafka-Thema nutzen.
Hinweis: Sobald eine Nachricht aus dem Thema gelesen wurde, kann sie mit derselben Gruppen-ID nicht erneut gelesen werden.
Thema erstellen
Erstellt ein neues Kafka-Thema mit angegebenen Parametern.
Optionen :
--topicName des zu erstellenden Themas--partitionsAnzahl der zuzuweisenden Partitionen--replication-factorReplikationsfaktor zwischen Brokern--config(optional) Überschreibt die Konfiguration auf Themenebene (z. B.retention.ms=604800000)
Thema löschen
Löscht ein vorhandenes Kafka-Thema.
Optionen :
--topicName des zu löschenden Themas--timeout(optional) Wartezeit bis zum Abschluss des Löschvorgangs
Listenthemen
Listet alle Themen im Cluster auf (oder nach Muster gefiltert).
Optionen :
--bootstrap-serverBrokeradresse--pattern(optional) Regulärer Ausdruck zum Filtern von Themennamen--exclude-internal(optional) Interne Themen ausschließen (Standard: true)
Themen-Konfiguration
Zeigt die Konfiguration für ein oder mehrere Themen an oder ändert sie.
Optionen :
--describeAktuelle Konfigurationen für ein Thema anzeigen--alterKonfigurationen ändern (zB--add-config retention.ms=86400000,--delete-config cleanup.policy)--topicName des Themas
Themen-Metadaten
Ruft Metadaten zu einem Thema oder dem Cluster ab.
Optionen :
--topic(falls angegeben) Ruft Metadaten nur für dieses Thema ab--bootstrap-serverBrokeradresse--include-offline(optional) Schließt Broker oder Partitionen ein, die offline sind
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
No tool schema history has been recorded yet.
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 Connectors
- mcp-serverOAuthcom.make
Give your AI agents the tools to build, manage, and run automation workflows.
Instagram for AI agents: publish, read comments and DMs, insights, and engage from your account.
Connect any AI agent to 11+ social platforms: schedule, publish & track posts via hosted MCP.
Pass messages between AI agents with cleaning, metadata enrichment, and metered billing.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables interaction with Apache Kafka topics, allowing users to publish messages to and read messages from Kafka instances through natural language.1Apache 2.0
- FlicenseNot gradedqualityDmaintenanceEnables 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.-
- AlicenseNot gradedqualityCmaintenanceEnables 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.1MIT
- FlicenseCqualityDmaintenanceExposes Kafka administration operations as MCP tools, enabling AI agents to inspect Kafka clusters using natural language.1-
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