All Frameworks
Cursor / Windsurf Quickstart
Give Cursor and Windsurf persistent memory across coding sessions via MCP.
1Install the MCP Server
Install the SDK globally (or in your project) and set your API key.
npm install -g agenticmemoryai
export AGENTICMEMORY_API_KEY="amk_your_key_here"
2Create the MCP Server Script
Save this as mcp-memory-server.js in your project root:
// 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 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',
{ 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 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', 'Save a fact to long-term memory',
{ 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.' }] };
}
);
server.tool('bootstrap', 'Load full context',
{ 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);
3Configure Cursor MCP
Add this to your .cursor/mcp.json (or Windsurf equivalent):
{
"mcpServers": {
"agenticmemory": {
"command": "node",
"args": ["mcp-memory-server.js"],
"env": {
"AGENTICMEMORY_API_KEY": "amk_your_key_here",
"MEMORY_SPACE_ID": "your_space_id"
}
}
}
}
Once configured, Cursor will have access to these memory tools:
store— Save conversation messagesrecall— Retrieve recent messagessearch— Semantic search across all memoryremember— Save long-term facts, summaries, decisionsbootstrap— Load full context at session start
Free tier: 1 space, 1K messages/month. Upgrade to Pro ($24.99/mo) for semantic search, entries, and entities.