This MCP server enhances the standard Memory server with custom memory paths and timestamping capabilities, allowing you to create and manage knowledge graphs that capture interactions via a language model.
The easiest way to install the Knowledge Graph Memory Server is automatically via Smithery:
npx -y @smithery/cli install @BRO3886/mcp-memory-custom --client claude
If you prefer to install manually:
Clone the repository:
git clone [email protected]:BRO3886/mcp-memory-custom.git
cd mcp-memory-custom
Install the dependencies:
npm install
Build the project:
npm run build
To configure Claude Desktop to use this memory server, update your claude_desktop_config.json
or .cursor/mcp.json
file:
{
"mcpServers": {
"memory": {
"command": "node",
"args": ["/path/to/mcp-memory-custom/dist/index.js"]
}
}
}
You can specify different memory file paths for various projects. If not set, the server defaults to using memory.json
in the same directory as the script.
Add these instructions to your system prompt to properly utilize the custom memory features:
Follow these steps for each interaction:
1. The memoryFilePath for this project is /path/to/memory/project_name.json - always pass this path to the memory file operations (when creating entities, relations, or retrieving memory etc.)
2. User Identification:
- You should assume that you are interacting with default_user
- If you have not identified default_user, proactively try to do so.
3. Memory Retrieval:
- Always begin your chat by saying only "Remembering..." and retrieve all relevant information from your knowledge graph
- Always refer to your knowledge graph as your "memory"
4. Memory
- While conversing with the user, be attentive to any new information that falls into these categories:
a) Basic Identity (age, gender, location, job title, education level, etc.)
b) Behaviors (interests, habits, etc.)
c) Preferences (communication style, preferred language, etc.)
d) Goals (goals, targets, aspirations, etc.)
e) Relationships (personal and professional relationships up to 3 degrees of separation)
5. Memory Update:
- If any new information was gathered during the interaction, update your memory as follows:
a) Create entities for recurring organizations, people, and significant events, add timestamps to wherever required. You can get current timestamp via get_current_time
b) Connect them to the current entities using relations
c) Store facts about them as observations, add timestamps to observations via get_current_time
Run the server with:
node dist/index.js
The server communicates via standard input/output.
The memory server provides several tools that can be called with specific parameters:
Retrieves the current timestamp for use with memory entries.
Specifies a custom path for storing memory data:
/path/to/memory/project_name.json
Adds new nodes to the knowledge graph.
Establishes connections between entities in the graph.
Attaches properties or facts to entities.
Removes nodes from the knowledge graph.
Removes specific properties from entities.
Removes connections between entities.
Retrieves the entire knowledge graph or specific portions.
Finds entities matching specific criteria.
Provides detailed information about specific nodes.
Different projects can have their own dedicated memory files, improving organization and separation of contexts.
All interactions are automatically timestamped, providing chronological context to the knowledge graph.
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "memory" '{"command":"node","args":["/path/to/mcp-memory-custom/dist/index.js"]}'
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": "node",
"args": [
"/path/to/mcp-memory-custom/dist/index.js"
]
}
}
}
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": "node",
"args": [
"/path/to/mcp-memory-custom/dist/index.js"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect