MCP Memory
Memory and note-taking capabilities for persistent agent knowledge using Anthropic's memory MCP server
- Name: MCP Memory
- Package:
@modelcontextprotocol/server-memory - Provider: Anthropic
Overview
MCP Memory is a third-party Model Context Protocol server from Anthropic that provides persistent memory and note-taking capabilities for AI agents. It enables agents to store, retrieve, and manage information across conversations, creating a knowledge base that persists beyond individual sessions.
Persistent Knowledge
The memory MCP server allows agents to remember information from previous interactions, making them more contextually aware and helpful over time.
Usage with ADK TypeScript
import { McpMemory } from "@iqai/adk";
const toolset = McpMemory();
const tools = await toolset.getTools();import { McpToolset } from "@iqai/adk";
const toolset = new McpToolset({
name: "Memory MCP Client",
description: "Client for memory and note-taking",
transport: {
mode: "stdio",
command: "npx",
args: ["-y", "@modelcontextprotocol/server-memory"],
env: {
PATH: process.env.PATH || "",
},
},
});
const tools = await toolset.getTools();If you want to use this MCP with Claude Desktop, add this to your Claude Desktop configuration file:
MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"memory": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-memory"]
}
}
}Environment Variables
No environment variables are required for the memory MCP server.
Configuration Options
All MCP servers support these configuration options:
| Option | Type | Description |
|---|---|---|
env | object | Environment variables (see table above) |
debug | boolean | Enable debug logging |
description | string | Custom description |
retryOptions.maxRetries | number | Max retry attempts (default: 2) |
retryOptions.initialDelay | number | Initial retry delay in ms (default: 200) |
samplingHandler | SamplingHandler | Handler for MCP sampling requests |
Available Tools
create_entitiesentities:array
create_entitiesDescription
Create multiple new entities in the knowledge graph
create_relationsrelations:array
create_relationsDescription
Create multiple new relations between entities in the knowledge graph. Relations should be in active voice
add_observationsobservations:array
add_observationsDescription
Add new observations to existing entities in the knowledge graph
delete_entitiesentityNames:array
delete_entitiesDescription
Delete multiple entities and their associated relations from the knowledge graph
delete_observationsdeletions:array
delete_observationsDescription
Delete specific observations from entities in the knowledge graph
delete_relationsrelations:array
delete_relationsDescription
Delete multiple relations from the knowledge graph
read_graphNo parameters
read_graphNo parameters
Description
Read the entire knowledge graph
search_nodesquery:string
search_nodesDescription
Search for nodes in the knowledge graph based on a query
open_nodesnames:array
open_nodesDescription
Open specific nodes in the knowledge graph by their names
Complete Example
import { McpMemory, LlmAgent } from "@iqai/adk";
async function main() {
// Initialize memory toolset
const memoryToolset = McpMemory({
debug: true,
});
try {
// Get available tools
const tools = await memoryToolset.getTools();
// Create agent with memory capabilities
const agent = new LlmAgent({
name: "knowledge_assistant",
model: "gemini-2.5-flash",
description: "An agent with persistent memory capabilities",
instruction: `You have access to a persistent memory system.
Store important information that users share with you.
Retrieve relevant memories to provide contextual responses.
Always check your memory before answering questions.`,
tools,
});
// Use the agent
const response1 = await agent.ask(
"Remember that my favorite color is blue",
);
console.log(response1);
// Later conversation - agent can recall
const response2 = await agent.ask("What is my favorite color?");
console.log(response2);
} finally {
// Always cleanup
await memoryToolset.close();
}
}
main();Use Cases
- Personalized Assistants: Remember user preferences and context
- Knowledge Management: Build a persistent knowledge base
- Conversation History: Track important details across sessions
- Task Tracking: Remember ongoing tasks and their status
- Learning Agents: Accumulate knowledge over time
Best Practices
- Structured Storage: Use clear keys and organization for memories
- Regular Cleanup: Periodically review and remove outdated memories
- Privacy Consideration: Be mindful of sensitive information storage
- Search Optimization: Use descriptive keys for easier retrieval
- Error Handling: Handle cases where memories don't exist gracefully
Combining with Other MCPs
Memory works great when combined with other MCP servers:
import { McpMemory, McpFilesystem, LlmAgent } from "@iqai/adk";
// Combine memory with filesystem for persistent file knowledge
const memoryToolset = McpMemory();
const filesystemToolset = McpFilesystem({
env: { ALLOWED_DIRECTORIES: "/workspace" },
});
const [memoryTools, fileTools] = await Promise.all([
memoryToolset.getTools(),
filesystemToolset.getTools(),
]);
const agent = new LlmAgent({
name: "smart_file_manager",
model: "gemini-2.5-flash",
description: "File manager with memory of previous operations",
tools: [...memoryTools, ...fileTools],
});
// Cleanup
await Promise.all([memoryToolset.close(), filesystemToolset.close()]);Troubleshooting
| Issue | Solution |
|---|---|
| Memory not persisting | Check if server is properly initialized |
| Search returns no results | Verify search query and memory key names |
| Connection timeout | Ensure npm/npx is installed and in PATH |
| Duplicate memories | Use unique keys or update existing entries |