MCP Knowledge Graph serves as persistent memory for AI models through a local knowledge graph system. It allows you to store and retrieve information across conversations using entities, relations, and observations, working with Claude Code/Desktop and any MCP-compatible AI platform.
Add this configuration to your claude_desktop_config.json
or .claude.json
file:
{
"mcpServers": {
"memory": {
"command": "npx",
"args": [
"-y",
"mcp-knowledge-graph",
"--memory-path",
"/Users/yourusername/.aim/"
]
}
}
}
This creates memory files in your specified directory:
memory.jsonl
- Master Database (default for all operations)memory-work.jsonl
- Work databasememory-personal.jsonl
- Personal databaseTo use project-specific memory, create a .aim
directory in your project:
mkdir .aim
Now memory tools automatically use .aim/memory.jsonl
(project-local master database) when run from this project.
The system uses the following storage logic:
.aim
- Uses .aim/memory.jsonl
(project-local).aim
- Uses configured global directorymemory-work.jsonl
, memory-personal.jsonl
The master database is your primary memory store and is used by default when no specific database is requested.
Global Setup:
/Users/yourusername/.aim/
├── memory.jsonl # Master Database (default)
├── memory-work.jsonl # Work database
├── memory-personal.jsonl # Personal database
└── memory-health.jsonl # Health database
Project Setup:
my-project/
├── .aim/
│ ├── memory.jsonl # Project Master Database (default)
│ └── memory-work.jsonl # Project Work database
└── src/
aim_create_entities
- Add new people, projects, eventsaim_create_relations
- Link entities togetheraim_add_observations
- Add facts to existing entitiesaim_search_nodes
- Find information by keywordaim_read_graph
- View entire memoryaim_open_nodes
- Retrieve specific entities by nameaim_list_databases
- Show all available databases and current locationaim_delete_entities
- Remove entitiesaim_delete_observations
- Remove specific factsaim_delete_relations
- Remove connectionscontext
(optional) - Specify named database (work
, personal
, etc.). Defaults to master databaselocation
(optional) - Force project
or global
storage location. Defaults to auto-detectionHere are examples of how to use the memory tools:
// Master Database (default - no context needed)
aim_create_entities({
entities: [{
name: "John_Doe",
entityType: "person",
observations: ["Met at conference"]
}]
})
// Work database
aim_create_entities({
context: "work",
entities: [{
name: "Q4_Project",
entityType: "project",
observations: ["Due December 2024"]
}]
})
// Personal database
aim_create_entities({
context: "personal",
entities: [{
name: "Mom",
entityType: "person",
observations: ["Birthday March 15th"]
}]
})
// Master database in specific location
aim_create_entities({
location: "global",
entities: [{
name: "Important_Info",
entityType: "reference",
observations: ["Stored in global master database"]
}]
})
Use the aim_list_databases
tool to see all available databases:
aim_list_databases()
This returns information like:
{
"project_databases": [
"default", // Master Database (project-local)
"project-work" // Named database
],
"global_databases": [
"default", // Master Database (global)
"work",
"personal",
"health"
],
"current_location": "project (.aim directory detected)"
}
You can specify any directory for your memory files:
{
"mcpServers": {
"memory": {
"command": "npx",
"args": [
"-y",
"mcp-knowledge-graph",
"--memory-path",
"/Users/yourusername/Dropbox/.aim"
]
}
}
}
To avoid confirmation prompts for certain operations:
{
"mcpServers": {
"memory": {
"command": "npx",
"args": [
"-y",
"mcp-knowledge-graph",
"--memory-path",
"/Users/yourusername/.aim"
],
"autoapprove": [
"aim_create_entities",
"aim_create_relations",
"aim_add_observations",
"aim_search_nodes",
"aim_read_graph",
"aim_open_nodes",
"aim_list_databases"
]
}
}
}
If you see "File does not contain required _aim safety marker" error:
{"type":"_aim","source":"mcp-knowledge-graph"}
as first lineIf memories are stored in unexpected locations:
.aim
folder (uses project-local storage)--memory-path
directoryaim_list_databases
to see current locationls .aim/
or ls /Users/yourusername/.aim/
to see your memory filesIf you have too many similar databases:
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "memory" '{"command":"npx","args":["-y","mcp-knowledge-graph","--memory-path","/Users/shaneholloman/Dropbox/shane/db/memory.jsonl"],"autoapprove":["create_entities","create_relations","add_observations","delete_entities","delete_observations","delete_relations","read_graph","search_nodes","open_nodes"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"memory": {
"command": "npx",
"args": [
"-y",
"mcp-knowledge-graph",
"--memory-path",
"/Users/shaneholloman/Dropbox/shane/db/memory.jsonl"
],
"autoapprove": [
"create_entities",
"create_relations",
"add_observations",
"delete_entities",
"delete_observations",
"delete_relations",
"read_graph",
"search_nodes",
"open_nodes"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"memory": {
"command": "npx",
"args": [
"-y",
"mcp-knowledge-graph",
"--memory-path",
"/Users/shaneholloman/Dropbox/shane/db/memory.jsonl"
],
"autoapprove": [
"create_entities",
"create_relations",
"add_observations",
"delete_entities",
"delete_observations",
"delete_relations",
"read_graph",
"search_nodes",
"open_nodes"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect