Submit

Kemdicode Mcp

@kemdi-pl

4 months ago
Overview

kemdiCode MCP

Model Context Protocol Server for AI-Powered Development

124 tools • 7 LLM providers • cognition layer • multi-agent orchestration • kanban • project memory

npm Version License

Bun Node.js TypeScript Redis


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.

Table of Contents

What's New in 1.23.1

Cognition Layer — 8 AI Self-Improvement Tools

An AI agent that uses kemdiCode MCP no longer starts from zero after each session. Version 1.23.1 adds 8 interconnected cognition tools that give the agent persistent self-awareness:

ToolWhat it does
decision-journalRecords every architectural choice with reasoning, alternatives considered, and outcome tracking
confidence-trackerTracks how certain the agent is about each action — flags low-confidence calls for human review
mental-modelBuilds persistent maps of system architecture: components, relationships, invariants, file mappings
intent-trackerMaintains a hierarchy of goals (mission → goal → sub-goal → task) and detects when the agent drifts
error-patternCross-session error database — when the agent hits an error, it checks if it has seen this before
self-critiquePost-session reflection: what went well, what went poorly, lessons extracted
smart-handoffStructured handoff reports for session transitions — modeled after medical shift handoffs
context-budgetEstimates context window usage, prioritizes items by relevance, suggests what to evict

Cross-Tool Intelligence

These 8 tools are not siloed. They react to each other through an in-process event bus:

  • Record a decision → confidence record is auto-created and cross-linked
  • Low confidence detected (<50%) → automatic intent drift check
  • Error recorded → recent decisions are scanned and tagged if related
  • Intent drift detected → self-critique entry auto-generated
  • Handoff created → auto-enriched with full cognition snapshot (active intents, recent decisions, recurring errors, lessons learned, stale models)
  • Mental model marked stale → affected decisions and intents flagged
  • Lesson learned → cross-linked to matching error patterns

All backed by a CognitionCrossLinker that maintains bidirectional Redis links between any two cognition records.

Enhanced Tool Actions

  • self-critique → new check-application action: verifies which lessons are actually being applied in recent decisions vs. ignored
  • mental-model → 3 new actions: impact-analysis (BFS from changed files), dependency-chain (forward + backward traversal), invariant-check (find at-risk invariants)
  • smart-handoffcreate auto-appends a Cognition Snapshot section with data from all stores

Previous Releases

1.22.0 — Code Quality Modernization
  • consoleLogger migration across 14 files (~70 call sites)
  • ESLint warnings fixed, version header corrected
1.21.0 — Thinking Chain
  • thinking-chain tool with 7 actions, forward-only constraint, branching, Redis-backed with 7-day TTL
1.20.0 — 14 New Tools + Task Comments
  • git-add, git-commit, git-stash, task-get, task-delete, task-comment, board-delete, workspace-delete, file-delete, file-move, file-copy, file-backup-restore, pipeline, checkpoint-diff
  • Metadata for all tools, auto-sessionId, board/workspace name lookup

Cognition Layer: How AI Remembers

When an AI agent works on your project over multiple sessions, the biggest problem is amnesia. Each new session starts blank. The cognition layer solves this by writing a continuous stream of structured records to Redis as the agent works:

What actually happens during a session

You: "Refactor the auth module to use JWT"

Agent thinks → records intent (mission: refactor auth, goal: implement JWT)
Agent considers options → records decision (chose RS256, rejected HS256, reasoning: key rotation)
Agent starts coding → confidence tracker logs 0.9 for JWT middleware
Agent hits TS error → error-pattern records it, checks DB, finds matching fix from 3 sessions ago
Agent applies fix → confidence stays high
Agent finishes → self-critique: went well (reused error fix), went poorly (forgot to update tests)
Agent creates handoff → auto-enriched with intent hierarchy, decisions, errors, lessons

What happens when a new session starts

New session starts → agent calls smart-handoff:latest

Gets back:
- What the human wanted (intent hierarchy)
- What approach was taken and why (decisions with reasoning)
- What's done, in-progress, blocked (status)
- Known unknowns and warnings
- Lessons from previous sessions (apply these!)
- THE single most important first action

Agent resumes work without asking "where were we?"

Why this matters in practice

Without cognition tools: The agent asks you to re-explain the project every session. It makes the same mistakes twice. It forgets why a decision was made and reverses it. It loses track of what's done.

With cognition tools: The agent picks up exactly where it left off. It checks its error database before trying fixes. It knows which approaches were rejected and why. It applies lessons from past sessions automatically. When it's unsure, it flags the action for human review instead of guessing.

The data lives in Redis with configurable TTL (default 7 days). Nothing is sent to external services. The agent writes its own memories as it works — you don't need to configure anything beyond enabling the tools.


Usage Examples

Using kemdiCode MCP tools from your AI agent prompt

You don't call these tools directly — your AI agent (Claude Code, Cursor, etc.) invokes them when you describe what you need. Here are real prompts and what happens behind the scenes:

Code review before committing:

You: "Review the auth module for security issues"
→ Agent calls: code-review --files "@src/auth/**/*.ts" --focus "security"

Fix a bug with AI assistance:

You: "There's a race condition in the queue processor, find and fix it"
→ Agent calls: fix-bug --description "race condition in queue processor" --files "@src/queue/"

Multi-model comparison for architecture decisions:

You: "Ask 3 models whether we should use event sourcing or CRUD for the order service"
→ Agent calls: consensus-prompt \
    --prompt "Event sourcing vs CRUD for an order management service with 10k orders/day" \
    --boardModels '["o:gpt-5","a:claude-sonnet-4-5","g:gemini-3-pro"]' \
    --ceoModel "a:claude-opus-4-5:4k"

Project memory for persistent context:

You: "Remember that we use JWT with RS256 for auth in this project"
→ Agent calls: write-memory --name "auth-strategy" --content "JWT with RS256, keys in /etc/keys/" --tags '["auth","architecture"]'

You: "What was our auth strategy?"
→ Agent calls: read-memory --name "auth-strategy"

Multi-agent task distribution:

You: "Set up 3 agents: backend, frontend, QA. Backend works on the API, frontend on React components"
→ Agent calls: agent-register → task-create → task-push-multi
→ Agents coordinate via shared-thoughts and queue-message

What's Next

Install from npm

npm install -g kemdicode-mcp

Then add to your AI IDE:

# Claude Code
claude mcp add kemdicode-mcp -- kemdicode-mcp

# Or add to ~/.claude.json / Cursor / KiroCode / RooCode config:
{
  "mcpServers": {
    "kemdicode-mcp": {
      "command": "kemdicode-mcp"
    }
  }
}

Tell the agent what you want — it picks the right tools

kemdiCode MCP works best when you tell the agent to use it. Add a line to your project's CLAUDE.md, .cursorrules, or system prompt:

You have access to kemdiCode MCP server. Use its tools for:
- Project memory (write-memory, read-memory) to persist decisions across sessions
- Cognition tools (decision-journal, smart-handoff) to track your reasoning
- Kanban (task-create, task-list) for project management
- Code analysis (code-review, find-definition) for deep code understanding

Example: Building a landing page

You: "Build a landing page for a SaaS product. Use kemdiCode tools to track progress
     and remember design decisions."

What the agent does:
1. write-memory --name "landing-design" → saves design system choices
2. decision-journal → records "chose Tailwind over CSS modules" with reasoning
3. task-create → creates tasks: hero section, pricing, testimonials, footer
4. code-review → reviews each component for accessibility
5. smart-handoff → creates handoff so next session can continue seamlessly

Example: Building a Flappy Bird clone for Android

You: "Build a Flappy Bird clone in Kotlin for Android. Track architecture decisions
     and use the kanban board."

What the agent does:
1. intent-tracker → sets mission "Flappy Bird Android clone"
2. mental-model → maps architecture: GameView, Bird, Pipe, ScoreManager, GameLoop
3. board-create → creates "Flappy Bird Sprint 1"
4. task-create → physics engine, rendering, collision detection, scoring, sounds
5. decision-journal → records "chose Canvas over OpenGL" (simpler for 2D, faster iteration)
6. error-pattern → when bitmap loading fails, records fix for next time
7. self-critique → "physics feels floaty, adjust gravity constant next session"
8. smart-handoff → full briefing for the next session with all context

The agent doesn't just write code — it builds a persistent understanding of your project that survives across sessions, compactions, and context resets.


Highlights

CapabilityDescription
124 MCP ToolsCode review, refactoring, testing, git, file management, AST editing, memory, checkpoints, kanban, cognition, pipelines
Cognition Layer8 self-improvement tools: decision journal, confidence tracking, mental models, intent hierarchy, error patterns, self-critique, smart handoff, context budget
Cross-Tool IntelligenceEvent bus + cross-linker: tools react to each other automatically (decision → confidence, error → fix lookup, drift → critique)
7 LLM ProvidersNative SDKs for OpenAI, Anthropic, Gemini + OpenAI-compatible for Groq, DeepSeek, Ollama, OpenRouter
Multi-AgentAgents connect via HTTP, share context through Redis Pub/Sub, coordinate via kanban boards
Parallel Multi-ModelSend one prompt to N models simultaneously; CEO-and-Board consensus pattern
Thinking TokensUnified syntax across providers: o:gpt-5:higha:claude-sonnet-4-5:4kg:gemini-3-pro:8k
Tree-sitter ASTLanguage-aware navigation and symbol editing for 19 languages
Project MemoryPersistent per-project key-value store with TTL and tags
Session Resurrectionloci-recall + smart-handoff restore full context after compaction
Hot ReloadChange provider, model, or config at runtime without restart
Cross-RuntimeRuns on Bun (recommended) or Node.js with automatic detection

Compatibility

IDE / EditorStatusConfig location
Claude Codeclaude mcp add or ~/.claude.json
CursorSettings → Features → MCP
KiroCode~/.kirocode/mcp.json
RooCodeVS Code extension settings

Quick Start

Prerequisites

  • Bun ≥ 1.0 (recommended) or Node.js ≥ 18
  • Redis (optional — required only for multi-agent features and cognition layer)

Install & Run

git clone https://github.com/kemdi-pl/kemdicode-mcp.git
cd kemdicode-mcp
bun install && bun run build:bun
bun run start:bun
Node.js alternative
npm install && npm run build && npm run start

IDE Configuration

Claude Code
claude mcp add kemdicode-mcp -- bun /path/to/kemdicode-mcp/dist/index.js

Or add to ~/.claude.json:

{
  "mcpServers": {
    "kemdicode-mcp": {
      "command": "bun",
      "args": ["/path/to/kemdicode-mcp/dist/index.js"]
    }
  }
}
Cursor

Settings → Features → MCP:

{
  "mcpServers": {
    "kemdicode-mcp": {
      "command": "bun",
      "args": ["/path/to/kemdicode-mcp/dist/index.js", "-m", "gpt-5"]
    }
  }
}
KiroCode

Add to ~/.kirocode/mcp.json:

{
  "mcpServers": {
    "kemdicode-mcp": {
      "command": "bun",
      "args": [
        "/path/to/kemdicode-mcp/dist/index.js",
        "-m", "claude-sonnet-4-5",
        "--redis-host", "127.0.0.1"
      ]
    }
  }
}
RooCode

Add to VS Code settings (RooCode extension):

{
  "mcpServers": {
    "kemdicode-mcp": {
      "command": "bun",
      "args": [
        "/path/to/kemdicode-mcp/dist/index.js",
        "-m", "claude-sonnet-4-5",
        "--redis-host", "127.0.0.1"
      ]
    }
  }
}

Multi-Provider LLM

kemdiCode MCP ships with 7 built-in providers. Each can be activated by setting the corresponding API key:

export OPENAI_API_KEY=sk-...            # OpenAI
export ANTHROPIC_API_KEY=sk-ant-...     # Anthropic
export GEMINI_API_KEY=AI...             # Google Gemini
export GROQ_API_KEY=gsk_...            # Groq
export DEEPSEEK_API_KEY=sk-...          # DeepSeek
export OPENROUTER_API_KEY=sk-or-...     # OpenRouter
# Ollama — no key required (local)

Provider Syntax

Use provider:model (or the short alias) anywhere a model is accepted:

openai:gpt-5               o:gpt-5              # Latest flagship model
anthropic:claude-sonnet-4-5  a:claude-sonnet-4-5  # Best balance
anthropic:claude-opus-4-5    a:claude-opus-4-5    # Maximum intelligence
gemini:gemini-3-pro          g:gemini-3-pro       # Most intelligent
groq:llama-3.3-70b           q:llama-3.3-70b      # Fast inference
deepseek:deepseek-chat       d:deepseek-chat      # Cost effective
ollama:llama3.3              l:llama3.3           # Local deployment
openrouter:gpt-5             r:gpt-5              # Aggregator access

Thinking / Reasoning Tokens

Append a third segment to enable extended thinking:

ProviderSyntaxEffect
OpenAI (reasoning)o:gpt-5:highSets reasoning_effort to low / medium / high
Anthropica:claude-sonnet-4-5:4kAllocates 4 096 extended thinking tokens
Geminig:gemini-3-pro:8kAllocates 8 192 thinking tokens

Tool Reference

124 tools across 22 categories.

Category#Tools
Cognition8decision-journal confidence-tracker mental-model intent-tracker error-pattern self-critique smart-handoff context-budget
AI Agents4plan build brainstorm ask-ai
Multi-LLM2multi-prompt consensus-prompt
Code Analysis8code-review explain-code find-definition find-references find-symbols semantic-search code-outline analyze-deps
Line Editing4insert-at-line delete-lines replace-lines replace-content
Symbol Editing3insert-before-symbol insert-after-symbol rename-symbol
Code Modification5fix-bug refactor auto-fix auto-fix-agent write-tests
Project Memory8write-memory read-memory list-memories edit-memory delete-memory checkpoint-save checkpoint-restore checkpoint-diff
Git8git-status git-diff git-log git-blame git-branch git-add git-commit git-stash
File Operations9file-read file-write file-search file-tree file-diff file-delete file-move file-copy file-backup-restore
Project5project-info run-script run-tests run-lint check-types
Kanban — Tasks10task-create task-get task-list task-update task-delete task-comment task-claim task-assign task-push-multi board-status
Kanban — Workspaces5workspace-create workspace-list workspace-join workspace-leave workspace-delete
Kanban — Boards6board-create board-list board-share board-members board-invite board-delete
Recursive3invoke-tool invoke-batch invocation-log
Multi-Agent13agent-list agent-register agent-watch agent-alert agent-inject agent-history monitor agent-summary queue-message shared-thoughts get-shared-context feedback batch
Orchestration1pipeline
Session5session-list session-info session-create session-switch session-delete
Knowledge Graph4graph-query graph-find-path loci-recall sequence-recommend
Thinking Chain1thinking-chain
MPC Security4mpc-split mpc-distribute mpc-reconstruct mpc-status
RL Learning2rl-reward-stats rl-dopamine-log
System10shell-exec process-list env-info memory-usage ai-config ai-models config ping help timeout-test

Architecture

System Overview

LayerComponentDescription
ClientsClaude Code, Cursor, KiroCode, RooCodeConnect via SSE + JSON-RPC (MCP Protocol)
HTTP Server:3100 (Bun or Node.js)Routes: /sse, /message, /resume, /stream
Session ManagerPer-client isolationCWD injection, activity tracking, SSE keep-alive
Tool Registry124 tools, 22 categoriesZod schema validation, auto JSON Schema generation, lazy loading, tools/list_changed broadcast
Cognition LayerEvent bus + cross-linkerIn-process EventEmitter, bidirectional Redis links, 9 reactive event handlers
Provider Registry7 LLM providersNative SDKs + OpenAI-compatible. Lazy init, hot-reload, unified thinking tokens
Tree-sitter AST19 languagesWASM parsers, symbol navigation, rename, insert before/after
Runtime AbstractionBun / Node.jsAuto-detection. Unified HTTP, process spawning, crypto
Redis (DB 2)Shared statemcp:context:*, mcp:agents:*, mcp:kanban:*, mcp:memory:*, mcp:cognition:*
Redis Pub/SubReal-time messagingChannels: broadcast, inject:<agentId>, alerts, thoughts

Multi-Agent Orchestration

Register agents, distribute work across kanban boards, and coordinate via Redis Pub/Sub:

# Register specialized agents
agent-register --agents '[
  {"id":"backend","role":"backend","capabilities":["typescript","postgresql"]},
  {"id":"frontend","role":"frontend","capabilities":["react","tailwind"]},
  {"id":"qa","role":"quality","capabilities":["jest","cypress"]}
]'

# Distribute tasks
task-push-multi --taskIds '["api-1","api-2"]' --agents '["backend"]' --mode assign

# Broadcast a requirement
queue-message --broadcast true --message "Use OpenAPI 3.0 spec" --priority high

# Real-time monitoring
monitor --view hierarchy

Multi-Model Consensus

Send one prompt to N models in parallel, then let a CEO model synthesize:

# CEO-and-Board consensus
consensus-prompt \
  --prompt "Redis vs PostgreSQL for sessions?" \
  --boardModels '["o:gpt-5", "a:claude-sonnet-4-5", "g:gemini-3-pro"]' \
  --ceoModel "a:claude-opus-4-5:4k"

All board models run via Promise.allSettled() — individual failures never block the others.


Kanban Task Management

# Create a workspace
workspace-create --name "Project Alpha"

# Add boards
board-create --name "Backend Sprint 1" --workspaceId <ws-id>

# Batch-create tasks
task-create --tasks '[
  {"title":"Auth API","priority":"high","boardId":"<id>"},
  {"title":"Rate limiter","priority":"medium","boardId":"<id>"}
]'

# Push to agents
task-push-multi --taskIds '["t-1","t-2"]' --agents '["agent-1"]' --mode assign

Features: workspaces • multiple boards • role-based access • batch ops (1-20 per call) • assign / clone / notify • append-only task comments


Recursive Tool Invocation

Sub-agents can invoke other tools with built-in safety limits (max depth 2, rate-limited):

invoke-batch --invocations '[
  {"tool":"file-read","args":{"path":"@src/index.ts"}},
  {"tool":"run-tests","args":{}}
]' --mode parallel

CLI Reference

bun dist/index.js [options]
FlagDefaultDescription
-m, --modelPrimary AI model
-f, --fallback-modelFallback on quota / error
--port3100HTTP server port
--host127.0.0.1Bind address
--redis-host127.0.0.1Redis host
--redis-port6379Redis port
--no-contextDisable Redis context sharing
-v, --verboseFull output with decorations
--compactEssential fields only

Development

Build & Run

CommandDescription
bun installInstall all dependencies
bun run build:bunBundle for Bun runtime
bun run start:bunStart server on :3100
bun run dev:bunWatch mode with hot-reload
npm run buildTypeScript compilation for Node.js
npm run startStart with Node.js

Quality

CommandDescription
bun run typecheckType-check without emitting
bun run lintESLint
bun run formatPrettier
bun run prepareAll checks (pre-commit)

Environment Variables

VariableDescription
OPENAI_API_KEYOpenAI API key
ANTHROPIC_API_KEYAnthropic API key
GEMINI_API_KEYGoogle Gemini API key
GROQ_API_KEYGroq API key
DEEPSEEK_API_KEYDeepSeek API key
OPENROUTER_API_KEYOpenRouter API key
KEMDICODE_SHELL_EXEC_ENABLEDEnable shell-exec tool (default: false)
MPC_MASTER_SECRETMaster secret for MPC security tools

Authors

Dawid Irzykdawid@kemdi.pl Kemdi Sp. z o.o.

License

This project is licensed under the GNU General Public License v3.0 — see the LICENSE file for details.

GPL-3.0

© 2025 MCP.so. All rights reserved.

Build with ShipAny.