Agent Memory MCP
Use Engra Agent Memory from MCP clients (Cursor, Claude Desktop, etc.) via Model Context Protocol Streamable HTTP. See the REST API guide for HTTP integration.
Integration versions v1.9.0
- REST API
- v1.6.0
- MCP
- v1.9.0
- Agent Skill
- v1.9.0
- Memory engine
- v0.5.0
Response headers: X-Engra-Memory-Mcp-Version, X-Engra-Memory-Engine-Version · also in MCP initialize serverInfo.version
MCP endpoint
Recommended edge endpoint https://mcp.engra.ai/api/v1/memory/mcp (Cloudflare Worker, bypasses Vercel). Legacy path https://engra.ai/api/v1/memory/mcp remains supported. Default is stateless JSON-only: RPC via POST (JSON responses); GET SSE listen returns 405 (set MEMORY_MCP_JSON_ONLY=false to restore).
https://mcp.engra.ai/api/v1/memory/mcp
Legacy (still supported): https://engra.ai/api/v1/memory/mcp
Authentication
MCP and REST share the same dashboard API keys (inf_ prefix). Team-scoped keys are required; local .env placeholder keys cannot be used for production MCP.
Create an API key
- Open Console → API keys (/dashboard/keys)
- Multi-select scopes under Gateway / Memory groups
- Quick presets: MCP read-only, MCP read/write, Gateway default
- Read-only agents: memory:read only
- For memory_save_atom: add memory:write
- Memory MCP usually needs no Gateway binding
- Copy the inf_… key immediately and configure mcp.json per the Cursor example below (Authorization, Accept, Content-Type)
Scope reference
- memory:read — memory_list_libraries / search / recall / wake-up / list_atoms
- memory:write — memory_save_atom, memory_correct_atom, POST/PATCH /atoms
Headers
- Authorization: Bearer inf_xxxxxxxx (recommended)
- Accept: application/json, text/event-stream (required; missing values often return HTTP 406)
- Content-Type: application/json
- X-API-Key: inf_xxxxxxxx
- Do not use upstream Gemini/OpenAI keys — those belong in Gateway upstream settings
Transport
- Protocol: MCP Streamable HTTP (2025-11-25)
- Mode: stateless + enableJsonResponse (one POST → one JSON body; GET SSE listen disabled by default)
- mcp.json still needs Accept: application/json, text/event-stream (spec; missing values often return HTTP 406)
- Standard MCP methods supported: initialize, tools/list, tools/call, etc.
Recommended workflow
- Call memory_list_libraries first (use description / writableTargets); optionally memory_suggest_write_library
- Use memory_retrieve (combined layers) or memory_search / memory_recall / memory_wake_up for retrieval; pass allAccessible: true for every listable library
- Proactively call memory_save_atom when the session reveals durable knowledge (decisions, conventions, preferences, root-cause fixes); search first to dedupe. Cross-team targets need sourceMemoryLibraryId + write grant. Multiple distinct facts in one turn: separate save per fact; parallel tool calls allowed
- Call memory_correct_atom when search hits are outdated (do not save duplicates for the same fact). Multiple outdated atoms in one turn: one correct per atom; parallel tool calls allowed
- Write tools default to async (202 + job.id): fast ack, background persist; do not expect immediate search hits
- Writes require memory:write; MCP instructions inject SAVE MEMORY POLICY by default
- All tools except list_libraries / suggest_write_library require memoryLibraryId or memoryLibraryLabel in arguments
Tools
| Tool | Scope | Description |
|---|---|---|
| memory_list_libraries | memory:read | List memory libraries for the workspace (includes Common Knowledge; fields include label, description, writableTargets, readableTargets; readableTargets are grant-eligible catalogs, not auto-merged every search) |
| memory_suggest_write_library | memory:read | Rank the primary library and writableTargets by description/label keywords to pick a save target |
| memory_search | memory:read | L3 deep semantic search (may merge Common Knowledge; cross-library extras via defaults or explicit labels/ids; grant targets are eligible when chosen) |
| memory_recall | memory:read | L2 topic recall (same cross-library rules as search; readableTargets are not auto-merged wholesale) |
| memory_retrieve | memory:read | Combined L2+L3 in one call; supports allAccessible (mutually exclusive with Ids/Labels) |
| memory_wake_up | memory:read | L0+L1 wake-up stack (may append ## Shared common knowledge) |
| memory_save_atom | memory:write | Save an atom asynchronously (202 + job id; cross-team targets need sourceMemoryLibraryId + write grant) |
| memory_correct_atom | memory:write | Correct an atom asynchronously (202 + job id; same cross-team rules as save) |
| memory_list_atoms | memory:read | Paginated atom list |
Cursor configuration example
{
"mcpServers": {
"engra-memory": {
"url": "https://mcp.engra.ai/api/v1/memory/mcp",
"headers": {
"Authorization": "Bearer inf_xxxxxxxx",
"Accept": "application/json, text/event-stream",
"Content-Type": "application/json"
}
}
}
}Library-bound MCP endpoint (optional)
Besides the team endpoint /api/v1/memory/mcp, each library has /api/v1/memory/libraries/{libraryId}/mcp. Connecting to a library-bound URL aligns initialize server instructions with that library's policies; memoryLibraryId becomes optional on read/write tools (defaults to the bound library). The API key must still be allowed to access that library (optional library allowlist on keys).
/api/v1/memory/libraries/{libraryId}/mcp
{
"mcpServers": {
"engra-memory": {
"url": "https://mcp.engra.ai/api/v1/memory/libraries/YOUR_LIBRARY_ID/mcp",
"headers": {
"Authorization": "Bearer inf_xxxxxxxx",
"Accept": "application/json, text/event-stream",
"Content-Type": "application/json"
}
}
}
}MCP Agent policy (server instructions)
Server instructions in the MCP initialize response guide when to retrieve, save, and correct. Configure in the console (soft constraints — models are not guaranteed to follow):
- Wake policy mcp_wake_policy
- off (agent decides) | session (memory_wake_up before first reply) | every_turn (search/wake_up before each user message). Per-library override available.
- Save policy mcp_save_policy
- off | proactive (default — proactive memory_save_atom; multiple distinct facts in one turn: separate save per fact, parallel tool calls allowed) | session_end (also require a structured summary atom before session ends).
- Auto-correct autoCorrectEnabled
- Per-library Settings toggle; when on with library-bound MCP, instructions inject CORRECT MEMORY POLICY so agents call memory_correct_atom instead of duplicate saves; multiple outdated atoms in one turn: one correct per atom, parallel tool calls allowed.
- Default library / key override
- Team Memory Settings or API key mcp_default_library_id; library-bound endpoints implicitly fix the library.
- Custom instructions mcp_custom_instructions
- Team-level append text (≤2000 chars) added to server instructions.
Configure at: each library → Settings → MCP Agent policy; team Memory Settings → MCP default library; /dashboard/keys → per-key default library.
HTTP integration
Custom MCP clients should follow the Streamable HTTP spec: POST requests need Accept including application/json and text/event-stream. This server primarily responds with application/json (JSON-only mode does not offer GET SSE by default). Cursor and similar clients should set Accept and Content-Type in mcp.json headers; otherwise HTTP 406 is common. Full example: skills/engra-memory/mcp.example.json.
Common Knowledge shared library · API key configuration (full guide) · Agent Skills (20+ agents) · ← Agent Memory REST API · API keys · Memory console