Skip to content
kafka-mcp-integration logo

Kafka MCP Server Integration

kafka-mcp-integration

MCP server integration for Kafka operations with Claude Desktop and SpecWeave. Use when configuring Kafka MCP servers, connecting Claude to Kafka topics, or choosing between MCP implementations.

SKILL.md

Full skill instructions

Kafka MCP Server Integration

Expert knowledge for integrating SpecWeave with Kafka MCP (Model Context Protocol) servers. Supports 4 MCP server implementations with auto-detection and configuration guidance.


Code-First Recommendation: For most Kafka automation tasks, writing code is better than MCP (98% token reduction). Use kafkajs or kafka-node directly:

import { Kafka } from 'kafkajs';
const kafka = new Kafka({ brokers: ['localhost:9092'] });
const producer = kafka.producer();
await producer.send({ topic: 'events', messages: [{ value: 'Hello' }] });

When MCP IS useful: Quick interactive debugging, topic exploration, Claude Desktop integration.

When to use code instead: CI/​CD pipelines, test automation, production scripts, anything that should be committed and reusable.


Supported MCP Servers

1. kanapuli/​mcp-kafka (Node.js)

Installation:

npm install -g mcp-kafka

Capabilities:

  • Authentication: SASL_PLAINTEXT, PLAINTEXT
  • Operations: produce, consume, list-topics, describe-topic, get-offsets
  • Best for: Basic Kafka operations, quick prototyping

Configuration Example:

{
  "mcpServers": {
    "kafka": {
      "command": "npx",
      "args": ["mcp-kafka"],
      "env": {
        "KAFKA_BROKERS": "localhost:9092",
        "KAFKA_SASL_MECHANISM": "plain",
        "KAFKA_SASL_USERNAME": "user",
        "KAFKA_SASL_PASSWORD": "password"
      }
    }
  }
}

2. tuannvm/​kafka-mcp-server (Go)

Installation:

go install github.com/​tuannvm/​kafka-mcp-server@latest

Capabilities:

  • Authentication: SASL_SCRAM_SHA_256, SASL_SCRAM_SHA_512, SASL_SSL, PLAINTEXT
  • Operations: All CRUD operations, consumer group management, offset management
  • Best for: Production use, advanced SASL authentication

Configuration Example:

{
  "mcpServers": {
    "kafka": {
      "command": "kafka-mcp-server",
      "args": [
        "--brokers", "localhost:9092",
        "--sasl-mechanism", "SCRAM-SHA-256",
        "--sasl-username", "admin",
        "--sasl-password", "admin-secret"
      ]
    }
  }
}

3. Joel-hanson/​kafka-mcp-server (Python)

Installation:

pip install kafka-mcp-server

Capabilities:

  • Authentication: SASL_PLAINTEXT, PLAINTEXT, SSL
  • Operations: produce, consume, list-topics, describe-topic
  • Best for: Claude Desktop integration, Python ecosystem

Configuration Example:

{
  "mcpServers": {
    "kafka": {
      "command": "python",
      "args": ["-m", "kafka_mcp_server"],
      "env": {
        "KAFKA_BOOTSTRAP_SERVERS": "localhost:9092"
      }
    }
  }
}

4. Confluent Official MCP (Enterprise)

Installation:

confluent plugin install mcp-server

Capabilities:

  • Authentication: OAuth, SASL_SCRAM, API Keys
  • Operations: All Kafka operations, Schema Registry, ksqlDB, Flink SQL
  • Advanced: Natural language interface, AI-powered query generation
  • Best for: Confluent Cloud, enterprise deployments

Configuration Example:

{
  "mcpServers": {
    "kafka": {
      "command": "confluent",
      "args": ["mcp", "start"],
      "env": {
        "CONFLUENT_CLOUD_API_KEY": "your-api-key",
        "CONFLUENT_CLOUD_API_SECRET": "your-api-secret"
      }
    }
  }
}

Auto-Detection

SpecWeave can auto-detect installed MCP servers:

/​sw-kafka:mcp-configure

This command:

  1. Scans for installed MCP servers (npm, go, pip, confluent CLI)
  2. Checks which servers are currently running
  3. Ranks servers by capabilities (Confluent > tuannvm > kanapuli > Joel-hanson)
  4. Generates recommended configuration
  5. Tests connection

Quick Start

Option 1: Auto-Configure (Recommended)

/​sw-kafka:mcp-configure

Interactive wizard guides you through:

  • MCP server selection (or auto-detect)
  • Broker URL configuration
  • Authentication setup
  • Connection testing

Option 2: Manual Configuration

  1. Install preferred MCP server (see installation commands above)

  2. Create .mcp.json configuration:

{
  "serverType": "tuannvm",
  "brokerUrls": ["localhost:9092"],
  "authentication": {
    "mechanism": "SASL/​SCRAM-SHA-256",
    "username": "admin",
    "password": "admin-secret"
  }
}
  1. Test connection:
# Via MCP server CLI
kafka-mcp-server test-connection

# Or via SpecWeave
node -e "import('./​dist/​lib/​mcp/​detector.js').then(async ({ MCPServerDetector }) => {
  const detector = new MCPServerDetector();
  const result = await detector.detectAll();
  console.log(JSON.stringify(result, null, 2));
});"

MCP Server Comparison

FeaturekanapulituannvmJoel-hansonConfluent
LanguageNode.jsGoPythonOfficial CLI
SASL_PLAINTEXT✅✅✅✅
SCRAM-SHA-256❌✅❌✅
SCRAM-SHA-512❌✅❌✅
mTLS/​SSL❌✅✅✅
OAuth❌❌❌✅
Consumer Groups❌✅❌✅
Offset Mgmt❌✅❌✅
Schema Registry❌❌❌✅
ksqlDB❌❌❌✅
Flink SQL❌❌❌✅
AI/​NL Interface❌❌❌✅
Best ForPrototypingProductionDesktopEnterprise

Troubleshooting

MCP Server Not Detected

# Check if MCP server installed
npm list -g mcp-kafka         # kanapuli
which kafka-mcp-server        # tuannvm
pip show kafka-mcp-server     # Joel-hanson
confluent version             # Confluent

Connection Refused

  • Verify Kafka broker is running: kcat -L -b localhost:9092
  • Check firewall rules
  • Validate broker URL (correct host:port)

Authentication Failed

  • Double-check credentials (username, password, API keys)
  • Verify SASL mechanism matches broker configuration
  • Check broker logs for authentication errors

Operations Not Working

  • Ensure MCP server supports the operation (see comparison table)
  • Check broker ACLs (permissions for the authenticated user)
  • Verify topic exists: /​sw-kafka:mcp-configure list-topics

Operations via MCP

Once configured, you can perform Kafka operations via MCP:

import { MCPServerDetector } from './​lib/​mcp/​detector';

const detector = new MCPServerDetector();
const result = await detector.detectAll();

// Use recommended server
if (result.recommended) {
  console.log(`Using ${result.recommended} MCP server`);
  console.log(`Reason: ${result.rankingReason}`);
}

Security Best Practices

  1. Never commit credentials - Use environment variables or secrets manager
  2. Use strongest auth - Prefer SCRAM-SHA-512 > SCRAM-SHA-256 > PLAINTEXT
  3. Enable TLS/​SSL - Encrypt communication with broker
  4. Rotate credentials - Regularly update passwords and API keys
  5. Least privilege - Grant only necessary ACLs to MCP server user

Related Commands

  • /​sw-kafka:mcp-configure - Interactive MCP server setup
  • /​sw-kafka:dev-env start - Start local Kafka for testing
  • /​sw-kafka:deploy - Deploy production Kafka cluster

External Links

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View