Skip to main content
Glama
kinjal-1007

kafka-mcp

by kinjal-1007

Kafka MCP Server

A Model Context Protocol (MCP) server that provides tools to interact with Apache Kafka clusters. This server allows Claude to manage topics, produce messages, and consume messages from your Kafka infrastructure.

Features

  • Topic Management: List, describe, and create Kafka topics

  • Message Production: Send messages to any Kafka topic

  • Message Consumption: Read messages from topics with configurable consumer groups

  • Cluster Inspection: Get detailed information about topic partitions and replication

Related MCP server: Kafka MCP Server

Prerequisites

  • Python 3.9+

  • uv (The ultra-fast Python package and project manager)

  • Claude Desktop App

  • Access to a Kafka cluster (Confluent Cloud or self-hosted)

  • Kafka connection credentials

Installation & Setup

  1. Navigate to the project directory:

    cd /path/to/this/folder
  2. Initialize the project and create a virtual environment:

    uv init kafka-mcp
    uv venv
  3. Install the dependencies from the provided requirements.txt:

    uv add -r requirements.txt
  4. Configure Kafka connection: Edit the main.py file and replace the Kafka configuration with your actual credentials:

    # Load Kafka configuration (use your client.properties values)
    KAFKA_CONFIG = {
        "bootstrap.servers": "your-bootstrap-server:9092",
        "security.protocol": "SASL_SSL",
        "sasl.mechanisms": "PLAIN",
        "sasl.username": "your-username",
        "sasl.password": "your-password",
        "client.id": "mcp-server",
        "session.timeout.ms": 180000,
    }

    Get these values from your Confluent Cloud dashboard or Kafka cluster configuration.

Running the Server

To test and run the MCP server locally, use:

uv run --with "mcp[cli]" mcp run main.py

If it runs without errors, you are ready to connect it to Claude.

Connecting to Claude Desktop

  1. Open Claude Desktop.

  2. Go to Settings -> Developer -> Edit MCP Server Configuration. This will open the claude_desktop_config.json file.

  3. Add a new configuration for this server. Replace the paths with the absolute paths on your system.

{
  "mcpServers": {
    "kafka-mcp": {
      "command": "/path/to/your/uv",
      "args": [
        "run",
        "--directory",
        "/path/to/your/kafka-mcp",
        "python",
        "main.py"
      ]
    }
  }
}
  • command: The absolute path to your uv installation. Find it by running which uv in your terminal.

  • args[3] (--directory): The absolute path to this project folder.

  1. Save the file and restart Claude Desktop.

Usage Examples

Once configured, you can ask Claude to interact with your Kafka cluster:

  • "Check my Kafka cluster and describe the topics."

  • "Create a new topic called mcp-test-topic."

  • "Produce a message to mcp-test-topic with the content 'test message'."

  • "Consume all messages from the mcp-test-topic."

  • "Describe the user-database-topic and show its partition information."

Available Tools

list_topics()

Lists all topics in the Kafka cluster with their configuration details.

describe_topic(topic: str)

Provides detailed information about a specific topic including partition distribution and replica placement.

create_topic(topic: str, num_partitions: int = 1, replication_factor: int = 3)

Creates a new Kafka topic with specified partition count and replication factor.

produce_message(topic: str, key: str = None, value: str = None)

Produces a message to the specified Kafka topic with optional key.

consume_messages(topic: str, group_id: str = "mcp-consumer", max_messages: int = 5)

Consumes messages from a topic using the specified consumer group.

Example Workflow

  1. Cluster Inspection: Check what topics exist in your cluster

  2. Topic Creation: Create new topics for testing or production use

  3. Message Production: Send test messages or production data

  4. Message Consumption: Verify messages are being processed correctly

  5. Topic Management: Monitor and manage topic configurations

Troubleshooting

  • Connection Issues: Verify your Kafka credentials and network connectivity

  • Topic Errors: Ensure you have proper permissions to create/manage topics

  • Consumer Issues: Check that consumer groups are properly configured

  • Timeout Errors: Increase timeout values in the configuration if needed

Security Notes

  • Keep your Kafka credentials secure and never commit them to version control

  • Use appropriate ACLs (Access Control Lists) in your Kafka cluster

  • Consider using environment variables for sensitive configuration data

  • Regularly rotate credentials for production environments

Example Output

When you ask to list topics, Claude will return:

  • Complete list of all topics in the cluster

  • Partition counts and replication factors

  • Topic organization and naming patterns

  • Health status based on leader distribution


Note: This tool provides direct access to your Kafka infrastructure. Use with caution in production environments and ensure proper access controls are in place.

Available Tools

5 tools
consume_messagesC

Consume messages from a Kafka topic.

ParametersJSON Schema
NameRequiredDescriptionDefault
topicYes
group_idNomcp-consumer
max_messagesNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.4/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It does not state whether consume_messages is a destructive operation (offset advancement, which can affect other consumers), whether it commits offsets back to Kafka, how it handles empty topics, timeouts, or whether consumers should use a unique group_id to avoid conflicting with other consumers. None of this is disclosed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

At one sentence, it is concise and to the point, but it borders on under-specification rather than true conciseness. Every word earns its place, but the description is too thin to be helpful — it reads more like a summary than a specification.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite having an output schema, the tool has real-world subtleties (Kafka consumer group semantics, offset management, blocking behavior) that are completely unaddressed. With 3 parameters at 0% schema-to-description coverage and zero annotations, this description leaves substantial behavioral and parameter ambiguities unresolved for a message-consuming tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, yet the description adds no parameter-level information. The description doesn't clarify what group_id does (offsets are tracked per consumer group), doesn't explain the tradeoffs of max_messages, and doesn't mention that group_id defaults and multiple calls with the same group could interfere. The schema provides field types and defaults, but no semantic depth.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states 'Consume messages from a Kafka topic' which is a clear verb+resource pairing. However, it doesn't distinguish itself from sibling tools like produce_message (which is clearly different) or describe_topic — the purpose is minimally clear but offers no scoping detail beyond the generic action.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. There's no mention of prerequisites (e.g., topic must exist, need create_topic first), no exclusions (e.g., not for reading topic metadata — use describe_topic), and no mention of blocking vs non-blocking consumption behavior.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

create_topicC

Create a new Kafka topic.

ParametersJSON Schema
NameRequiredDescriptionDefault
topicYes
num_partitionsNo
replication_factorNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.5/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden of behavioral disclosure. It does not state whether creating an existing topic errors, whether configuration defaults to broker settings, whether partitions/replication are auto-created, or any idempotency characteristics. Minimal behavioral info for a mutating operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence, efficient, no waste. But it is under-specified — brevity is appropriate yet could include non-redundant context like default behavior in the same compact structure.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite having an output schema, the description is incomplete for a mutating operation with no annotations. It doesn't cover error cases (duplicate topic), broker requirements, or the significance of the replication_factor default. For a CRUD create operation, more behavioral context is expected.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, but the parameter names (topic, num_partitions, replication_factor) are self-explanatory with sensible defaults (1 partition, replication factor 3). The description adds nothing beyond schema, so it doesn't compensate for the 0% coverage, but the parameter semantics are inherently clear from naming and defaults.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description states 'Create a new Kafka topic' — verb+resource are clear. However, it provides no differentiation from siblings like describe_topic or list_topics. The purpose is functional but minimal, lacking any context about the create operation's role in the topic lifecycle.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool vs alternatives or prerequisites (e.g., broker availability, whether topic must not already exist). Siblings like produce_message/consume_messages imply different phases but no explicit guidance is given.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

describe_topicC

Describe a Kafka topic.

ParametersJSON Schema
NameRequiredDescriptionDefault
topicYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.7/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full behavioral disclosure burden. It doesn't state what information is returned (partitions, configs, offsets), whether the topic must already exist, or error behavior when describing a nonexistent topic. However, there is an output schema, which is not shown here, so some transparency may be expected from that.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

One short sentence with zero wasted words. Truly concise. Not as fully specified as it could be, but it would be hard to call this verbose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is simple (1 param, 1 required) and has an output schema, which likely carries the return-value explanation. However, with no annotations and no guidance about prerequisites (topic must exist) or what 'describe' reveals beyond the output schema name, a bit more behavioral context would round it out. Adequate for a minimal tool but not enriched.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

There is only 1 parameter (topic) with 0% schema description coverage. The description doesn't add any meaning beyond the schema's 'topic' string field. However, the single-parameter tool is simple—'topic' is self-explanatory in context—so the baseline for a simple single-param tool is reasonable but not enhanced.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Describe a Kafka topic.' uses a specific verb+resource, clearly indicating the operation (describe) and target (Kafka topic). It's understandable but minimal, and given sibling tools like list_topics and create_topic, it doesn't explicitly differentiate what 'describe' returns vs 'list' — the verb does most of the work.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus siblings. With list_topics, create_topic, produce_message, and consume_messages present, there's no mention of when describe is appropriate (e.g., after creating a topic to verify configs, vs listing all topics to find it). Usage must be inferred entirely.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_topicsB

List all topics in the Kafka cluster.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It doesn't mention the return format, whether pagination applies, whether it reflects the live cluster state, required permissions, or latency/gating concerns. For a read-only enumeration tool with zero annotation coverage, more behavioral context is warranted.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single, efficient sentence with zero waste. Appropriate for a zero-parameter listing tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter list tool with an output schema present, the description is reasonably complete for its core purpose. However, given the presence of siblings like create_topic, the description could add value by noting this is a read-only discovery operation, and could mention whether topic metadata includes configuration or offsets details.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, so there is no parameter burden to carry. With schema description coverage at 100% and no params, the baseline of 4 applies. Nothing to add beyond what the schema conveys.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clear verb+resource: 'List all topics in the Kafka cluster.' This clearly states what it does. The word 'all' suggests it returns the full topic list, distinguishing it somewhat from describe_topic which targets a specific topic.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this vs alternatives. With siblings like describe_topic, create_topic, produce_message, consume_messages, the description could note that this is for enumeration/discovery while describe_topic handles individual topic details. No exclusions or context provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

produce_messageC

Produce a message to a Kafka topic.

ParametersJSON Schema
NameRequiredDescriptionDefault
keyNo
topicYes
valueNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It conveys that this is a write/mutation operation (producing a message), which is the core behavior. However, it doesn't disclose whether the topic is auto-created, whether the operation is synchronous or fire-and-forget, or what happens on failure — key gaps for a producer tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely short (a single sentence, 8 words), which makes it efficient but under-specified. It's front-loaded with the primary purpose. However, it has no structural elements (no sections) and uses almost no space for the multiple gaps identified in other dimensions.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite having an output schema, the description omits critical context for a Kafka producer: serialization format expectations, whether this blocks until acknowledged (acks setting), behavior on non-existent topics, key/value null handling, or message size limits. The sibling tool consume_messages implies a read/write pairing, but the produce side is underdocumented. For a write tool interacting with infrastructure, this is a meaningful completeness gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, and the description adds no information about the semantics of the topic, key, or value parameters beyond what's in the schema (which itself is minimal — just types and defaults). Specifically, the description doesn't clarify the role of 'key' in partitioning/message ordering, or the expected format of 'value', or how null value/key are handled. With 3 parameters and 0% coverage, the description should compensate but doesn't.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Produce a message to a Kafka topic' has a clear verb (produce) and resource (message to Kafka topic). It does distinguish from sibling tools like consume_messages, list_topics, and describe_topic, though it doesn't explicitly contrast them. It's adequate but the phrase 'produce a message' is somewhat generic — could add scope like producing to produce a single record vs batch.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool vs alternatives, prerequisites (e.g., topic must exist, needing create_topic first), or Kafka producer-specific constraints. There's no mention of when-not-to-use or alternatives. The agent must infer usage context entirely from the sibling names.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 5 tool updatesv0.1.0
    • First observedconsume_messages
    • First observedcreate_topic
    • First observeddescribe_topic
    • First observedlist_topics
    • First observedproduce_message

TDQS

B3/5.0
Disambiguation4/5

Each tool targets a distinct Kafka resource action: listing, describing, creating topics, plus producing and consuming messages. The two message tools (produce_message, consume_messages) are clearly opposite operations, so little confusion. Minor overlap between list_topics and describe_topic could cause slight ambiguity but descriptions are clear enough.

Naming Consistency5/5

All tools follow a consistent verb_noun pattern: list_topics, describe_topic, create_topic, produce_message, consume_messages. The naming convention is uniform with no mixture of styles or vague verbs.

Tool Count4/5

Five tools is a reasonable, well-scoped count for a Kafka server covering core topic management and messaging. It's on the leaner side but every tool earns its place for the apparent purpose.

Completeness3/5

The surface covers topic lifecycle (list, describe, create) and basic messaging (produce, consume). Missing obvious operations like delete_topic, update_topic (partitions/replication), and consumer group management, which are common Kafka workflows an agent would expect.

Maintenance

ActivityInactive
ResponsivenessNo issues

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

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI models to publish and consume messages from Apache Kafka topics through a standardized interface, making it easy to integrate Kafka messaging with LLM and agent applications.
    17
    Apache 2.0
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables 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.
    -
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables 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.
    1
    MIT

Latest Blog Posts

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/kinjal-1007/confluent-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server