# Kafka Schema Registry MCP - Quick Reference Card
**Version:** 2.1.5 | **Date:** 2026-01-17
---
## π INSTANT START
```bash
# Navigate to project directory
cd /path/to/kafka-schema-reg-mcp
source .venv/bin/activate
./scripts/quick-lint-check.sh
```
---
## π PROJECT STRUCTURE
```
kafka-schema-reg-mcp/
βββ .claude-code/ β Claude Code integration
β βββ config.json Project configuration
β βββ workspace.json Workspace settings
β βββ README.md Usage guide
β βββ templates/ 4 schema templates
β βββ event-schema.json
β βββ entity-schema.json
β βββ command-schema.json
β βββ aggregate-schema.json
βββ GETTING_STARTED.md β Start here!
βββ SETUP_SUMMARY.md Setup documentation
βββ AGENTS.md Development guidelines
βββ tests/ Test suite (80+ tests)
βββ scripts/ Lint checking scripts
βββ docs/ Documentation (30+ guides)
βββ *.py (24 modules) Source code
```
---
## π§ ESSENTIAL COMMANDS
### Linting (Pre-Commit)
```bash
# Quick check (2-3s) - Run FREQUENTLY
./scripts/quick-lint-check.sh
# Auto-fix formatting (20-30s) - Before commit
./scripts/check-lint-issues.sh --fix
# CI mirror check (10-15s) - Before push
./scripts/ci-lint-check.sh
```
### Testing
```bash
# Quick tests (2-5 min) - Essential tests only
cd tests && ./run_all_tests.sh --quick
# Full test suite (10-15 min) - Comprehensive
cd tests && ./run_all_tests.sh
# Keep environment running - For debugging
cd tests && ./run_all_tests.sh --no-cleanup
```
### Git Workflow
```bash
git status # Check current state
git add . # Stage all changes
git commit -m "feat: description" # Commit with conventional format
git log -1 # View last commit
git push origin your-branch-name # Push to remote
```
---
## π€ AI ASSISTANCE (Claude Code)
### Schema Generation
```
"Generate a user registration event with fields:
- userId (required, string)
- email (required, string)
- registrationMethod (enum: EMAIL, GOOGLE, FACEBOOK)"
```
### Schema Evolution
```
"Evolve the user-profile schema to add:
- phoneNumber (optional, string with default)
- preferences (record with notification settings)
While maintaining backward compatibility"
```
### Compatibility Checking
```
"Check if adding a required field to order-events schema
is compatible with existing production version"
```
### Migration Planning
```
"Plan migration from development to staging:
- Analyze all user-* schemas
- Check compatibility
- Generate migration sequence
- Provide rollback strategy"
```
---
## π SCHEMA TEMPLATES
### View Templates
```bash
ls .claude-code/templates/
cat .claude-code/templates/event-schema.json
cat .claude-code/templates/entity-schema.json
cat .claude-code/templates/command-schema.json
cat .claude-code/templates/aggregate-schema.json
```
### Event Schema Template
**Use Case:** Domain events (UserRegistered, OrderPlaced, PaymentProcessed)
**Standard Fields:**
- `eventId` (UUID) - Unique identifier
- `eventType` (string) - Event type for routing
- `timestamp` (long) - Unix milliseconds
- `version` (string) - Schema version
- `source` (record) - Service, instance
- `data` (custom) - Event payload
- `metadata` (map) - Extensibility
**AI Prompt Example:**
```
"Generate OrderPlaced event using event template with:
- orderId, customerId, items array, totalAmount"
```
### Entity Schema Template
**Use Case:** Business entities (User, Product, Order)
**Standard Fields:**
- `id` (UUID) - Entity identifier
- `version` (long) - Optimistic locking
- `createdAt`, `updatedAt` (long) - Timestamps
- `createdBy`, `updatedBy` (string) - Audit
- `status` (enum) - Lifecycle status
- `attributes` (custom) - Business data
- `tags` (array) - Categorization
**AI Prompt Example:**
```
"Generate Product entity using entity template with:
- sku, name, description, price, category"
```
### Command Schema Template
**Use Case:** CQRS commands (CreateOrder, UpdateUser, DeleteProduct)
**Standard Fields:**
- `commandId` (UUID) - Command identifier
- `commandType` (string) - Command routing
- `timestamp` (long) - Issued time
- `issuedBy` (record) - User/service info
- `targetEntityId` (string) - Target entity
- `expectedVersion` (long) - Optimistic lock
- `payload` (custom) - Command data
- `metadata` (map) - Optional metadata
**AI Prompt Example:**
```
"Generate UpdateInventory command using command template with:
- productId, quantityChange, warehouseId"
```
### Aggregate Schema Template
**Use Case:** DDD aggregates (OrderAggregate, UserAggregate)
**Standard Fields:**
- `aggregateId` (UUID) - Aggregate identifier
- `aggregateType` (string) - Type identifier
- `version` (long) - Event sourcing version
- `createdAt`, `updatedAt` (long) - Timestamps
- `state` (enum) - Lifecycle state
- `snapshot` (custom) - Current state
- `lastEventId` (string) - Last applied event
- `eventCount` (long) - Total events
- `entities` (array) - Child entities
- `metadata` (map) - Optional metadata
**AI Prompt Example:**
```
"Generate ShoppingCart aggregate using aggregate template with:
- cart items, customer info, totals calculation"
```
---
## β‘ CLAUDE CODE SHORTCUTS
| Shortcut | Description | Example |
|----------|-------------|---------|
| `schema:analyze` | Analyze schema structure | "Analyze user-events schema" |
| `schema:generate` | Generate from description | "Generate order schema" |
| `schema:evolve` | Evolve with compatibility | "Add field to user schema" |
| `migration:plan` | Plan context migration | "Migrate dev to staging" |
| `migration:execute` | Execute migration | "Run migration with monitoring" |
| `export:smart` | Optimal export strategy | "Export production schemas" |
| `docs:generate` | Generate documentation | "Document all schemas" |
| `lint:check` | Quick lint check | "Check code quality" |
| `lint:fix` | Auto-fix formatting | "Fix all lint issues" |
| `test:quick` | Quick test suite | "Run essential tests" |
| `test:full` | Full test suite | "Run all tests" |
---
## π³ DOCKER & TEST ENVIRONMENT
### Docker Commands
```bash
docker ps # List running containers
docker-compose logs -f # View logs
docker-compose ps # Check service status
docker-compose down # Stop all services
```
### Test Environment Management
```bash
./tests/start_test_environment.sh # Start test environment
./tests/stop_test_environment.sh # Stop test environment
./tests/start_test_environment.sh dev # DEV only
./tests/start_test_environment.sh multi # Full multi-registry
./tests/start_test_environment.sh ui # With AKHQ UI
```
### Test Environment URLs
| Service | URL | Purpose |
|---------|-----|---------|
| DEV Registry | http://localhost:38081 | Development schemas |
| PROD Registry | http://localhost:38082 | Production schemas |
| AKHQ UI | http://localhost:38080 | Web UI for management |
| MCP Server | http://localhost:38000 | MCP API endpoint |
### Quick Test Queries
```bash
# List subjects in DEV
curl http://localhost:38081/subjects
# List subjects in PROD
curl http://localhost:38082/subjects
# Get schema
curl http://localhost:38081/subjects/user-value/versions/latest
# Check MCP server health
curl http://localhost:38000/
```
---
## π DOCUMENTATION GUIDE
### Start Here
```bash
cat GETTING_STARTED.md # Comprehensive contributor guide (900 lines)
```
**Sections:**
1. Prerequisites & system requirements
2. Quick setup (5-step process)
3. Development workflow
4. Running tests (with Docker)
5. Code quality & linting
6. Making changes & commits
7. Submitting pull requests
8. Common tasks & examples
9. Troubleshooting guide
10. Resources & help
### Development Guidelines
```bash
cat AGENTS.md # Development rules (200 lines)
```
**Key Topics:**
- Pre-commit checklist
- Lint script comparison
- Project configuration
- Common fixes
- Testing requirements
### Claude Code Features
```bash
cat .claude-code/README.md # Claude Code guide (200 lines)
```
**Covers:**
- Quick start
- AI-enhanced workflows
- Shortcuts reference
- Development contexts
- Linting configuration
- Testing requirements
### Setup Documentation
```bash
cat SETUP_SUMMARY.md # Setup summary (400 lines)
```
**Includes:**
- What was accomplished
- Files created
- Verification checklist
- Quick commands
- Next steps
### Project Overview
```bash
cat README.md # Main documentation
```
**Main Topics:**
- Features overview
- Installation methods
- Configuration examples
- API reference
- Use cases
---
## π GIT CONVENTIONS
### Commit Message Format
```
<type>(<scope>): <description>
[optional body]
[optional footer]
```
### Commit Types
| Type | Purpose | Example |
|------|---------|---------|
| `feat` | New feature | `feat: add schema migration rollback` |
| `fix` | Bug fix | `fix: resolve compatibility check error` |
| `docs` | Documentation | `docs: update API reference` |
| `test` | Tests | `test: add integration tests for migration` |
| `chore` | Maintenance | `chore: update dependencies` |
| `refactor` | Code refactor | `refactor: simplify schema validation` |
| `perf` | Performance | `perf: optimize schema lookup` |
| `style` | Formatting | `style: apply black formatting` |
### Branch Naming
```
feature/descriptive-name # New features
fix/issue-description # Bug fixes
docs/what-changed # Documentation updates
test/what-testing # Test additions
```
---
## π οΈ TROUBLESHOOTING
### Import Errors
**Problem:** `ModuleNotFoundError` or import failures
**Solution:**
```bash
source .venv/bin/activate
pip install -r requirements.txt
export PYTHONPATH="${PYTHONPATH}:$(pwd)"
```
### Lint Check Failures
**Problem:** Formatting or style errors
**Solution:**
```bash
# Auto-fix most issues
./scripts/check-lint-issues.sh --fix
# Check what changed
git diff
# Manual fixes if needed
black *.py tests/*.py
isort *.py tests/*.py
```
### Test Failures
**Problem:** Tests failing or not starting
**Solution:**
```bash
# Check Docker is running
docker ps
# Check ports are available
lsof -i :38080
lsof -i :38081
lsof -i :38082
# Restart Docker Desktop
# Clean up Docker
docker-compose down -v
docker system prune -f
# Restart test environment
cd tests
./stop_test_environment.sh
./start_test_environment.sh
# Run tests with verbose output
./run_all_tests.sh --quick --verbose
```
### Port Already in Use
**Problem:** Cannot start services, port conflict
**Solution:**
```bash
# Find process using port
lsof -i :38080
# Kill process
kill -9 <PID>
# Or use different port
export MCP_SERVER_PORT=39000
```
### Docker Container Issues
**Problem:** Containers not starting or unhealthy
**Solution:**
```bash
# Check container status
docker-compose ps
# View container logs
docker-compose logs mcp-server
docker-compose logs schema-registry-dev
# Restart specific service
docker-compose restart mcp-server
# Full restart
docker-compose down
docker-compose up -d
```
### Virtual Environment Issues
**Problem:** Wrong Python version or missing packages
**Solution:**
```bash
# Deactivate current environment
deactivate
# Remove old environment
rm -rf .venv
# Create fresh environment
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
```
---
## β
PRE-COMMIT CHECKLIST
Before committing:
- [ ] Virtual environment activated (`source .venv/bin/activate`)
- [ ] Code changes complete and tested locally
- [ ] Quick lint check passes (`./scripts/quick-lint-check.sh`)
- [ ] Auto-fix applied if needed (`./scripts/check-lint-issues.sh --fix`)
- [ ] Changes reviewed (`git diff`)
- [ ] Commit message follows conventional format
- [ ] No sensitive data in commit (API keys, passwords)
---
## β
PRE-PUSH CHECKLIST
Before pushing to remote:
- [ ] All commits have proper messages
- [ ] CI lint check passes (`./scripts/ci-lint-check.sh`)
- [ ] Quick tests pass (`cd tests && ./run_all_tests.sh --quick`)
- [ ] No merge conflicts with main
- [ ] Branch is up to date with main
- [ ] Commit history is clean (`git log --oneline`)
---
## π PROJECT STATISTICS
| Metric | Value |
|--------|-------|
| **Version** | 2.1.5 |
| **Branch** | Current working branch |
| **Python** | 3.10.0 |
| **Tests** | 35/35 passed (100%) |
| **Files Created** | 9 new files |
| **Lines Added** | 1,628 |
| **Setup Time** | ~5 minutes |
| **Test Duration** | 70 seconds |
| **Success Rate** | 100% β
|
---
## π― DEVELOPMENT WORKFLOWS
### Daily Development
```bash
# 1. Start your day
# Navigate to project directory
cd /path/to/kafka-schema-reg-mcp
source .venv/bin/activate
# 2. Pull latest changes (if working with team)
git pull origin main
# 3. Make your changes
vim kafka_schema_registry_unified_mcp.py
# 4. Check code quality frequently
./scripts/quick-lint-check.sh
# 5. Before commit
./scripts/check-lint-issues.sh --fix
git diff
# 6. Commit
git add .
git commit -m "feat: add new feature"
# 7. Before push
./scripts/ci-lint-check.sh
cd tests && ./run_all_tests.sh --quick
# 8. Push
git push origin your-branch-name
```
### Creating New Schema
```bash
# 1. Choose template
cat .claude-code/templates/event-schema.json
# 2. Use AI to generate
# "Generate OrderCreated event with orderId, customerId, items, total"
# 3. Validate schema
# Save to file: schemas/order-created.avsc
# 4. Register schema
curl -X POST http://localhost:38000/schemas \
-H 'Content-Type: application/json' \
-d @schemas/order-created.avsc
# 5. Verify
curl http://localhost:38081/subjects
```
### Schema Migration
```bash
# 1. Plan migration with AI
# "Plan migration of user-events from dev to staging"
# 2. Review migration plan
# 3. Dry run
curl -X POST http://localhost:38000/migrate/schema \
-d '{"subject": "user-events", "source_context": "development",
"target_context": "staging", "dry_run": true}'
# 4. Execute migration
curl -X POST http://localhost:38000/migrate/schema \
-d '{"subject": "user-events", "source_context": "development",
"target_context": "staging", "dry_run": false}'
# 5. Verify
curl http://localhost:38082/subjects/user-events/versions/latest
```
### Running Comprehensive Tests
```bash
# 1. Start fresh environment
cd tests
./stop_test_environment.sh
./start_test_environment.sh
# 2. Run specific test categories
./run_comprehensive_tests.sh --category basic_unified_server
./run_comprehensive_tests.sh --category essential_integration
./run_comprehensive_tests.sh --category multi_registry_core
# 3. Run all tests
./run_all_tests.sh
# 4. Review results
cat results/final_summary_*.txt
# 5. Cleanup
./stop_test_environment.sh
```
---
## π‘ PRO TIPS
### Code Quality
- β
Run `quick-lint-check.sh` **frequently** while coding
- β
Use `--fix` flag to **auto-format** before committing
- β
Review diffs **before committing** (`git diff`)
- β
Never modify `pyproject.toml` lint configurations
- β
Fix critical errors (E9, F63, F7, F82) **immediately**
### Testing
- β
Use `--quick` flag for **rapid feedback** (2-5 min)
- β
Use `--no-cleanup` to **debug** test failures
- β
Check Docker is **running** before tests
- β
Verify **ports available** (38080-38082, 9092, 39093)
- β
Allocate **4GB+ RAM** to Docker Desktop
### Git Workflow
- β
Write **clear** commit messages (conventional format)
- β
Keep commits **focused** (one logical change per commit)
- β
Review **history** before pushing (`git log --oneline`)
- β
Run **CI check** before pushing (`./scripts/ci-lint-check.sh`)
- β
Rebase on main **regularly** to avoid conflicts
### AI Assistance
- β
Use **templates** for consistent schema design
- β
Provide **context** in AI prompts (domain, requirements)
- β
Review **AI-generated** schemas before registering
- β
Test **compatibility** after schema evolution
- β
Generate **documentation** for all schemas
### Performance
- β
Use **virtual environment** (avoid global packages)
- β
Run **quick-lint-check** (2-3s) not comprehensive (20-30s)
- β
Run **quick tests** (2-5 min) not full suite (10-15 min)
- β
Use **parallel** tool calls when possible
- β
Cache **dependencies** (don't reinstall unnecessarily)
---
## π HELP & RESOURCES
### Documentation
| Resource | Command | Purpose |
|----------|---------|---------|
| **Getting Started** | `cat GETTING_STARTED.md` | Comprehensive guide |
| **Dev Guidelines** | `cat AGENTS.md` | Development rules |
| **Claude Code** | `cat .claude-code/README.md` | AI features |
| **Setup Summary** | `cat SETUP_SUMMARY.md` | Setup docs |
| **Testing Guide** | `cat TESTING_SETUP_GUIDE.md` | Testing details |
| **API Reference** | `cat docs/api-reference.md` | API documentation |
### Scripts
| Script | Speed | Purpose |
|--------|-------|---------|
| `quick-lint-check.sh` | ~2-3s | Pre-commit hook |
| `ci-lint-check.sh` | ~10-15s | Before pushing |
| `check-lint-issues.sh` | ~20-30s | Comprehensive check |
### Links
- **GitHub Repo:** https://github.com/aywengo/kafka-schema-reg-mcp
- **GitHub Issues:** https://github.com/aywengo/kafka-schema-reg-mcp/issues
- **Docker Hub:** https://hub.docker.com/r/aywengo/kafka-schema-reg-mcp
- **MCP Catalog:** Glama.ai MCP Registry
### Getting Help
1. Check **GETTING_STARTED.md** (comprehensive troubleshooting)
2. Review **AGENTS.md** (development guidelines)
3. Search **GitHub Issues** (common problems)
4. Open **new issue** (provide details, logs, steps)
5. Ask in **repository discussions**
---
## π SUCCESS! YOU'RE READY!
Your development environment is **fully configured** and **verified**:
- β
Python 3.10.0 with virtual environment
- β
All dependencies installed
- β
Linting tools configured
- β
Docker environment tested
- β
Tests passing (35/35 - 100%)
- β
Claude Code integration ready
- β
Schema templates available
- β
Documentation complete
### Next Steps
1. **Read** `GETTING_STARTED.md` for detailed workflow
2. **Explore** `.claude-code/templates/` for schema patterns
3. **Try** AI-assisted schema generation
4. **Run** tests to familiarize yourself
5. **Start** contributing!
### Optional: Push Your Setup
```bash
git push origin your-branch-name
```
Then create a PR on GitHub to share this setup with the team!
---
**π Happy Coding!**
**Version:** 2.1.5 | **Updated:** 2026-01-17 | **Status:** Production Ready β