@flinkhouse/server-kafkamanager
v0.1.1
Published
MCP server for managing Kafka clusters
Readme
Kafka Manager MCP Server
Model Context Protocol (MCP) server for managing Kafka clusters. This server provides tools for Kafka management operations including:
- Starting and stopping Kafka clusters
- Managing topics (list, create, delete, modify)
- Managing consumer groups (list, delete)
- Viewing topic data
Prerequisites
- Node.js (v16+)
- Kafka installation (2.5.0+)
Installation
npm install -g @modelcontextprotocol/server-kafkamanagerOr you can use it without installing:
npx @modelcontextprotocol/server-kafkamanager /path/to/kafka/homeUsage
The server requires the path to your Kafka installation directory:
mcp-server-kafkamanager /path/to/kafka/homeFor example:
mcp-server-kafkamanager /Users/jian.zhang04/Documents/kafka_2.12-2.5.0Available Tools
Start Kafka Cluster
Starts a Kafka cluster by launching ZooKeeper and Kafka broker processes.
start_kafka_cluster [--dryRun]Options:
dryRun: Only display the command without running it (optional, default: false)
Stop Kafka Cluster
Stops a running Kafka cluster by shutting down both the Kafka broker and ZooKeeper.
stop_kafka_cluster [--dryRun]Options:
dryRun: Only display the command without running it (optional, default: false)
List Topics
Lists all topics in the Kafka cluster with their configurations.
list_topics [--bootstrap_server <server>]Options:
bootstrap_server: Kafka bootstrap server (optional, default: "localhost:9092")
Create Topic
Creates a new Kafka topic with specified configuration.
create_topic --topic_name <name> [--partitions <num>] [--replication_factor <num>] [--bootstrap_server <server>]Options:
topic_name: Name of the topic to createpartitions: Number of partitions (optional, default: 1)replication_factor: Replication factor (optional, default: 1)bootstrap_server: Kafka bootstrap server (optional, default: "localhost:9092")
Delete Topic
Deletes a Kafka topic.
delete_topic --topic_name <name> [--bootstrap_server <server>]Options:
topic_name: Name of the topic to deletebootstrap_server: Kafka bootstrap server (optional, default: "localhost:9092")
Modify Topic
Modifies an existing Kafka topic's configuration.
modify_topic --topic_name <name> --partitions <num> [--bootstrap_server <server>]Options:
topic_name: Name of the topic to modifypartitions: New number of partitionsbootstrap_server: Kafka bootstrap server (optional, default: "localhost:9092")
List Consumer Groups
Lists all consumer groups in the Kafka cluster with their status and offsets.
list_consumer_groups [--bootstrap_server <server>]Options:
bootstrap_server: Kafka bootstrap server (optional, default: "localhost:9092")
Delete Consumer Group
Deletes a consumer group from the Kafka cluster.
delete_consumer_group --group_id <id> [--bootstrap_server <server>]Options:
group_id: Consumer group ID to deletebootstrap_server: Kafka bootstrap server (optional, default: "localhost:9092")
View Topic Data
Views data in a Kafka topic by consuming a specified number of messages.
view_topic_data --topic_name <name> [--max_messages <num>] [--bootstrap_server <server>]Options:
topic_name: Name of the topic to viewmax_messages: Maximum number of messages to consume (optional, default: 10)bootstrap_server: Kafka bootstrap server (optional, default: "localhost:9092")
Docker Usage
You can also run this server using Docker:
docker build -t kafkamanager .
docker run -it --network host kafkamanager /path/to/kafka/homeExample
# Start Kafka cluster
start_kafka_cluster
# Create a topic
create_topic --topic_name my-topic --partitions 3 --replication_factor 1
# List all topics
list_topics
# View messages in a topic
view_topic_data --topic_name my-topic --max_messages 5
# Stop Kafka cluster
stop_kafka_clusterTroubleshooting
- If you encounter connection issues, make sure Kafka and ZooKeeper are running properly
- Check Kafka logs in
/tmp/kafka.logand ZooKeeper logs in/tmp/zookeeper.log - Verify the bootstrap server address (default is localhost:9092)
License
MIT
