multi-coding-agents-mcp
by jrdagala
README.md
# multi-coding-agents-mcp
A persistent shared memory MCP server for multi-agent coding workflows.
Stores project context, session handoff state, and task status across **Antigravity**, **Claude Code**, **Codex**, **GitHub Copilot**, and **Gemini CLI** — so agents can resume each other's work without losing context.
---
## What it does
Each AI agent connects to this server via the Model Context Protocol (MCP). Instead of starting every session blind, agents call `init_session()` first to load the full project state: tech stack, conventions, architectural decisions, ownership, and any open tasks left by previous agents.
```text
Agent A finishes work → save_state() → DB
Agent B starts work → init_session() → picks up exactly where A left off
```
---
## Tools
| Tool | Purpose |
|---|---|
| `init_session` | **Always call first.** Returns full project context, open tasks, and session rules |
| `register_project` | Add or update a project entry |
| `list_projects` | List all tracked projects |
| `get_context` | Read project context keys (includes `version` for conflict detection) |
| `set_context` | Write a context key with optional optimistic concurrency (`expected_version`) |
| `append_decision` | Push an architectural decision onto the decisions log |
| `save_state` | Save agent session state (phase, completed, pending, blockers, next steps) |
| `load_state` | Load a previous session's full handoff record |
| `list_tasks` | List all handoff records for a project, newest first |
---
## Quick start
```bash
# 1. Install
pnpm install
# 2. Build
pnpm build
# 3. Test interactively (browser UI at localhost:5173)
npx @modelcontextprotocol/inspector node dist/index.js
# 4. Register with your agent (example: Claude Code)
claude mcp add multi-coding-agents -- node /absolute/path/to/dist/index.js
```
---
## Database
Supports **SQLite** (default, zero config) and **PostgreSQL** (team/remote use).
| Variable | Default | Purpose |
|---|---|---|
| `DB_PATH` | `./agent-state.db` | SQLite file path |
| `DATABASE_URL` | _(unset)_ | PostgreSQL connection string — activates PG mode when set |
SQLite mode: `agent-state.db` is committed to git — it is the persistent state, not a build artifact.
---
## Architecture
```
src/
index.ts ← wiring only: DB init, createHandlers(), transport
utils.ts ← safeJsonParse(), serialize()
db/
index.ts ← createDb() — engine selected from DATABASE_URL env var
schema-sqlite.ts ← Drizzle SQLite schema
schema-pg.ts ← Drizzle PostgreSQL schema
handlers/
index.ts ← createHandlers(server, engine, db) — ONLY engine branch
projects/
sqlite.ts pg.ts ← list_projects, register_project
context/
sqlite.ts pg.ts ← get_context, set_context, append_decision
handoffs/
sqlite.ts pg.ts ← save_state, load_state, list_tasks
session/
sqlite.ts pg.ts ← init_session
```
Each `sqlite.ts` / `pg.ts` file uses only its own DB type — no branching, no type casts.
---
## Agent configuration
**Claude Code:**
```bash
claude mcp add multi-coding-agents -- node /absolute/path/to/multi-coding-agents-mcp/dist/index.js
```
**Antigravity / Gemini CLI** (`~/.gemini/mcp.json`):
```json
{
"mcpServers": {
"multi-coding-agents": {
"command": "node",
"args": ["/absolute/path/to/multi-coding-agents-mcp/dist/index.js"]
}
}
}
```
**GitHub Copilot** (`.vscode/mcp.json`):
```json
{
"servers": {
"multi-coding-agents": {
"type": "stdio",
"command": "node",
"args": ["/absolute/path/to/multi-coding-agents-mcp/dist/index.js"]
}
}
}
```
**Codex** (`~/.openai/mcp.json`):
```json
{
"mcpServers": {
"multi-coding-agents": {
"command": "node",
"args": ["/absolute/path/to/multi-coding-agents-mcp/dist/index.js"]
}
}
}
```
> Use absolute paths. Relative paths fail silently.
---
## Tech stack
- **TypeScript** — strict mode, ES modules
- **Drizzle ORM** — engine-agnostic queries for SQLite and PostgreSQL
- **`@modelcontextprotocol/sdk`** — stdio transport
- **Zod** — input validation for all tools
- **pnpm** — package manager
---
## Contributing / agent rules
See [`AGENTS.md`](./AGENTS.md) for the mandatory session startup protocol and hard rules all agents must follow.This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessNo recent community issues