Logotipo de Kafka MCP Server

Kafka MCP Server

Comunidad
tuannvm

A Model Context Protocol (MCP) server for Apache Kafka implemented in Go, leveraging franz-go and mcp-go.

Editortuannvm
Repositoriokafka-mcp-server
IdiomaGo
Forks
20
Estrellas
55
Herramientas disponibles
0
Tipo de transportestdio
Categorías
Enlaces
  • Conecta herramientas a flujos de trabajo con IA

    Kafka MCP Server ofrece funciones MCP que pueden usar los clientes y agentes de IA compatibles.

  • 0 herramientas disponibles

    Explora a continuación las acciones que se pueden invocar, con sus nombres y descripciones cuando el servidor los proporcione.

  • Configuración lista para copiar

    Usa los ejemplos de instalación para configurar este servidor en tu cliente MCP preferido.

  • Indicadores de interés de la comunidad en el repositorio

    55 estrellas y 20 forks en el repositorio enlazado.

Kafka MCP Server

A Model Context Protocol (MCP) server for Apache Kafka implemented in Go, leveraging franz-go and mcp-go.

This server provides an implementation for interacting with Kafka via the MCP protocol, enabling LLM models to perform common Kafka operations through a standardized interface.

Go Report Card GitHub Workflow Status Go Version Trivy Scan SLSA 3 Go Reference Docker Image GitHub Release License: MIT

Overview

The Kafka MCP Server bridges the gap between LLM models and Apache Kafka, allowing them to:

  • Produce and consume messages from topics
  • List, describe, and manage topics
  • Monitor and manage consumer groups
  • Assess cluster health and configuration
  • Execute standard Kafka operations

All through the standardized Model Context Protocol (MCP).

Architecture

How it works:

  1. MCP Clients (AI applications) connect to the Kafka MCP Server via stdio or HTTP transport
  2. MCP Server exposes three types of capabilities:
    • Tools - Direct Kafka operations (produce/consume messages, describe topics, etc.)
    • Resources - Cluster health reports and diagnostics
    • Prompts - Pre-configured workflows for common operations
  3. Kafka Client Wrapper handles all Kafka communication using the franz-go library
  4. Apache Kafka Cluster processes the actual message streaming and storage

Transport Modes:

  • STDIO: Default mode, ideal for local MCP clients (Claude Desktop, Cursor, etc.)
  • HTTP: Enables remote access with optional OAuth 2.1 authentication

Tools

Prompts & Resources

Key Features

  • Kafka Integration: Implementation of common Kafka operations via MCP
  • Security:
    • Support for SASL (PLAIN, SCRAM-SHA-256, SCRAM-SHA-512) and TLS authentication
    • OAuth 2.1 authentication for HTTP transport (Native and Proxy modes)
    • Support for Okta, Google, Azure AD, and HMAC providers
  • Flexible Transport: STDIO for local clients, HTTP for remote access
  • Error Handling: Error handling with meaningful feedback
  • Configuration Options: Customizable for different environments
  • Pre-Configured Prompts: Set of prompts for common Kafka operations
  • Compatibility: Works with MCP-compatible LLM models

Getting Started

Prerequisites

  • Go 1.24 or later
  • Docker (for running integration tests)
  • Access to a Kafka cluster

Installation

Homebrew (macOS and Linux)

The easiest way to install kafka-mcp-server is using Homebrew:

bash
# Add the tap repository
brew tap tuannvm/mcp

# Install kafka-mcp-server
brew install kafka-mcp-server

To update to the latest version:

bash
brew update && brew upgrade kafka-mcp-server

From Source

bash
# 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

MCP Client Integration

This MCP server can be integrated with several AI applications. Below are platform-specific instructions:

Cursor

Edit ~/.cursor/mcp.json and add the kafka-mcp-server configuration:

json
{
  "mcpServers": {
    "kafka": {
      "command": "kafka-mcp-server",
      "args": [],
      "env": {
        "KAFKA_BROKERS": "localhost:9092",
        "KAFKA_CLIENT_ID": "kafka-mcp-server",
        "MCP_TRANSPORT": "stdio"
      }
    }
  }
}

Claude Desktop

Edit your Claude configuration file and add the server:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
json
{
  "mcpServers": {
    "kafka": {
      "command": "kafka-mcp-server",
      "args": [],
      "env": {
        "KAFKA_BROKERS": "localhost:9092",
        "KAFKA_CLIENT_ID": "kafka-mcp-server",
        "MCP_TRANSPORT": "stdio"
      }
    }
  }
}

Restart Claude Desktop to apply changes.

Claude Code

To use with Claude Code, add the server using the built-in MCP configuration command:

bash
# Add kafka-mcp-server with environment variables
claude mcp add kafka \
  --env KAFKA_BROKERS=localhost:9092 \
  --env KAFKA_CLIENT_ID=kafka-mcp-server \
  --env MCP_TRANSPORT=stdio \
  --env KAFKA_SASL_MECHANISM= \
  --env KAFKA_SASL_USER= \
  --env KAFKA_SASL_PASSWORD= \
  --env KAFKA_TLS_ENABLE=false \
  -- kafka-mcp-server

Other useful commands:

bash
# List configured MCP servers
claude mcp list

# Remove server
claude mcp remove kafka

# Test server connection
claude mcp get kafka

ChatWise

  1. Open ChatWise → Settings → Tools → "+" → "Command Line MCP"
  2. Configure:
    • ID: kafka
    • Command: kafka-mcp-server
    • Args: (leave empty)
    • Env: Add environment variables:
      KAFKA_BROKERS=localhost:9092
      KAFKA_CLIENT_ID=kafka-mcp-server
      MCP_TRANSPORT=stdio

Simplify Configuration with mcpenetes

Managing MCP server configurations across multiple clients can become challenging. mcpenetes is a dedicated tool that makes this process significantly easier:

bash
# Install mcpenetes
go install github.com/tuannvm/mcpenetes@latest

Key Features

  • Interactive Search: Find and select Kafka MCP server configurations with a simple command
  • Apply Everywhere: Automatically sync configurations across all your MCP clients
  • Configuration Backup: Safely backup existing configurations before making changes
  • Restore: Easily revert to previous configurations if needed

Quick Start with mcpenetes

bash
# Search for available MCP servers including kafka-mcp-server
mcpenetes search 

# Apply kafka-mcp-server configuration to all your clients at once
mcpenetes apply

# Load a configuration from your clipboard
mcpenetes load

With mcpenetes, you can maintain multiple Kafka configurations (development, production, etc.) and switch between them instantly across all your clients (Cursor, Claude Desktop, Windsurf, ChatWise) without manually editing each client's configuration files.

MCP Tools

The server exposes the following tools for Kafka interaction. For detailed documentation including examples and sample responses, see docs/tools.md.

  • produce_message: Produces messages to Kafka topics
  • consume_messages: Consumes messages from Kafka topics in batch operations
  • list_brokers: Lists all configured Kafka broker addresses
  • describe_topic: Provides comprehensive metadata for specific topics
  • list_consumer_groups: Enumerates all consumer groups in the cluster
  • describe_consumer_group: Provides detailed consumer group information including lag metrics
  • describe_configs: Retrieves configuration settings for Kafka resources
  • cluster_overview: Provides comprehensive cluster health summaries
  • list_topics: Lists all topics with metadata including partition and replication information

MCP Resources

The server provides the following resources that can be accessed through the MCP protocol. For detailed documentation including example responses, see docs/resources.md.

  • kafka-mcp://overview: Comprehensive cluster health summary
  • kafka-mcp://health-check: Detailed health assessment with actionable insights
  • kafka-mcp://under-replicated-partitions: Analysis of partitions with replication issues
  • kafka-mcp://consumer-lag-report: Consumer performance analysis with customizable thresholds

MCP Prompts

The server includes the following pre-configured prompts for Kafka operations and diagnostics. For detailed documentation including arguments and example responses, see docs/prompts.md.

  • kafka_cluster_overview: Generates comprehensive cluster health summaries
  • kafka_health_check: Performs detailed health assessments with actionable recommendations
  • kafka_under_replicated_partitions: Analyzes replication issues with troubleshooting guidance
  • kafka_consumer_lag_report: Provides consumer lag analysis with performance optimization recommendations

End-to-End Example

Here's an interaction example showing how an AI assistant might use these tools to help a user:

User Query: "We need to investigate why our order processing pipeline is falling behind. Can you help me check the consumer lag?"

AI Assistant's workflow:

  1. First, check the consumer groups

    > Using list_consumer_groups tool
    > Discovers "order-processor" group
  2. Then, examine the consumer group details

    > Using describe_consumer_group tool with group_id "order-processor" and include_offsets=true
    > Discovers lag on several partitions
  3. Get cluster overview to check general health

    > Using cluster_overview tool
    > Confirms no under-replicated partitions or offline brokers
  4. Generate a consumer lag report

    > Using consumer_lag_report prompt with threshold=1000
    > Provides detailed analysis of lag across consumer groups
  5. Provide actionable recommendations:

    Based on my analysis, your order-processor consumer group has significant lag on topic orders, partitions 2 and 3, with lag values of 15,420 and 12,305 messages respectively.
    
    The cluster itself is healthy with no under-replicated partitions, suggesting this is an issue with the consumer application rather than Kafka infrastructure.
    
    I recommend:
    1. Check the consumer instances processing those partitions for slowdowns or errors
    2. Consider scaling up your consumer group by adding more instances
    3. Review the consumer configuration, particularly max.poll.records and max.poll.interval.ms
    4. Examine any processing bottlenecks in the consumer logic

This seamless workflow demonstrates how the Kafka MCP tools enable LLM models to perform sophisticated diagnostics and provide actionable insights.

Configuration

The server can be configured using the following environment variables:

VariableDescriptionDefault
KAFKA_BROKERSComma-separated list of Kafka broker addresseslocalhost:9092
KAFKA_CLIENT_IDKafka client ID used for connectionskafka-mcp-server
MCP_TRANSPORTMCP transport method (stdio/http)stdio
KAFKA_SASL_MECHANISMSASL mechanism: plain, scram-sha-256, scram-sha-512, or "" (disabled)""
KAFKA_SASL_USERUsername for SASL authentication""
KAFKA_SASL_PASSWORDPassword for SASL authentication""
KAFKA_TLS_ENABLEEnable TLS for Kafka connection (true or false)false
KAFKA_TLS_INSECURE_SKIP_VERIFYSkip TLS certificate verification (true or false)false

OAuth 2.1 Configuration (HTTP Transport Only)

When using HTTP transport (MCP_TRANSPORT=http), OAuth 2.1 authentication can be enabled:

VariableDescriptionDefaultRequired
MCP_HTTP_PORTHTTP server port8080No
OAUTH_ENABLEDEnable OAuth 2.1 authenticationfalseNo
OAUTH_MODEOAuth mode: native or proxynativeNo
OAUTH_PROVIDERProvider: hmac, okta, google, azureoktaNo
OAUTH_SERVER_URLFull MCP server URL (e.g., https://localhost:8080)-When OAuth enabled
OIDC_ISSUEROAuth issuer URL-When OAuth enabled
OIDC_AUDIENCEOAuth audience-When OAuth enabled
OIDC_CLIENT_IDOAuth client ID-Proxy mode only
OIDC_CLIENT_SECRETOAuth client secret-Proxy mode only
OAUTH_REDIRECT_URISComma-separated redirect URIs-Proxy mode only
JWT_SECRETJWT signing secret-Proxy mode only

For detailed OAuth setup and examples, see docs/oauth.md.

Security Notes:

  • When using KAFKA_TLS_INSECURE_SKIP_VERIFY=true, the server will skip TLS certificate verification. This should only be used in development or testing environments, or when using self-signed certificates.
  • OAuth is only available when using HTTP transport. STDIO transport does not support OAuth.
  • Always use HTTPS in production when OAuth is enabled.

Security Considerations

The server is designed with enterprise-grade security in mind:

  • Authentication:
    • Kafka: Full support for SASL PLAIN, SCRAM-SHA-256, and SCRAM-SHA-512
    • MCP Server: OAuth 2.1 authentication for HTTP transport (Okta, Google, Azure AD, HMAC)
  • Encryption: TLS support for secure communication with Kafka brokers
  • Input Validation: Thorough validation of all user inputs to prevent injection attacks
  • Error Handling: Secure error handling that doesn't expose sensitive information
  • Token Security: Bearer token validation with 5-minute caching for OAuth-protected endpoints

For OAuth security best practices, see docs/oauth.md.

Development

Testing

Comprehensive test coverage ensures reliability:

bash
# Run all tests (requires Docker for integration tests)
go test ./...

# Run tests excluding integration tests
go test -short ./...

# Run integration tests with specific Kafka brokers
export KAFKA_BROKERS="your-broker:9092"
export SKIP_KAFKA_TESTS="false"
go test ./kafka -v -run Test

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Instalación

TypingMind
Requisitos:

Node.js 18+

{
  "mcpServers": {
    "tuannvm-kafka-mcp-server": {
      "command": "",
      "args": []
    }
  }
}

Usa el MCP de Kafka MCP Server con varios modelos de IA

TypingMind conecta las herramientas MCP a nivel del espacio de trabajo, por lo que, una vez conectado Kafka MCP Server, puedes usarlo con distintos modelos de IA en TypingMind sin tener que configurarlo por separado para cada modelo. Esta integración MCP se ejecuta localmente en tu dispositivo a través del conector MCP de TypingMind.

Guía de configuración para usar el conector local

Usa esta opción si el servidor MCP necesita acceder a archivos locales, aplicaciones o recursos privados de tu ordenador.

1

Abre los ajustes de MCP

En TypingMind, ve a Ajustes, luego a Ajustes avanzados y a Model Context Protocol, y elige Configurar conector.

  1. Abre TypingMind en tu navegador.
  2. Haz clic en el icono de Ajustes.
  3. Ve a Ajustes avanzados.
  4. Abre la sección Model Context Protocol.
  5. Haz clic en Configurar conector y elige Este dispositivo.
Pantalla de configuración del conector MCP de TypingMind con «Este dispositivo» seleccionado
2

Ejecuta el comando del conector

Elige Este dispositivo, copia el comando de TypingMind y ejecútalo en Terminal. Mantén el proceso en ejecución mientras uses MCP.

  1. Copia el comando de configuración que muestra TypingMind.
  2. Abre Terminal en macOS o Windows Terminal en Windows.
  3. Pega y ejecuta el comando.
  4. Acepta la instalación del paquete si Terminal te pide confirmación para continuar.
  5. Mantén el proceso en ejecución en la ventana de Terminal mientras uses las herramientas MCP.
3

Añade Kafka MCP Server como servidor

Cuando el estado del conector sea «Listo», haz clic en «Editar servidores» y pega la configuración del servidor MCP.

  1. Espera hasta que el estado del conector indique «Listo».
  2. Haz clic en «Editar servidores».
  3. Pega la configuración del servidor MCP de Kafka MCP Server.
  4. Guarda la lista de servidores.
  5. Actualiza si quieres comprobar que el conector sigue listo.
Ajustes de MCP de TypingMind con un servidor activo y el botón «Editar servidores»
{
  "mcpServers": {
    "tuannvm-kafka-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "kafka-mcp-server"
      ]
    }
  }
}
4

Usa la conexión con distintos modelos

Guarda la lista de servidores, abre Plugins, activa las herramientas MCP de Kafka MCP Server y selecciona cualquier modelo de IA compatible en TypingMind para usar las herramientas en el chat o asignárselas a un agente de IA.

  1. Abre la página Plugins en TypingMind.
  2. Activa las herramientas MCP de Kafka MCP Server.
  3. Inicia un chat y elige el modelo de IA que quieras usar.
  4. Usa las herramientas MCP en el chat o asígnalas a un agente de IA.
  5. Cambia a otro modelo de IA cuando lo necesites sin volver a conectar MCP.
Chat de TypingMind que usa herramientas MCP activadas con un modelo de IA seleccionado
¿Puedes usar Kafka MCP Server para ayudarme con esta tarea?
Kafka MCP Server
Claro. Lo he leído.
Esto es lo que he encontrado con Kafka MCP Server.

Preguntas frecuentes

¿Para qué sirve el servidor MCP Kafka MCP Server?

Kafka MCP Server es un servidor MCP que permite a los clientes de IA compatibles conectarse a herramientas externas y acceder a información de contexto de fuentes externas. En TypingMind, basta con añadir este servidor MCP una vez para que sus herramientas estén disponibles en tu espacio de trabajo de IA.

¿Puedo usar el servidor MCP Kafka MCP Server con varios modelos de IA en TypingMind?

Sí. TypingMind conecta las herramientas MCP a nivel del espacio de trabajo, por lo que puedes usar Kafka MCP Server con distintos modelos de IA, como Claude, ChatGPT, Gemini u otros que hayas configurado en TypingMind, sin configurar el servidor MCP por separado para cada modelo.

¿Por qué usar el servidor MCP Kafka MCP Server con TypingMind?

TypingMind es una de las mejores interfaces de chat con LLM porque reúne varios modelos de IA, prompts, plugins, agentes de IA, claves API y herramientas MCP en un solo espacio de trabajo. Con Kafka MCP Server conectado, puedes usar sus herramientas MCP con tus modelos preferidos y mantener organizado tu trabajo con los chats en TypingMind.

¿Cómo conecto el servidor MCP Kafka MCP Server a TypingMind?

Kafka MCP Server funciona a través del conector MCP local de TypingMind. Es la mejor opción cuando el servidor MCP necesita acceder a archivos locales, aplicaciones de escritorio, herramientas de línea de comandos o recursos privados de tu ordenador.

¿Qué herramientas ofrece el servidor MCP Kafka MCP Server en TypingMind?

Kafka MCP Server ofrece funciones MCP que puedes activar desde la página Plugins de TypingMind y usar en el chat o asignar a agentes de IA.

¿Tengo que compartir mis claves API con TypingMind para usar el servidor MCP Kafka MCP Server?

No. TypingMind prioriza el funcionamiento local y te permite mantener el control de tus proveedores de modelos, claves API, prompts y configuración MCP. Si Kafka MCP Server requiere autenticación, añade las cabeceras, los ajustes de OAuth o la configuración local necesarios para ese servidor MCP al crear la conexión.

Servidores MCP relacionados

Ver el directorio

Crea ya tu propio espacio de trabajo con IA

Suscríbete a nuestro boletín para recibir avisos sobre nuevas funciones y próximos sorteos 👇