Skip to content

MCP integration

aiDimag ships an MCP server so any MCP-capable AI agent can read and write memory live during a session — search before exploring, write learnings at the end, and critique its own work against your verified rules.

Start the server

The server runs over stdio and is normally launched by your agent, not by hand:

sh
dim mcp

Point it at a repo with the AIDIMAG_REPO environment variable (most agent configs set this for you).

Add it to your agent

Claude Code (.mcp.json)

json
{
  "mcpServers": {
    "aidimag": {
      "command": "npx",
      "args": ["-y", "aidimag", "mcp"],
      "env": { "AIDIMAG_REPO": "/path/to/your/repo" }
    }
  }
}

Cursor

Add the same server block to Cursor's MCP settings (Settings → MCP), using the npx -y aidimag mcp command and the AIDIMAG_REPO env var.

GitHub Copilot / other MCP clients

Any client that supports MCP servers can use the identical command/args/env. If your tool doesn't speak MCP, use generated context files instead.

dim init prints a ready-to-paste snippet for you.

What the server exposes

Tools

ToolWhat it does
memory_searchSearch verified memory before exploring the codebase (every search is logged locally; zero-hit queries surface as knowledge gaps via dim gaps)
memory_get_for_filesGet memories relevant to specific files before editing them
memory_writeSave a new memory (set guardrail_level for guardrails)
memory_proposeQueue a memory for human review (preferred at session end)
context_notePassive in-chat capture — the moment you state a durable fact in chat ("we use X because Y", "never touch Z"), the agent notes it into the review queue with your verbatim quote and HUMAN_ATTESTED evidence. No session-end ritual needed.
memory_verifyRe-run cheap evidence and update statuses. Evidence commands that arrived via team sync and weren't approved on this machine are skipped, never executed — the human approves them once with dim verify --trust
memory_refuteMark a memory false when it no longer holds
memory_statusCounts by status and kind
commits_mineMine git history for memory proposals (like dim mine; optional full, llm, max)
memory_critiqueReview work against verified memory + guardrails (a "second critic")
proposals_pendingList proposals awaiting review
knowledge_pendingList documents waiting in the knowledge inbox to be summarized
knowledge_ingest_submitSubmit the claims extracted from a pending knowledge doc (queues proposals, backs up the original)
ticket_getFetch the current ticket's details (auto-detects from the branch)

Prompts

PromptWhen to run it
session_startAt the start of a session — surfaces in-scope memory, guardrails, stale warnings, questions to ask, and any docs waiting in the knowledge inbox
session_end_extractionAt the end — extract durable learnings into the proposal queue
knowledge_ingestProcess the knowledge inbox in-session — read each pending doc, extract falsifiable claims, and submit them with knowledge_ingest_submit

Resources

ResourceContents
aidimag://digestA compact digest of repo memory for bootstrapping
aidimag://session-briefingThe same briefing as dim brief, as a resource

A typical agent loop

  1. Start → run session_start (or read aidimag://session-briefing) to learn the rules and stale spots.
  2. Before editing filesmemory_get_for_files to pull conventions/gotchas/guardrails.
  3. While workingmemory_search whenever a question comes up, and context_note the moment the human states a durable fact in chat.
  4. Before finishingmemory_critique with a short summary to catch guardrail violations and contradictions.
  5. End → run session_end_extraction and memory_propose durable learnings (which you later approve with dim review).

Do I even need MCP?

No — it's the richest integration, but optional. dim generate-context produces CLAUDE.md, .cursorrules, and copilot-instructions.md that any assistant reads at startup. Many teams use both: MCP for live read/write, generated files as a static fallback.

Licensed under Elastic License 2.0 — free for teams of 10 or fewer users.