N2N Memory
Context as code. Memory as asset.
N2N Memory is a specialized Model Context Protocol (MCP) server designed to eliminate "memory pollution" during AI-assisted cross-project development. Unlike global memory solutions, N2N Memory persists cognitive fragments directly within each project's own directory, ensuring that your AI assistant maintains a clean, project-specific knowledge graph that evolves alongside your codebase.
Key Features
- Project-Level Isolation: All memory files are stored locally at
[Project Root]/.mcp/memory.json, preventing context leakage between different repositories. - Git-Optimized Storage: JSON data is automatically sorted by key to ensure clean, readable
git diffoutputs, making memory files easy to review and audit. - Tool Agnostic: Built on the
.mcpnaming convention, this server works across various AI ecosystems and IDE plugins without vendor lock-in. - Collaborative Context: By committing the
.mcp/memory.jsonfile to your repository, team members can instantly share the AI's understanding of the architecture and logic. - Universal Compatibility: Fully supports MCP-enabled models, including
Claude 3.5/4,Gemini 1.5 Pro/Flash,GPT-4o/5, andDeepSeek V3. - Privacy-First Architecture: Designed for security by keeping all data local and isolated within your controlled environment.
Installation and Configuration
The most efficient way to deploy N2N Memory is via npx.
Claude Desktop
To integrate with Claude Desktop, edit your configuration file located at %APPDATA%\Claude\claude_desktop_config.json (Windows) or ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):
{
"mcpServers": {
"n2n-memory": {
"command": "npx",
"args": ["-y", "@datafrog-io/n2n-memory"]
}
}
}
Cursor or VSCode (MCP Plugin)
Add N2N Memory through your IDE's MCP settings panel:
- Name:
n2n-memory - Type:
command - Command:
npx -y @datafrog-io/n2n-memory
Usage Guide
N2N Memory is path-driven. To ensure the AI assistant functions correctly, keep the following protocols in mind:
- Absolute Paths: When invoking any
n2n_*tool, you must provide the absolute path of the current project root as theprojectPathparameter. - Automatic Persistence: Memory is saved automatically to
[ProjectPath]/.mcp/memory.json. You do not need to manually trigger save events. - Team Integration: We recommend committing the
.mcp/directory to your Git repository to provide a shared "knowledge graph" for all contributors.
Available Tools
n2n_add_entities: Define and create new entities within the knowledge graph.n2n_add_observations: Append specific facts, observations, or logic constraints to existing entities.n2n_create_relations: Map the dependencies and connections between different entities.n2n_read_graph: Retrieve the project memory and active context (SupportssummaryModeandpagination).n2n_get_graph_summary: Access a lightweight index of all entities for rapid context gathering (Supportspagination).n2n_update_context: Keep the AI informed on the current task status and planned next steps.n2n_search: Perform keyword-based searches across the memory graph (Supportspagination).n2n_open_nodes: Directly retrieve specific entities by their unique names.
Versionshistorie
Changelog
All notable changes to n2n-memory will be documented in this file.
[1.1.0] - 2024-12-19
Added
- Bilingual Support: Full documentation now available in both English and Chinese.
- Enhanced Reliability:
- Data Safety: Improved mechanisms to prevent data corruption during crashes or power failures.
- Concurrency: Better handling of multiple IDE windows accessing the same project.
- Smarter Context:
- Hot/Cold Memory: Separated active task context from long-term project knowledge for better performance.
- Auto-Sync: Enforced "Memory Update before Git Commit" protocol to keep AI context in sync with code.
[1.0.0] - Prior to 2024-12-19
Released
- Initial Release: Project-local memory isolation for AI Agents.
- Core Tools:
n2n_add_entities,n2n_read_graph,n2n_search. - Persistence: Stores knowledge graph at
[Project Root]/.mcp/memory.json.