Skip to main content
image

🔌 WKafka Model Context Protocol (MCP) Server

PyPI Version Python Version License: MIT

An advanced Model Context Protocol (MCP) server designed to enable AI coding assistants (like Gemini, Claude, Cursor, OpenCode, and Antigravity) to design, build, test, and adapt high-performance event-driven microservices based on WKafka (the standard Kafka orchestrator suite).


🎯 Why This MCP Server Exists

Building streaming pipelines and microservices with Kafka often requires complex configuration, custom serialization patterns, error-handling logic, and safety contexts (like SASL and SSL).

This MCP server acts as an expert assistant interface for AI agents. It equips them with the tools and domain-specific knowledge to:

  1. Instantly Scaffold production-ready Kafka services adhering to strict architectural structures.
  2. Generate clean code for JSON, raw images, and video stream consumers and producers.
  3. Adapt existing scripts automatically to run under Kafka message triggers.
  4. Validate Kafka connection configs to prevent hardcoded credentials or missing settings.

🛠️ Technologies and Ecosytem Libraries Used

This component is built using the following core technologies:

  • Python (>=3.10): Core programming language.
  • FastMCP: High-productivity framework for building Model Context Protocol servers in Python.
  • MCP CLI/SDK: Protocol implementations supporting integration with AI environments.
  • Pydantic (v2): Advanced data validation and settings schema definitions.
  • Pytest & Pytest-Cov: Testing framework and coverage reports.
  • Docker: For sandboxed unit test execution.

🚀 Installation & Setup

1. Install the Package

Install wkafka-mcp via PyPI:

pip install wkafka-mcp

2. Configure in your AI Agent Config

OpenCode Configuration

Add to your ~/.config/opencode/opencode.jsonc inside the "mcp" block:

    "wkafka-mcp": {
      "type": "local",
      "command": [
        "python",
        "-m",
        "wkafka_mcp.server",
        "run"
      ],
      "enabled": true
    }

Antigravity (agy) / Gemini CLI Configuration

Add to your global ~/.gemini/antigravity/mcp_config.json:

{
  "mcpServers": {
    "wkafka-mcp": {
      "command": "python",
      "args": [
        "-m",
        "wkafka_mcp.server",
        "run"
      ]
    }
  }
}

⚙️ Detailed MCP Tools List

The server exposes the following MCP tools to your agent:

Tool Name Arguments Description
get_wkafka_architect_blueprints None Returns production-ready consumer and producer patterns (JSON, images, video streaming, and SASL configuration).
get_wkafka_architect_manual None Returns the master manual covering project structure rules, module map, and monolith refactoring steps.
search_wkafka_pattern query: str Searches the catalog database for specific streaming patterns.
deploy_wkafka_scaffolding target_dir: str, project_name: str, scaffold_type: str Deploys a complete directory structure matching the requested scaffold (standard, vision_pipeline, or full_service).
generate_from_pattern pattern_name: str, target_dir: str Generates a project tailored from a specific catalog pattern name.
validate_kafka_config config_code: str Scans a configuration snippet for missing credentials or unsafe defaults.
generate_wkafka_consumer topic: str, format: str, key_filter: str, target_file: str Generates a custom worker trigger template.
generate_wkafka_producer topic: str, format: str, target_file: str Generates a custom producer message dispatcher template.
adapt_code_to_wkafka source_code: str, topic: str, value_type: str, group_id: str Automatically wraps any Python script (with or without main()) inside a WKafka consumer trigger.
chain_topics_pipeline source_topic: str, target_topic: str, value_type: str, transform_logic: str Generates a pipeline worker that links a consumer from source_topic to a producer forwarding to target_topic.
suggest_serializers sample_data: str Analyzes raw data payload structures to suggest the optimal serialization type.

💡 MCP Usage Examples

Here are some typical requests you can make to your AI assistant:

Example 1: Create a basic consumer

User request: "Crea un consumidor de kafka para el topico orders_stream"

  • Agent action: The agent will ask clarifying questions about whether the payload is JSON or an image, and if a group_id is required. Then it will call generate_wkafka_consumer.

Example 2: Adapt an existing script to run as a trigger

User request: "Toma este script.py y adaptalo para que la funcion prueba1() se lance por trigger de kafka en el topico orders"

  • Agent action: The agent will call adapt_code_to_wkafka, automatically wrapping the execution logic inside the callback so prueba1(data) receives the message payload upon event ingestion.

💬 Interactive Questions Flow

When requesting new consumer configurations, the assistant will automatically present you with options to select:

  1. Payload Type: JSON (Structured data/dict) vs Image (cv2 frames) vs Video streams.
  2. Security: Plain local configuration vs SASL Authenticated context.
  3. Consumer Group: Optional choice to specify a custom group_id or default to dynamic group generators.

🧪 Running the Tests

To ensure code stability and API contracts are preserved, a comprehensive unit test suite is included.

Run Locally (pytest)

# Install development dependencies
make install

# Execute the test suite
make test

Coverage Reports

To run the tests and calculate code coverage, execute the provided script:

./run_coverage.sh

Sandboxed Testing with Docker

To run the test suite in an isolated Python 3.13 environment container (independent of local packages):

./run_tests_docker.sh

Generated by WKafka MCP by wisrovi

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wkafka_mcp-0.2.2.tar.gz (27.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wkafka_mcp-0.2.2-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file wkafka_mcp-0.2.2.tar.gz.

File metadata

  • Download URL: wkafka_mcp-0.2.2.tar.gz
  • Upload date:
  • Size: 27.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for wkafka_mcp-0.2.2.tar.gz
Algorithm Hash digest
SHA256 05f3a97ca6b0a3d29016d9adfb89886dc8a13ebfe4c4105614a32773a7c75e00
MD5 4966b0c7996358e06fe5d459dd611b24
BLAKE2b-256 78e30bbed055544c8711f35a2c6a45beb918d8426e7139385980258bd6188ecf

See more details on using hashes here.

File details

Details for the file wkafka_mcp-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: wkafka_mcp-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 21.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for wkafka_mcp-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7885a752b193a4b64d5a6897b24fbf2f70147f8162d7b4b97ec86a30b1441e72
MD5 73625071223060f6b42bb61f0e6dc944
BLAKE2b-256 c68a10a297f5691083404f9af9e251e9d7db626283c90a0c5a0aae89f4c5d8a5

See more details on using hashes here.

Release history Release notifications | RSS feed

0.4.5

2 files

0.4.4

2 files

0.4.3

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.0

2 files

0.2.4

2 files

0.2.3

2 files

This release

0.2.2 This release

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page