n2n-memory
n2ns/n2n-memory
Project-local MCP memory server for AI coding agents. Knowledge graph stored in .mcp/ inside each repo — isolated per project, Git-friendly JSON, dual-buffer (durable graph + active context).
Instalação
npx convez-ai n2ns/n2n-memory1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.
Métricas
README
A tradução para o português deste README ainda está na fila.
n2n-memory
Project-local knowledge-graph memory MCP server from N2NS Lab for AI coding agents.
Context as code. Memory as asset.
n2n-memory is an open-source, local-first Model Context Protocol (MCP) memory server for AI coding assistants. It prevents cross-project memory pollution by storing durable project knowledge in .mcp/memory.json and active task context in .mcp/context.json inside each repository.
💡 What is n2n-memory?
n2n-memory gives AI coding tools a project-local knowledge graph they can read and update through MCP. Memory and context are stored inside each repository under .mcp/, keeping them isolated, Git-friendly, and reviewable.
- Restore project context at the start of an AI coding session.
- Preserve architecture decisions, implementation notes, and known pitfalls.
- Share durable project memory with teammates through Git.
- Keep memory isolated per repository when working across many projects.
🚀 Quick start
1. Configure your MCP client
Claude Desktop
File Path: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"n2n-memory": {
"command": "npx",
"args": ["-y", "n2n-memory"]
}
}
}
Cursor / VS Code
Add in the MCP settings panel:
- Name:
n2n-memory - Type:
command - Command:
npx -y n2n-memory
Other MCP clients
- The server uses stdio MCP and can be wired to any MCP client that supports local command execution.
- If your client supports it, set
N2N_LOG_LEVEL=debugonly when troubleshooting local path resolution.
2. Usage guide
This service is path-driven. AI assistants should pay attention to:
- Absolute Project Root: When calling any
n2n_*tool, provide the absolute path of the current project root or workspace top-level directory (projectPath). - Initialization Handshake: If
.mcpdoes not exist yet, call the tool again withconfirmNewProjectRootset to the detected root returned by the server. - Auto Storage: Durable memory is saved to
[ProjectPath]/.mcp/memory.json; active task context is saved to[ProjectPath]/.mcp/context.json. - Collaboration: Commit
.mcp/memory.jsonwhen the knowledge graph should be shared with the team. Commitcontext.jsononly if your workflow wants active task state shared.
Recommended .gitignore policy for teams that want to share durable memory:
.mcp/context.json
!.mcp/
!.mcp/memory.json
If your project memory may contain private implementation details, keep the whole .mcp/ directory ignored.
Available tools
- Graph writes: add entities, observations, and relations to build the knowledge graph.
- Graph reads: read the full graph, get a lightweight summary, search, or open specific entities.
- Context: update active task state before commits and handoffs.
- Maintenance: delete entities, observations, or relations; export the graph to Markdown.
See Tools reference for parameter schemas and usage notes.
🔐 Security and governance notes
n2n_delete_entities,n2n_delete_observations, andn2n_delete_relationsare destructive and should be governed by review workflows.- Keep
context.jsonuncommitted by default, and commit.mcp/memory.jsononly when team sharing is intentional. - Existing but unreadable JSON files are treated as data integrity errors, not as empty memory.
- Export paths must be relative and must stay inside the project root.
- Relations that point to missing entities are rejected.
- Generic README-only folders are not treated as project roots; use a real project marker such as
.git,package.json, or language-specific build files. - Full local paths are hidden from server logs by default. Set
N2N_LOG_LEVEL=debugwhen diagnosing path issues. - See SECURITY.md for vulnerability reporting.
📖 Related docs
- Design: Why project-level isolation?
- Tools reference: MCP tool parameter schemas and usage notes.
- Development: How to build, test and extend.
- Roadmap: Planned features and what's coming next.
- Changelog: Version history and incident recovery.
- Contributing: How to report issues and contribute.
- Security: How to report vulnerabilities.
📄 License
This project is licensed under the MIT License.
Built by N2NS Lab, the open-source lab of datafrog.io for practical AI developer tools.