kafka
A Model Context Protocol (MCP) server for Apache Kafka implemented in Go, leveraging franz-go and mcp-go.
claude mcp add --transport stdio tuannvm-kafka-mcp-server kafka-mcp-server \ --env KAFKA_BROKERS="localhost:9092" \ --env MCP_TRANSPORT="stdio" \ --env KAFKA_CLIENT_ID="kafka-mcp-server"
How to use
This Kafka MCP Server provides a standardized interface for interacting with an Apache Kafka cluster via the Model Context Protocol (MCP). It exposes three capability families through MCP: Tools for direct Kafka operations (such as producing and consuming messages, managing topics, and handling consumer groups), Resources for cluster health and diagnostics, and Prompts for pre-configured workflows that simplify common Kafka tasks. The server uses a Kafka client wrapper built on franz-go to communicate with Kafka, enabling LLM-driven agents to perform typical Kafka operations from within MCP-enabled environments. You can connect from MCP clients via STDIO or HTTP transport, depending on how you configure the server and client.
To use it, connect your MCP client (e.g., Claude Desktop, Cursor, ChatWise, or any MCP-enabled AI application) to the kafka MCP server. The standard transport is STDIO, which is ideal for local deployments, while HTTP can be enabled for remote access with optional OAuth 2.1 support. The client can then request operations such as producing messages to topics, consuming from topics, describing topics, listing consumer groups, checking cluster health, and executing pre-configured prompts that automate common workflows like rolling restarts or health checks. The server also exposes environment-driven configuration to tailor Kafka connectivity, security (SASL/TLS), and transport behavior to fit your environment.
How to install
Prerequisites:
- Go 1.20+ (the project targets modern Go versions used by the repository)
- Access to a Kafka cluster (local or remote)
- Optional: Docker for integration testing
From Source (build locally):
# Clone the repository
git clone https://github.com/tuannvm/kafka-mcp-server.git
cd kafka-mcp-server
# Build the server
go build -o kafka-mcp-server ./cmd
Run the server (example):
# Ensure Kafka is reachable at the configured brokers, e.g., localhost:9092
./kafka-mcp-server
Alternatively, use the pre-built binary via your preferred package manager or container registry according to your environment.
For development, you can run tests or integration tests with Docker as described in the repository's CI workflows.
Note: If you plan to enable HTTP transport or SASL/TLS, configure the corresponding environment variables (e.g., KAFKA_SASL_MECHANISM, KAFKA_TLS_ENABLE, etc.) as described in the README.
Additional notes
Tips and common considerations:
- Ensure KAFKA_BROKERS points to your Kafka cluster and that any required SASL/TLS settings are provided via environment variables when needed.
- The MCP transport can be STDIO (default) for local clients or HTTP for remote access; adjust MCP_TRANSPORT accordingly in both server and client configurations.
- When integrating with clients like Claude or ChatWise, you can embed the kafka-mcp-server command with the appropriate environment variables in your mcp.json or client configuration.
- If you upgrade the Kafka client library or Kafka cluster version, re-build the server to ensure compatibility.
- For testing, you may run a local Kafka cluster (e.g., via Docker) to validate produce/consume flows before connecting to a production cluster.
Related MCP Servers
mcp-language
mcp-language-server gives MCP enabled clients access semantic tools like get definition, references, rename, and diagnostics.
kodit
š©āš» MCP server to index external repositories
github-brain
An experimental GitHub MCP server with local database.
bgg
BGG MCP provides access to BoardGameGeek and a variety of board game related data through the Model Context Protocol. Enabling retrieval and filtering of board game data, user collections, and profiles.
mcp
Teamwork.com MCP server
chromedp
MCP server for browser automation using chromedp