All Frameworks
Claude Code / MCP Quickstart
Give Claude Code persistent memory using the Model Context Protocol.
1Install & Configure
Install the MCP server package and set your API key.
npm install agenticmemoryai
export AGENTICMEMORY_API_KEY="amk_your_key_here"
2Create the MCP Server
Build a lightweight MCP server that exposes AgenticMemory as tools for Claude Code.
// mcp-memory-server.js
const { AgenticMemory } = require('agenticmemoryai');
const { McpServer } = require('@modelcontextprotocol/sdk/server/mcp.js');
const { StdioServerTransport } = require('@modelcontextprotocol/sdk/server/stdio.js');
const { z } = require('zod');
const memory = new AgenticMemory();
const SPACE_ID = process.env.MEMORY_SPACE_ID;
const server = new McpServer({ name: 'agenticmemory', version: '1.0.0' });
server.tool('store',
'Store a message to short-term memory',
{ role: z.enum(['user', 'assistant', 'system']), content: z.string() },
async ({ role, content }) => {
await memory.store(SPACE_ID, { role, content });
return { content: [{ type: 'text', text: 'Stored.' }] };
}
);
server.tool('recall',
'Recall recent messages from memory',
{ limit: z.number().optional().default(20) },
async ({ limit }) => {
const msgs = await memory.recall(SPACE_ID, { limit });
return { content: [{ type: 'text', text: JSON.stringify(msgs.messages, null, 2) }] };
}
);
server.tool('search',
'Search memory by semantic relevance',
{ query: z.string(), limit: z.number().optional().default(10) },
async ({ query, limit }) => {
const results = await memory.search(SPACE_ID, query, { limit, scope: 'all' });
return { content: [{ type: 'text', text: JSON.stringify(results.results, null, 2) }] };
}
);
server.tool('remember',
'Store a long-term entry (fact, summary, decision)',
{ title: z.string(), content: z.string(), tags: z.array(z.string()).optional() },
async ({ title, content, tags }) => {
await memory.addEntry(SPACE_ID, { type: 'fact', title, content, tags: tags || [] });
return { content: [{ type: 'text', text: 'Saved to long-term memory.' }] };
}
);
server.tool('bootstrap',
'Load full context (messages, entries, entities, shared)',
{ query: z.string().optional() },
async ({ query }) => {
const ctx = await memory.bootstrap(SPACE_ID, {
entries: 5, messages: 20, semantic: !!query, query
});
return { content: [{ type: 'text', text: JSON.stringify(ctx, null, 2) }] };
}
);
const transport = new StdioServerTransport();
server.connect(transport);
3Add to Claude Code Config
Add the server to your .claude/settings.json or claude_desktop_config.json:
{
"mcpServers": {
"agenticmemory": {
"command": "node",
"args": ["mcp-memory-server.js"],
"env": {
"AGENTICMEMORY_API_KEY": "amk_your_key_here",
"MEMORY_SPACE_ID": "your_space_id"
}
}
}
}
Claude Code will now have access to store, recall, search, remember, and bootstrap tools.
Free tier: 1 space, 1K messages/month. Upgrade to Pro ($24.99/mo) for semantic search, entries, and entities.