Skip to content

MCP Integration

MemPalace provides 34 tools through the Model Context Protocol (MCP), giving any MCP-compatible AI full read/write access to your palace.

Setup

Setup Helper

MemPalace includes a setup helper that prints the exact configuration commands for your environment:

bash
mempalace mcp

Manual Connection

bash
claude mcp add mempalace -- python -m mempalace.mcp_server
codex mcp add mempalace -- python -m mempalace.mcp_server

With Custom Palace Path

bash
claude mcp add mempalace -- python -m mempalace.mcp_server --palace /path/to/palace
codex mcp add mempalace -- python -m mempalace.mcp_server --palace /path/to/palace

Now your AI has all 34 tools available. Ask it anything:

"What did we decide about auth last month?"

Claude calls mempalace_search automatically, gets verbatim results, and answers you.

Compatible Tools

MemPalace works with any tool that supports MCP:

  • Claude Code — native via plugin or manual MCP
  • Codex CLI — native via bundled Codex plugin or manual MCP
  • OpenClaw — via official skill, see OpenClaw Skill
  • ChatGPT — via MCP bridge
  • Cursor — native MCP support
  • Gemini CLI — see Gemini CLI guide

Memory Protocol

When the AI first calls mempalace_status, it receives the Memory Protocol — a behavior guide that teaches it to:

  1. On wake-up: Call mempalace_status to load the palace overview
  2. Before responding about any person, project, or past event: search first, never guess
  3. If unsure: Say "let me check" and query the palace
  4. After each session: Write diary entries to record what happened
  5. When facts change: Invalidate old facts, add new ones

This protocol is what turns storage into memory — the AI knows to verify before speaking.

Tool Overview

Palace (read)

ToolWhat
mempalace_statusPalace overview + AAAK spec + memory protocol
mempalace_list_wingsWings with counts
mempalace_list_roomsRooms within a wing
mempalace_get_taxonomyFull wing → room → count tree
mempalace_searchSemantic search with wing/room filters
mempalace_check_duplicateCheck before filing
mempalace_get_aaak_specAAAK dialect reference

Drawers (read)

ToolWhat
mempalace_get_drawerFetch a single drawer by ID
mempalace_list_drawersList drawers with pagination

Palace (write)

ToolWhat
mempalace_add_drawerFile verbatim content
mempalace_update_drawerUpdate drawer content or metadata
mempalace_delete_drawerRemove by ID

Knowledge Graph

ToolWhat
mempalace_kg_queryEntity relationships with time filtering
mempalace_kg_addAdd facts
mempalace_kg_invalidateMark facts as ended
mempalace_kg_timelineChronological entity story
mempalace_kg_statsGraph overview
ToolWhat
mempalace_traverseWalk the graph from a room across wings
mempalace_find_tunnelsFind rooms bridging two wings
mempalace_graph_statsGraph connectivity overview

Tunnels

ToolWhat
mempalace_create_tunnelCreate an explicit cross-wing tunnel
mempalace_list_tunnelsList all explicit tunnels
mempalace_delete_tunnelDelete an explicit tunnel
mempalace_follow_tunnelsFollow tunnels out from a room

Agent Diary

ToolWhat
mempalace_diary_writeWrite AAAK diary entry
mempalace_diary_readRead recent diary entries

System

ToolWhat
mempalace_hook_settingsGet or set hook behavior
mempalace_memories_filed_awayCheck whether the last checkpoint was saved
mempalace_reconnectForce reconnect to the database

For detailed schemas and parameters, see MCP Tools Reference.

Released under the MIT License.