
Kafka Schema Registry
STDIOMCP server for Kafka Schema Registry operations with multi-registry and context management capabilities.
MCP server for Kafka Schema Registry operations with multi-registry and context management capabilities.
A comprehensive Message Control Protocol (MCP) server that provide s Claude Desktop and other MCP clients with tools for Kafka Schema Registry operations. Features include advanced Schema Context support for logical schema grouping, Configuration Management for compatibility settings, Mode Control for operational state management, and comprehensive Schema Export capabilities for backup, migration, and schema documentation.
![]() |
|
SCHEMA_REGISTRY_NAME_X
, SCHEMA_REGISTRY_URL_X
patternREADONLY_X
mode control:stable
for production deploymentskafka_schema_registry_unified_mcp.py
that auto-detects single vs multi-registry mode# Latest stable release docker pull aywengo/kafka-schema-reg-mcp:stable # Or use latest (might be not released yet) docker pull aywengo/kafka-schema-reg-mcp:latest # Or specific version docker pull aywengo/kafka-schema-reg-mcp:v1.4.0
# Test MCP server in Docker python tests/test_docker_mcp.py
# Start with docker-compose (includes Schema Registry) docker-compose up -d
# Clone the repository git clone https://github.com/aywengo/kafka-schema-reg-mcp cd kafka-schema-reg-mcp # Install Python dependencies pip install -r requirements.txt
Single Registry Mode (Backward Compatible):
# Basic Schema Registry connection export SCHEMA_REGISTRY_URL="http://localhost:8081" export SCHEMA_REGISTRY_USER="" # Optional export SCHEMA_REGISTRY_PASSWORD="" # Optional export READONLY="false" # Global readonly mode
Multi-Registry Mode (New - Up to 8 Registries):
# Registry 1 - Development export SCHEMA_REGISTRY_NAME_1="development" export SCHEMA_REGISTRY_URL_1="http://dev-schema-registry:8081" export SCHEMA_REGISTRY_USER_1="dev-user" # Optional export SCHEMA_REGISTRY_PASSWORD_1="dev-pass" # Optional export READONLY_1="false" # Per-registry readonly # Registry 2 - Production (with safety) export SCHEMA_REGISTRY_NAME_2="production" export SCHEMA_REGISTRY_URL_2="http://prod-schema-registry:8081" export SCHEMA_REGISTRY_USER_2="prod-user" export SCHEMA_REGISTRY_PASSWORD_2="prod-pass" export READONLY_2="true" # Production safety
Variable | Description | Default | Example |
---|---|---|---|
Single Registry Mode | |||
SCHEMA_REGISTRY_URL | Schema Registry endpoint | http://localhost:8081 | http://schema-registry:8081 |
SCHEMA_REGISTRY_USER | Username for authentication | (empty) | admin |
SCHEMA_REGISTRY_PASSWORD | Password for authentication | (empty) | password123 |
READONLY | Global read-only mode | false | true |
Multi-Registry Mode | |||
SCHEMA_REGISTRY_NAME_X | Registry alias (X=1-8) | (required) | production |
SCHEMA_REGISTRY_URL_X | Registry endpoint (X=1-8) | (required) | http://prod-registry:8081 |
SCHEMA_REGISTRY_USER_X | Username (X=1-8) | (empty) | prod-user |
SCHEMA_REGISTRY_PASSWORD_X | Password (X=1-8) | (empty) | prod-password |
READONLY_X | Per-registry readonly (X=1-8) | false | true |
Security Settings | |||
ALLOW_LOCALHOST | Allow localhost URLs (dev/test only) | false | true |
TESTING | Enable test mode | false | true |
When READONLY=true
is set, the MCP server blocks all modification operations while keeping read and export operations available. Perfect for production environments where you want to prevent accidental changes.
Blocked Operations:
Allowed Operations:
Usage Examples:
# Production environment with read-only protection export READONLY=true python kafka_schema_registry_mcp.py # Docker with read-only mode docker run -e READONLY=true -e SCHEMA_REGISTRY_URL=http://localhost:8081 aywengo/kafka-schema-reg-mcp:stable # Claude Desktop configuration with read-only mode { "env": { "SCHEMA_REGISTRY_URL": "http://localhost:8081", "READONLY": "true" } }
# The unified server automatically detects single vs multi-registry mode python kafka_schema_registry_unified_mcp.py
# Run the unified test runner (starts environment + runs all tests) cd tests ./run_all_tests.sh # Or run essential tests only (faster) ./run_all_tests.sh --quick # Or use the simple wrapper ./test-unified.sh
All configuration examples are available in the config-examples/
directory with updated port configurations.
Quick Setup:
# Copy the configuration that matches your use case cp config-examples/claude_desktop_stable_config.json ~/Library/Application\ Support/Claude/claude_desktop_config.json # Or for Linux cp config-examples/claude_desktop_stable_config.json ~/.config/claude-desktop/config.json
Stable Tag (Recommended for Production):
# Use the pre-configured stable setup cp config-examples/claude_desktop_stable_config.json ~/Library/Application\ Support/Claude/claude_desktop_config.json
Latest Tag:
# Use the latest Docker image cp config-examples/claude_desktop_docker_config.json ~/Library/Application\ Support/Claude/claude_desktop_config.json
Multi-Registry Setup:
# For multi-environment schema management cp config-examples/claude_desktop_multi_registry_docker.json ~/Library/Application\ Support/Claude/claude_desktop_config.json
# For local development cp config-examples/claude_desktop_config.json ~/Library/Application\ Support/Claude/claude_desktop_config.json
Configuration | Use Case | Description |
---|---|---|
claude_desktop_stable_config.json | Production | Docker stable tag, single registry |
claude_desktop_multi_registry_docker.json | Multi-Environment | Docker with DEV/STAGING/PROD registries |
claude_desktop_config.json | Local Development | Python local execution |
claude_desktop_readonly_config.json | Production Safety | Read-only mode enforced |
claude_desktop_simple_multi.json | Simple Multi-Registry | 2-registry setup (dev + prod) |
📖 Complete Configuration Guide: config-examples/README.md
Copy the configuration to your Claude Desktop config file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
💡 Configuration Pattern: The
-e VARIABLE_NAME
pattern (without values) in args combined with theenv
section is the recommended approach. This separates Docker arguments from configuration values, making the setup more maintainable and secure.
Single Registry Example prompts:
Multi-Registry Example prompts:
The MCP server provides 20 comprehensive tools and 2 resources for all Schema Registry operations:
register_schema
, get_schema
, get_schema_versions
, check_compatibility
list_contexts
, create_context
, delete_context
list_subjects
, delete_subject
get_global_config
, update_global_config
, get_subject_config
, update_subject_config
get_mode
, update_mode
, get_subject_mode
, update_subject_mode
export_schema
, export_subject
, export_context
, export_global
registry://status
: Real-time Schema Registry connection statusregistry://info
: Detailed server configuration and capabilitiesWith the MCP server connected to Claude Desktop, you can use natural language:
"List all schema contexts"
"Show me the subjects in the production context"
"Register a new user schema with fields for id, name, and email"
"Export all schemas from the staging context in Avro IDL format"
"Check if my updated schema is compatible with the latest version"
"Get the current configuration for the user-events subject"
📖 Complete Tool Documentation: API Reference
The MCP server includes 8 comprehensive prompts that provide guided workflows and best practices for schema management. These prompts appear in Claude Desktop to help you learn and execute complex operations.
Prompt | Purpose | Best For |
---|---|---|
schema-getting-started | Introduction to basic operations | New users, onboarding |
schema-registration | Complete guide for registering schemas | Developers, schema creation |
context-management | Organizing schemas by environment/team | DevOps, multi-environment setups |
schema-export | Export for backup, docs, compliance | Documentation, backup procedures |
multi-registry | Managing multiple registries | Multi-environment, disaster recovery |
schema-compatibility | Safe schema evolution | Schema changes, production safety |
troubleshooting | Diagnose and resolve issues | Problem resolution, debugging |
advanced-workflows | Enterprise patterns and automation | Complex deployments, team coordination |
Human: Show me the schema-getting-started prompt
Claude: [Displays comprehensive getting started guide with examples]
Human: I need help with schema compatibility
Claude: Let me show you the schema-compatibility prompt which covers compatibility levels, safe vs breaking changes, and evolution workflows.
🔰 Beginner Path (15-30 minutes):
schema-getting-started
- Understand basicsschema-registration
- Register your first schemacontext-management
- Organize with contexts⚡ Intermediate Path (30-60 minutes):
4. schema-export
- Document and backup
5. schema-compatibility
- Safe evolution
6. troubleshooting
- Handle common issues
🚀 Advanced Path (1-2 hours):
7. multi-registry
- Multi-environment management
8. advanced-workflows
- Enterprise patterns
Role | Recommended Prompts |
---|---|
Developers | schema-registration , schema-compatibility |
DevOps Engineers | multi-registry , advanced-workflows |
Data Engineers | schema-export , context-management |
System Administrators | troubleshooting , multi-registry |
📖 Complete Prompts Guide: MCP Prompts Documentation
Comprehensive export functionality with 17 endpoints supporting backup, migration, and documentation:
📖 Detailed Guide: API Reference - Export Endpoints
Advanced migration tools for moving schemas between registries and contexts:
The migrate_context
tool generates ready-to-run Docker commands using the kafka-schema-reg-migrator:
Example:
Human: "Migrate all schemas from development context to production"
Claude: I'll generate the Docker migration command for you.
[Uses migrate_context MCP tool]
🚀 Ready to migrate development context to production:
Copy and run this command:
docker run --platform linux/amd64 --network host -it --rm \
-e SOURCE_SCHEMA_REGISTRY_URL=http://dev-registry:8081 \
-e DEST_SCHEMA_REGISTRY_URL=http://prod-registry:8082 \
-e ENABLE_MIGRATION=true \
-e DRY_RUN=true \
-e PRESERVE_IDS=true \
-e SOURCE_CONTEXT=development \
-e DEST_CONTEXT=production \
aywengo/kafka-schema-reg-migrator:latest
Set DRY_RUN=false when ready for actual migration.
Individual schemas can be migrated directly using migrate_schema
:
📖 Migration Guide: MCP Tools Reference - Migration
Powerful logical grouping for enterprise schema management:
📖 Real-World Examples: Use Cases - Enterprise Scenarios
Enterprise-grade operational control:
📖 Complete Reference: API Reference - Configuration
There are two types of authentication in this project:
Schema Registry Authentication (Backend):
SCHEMA_REGISTRY_USER
, SCHEMA_REGISTRY_PASSWORD
(and their multi-registry variants).MCP Server Authentication (Frontend):
ENABLE_AUTH=true
and configure via AUTH_ISSUER_URL
, AUTH_VALID_SCOPES
, etc.Note: Setting
SCHEMA_REGISTRY_USER
/PASSWORD
only protects the connection to the backend registry, not the MCP server API/tools. To secure the MCP server itself, use theENABLE_AUTH
and related variables.
There are two layers of authentication:
- Schema Registry Auth: Controls how the MCP server connects to the backend registry. Set
SCHEMA_REGISTRY_USER
/PASSWORD
(and_X
variants for multi-registry) for this purpose.- MCP Server Auth: Controls who can access the MCP server and its tools. Use
ENABLE_AUTH
and relatedAUTH_*
variables to secure the MCP server itself.
To secure the MCP server itself, you must set ENABLE_AUTH=true
and configure the OAuth2 variables.
Variable | Description | Default | Applies To |
---|---|---|---|
SCHEMA_REGISTRY_USER | Username for backend Schema Registry | (empty) | Schema Registry (backend) |
SCHEMA_REGISTRY_PASSWORD | Password for backend Schema Registry | (empty) | Schema Registry (backend) |
SCHEMA_REGISTRY_USER_X | Username for multi-registry backend | (empty) | Schema Registry (backend) |
SCHEMA_REGISTRY_PASSWORD_X | Password for multi-registry backend | (empty) | Schema Registry (backend) |
ENABLE_AUTH | Enable OAuth2 authentication/authorization | false | MCP Server (frontend) |
AUTH_ISSUER_URL | OAuth2 issuer URL | https://example.com | MCP Server (frontend) |
AUTH_VALID_SCOPES | Comma-separated list of valid scopes | myscope | MCP Server (frontend) |
AUTH_DEFAULT_SCOPES | Comma-separated list of default scopes | myscope | MCP Server (frontend) |
AUTH_REQUIRED_SCOPES | Comma-separated list of required scopes | myscope | MCP Server (frontend) |
AUTH_CLIENT_REG_ENABLED | Enable dynamic client registration | true | MCP Server (frontend) |
AUTH_REVOCATION_ENABLED | Enable token revocation endpoint | true | MCP Server (frontend) |
The MCP server implements a three-tier permission system when OAuth authentication is enabled (ENABLE_AUTH=true
):
Scope | Permissions | Description |
---|---|---|
read | View schemas, subjects, configurations | Basic read-only access to all schema information |
write | Register schemas, update configs (includes read ) | Schema modification and configuration management |
admin | Delete subjects, manage registries (includes write + read ) | Full administrative access |
All MCP tools are protected by scopes:
read
) — View/Export/Status Operationslist_registries
, get_registry_info
, test_registry_connection
, test_all_registries
compare_registries
, compare_contexts_across_registries
, find_missing_schemas
get_schema
, get_schema_versions
, list_subjects
, check_compatibility
get_global_config
, get_subject_config
get_mode
, get_subject_mode
list_contexts
export_schema
, export_subject
, export_context
, export_global
list_migrations
, get_migration_status
count_contexts
, count_schemas
, count_schema_versions
, get_registry_statistics
get_task_status
, get_task_progress
, list_active_tasks
, list_statistics_tasks
, get_statistics_task_progress
get_default_registry
, check_readonly_mode
, get_oauth_scopes_info
, get_operation_info_tool
write
) — Modification Operationsregister_schema
update_global_config
, update_subject_config
update_mode
, update_subject_mode
create_context
admin
) — Administrative/Cleanup Operationsdelete_context
, delete_subject
migrate_schema
, migrate_context
clear_context_batch
, clear_multiple_contexts_batch
set_default_registry
, cancel_task
Note: The
get_oauth_scopes_info
tool will show the enforced required scopes for every tool, as defined in the code. Use it to audit or discover permissions for any operation.
For development and testing, you can use special development tokens:
# Format: dev-token-{scopes} export OAUTH_TOKEN="dev-token-read,write,admin" # Full access export OAUTH_TOKEN="dev-token-read" # Read-only access export OAUTH_TOKEN="dev-token-write" # Read + Write access
export ENABLE_AUTH=true export AUTH_ISSUER_URL="https://dev-auth.example.com" export AUTH_VALID_SCOPES="read,write,admin" export AUTH_DEFAULT_SCOPES="read" export AUTH_REQUIRED_SCOPES="read"
export ENABLE_AUTH=true export AUTH_ISSUER_URL="https://prod-auth.example.com" export AUTH_VALID_SCOPES="read,write" export AUTH_DEFAULT_SCOPES="read" export AUTH_REQUIRED_SCOPES="read,write"
export ENABLE_AUTH=true export AUTH_ISSUER_URL="https://auth.example.com" export AUTH_VALID_SCOPES="read" export AUTH_DEFAULT_SCOPES="read" export AUTH_REQUIRED_SCOPES="read"
Use the get_oauth_scopes_info
MCP tool to discover:
Example usage with Claude:
"Show me the OAuth scopes and which tools require which permissions"
"What development tokens can I use for testing?"
"Which tools require admin access?"
The MCP server implements OAuth 2.0 discovery endpoints for seamless MCP client integration:
Endpoint | Purpose | RFC Standard |
---|---|---|
/.well-known/oauth-authorization-server | Authorization server metadata | RFC 8414 |
/.well-known/oauth-protected-resource | Protected resource metadata | RFC 8692 |
/.well-known/jwks.json | JSON Web Key Set for token validation | RFC 7517 |
Use the built-in MCP tool to validate discovery endpoints:
# Test all discovery endpoints curl -X POST http://localhost:8000/mcp \ -H "Content-Type: application/json" \ -d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "test_oauth_discovery_endpoints", "arguments": {"server_url": "http://localhost:8000"}}}'
Claude Desktop Usage:
"Test the OAuth discovery endpoints"
"Check if my server is properly configured for MCP client discovery"
Authorization Server Metadata (/.well-known/oauth-authorization-server
):
{ "issuer": "https://login.microsoftonline.com/TENANT_ID/v2.0", "authorization_endpoint": "https://login.microsoftonline.com/TENANT_ID/oauth2/v2.0/authorize", "token_endpoint": "https://login.microsoftonline.com/TENANT_ID/oauth2/v2.0/token", "jwks_uri": "https://login.microsoftonline.com/TENANT_ID/discovery/v2.0/keys", "scopes_supported": ["read", "write", "admin", "openid", "email", "profile"], "mcp_server_version": "2.0.0", "mcp_transport": "streamable-http", "mcp_endpoints": { "mcp": "https://your-server.com/mcp", "health": "https://your-server.com/health", "metrics": "https://your-server.com/metrics" } }
Protected Resource Metadata (/.well-known/oauth-protected-resource
):
{ "resource": "https://your-server.com", "authorization_servers": ["https://login.microsoftonline.com/TENANT_ID/v2.0"], "scopes_supported": ["read", "write", "admin"], "scope_descriptions": { "read": "Can view schemas, subjects, configurations", "write": "Can register schemas, update configs (includes read permissions)", "admin": "Can delete subjects, manage registries (includes write and read permissions)" }, "mcp_server_info": { "name": "Kafka Schema Registry MCP Server", "version": "2.0.0", "transport": "streamable-http", "tools_count": 48, "supported_registries": ["confluent", "apicurio", "hortonworks"] } }
PKCE (Proof Key for Code Exchange) is mandatory according to the MCP authorization specification.
All MCP clients MUST implement PKCE with SHA256 (S256
) code challenge method:
BASE64URL(SHA256(code_verifier))
code_challenge
and code_challenge_method=S256
code_verifier
when exchanging authorization codeServer-Side Validation Example:
def validate_pkce(code_verifier, stored_challenge): calculated = base64.urlsafe_b64encode( hashlib.sha256(code_verifier.encode()).digest() ).rstrip(b'=').decode() return calculated == stored_challenge
Discovery Response Indicates PKCE is Required:
{ "code_challenge_methods_supported": ["S256"], "require_pkce": true, "pkce_note": "PKCE (Proof Key for Code Exchange) is mandatory for all authorization flows" }
⚠️ Critical: MCP clients will fail silently if PKCE is not properly implemented. The discovery endpoints ensure clients can detect PKCE requirements automatically.
💡 Note: Discovery endpoints return 404 when OAuth is disabled (
ENABLE_AUTH=false
), which is the expected behavior for MCP clients.
dev-token-*
formats in development environmentsThe MCP server implements strict URL validation to prevent Server-Side Request Forgery (SSRF) attacks:
http
and https
protocols are permittedlocalhost
, 127.0.0.1
, 0.0.0.0
) are blocked in production10.x.x.x
, 172.16.x.x
, 192.168.x.x
) are blocked in productionFor development and testing environments, localhost URLs can be allowed by setting one of:
TESTING=true
- Enable test modeALLOW_LOCALHOST=true
- Explicitly allow localhost URLsCI=true
- For CI/CD pipelinesExample:
# Development with localhost Schema Registry export ALLOW_LOCALHOST=true export SCHEMA_REGISTRY_URL="http://localhost:8081" # Production (localhost blocked by default) export SCHEMA_REGISTRY_URL="https://schema-registry.example.com:8081"
If an invalid or unsafe URL is configured:
"Invalid or unsafe registry URL"
The project includes automated security scanning via GitHub Actions, with documented handling of security exceptions:
Some vulnerabilities may be marked as "will_not_fix" by upstream maintainers when they:
Documented Exceptions:
.trivyignore
with detailed rationaleCurrent Exceptions:
CVE-2023-45853
(zlib): Integer overflow in zipOpenNewFileInZip4_6 function
# Disable VEX notices (already documented) export TRIVY_DISABLE_VEX_NOTICE=true
The security scan workflow continues to monitor for new vulnerabilities while allowing documented exceptions to avoid false positives in CI/CD pipelines.
The project includes a unified, comprehensive test suite with automatic environment management.
# Run complete test suite with automatic environment management cd tests/ ./run_all_tests.sh # Or run essential tests only (faster) ./run_all_tests.sh --quick # Keep environment running for debugging ./run_all_tests.sh --no-cleanup # Show all available options ./run_all_tests.sh --help
# Start unified environment (supports both single and multi-registry tests) cd tests/ ./start_test_environment.sh multi # Run individual tests python3 test_basic_server.py python3 test_multi_registry_mcp.py # Stop environment ./stop_test_environment.sh clean
# Start only DEV registry (single-registry tests) ./start_test_environment.sh dev # Start full environment (multi-registry tests) ./start_test_environment.sh multi # Start with UI monitoring ./start_test_environment.sh ui
Production-ready with pre-built DockerHub images and comprehensive deployment options:
# Quick production start with pre-built images docker-compose up -d # Or direct Docker usage with stable tag docker run -d -p 38000:8000 aywengo/kafka-schema-reg-mcp:stable # Or with latest tag docker run -d -p 38000:8000 aywengo/kafka-schema-reg-mcp:latest
📖 Complete Guide: Deployment Guide - Docker Compose, Kubernetes, cloud platforms, monitoring, CI/CD
Quick local development setup:
# Local Python development python -m venv .venv && source .venv/bin/activate pip install -r requirements.txt && python mcp_server.py # Docker development mv docker-compose.override.yml docker-compose.override.yml.bak docker-compose build --no-cache mcp-server && docker-compose up -d
📖 Development Guide: Deployment Guide - Development
Comprehensive documentation covering all aspects:
Guide | Purpose |
---|---|
API Reference | Complete endpoint documentation with examples |
Use Cases | Real-world scenarios and implementation patterns |
IDE Integration | VS Code, Claude Code, and Cursor setup guides |
Deployment Guide | Docker, Kubernetes, cloud platforms, CI/CD |
📖 Setup Instructions: IDE Integration Guide
Integrates with Confluent Schema Registry supporting multiple formats (Avro, JSON, Protobuf), schema evolution, and context-based namespace management.
📖 Integration Details: Use Cases - Schema Registry Integration
ENABLE_AUTH=true
and configure via environment variables:
AUTH_ISSUER_URL
, AUTH_VALID_SCOPES
, AUTH_DEFAULT_SCOPES
, AUTH_REQUIRED_SCOPES
, AUTH_CLIENT_REG_ENABLED
, AUTH_REVOCATION_ENABLED
mcp[cli]==1.9.2
with full authorization support.count_contexts
: Track context distributioncount_schemas
: Monitor schema growthcount_schema_versions
: Track schema evolutionget_registry_statistics
: Comprehensive registry analytics
📖 DetailsVariable | Description | Default |
---|---|---|
ENABLE_AUTH | Enable OAuth2 authentication/authorization | false |
AUTH_ISSUER_URL | OAuth2 issuer URL | https://example.com |
AUTH_VALID_SCOPES | Comma-separated list of valid scopes | myscope |
AUTH_DEFAULT_SCOPES | Comma-separated list of default scopes | myscope |
AUTH_REQUIRED_SCOPES | Comma-separated list of required scopes | myscope |
AUTH_CLIENT_REG_ENABLED | Enable dynamic client registration | true |
AUTH_REVOCATION_ENABLED | Enable token revocation endpoint | true |
Example usage:
export ENABLE_AUTH=true export AUTH_ISSUER_URL="https://auth.example.com" export AUTH_VALID_SCOPES="myscope,otherscope" export AUTH_DEFAULT_SCOPES="myscope" export AUTH_REQUIRED_SCOPES="myscope" export AUTH_CLIENT_REG_ENABLED=true export AUTH_REVOCATION_ENABLED=true
ENABLE_AUTH
is not set or is false, the server runs with no authentication (backward compatible).✅ COMPLETE TRANSFORMATION SUCCESS: Successfully converted from REST API to true MCP protocol server compatible with Claude Desktop and other MCP clients.
🤖 MCP Features Verified:
🔧 Claude Desktop Integration:
"List all schema contexts"
"Register a new user schema with fields for id, name, and email"
"Export all schemas from the production context in Avro IDL format"
"Check if my updated schema is compatible with the latest version"
🧪 Testing Results: All advanced features tested and working with live Schema Registry including context isolation, schema registration, compatibility checking, configuration management, and export functionality.
📈 Evolution: v1.3.0 (True MCP) → v1.2.0 (Configuration) → v1.1.0 (Contexts) → v1.0.0 (REST API)