mcp-ad4m
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-ad4mremember that we decided to use React for the frontend"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-ad4m
AD4M MCP server for Claude Code — 13-tool semantic memory and enforcement layer.
Gives Claude Code persistent memory, cross-session context, and memory hygiene via a locally hosted AD4M executor. All data stays on your machine.
The Problem
Getting AD4M working with Claude Code requires:
Figuring out the executor port (it reads from
~/.ad4m/executor-port, not a fixed value)Writing a custom MCP server from scratch — none existed
Re-unlocking the agent on every reboot (no persistence)
No documented integration path for Claude Code specifically
This server solves all of it. One command sets everything up.
One-Command Install
git clone https://github.com/thefranceway/mcp-ad4m.git
cd mcp-ad4m
./setup-claude-code.sh --passphrase YOUR_AD4M_PASSPHRASEThe script:
Builds the TypeScript server
Stores your passphrase in macOS Keychain (not plaintext)
Installs a
launchdjob that auto-unlocks AD4M on every bootCreates a
ClaudeMemoryPerspective and saves the UUIDPrints the
settings.jsonsnippet to paste into Claude Code
Requires: Node.js 18+, AD4M executor running locally, macOS
Tools (13)
Tool | Description |
| DID, initialization state, keystore lock state |
| All local Perspectives |
| Create a new named semantic graph |
| Write a LinkExpression (source → predicate → target) |
| Query links with optional source/predicate/target filters |
| Remove links by filter — matched/removed/failed counts |
| Classify content by layer before writing (env/local/relay/ad4m) |
| Detect MCP registration in the wrong config file |
| Deduplicate graph, flag stale entries, auto-runs every 10 writes |
| Total links, duplicate count, breakdown by predicate |
| Inspect a shared AD4M Neighbourhood |
| Write cross-terminal live state via AD4M |
| Read cross-terminal relay messages |
Memory Architecture
AD4M stores information as signed links: source → predicate → target.
memory://project/zuafrique → ad4m://has-content → literal://Deployed CF Pages 2026-03-15
franc://session-log → franc://closed → literal://Session ended
franc://relay/terminal-a → franc://relay → literal://Build in progressLayer Taxonomy (enforced by ad4m_classify)
Layer | Where it belongs | Examples |
| AD4M semantic graph | Decisions, project facts, cross-session context |
|
| API keys, tokens, credentials |
|
| Rules, hooks, permissions |
| AD4M relay predicate | Live cross-terminal state |
Run ad4m_classify before ad4m_write_memory if unsure which layer to use.
Self-Optimization
The graph self-prunes automatically. Every 10 writes from any terminal increments a shared counter stored in AD4M (franc://optimizer → franc://write-count). When it hits 10, ad4m_optimize runs and removes exact duplicates.
To run manually:
ad4m_optimize({ perspective_uuid: "...", dry_run: true }) // report only
ad4m_optimize({ perspective_uuid: "...", dry_run: false }) // remove duplicatesCross-Terminal Relay
Two Claude Code terminals sharing the same AD4M executor can exchange live messages:
Terminal A:
relay_write({ perspective_uuid: "...", message: "build done", session_id: "terminal-a" })Terminal B:
relay_read({ perspective_uuid: "...", since: "2026-05-16T00:00:00Z" })Manual Setup (without the script)
1. Build
npm install && npm run build2. Add to ~/.claude/settings.json
"ad4m": {
"command": "/path/to/mcp-ad4m/bin/mcp-ad4m",
"args": [],
"env": {
"AD4M_GQL_URL": "http://localhost:4000/graphql"
}
}3. Unlock the agent before each session
curl -s http://localhost:4000/graphql \
-H "Content-Type: application/json" \
-d '{"query":"mutation { agentUnlock(passphrase: \"YOUR_PASSPHRASE\") { isUnlocked } }"}'Or install the launchd job from launchd/dev.ad4m.auto-unlock.plist to auto-unlock on boot.
Error Messages
The server returns actionable errors:
Situation | What you see |
Executor not running |
|
Agent locked |
|
Timeout |
|
Tested On
macOS 13.3 ARM64 (Apple M1)
AD4M executor v0.12.x
Claude Code CLI (Sonnet 4.6)
Node.js v24
Project Structure
mcp-ad4m/
├── src/
│ └── index.ts TypeScript source (13 tools)
├── dist/ Compiled output (generated by npm run build)
├── launchd/
│ └── dev.ad4m.auto-unlock.plist
├── setup-claude-code.sh One-command setup
├── package.json
└── tsconfig.jsonLicense
MIT
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/thefranceway/mcp-ad4m'
If you have feedback or need assistance with the MCP directory API, please join our Discord server