convez.ai
MCP Server
n2ns

n2n-memory

n2ns/n2n-memory

Ver no GitHub
BomPluginScore · de 0 a 100

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-memory

1 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

Estrelas
11
Forks
2
Acompanhando
0
Saúde
100%
Último commit
há 3 semanas
Versão
v1.2.1
Issues abertas
0
Contribuidores
2

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.

npm version npm total downloads license MCP Protocol node version

中文版


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=debug only when troubleshooting local path resolution.

2. Usage guide

This service is path-driven. AI assistants should pay attention to:

  1. Absolute Project Root: When calling any n2n_* tool, provide the absolute path of the current project root or workspace top-level directory (projectPath).
  2. Initialization Handshake: If .mcp does not exist yet, call the tool again with confirmNewProjectRoot set to the detected root returned by the server.
  3. Auto Storage: Durable memory is saved to [ProjectPath]/.mcp/memory.json; active task context is saved to [ProjectPath]/.mcp/context.json.
  4. Collaboration: Commit .mcp/memory.json when the knowledge graph should be shared with the team. Commit context.json only 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, and n2n_delete_relations are destructive and should be governed by review workflows.
  • Keep context.json uncommitted by default, and commit .mcp/memory.json only 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=debug when diagnosing path issues.
  • See SECURITY.md for vulnerability reporting.

📖 Related docs

📄 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.

Ver o original no GitHub

Bom para

Relacionados