Labsco
kemdi-pl logo

kemdiCode MCP

β˜… 2

from kemdi-pl

kemdiCode MCP is a Model Context Protocol server that gives AI agents and IDE assistants access to 124 specialized tools for code analysis, generation, git operations, file management, AST-aware editing, project memory, cognition & self-improvement, multi-board kanban, and multi-agent coordination.

πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedAccount requiredAdvanced setup
<p align="center"> <img src="kemdi-code-mcp.png" alt="kemdiCode MCP" /> </p> <h3 align="center">Persistent Cognition, Cluster Bus & Magistrale, Parallel Multi-Agent Orchestration with Live Monitoring for AI Coding Assistants</h3> <p align="center"> <a href="https://www.npmjs.com/package/kemdicode-mcp"><img src="https://img.shields.io/badge/npm-kemdicode--mcp-CB3837?style=flat-square&logo=npm&logoColor=white" alt="npm" /></a> <a href="https://github.com/kemdi-pl/kemdicode-mcp/releases"><img src="https://img.shields.io/badge/version-4.9.0-blue?style=flat-square" alt="Version" /></a> <a href="LICENSE"><img src="https://img.shields.io/badge/license-GPL--3.0-green?style=flat-square" alt="License" /></a> </p> <p align="center"> <a href="https://bun.sh"><img src="https://img.shields.io/badge/Bun-%E2%89%A51.0-f9f1e1?style=flat-square&logo=bun&logoColor=f9f1e1&labelColor=14151a" alt="Bun" /></a> <a href="https://www.typescriptlang.org"><img src="https://img.shields.io/badge/TypeScript-5.x-3178C6?style=flat-square&logo=typescript&logoColor=white" alt="TypeScript" /></a> <a href="https://redis.io"><img src="https://img.shields.io/badge/Redis-7.x-DC382D?style=flat-square&logo=redis&logoColor=white" alt="Redis" /></a> <a href="https://modelcontextprotocol.io"><img src="https://img.shields.io/badge/MCP-Protocol-6B4FBB?style=flat-square" alt="MCP" /></a> <a href="https://zod.dev"><img src="https://img.shields.io/badge/Zod-4.x-3E67B1?style=flat-square&logo=zod&logoColor=white" alt="Zod" /></a> </p>

kemdiCode MCP is a Model Context Protocol server that extends AI coding assistants with persistent cognition, multi-agent orchestration, distributed cluster communication, and context compaction. 63 tools across 15 categories, backed by Redis for cross-session state and 8 LLM providers for embedded AI execution.

Lorenz-inspired compaction pipeline β€” Phase Detection via PoincarΓ© sections, Orbit Compression via attractor cycle deduplication, and CTC perturbation impact scoring β€” maintains reasoning continuity across context window boundaries.

Cluster Bus & Magistrale β€” two-layer bus (ClusterBus L3 for inter-cluster Redis Pub/Sub, GlobalEventBus L1 for in-process events) with 18 signal types, MetaRouter tag-based routing, anti-amplification bridges, and LLM Magistrale for distributed prompt execution across clusters (4 strategies: first-wins, best-of-n, consensus, fallback-chain).

The Nine Minds β€” nine specialized cognitive agents (Socratic, Ontologist, Seed Architect, Evaluator, Contrarian, Hacker, Simplifier, Researcher, Architect), each a different mode of thinking. Inspired by Ouroboros by Harry Munro. Loaded on-demand, never preloaded.

741 tests across 33 test files. Works with Claude Code, Cursor, Windsurf, VS Code, Zed, and any MCP-compatible client.


Tool Reference

63 tools across 15 categories. Consolidated tools use an action parameter (e.g., task action=create|get|list|update|delete).

CategoryTools
Core AIask-ai plan build brainstorm batch pipeline
Code Intelligencefind-definition find-references semantic-search
Multi-LLMmulti-prompt consensus-prompt enhance-prompt mind-chain
Cognitiondecision-journal confidence-tracker mental-model intent-tracker error-pattern self-critique smart-handoff context-budget
Agentsagent agent-comm monitor
Contextshared-thoughts get-shared-context feedback
Kanbantask task-multi board workspace
Memorymemory checkpoint
Recursiveinvoke-tool invoke-batch invocation-log agent-orchestrate
Sessionsession
Thinkingthinking-chain
Knowledge Graphgraph-query graph-find-path loci-recall sequence-recommend
Cluster Buscluster-bus-status cluster-bus-topology cluster-bus-send cluster-bus-magistrale cluster-bus-flow cluster-bus-routing cluster-bus-inspect cluster-bus-file-read audit-scheduler
MCP Clientclient-sampling client-elicit client-roots
Systemenv-info memory-usage ai-config ai-models tool-health config ping help

Architecture

Event Bus (2-Layer)

Copy & paste β€” that's it
L3  ClusterBus     Redis Pub/Sub cross-process signaling
                   18 signal types, 4 send modes (unicast/broadcast/routed/multicast)
                   HMAC auth, bloom filter dedup, backpressure, circuit breaker
    ----bridges--> hop limit 5, source prefix guard
L1  GlobalEventBus In-process async events, namespaced, max chain depth 8
                   Redis bridge for cross-session propagation

Lorenz Context Compaction

Three algorithms for maintaining reasoning continuity across compaction boundaries:

  1. Phase Detection β€” Poincare section analysis. Consecutive Jensen-Shannon divergence identifies topic transitions. Phase boundaries carry maximum information about the reasoning trajectory.

  2. Orbit Compression β€” Lorenz attractor cycle detection. NxN TF-IDF cosine similarity matrix with greedy cycle search (length 2-10, min 2 repetitions). Retains first cycle, prunes duplicates.

  3. Perturbation Impact β€” JSD(full_context, context_without_item) quantifies each item's contribution. High-impact items are causal anchors that survive compaction.

The Nine Minds

Nine specialized cognitive agents, each a different mode of thinking. Inspired by Ouroboros by Harry Munro:

MindModeCore Question
socraticInterrogative"What are you assuming?"
ontologistClassificatory"What IS this, really?"
seed-architectCrystallizing"Is this complete and unambiguous?"
evaluatorVerificatory"Did we build the right thing?"
contrarianAdversarial"What if the opposite were true?"
hackerLateral"What constraints are actually real?"
simplifierReductive"What's the simplest thing that could work?"
researcherEvidential"What evidence do we actually have?"
architectStructural"If we started over, would we build it this way?"

Use any Mind as the agent parameter: ask-ai --agent socratic --prompt "...". Compose them for multi-perspective analysis: Socratic β†’ Ontologist β†’ Seed Architect (dialectical progression).

Agentic Loop

Autonomous agent execution with sub-agent spawning (max depth 2, global budget 10), file context injection via @path syntax, and full orchestration ID traceability.

Parallel Agents β€” Launch 2-10 agents in parallel via agent-orchestrate --parallel. Each gets a unique orchestrationId, tracked in real-time via Redis and in-memory cache. Results aggregated via Promise.allSettled.

Live Monitoring β€” Query orchestration status while agents run (MCP blocks during tool calls, so use HTTP):

Copy & paste β€” that's it
# List all active orchestrations
curl http://localhost:3100/orchestrations

# Get specific orchestration status
curl http://localhost:3100/orchestrations/<id>

# Or via MCP tool (when not blocked)
monitor --view orchestrations

Orchestration ID Traceability β€” Every agentic loop gets a UUID. Sub-agents reference parent via parentOrchestrationId. All cognition records (decisions, confidence, intents, errors, critiques, handoffs) carry orchestrationId for full traceability across nested agent hierarchies.

Tool Access β€” All kemdiCode tools are available to agents by default (read-only, kanban, thinking chains β€” no shell/file-write). Use allowedTools or blockedTools to customize per-agent.

Concurrency Model

  • Per-session isolation via AsyncLocalStorage (propagates through async chains)
  • Redis transactions for task state mutations (MULTI/EXEC, Lua scripts)
  • Distributed locks with SET NX PX, Lua CAS release, 3-retry backoff

Development

Copy & paste β€” that's it
bun install                    # Install dependencies
bun run build                  # Compile TypeScript
bun run dev                    # Hot reload
bun run test                   # Run 741 tests
bun run typecheck              # Type check
bun run lint                   # ESLint
bun run format                 # Prettier

Adding Tools

  1. Create file in src/tools/<category>/
  2. Define Zod schema with .describe() per field
  3. Implement UnifiedTool interface
  4. Register via registerLazyTool() in src/tools/index.ts
  5. Add annotation in src/tools/annotations-map.ts

Documentation


License

GNU General Public License v3.0

Author

Dawid Irzyk β€” dawid@kemdi.pl β€” Kemdi Sp. z o.o.