OCI Kafka MCP Server
OCI Kafka MCP Server
An AI-native control interface for OCI Streaming with Apache Kafka, built on the Model Context Protocol (MCP) specification.
This MCP server enables LLM agents (Claude, GPT, etc.) to securely manage Kafka clusters through structured tool execution — with built-in safety guardrails, audit logging, and enterprise-grade security.
Features
42 structured tools for cluster, topic, consumer, observability, AI diagnostics, OCI metadata, cluster lifecycle, cluster configuration, and work request operations
Read-only by default — write tools require explicit
--allow-writesflagPolicy guard — every tool is risk-classified (LOW/MEDIUM/HIGH); destructive operations require confirmation
AI diagnostic tools — orchestrate multiple Kafka operations to produce scaling recommendations and lag root cause analyses
Circuit breaker — prevents cascading failures when Kafka is unavailable
Structured audit logging — every tool execution logged as JSON with timestamp, input hash, and duration
SASL/SCRAM-SHA-512 + TLS — enterprise security from day one
Private networking — designed for OCI private endpoints
Quick Start
Prerequisites
Python 3.11+
uv (recommended) or pip
Install
git clone <repo-url>
cd oci-kafka-mcp-server
uv syncRun with local Kafka (development, Podman)
# Start a local Kafka broker
podman compose -f docker/docker-compose.yaml up -d
# Run the MCP server (read-only mode)
uv run oci-kafka-mcp
# Run with write tools enabled
uv run oci-kafka-mcp --allow-writes
# Stop local Kafka
podman compose -f docker/docker-compose.yaml downConfigure for OCI Streaming
You can configure OCI Kafka in either of these ways:
Set environment variables up front (optional)
Leave variables unset and let the MCP server request the required values at runtime, then call
oci_kafka_configure_connection
If you want to pre-configure with environment variables:
export KAFKA_BOOTSTRAP_SERVERS="bootstrap-clstr-XXXXX.kafka.us-chicago-1.oci.oraclecloud.com:9092"
export KAFKA_SECURITY_PROTOCOL="SASL_SSL"
export KAFKA_SASL_MECHANISM="SCRAM-SHA-512"
export KAFKA_SASL_USERNAME="your-username"
export KAFKA_SASL_PASSWORD="your-password"
export KAFKA_SSL_CA_LOCATION="/path/to/ca.pem"
uv run oci-kafka-mcpOr use the OCI template file:
cp .env.oci.example .env.oci
# edit .env.oci with your cluster values
source .env.oci
uv run oci-kafka-mcpNote:
KAFKA_*variables are not mandatory at server startup. If not set, tools will guide the agent/user to provide connection details and useoci_kafka_configure_connectionbefore data-plane operations.
Use with an MCP Client
This server works with any MCP-compatible client. Oracle recommends Cline, Cursor, and MCPHost. See the Oracle MCP client configuration guide for details.
The env block below is optional — if omitted, the server will prompt the agent to call oci_kafka_configure_connection with your cluster details at runtime.
Cline (VS Code extension)
Add to your Cline MCP settings:
{
"mcpServers": {
"oci-kafka": {
"type": "stdio",
"command": "/path/to/oci-kafka-mcp-server/.venv/bin/oci-kafka-mcp",
"args": ["--allow-writes"],
"env": {
"KAFKA_BOOTSTRAP_SERVERS": "your-bootstrap:9092",
"KAFKA_SECURITY_PROTOCOL": "SASL_SSL",
"KAFKA_SASL_MECHANISM": "SCRAM-SHA-512",
"KAFKA_SASL_USERNAME": "your-username",
"KAFKA_SASL_PASSWORD": "your-password"
}
}
}
}Cursor
Add to .cursor/mcp.json (project-level) or ~/.cursor/mcp.json (global):
{
"mcpServers": {
"oci-kafka": {
"type": "stdio",
"command": "/path/to/oci-kafka-mcp-server/.venv/bin/oci-kafka-mcp",
"args": ["--allow-writes"],
"env": {
"KAFKA_BOOTSTRAP_SERVERS": "your-bootstrap:9092",
"KAFKA_SECURITY_PROTOCOL": "SASL_SSL",
"KAFKA_SASL_MECHANISM": "SCRAM-SHA-512",
"KAFKA_SASL_USERNAME": "your-username",
"KAFKA_SASL_PASSWORD": "your-password"
}
}
}
}MCPHost
Add to your MCPHost configuration file (e.g., ~/.mcphost.json):
{
"mcpServers": {
"oci-kafka": {
"type": "stdio",
"command": "/path/to/oci-kafka-mcp-server/.venv/bin/oci-kafka-mcp",
"args": ["--allow-writes"],
"env": {
"KAFKA_BOOTSTRAP_SERVERS": "your-bootstrap:9092",
"KAFKA_SECURITY_PROTOCOL": "SASL_SSL",
"KAFKA_SASL_MECHANISM": "SCRAM-SHA-512",
"KAFKA_SASL_USERNAME": "your-username",
"KAFKA_SASL_PASSWORD": "your-password"
}
}
}
}Then start MCPHost with:
mcphost -m ollama:<model> --config ~/.mcphost.jsonAvailable Tools (42)
Connection Management
Tool | Description | Risk |
| Set or update Kafka cluster connection details at runtime (no restart needed) | LOW |
| Show current connection config with masked password | LOW |
Cluster Operations
Tool | Description | Risk |
| Broker status, controller ID, topic count | LOW |
| Broker-level Kafka configuration settings | LOW |
Topic Operations
Tool | Description | Risk |
| List all topics | LOW |
| Partition details, leaders, replicas, ISR, topic config | LOW |
| Create a topic with partitions and replication factor | MEDIUM |
| Update topic configuration (retention, compaction, etc.) | MEDIUM |
| Delete a topic (requires confirmation) | HIGH |
Consumer Operations
Tool | Description | Risk |
| List all consumer groups | LOW |
| Group state, members, coordinator, partition assignments | LOW |
| Per-partition lag, committed offsets, end offsets | LOW |
| Reset offsets to earliest/latest/specific offset (requires confirmation) | HIGH |
| Delete a consumer group (requires confirmation) | HIGH |
Observability
Tool | Description | Risk |
| Detect partition leader imbalance across brokers | LOW |
| Find partitions where ISR count < replica count | LOW |
AI Diagnostics
Tool | Description | Risk |
| Orchestrates health, skew, and replication data into scaling recommendations | LOW |
| Correlates consumer state, lag, and topology into root cause analysis | LOW |
OCI Control Plane Metadata
Tool | Description | Risk |
| List all Kafka clusters in an OCI compartment (auto-discovers compartment) | LOW |
| Cluster OCID, lifecycle state, broker shape, bootstrap URLs, tags | LOW |
Cluster Lifecycle (OCI Control Plane)
Async operations — returns a work request OCID; use oci_kafka_get_work_request to poll for completion.
Tool | Description | Risk |
| Provision a new OCI Kafka cluster (requires confirmation) | HIGH |
| Update cluster display name, tags, or applied configuration | MEDIUM |
| Scale broker count for an existing cluster (requires confirmation) | HIGH |
| Permanently delete a cluster and all its data (requires confirmation) | HIGH |
| Move a cluster to a different OCI compartment (requires confirmation) | HIGH |
| Grant full administrative access to the cluster's superuser | MEDIUM |
| Revoke superuser access to restore least-privilege | MEDIUM |
Cluster Configuration (OCI Control Plane)
Named, versioned sets of Kafka broker settings that can be applied to one or more clusters.
Tool | Description | Risk |
| List all cluster configurations in a compartment | LOW |
| Get a cluster configuration and its latest version | LOW |
| Create a new named cluster configuration | MEDIUM |
| Update a config's display name or tags | MEDIUM |
| Delete a configuration and all its versions (requires confirmation) | HIGH |
| Move a configuration to a different compartment | MEDIUM |
| List all versions of a cluster configuration | LOW |
| Get a specific version of a cluster configuration | LOW |
| Delete a specific configuration version | MEDIUM |
Work Requests & Node Shapes (OCI Control Plane)
Track asynchronous OCI operations returned by cluster lifecycle and configuration tools.
Tool | Description | Risk |
| Poll status and progress of an async OCI operation | LOW |
| List work requests by compartment or resource OCID | LOW |
| Get error details from a failed work request | LOW |
| Get timestamped log entries from a work request | LOW |
| Cancel an in-progress work request | MEDIUM |
| List available broker node shapes for cluster provisioning | LOW |
Safety Model
Risk Level | Behavior | Examples |
LOW | Always allowed | Health checks, list/describe operations |
MEDIUM | Requires | Create topic, update config |
HIGH | Requires | Delete topic, reset offsets, cluster lifecycle |
Development
# Run tests (92 tests, all unit — no Kafka broker needed)
uv run pytest
# Run tests with coverage
uv run pytest --cov=oci_kafka_mcp --cov-report=term-missing
# Lint
uv run ruff check src/ tests/
# Format
uv run ruff format src/ tests/
# Type check
uv run mypy src/Architecture
See docs/ARCHITECTURE.md for the full security architecture document, including threat model, dependency audit, and deployment architecture.
License
Apache-2.0
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/BhaumikAbhishek/oci-kafka-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server