Repository avatar
Other Tools
v1.1.0
active

memoreal-mcp

io.github.kolivritech/memoreal-mcp

Official Node.js MCP connector for Memoreal Cloud (https://memoreal.kolivri.com).

Documentation

@kolivri/memoreal-mcp — Deterministic AI Memory & Code Intelligence MCP for Claude Code, OpenCode, Cursor, Codex & 17 AI Harnesses

kolivritech/memoreal-mcp MCP server Node.js >= 18

@kolivri/memoreal-mcp is the official zero-dependency Node.js ESM Model Context Protocol (MCP) connector (stdio & HTTP) for Memoreal Cloud — giving AI coding and operator agents across 17 local AI agent harnesses (Claude Code, Claude Desktop, Cursor, OpenCode, OpenAI Codex, Windsurf, VS Code / GitHub Copilot, Zed, Gemini CLI, Cline, Roo Code, Kilo Code, Continue, Block Goose, Sourcegraph Amp, AWS Kiro & Amazon Q, Trae, and Aider) deterministic long-term memory, cross-session recall, and polyglot code intelligence powered by memoreal.kolivri.com.


Environment Variables

VariableRequiredDefaultDescription
MEMOREAL_API_KEYYes—Your Memoreal Cloud API key (mem_dev_..., mem_start_..., or mem_biz_...) from memoreal.kolivri.com/register
MEMOREAL_API_URLOptionalhttps://memoreal.kolivri.comMemoreal Cloud base URL
MEMOREAL_NAMESPACEOptionaldefaultDefault project/workspace namespace when omitted from tool arguments

Backward Compatibility: Legacy MEMORIA_API_KEY, MEMORIA_API_URL, and MEMORIA_NAMESPACE environment variables remain 100% supported as automatic fallbacks across all transports.


The 5 Market Tracks & Automated Feature Showcases

Memoreal Cloud provides deterministic, high-speed memory architectures tailored to 5 primary market tracks. Each track leverages a dedicated context mode, domain-specific hooks, and live automated feature showcases:

1. Software Developers & Engineering Teams (mode: "organizational")

  • Stack & Installation: npx -y @kolivri/memoreal-mcp setup across Windows, Linux/WSL, and macOS supporting all 17 local AI agent harnesses.
  • Polyglot Code Intelligence: Cold-start bootstrap_project parses instructions (CLAUDE.md, AGENTS.md, README.md) and indexes symbols across 15+ programming languages.
  • Belief Revision & Evolution: Supersedes graph edges dynamically deprecate killed-RFC architectural decisions when new patterns are accepted.
  • Architectural Tools: Deep caller/callee trees (call_tree), blast radius assessment (impact), and gap detection (test_gaps).
  • Compaction-Proof Hooks: Session lifecycle hooks provide 70%+ prompt token savings through automated memory recall and compaction survival.
  • CI/CD Integration: Seamless integration with GitHub via /v1/webhooks/github for automatic memory syncing on branch merges.

2. Automated Call & Customer Support Centers (mode: "support")

  • Telephony & Helpdesk Connectors: Native voice and support webhooks/SDKs for Kolivri Voice, Twilio, Vapi, LiveKit, WhatsApp, and Zendesk.
  • Sub-First-Ring Recall: 12.9 ms* p50 returning-caller memory recall eliminates dead air ($0 LLM dead air delay) before the first phone ring.
  • Multilingual Support: Verified across 15 natural languages, including 102/102 = 100.0% on Hebrew LongMemEval benchmark tests.
  • Dynamic Customer State: Supersedes edges track live ticket status, address updates, and preference changes over time.
  • Privacy & Safety: Pre-storage PII redaction ensures caller identity data and payment information are protected.

3. Autonomous & Multi-Agent Builders (mode: "operational")

  • Agent Frameworks: Streamable HTTP /v1/mcp transport and REST SDK integrations for LangGraph, CrewAI, OpenAI Agents SDK, AutoGen, and Mastra.
  • 5 Specialist Agent Wings: Multi-agent coordination across architect, reviewer, qa, security, and ops wings via handoff_to_agent and /v1/rooms/handoff.
  • Memory Tiering: Isolation between scratchpad ideation in Buffer tier vs immutable production invariants in Core tier.
  • Causal Reasoning: Graph-powered dependency tracking via downstream_effects and root_cause diagnostics for runtime failure recovery.

4. Sales, CRM & Revenue Operations AI (mode: "sales")

  • RevOps Integrations: Native connectors and webhooks for AI SDRs, HubSpot, Salesforce, Gong, n8n, and Make.
  • Deterministic Math: Strict numeric reasoning and signed deal arithmetic (e.g. $25k + $15k = $40k) without LLM hallucination.
  • Entity Separation: Strict graph boundary separation between first-party customer facts and competitor/vendor intelligence.
  • Pre-Call Briefs: Automated account synthesis using /v1/extract and /v1/reflect to assemble instant executive briefing documents.

5. Security- & Compliance-First Organizations (mode: "research")

  • Cryptographic Access Control: Role-scoped API keys with explicit Write vs Read-only auditor access.
  • Enterprise Team RBAC: Granular role-based access control supporting owner, admin, manager, and member tiers.
  • Zero-Trust Data Protection: Pre-storage PII/secret scrubbing and prompt-injection quarantine prevent memory poisoning.
  • Auditability & Provenance: Full memory trust chains via trace_provenance, immutable audit trails via /v1/trace/recent, and GDPR compliance via /v1/export and right-to-forget endpoints.

Cross-OS Support (Windows · Linux / WSL · macOS)

@kolivri/memoreal-mcp runs natively across all major operating systems with zero external shell dependencies:

  • Windows (win32):
    • Full support for PowerShell and cmd.exe.
    • Config paths resolved to %APPDATA% (Roaming) and %LOCALAPPDATA% with %USERPROFILE%.
    • Lifecycle hooks run via pure Node.js (bin/memoreal-hook.mjs) and Windows batch wrappers (bin/memoreal-ns.cmd), requiring zero /bin/sh or jq.
    • Safe OAuth browser launching via rundll32 (url.dll,FileProtocolHandler), preventing URL query parameters (&) from breaking.
  • Linux & WSL (linux):
    • Compliant with $XDG_CONFIG_HOME (defaulting to ~/.config).
    • Seamless WSL integration: automatically detects WSL environments (WSL_DISTRO_NAME / WSL_INTEROP) and opens the host Windows browser via rundll32.exe.
  • macOS (darwin):
    • Idiomatic macOS application paths under ~/Library/Application Support and ~/.config.
    • Works out of the box with standard Apple Silicon (arm64) and Intel (x64) architectures.

Supported Local AI Agent Harnesses (17 Harnesses)

@kolivri/memoreal-mcp automatically detects and provisions MCP configurations, skills, and lifecycle hooks across 17 local AI agent harnesses:

  1. Claude Code (~/.claude/settings.json, .claude.json, hooks)
  2. Claude Desktop (claude_desktop_config.json on macOS / Windows %APPDATA% / Linux)
  3. Cursor (~/.cursor/mcp.json, .cursor/rules/)
  4. OpenCode (${XDG_CONFIG_HOME:-~/.config}/opencode/opencode.json, plugins, hooks)
  5. OpenAI Codex (~/.codex/config.toml, .codex/skills/, .codex/AGENTS.md)
  6. Windsurf (~/.codeium/windsurf/mcp_config.json, memories/global_rules.md)
  7. VS Code / GitHub Copilot (~/.vscode/mcp.json, Code/User/mcp.json, .github/copilot-instructions.md)
  8. Zed (~/.config/zed/settings.json via context_servers.memoreal)
  9. Gemini CLI (~/.gemini/settings.json, .gemini/GEMINI.md)
  10. Cline (cline_mcp_settings.json in globalStorage / stdio with cmd /c npx on Windows)
  11. Roo Code (mcp_settings.json in globalStorage / stdio)
  12. Kilo Code (mcp_settings.json in globalStorage / stdio)
  13. Continue (~/.continue/mcpServers/memoreal.json)
  14. Block Goose (~/.config/goose/config.yaml via extensions.memoreal)
  15. Sourcegraph Amp (~/.config/amp/settings.json via amp.mcpServers)
  16. AWS Kiro & Amazon Q (~/.kiro/settings/mcp.json, ~/.aws/amazonq/mcp.json, .kiro/steering/memoreal.md)
  17. Trae (Trae/User/mcp.json) (Also supports conventions for Aider via CONVENTIONS.md)

Installation

1. Interactive CLI Setup & Auto-Hook Provisioning (Recommended)

Run the zero-dependency interactive setup wizard to configure your API key, auto-provision client lifecycle hooks and skills, and index your repository:

# Interactive setup with automatic client detection
npx -y @kolivri/memoreal-mcp setup

# Or alias
npx -y @kolivri/memoreal-mcp init

# Setup with direct API key and target specific client
npx -y @kolivri/memoreal-mcp setup --key "mem_..." --tool opencode

# Setup without cold-start repository indexing
npx -y @kolivri/memoreal-mcp setup --no-bootstrap

What the setup wizard auto-provisions:

  • Automated Client Detection: Configures Claude Code, Cursor, OpenCode, Codex, Windsurf, and VS Code MCP configs.
  • Agent Lifecycle Hooks & Skills: Copies plugins/skills and configures lifecycle hooks (SessionStart, PreCompact, PostCompact, UserPromptSubmit, PostToolUse, TaskCompleted, Stop) with .bak safety backups.
  • Canonical Worktree Resolver: Installs ~/.memoreal/bin/memoreal-ns (0o755) to ensure git worktrees share canonical repository memory namespaces without org: prefixes.
  • Turn-1 Cold-Start Indexing: Automatically indexes repository guidance (CLAUDE.md, AGENTS.md, README.md) and code symbols into Memoreal Cloud (unless --no-bootstrap is passed).

2. One-Line Auto-Installer (15 AI Clients + Claude Code Lifecycle Hooks)

Automatically configures Claude Code, Cursor, Windsurf, VS Code, Claude Desktop, OpenCode, Cline, Roo Code, Continue, Zed, Goose, PearAI, Trae, Void, and Melty:

# macOS / Linux / WSL
curl -fsSL --proto '=https' --tlsv1.2 https://memoreal.kolivri.com/downloads/install.sh | MEMOREAL_KEY=YOUR_MEMOREAL_API_KEY bash
# Windows PowerShell
$env:MEMOREAL_KEY="YOUR_MEMOREAL_API_KEY"; irm https://memoreal.kolivri.com/downloads/install.ps1 | iex

3. Claude Code (claude mcp add)

claude mcp add memoreal \
  -e MEMOREAL_API_KEY="your-memoreal-api-key" \
  -- npx -y @kolivri/memoreal-mcp

4. Cursor (~/.cursor/mcp.json) & Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "memoreal": {
      "command": "npx",
      "args": ["-y", "@kolivri/memoreal-mcp"],
      "env": {
        "MEMOREAL_API_KEY": "your-memoreal-api-key",
        "MEMOREAL_NAMESPACE": "my-project"
      }
    }
  }
}

5. OpenCode (~/.config/opencode/opencode.json)

{
  "mcp": {
    "memoreal": {
      "type": "local",
      "command": ["npx", "-y", "@kolivri/memoreal-mcp"],
      "environment": {
        "MEMOREAL_API_KEY": "your-memoreal-api-key",
        "MEMOREAL_NAMESPACE": "my-project"
      },
      "enabled": true
    }
  }
}

6. OpenAI Codex (~/.codex/config.toml)

OpenAI Codex uses native TOML configuration (~/.codex/config.toml). Running npx -y @kolivri/memoreal-mcp setup automatically provisions the Streamable HTTP MCP server:

[mcp_servers.memoreal]
url = "https://memoreal.kolivri.com/v1/mcp"
http_headers = { "Authorization" = "Bearer your-memoreal-api-key" }

Alternatively, you can configure local stdio execution:

[mcp_servers.memoreal]
command = "npx"
args = ["-y", "@kolivri/memoreal-mcp"]
env = { MEMOREAL_API_KEY = "your-memoreal-api-key", MEMOREAL_NAMESPACE = "my-project" }

7. Docker

docker build -t memoreal-mcp .
docker run -i --rm \
  -e MEMOREAL_API_KEY="your-memoreal-api-key" \
  -e MEMOREAL_NAMESPACE="my-project" \
  memoreal-mcp

32 MCP Tools (https://memoreal.kolivri.com/v1/mcp)

Core Memory & Context (10 Tools)

ToolRequired ArgsDescription
build_contextqueryAssemble a token-budgeted <memory_context> block grouped into Core Rules, Established Facts, and Recent Context.
recall_memoriesqueryRetrieve top memories ranked deterministically by Memoreal Cloud within token_budget.
encode_memorycontentStore a new memory in Memoreal Cloud with tier (episodic, semantic, buffer, core), salience (0.0–1.0), namespace, and context pairs.
batch_encodememoriesAtomically encode an array of memories in a single call.
forget_memoryidDelete a specific memory and its incident graph edges by ID.
delete_by_contextkey, valueDelete all memories matching a specific [key, value] context metadata pair.
feedbackid, usefulRecord positive/negative utility feedback on a memory and adjust its salience score.
consolidatenamespaceDeduplicate memories within a namespace and promote recurring high-salience episodic memories to Semantic tier.
health(none)Return Memoreal Cloud engine health, active memory/edge counts, and tier distribution.
statsnamespaceReturn per-namespace memory count, edge count, and tier distribution.

Code Intelligence & Navigation (9 Tools)

ToolRequired ArgsDescription
bootstrap_project(optional: project_dir, namespace)Turn-1 cold-start project indexing: parses instructions (CLAUDE.md, AGENTS.md, README.md) and indexes top-level code symbols into Memoreal Cloud.
search_codequerySearch indexed code symbol definitions and references with file paths and line numbers.
explain_codetargetExplain a symbol: definitions, workspace references, related tests, and associated architectural memories.
find_filepatternResolve file or directory paths matching a pattern or name across the workspace.
find_referencessymbolFind all call-sites and symbol references across the indexed workspace.
call_treesymbolGenerate caller/callee hierarchy trees (direction: "in" | "out", max_depth).
navigate(optional: namespace, cursor, move)Stateless hierarchical cursor walk across project, directory, file, and definition layers.
get_hierarchynodeSingle-shot retrieval of all ancestor layers and full descendant subtree around a node.
implementorsinterface_nameList concrete implementations and classes implementing an interface, trait, or abstract type.

15+ Supported Programming Languages

The 16 code-intelligence tools natively parse definitions, references, and hierarchies across:

  • TypeScript & JavaScript (.ts, .tsx, .js, .jsx, .mjs, .cjs)
  • Python (.py)
  • Go (.go)
  • Rust (.rs)
  • Java (.java)
  • C# (.cs)
  • C & C++ (.c, .cc, .cpp, .h, .hpp)
  • PHP (.php)
  • Ruby (.rb)
  • Kotlin (.kt, .kts)
  • Swift (.swift)
  • Scala (.scala)
  • Shell / Bash (.sh, .bash)

Architecture, Quality & Diagnostics (10 Tools)

ToolRequired ArgsDescription
impacttargetCompute blast radius, affected call-sites, and test dependencies before changing a symbol or file.
dead_code(optional: path)Detect unreferenced symbols, orphan functions, and unreachable code paths across workspace.
test_gaps(optional: path)Identify untested symbols, uncovered edge cases, and missing test suites.
diff_risk(optional: diff, path)Compute deterministic risk score, hotspot warnings, and reviewer checklists for code diffs.
downstream_effectstargetEvaluate cascading architectural impact and downstream service dependencies.
root_causeerrorTrace error logs, crash signatures, and stack traces back to root cause symbols.
trace_provenancesymbolTrace symbol origin, commit history, architectural decisions, and original rationale.
explain_diff(optional: diff, path)Provide structured code review explanations and risk highlights for git changes.
explain_errorerrorDiagnose runtime exceptions, compiler errors, and stack traces with targeted fix advice.
renameold_name, new_nameCalculate a complete, safe symbol rename plan across all call-sites and definitions.

Multi-Agent Coordination & Setup (3 Tools)

ToolRequired ArgsDescription
list_agent_wings(none)List specialist multi-agent wings (architect, reviewer, qa, security, ops) and active memory counts.
handoff_to_agentfrom_wing, to_wing, summary, taskRecord a structured context handoff between specialist agent wings.
connect_account(optional: action, device_code)Interactive 3-click in-chat setup wizard for Memoreal credentials and client configuration.

Running Connector Tests

npm test

License

Connector package licensed under MIT. Memoreal Cloud (https://memoreal.kolivri.com) is a commercial hosted service by Kolivri.