@datafrog-io/n2n-memory 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -4
- package/README.md +114 -9
- package/build/core/memory-manager.js +66 -51
- package/build/core/memory-manager.js.map +1 -1
- package/build/core/memory-service.js +59 -39
- package/build/core/memory-service.js.map +1 -1
- package/build/handlers/mcp-handlers.js +140 -20
- package/build/handlers/mcp-handlers.js.map +1 -1
- package/build/index.js +23 -7
- package/build/index.js.map +1 -1
- package/build/tools/definitions.js +17 -12
- package/build/tools/definitions.js.map +1 -1
- package/build/tools/schemas.js +1 -1
- package/build/tools/schemas.js.map +1 -1
- package/build/utils/logging.js +27 -0
- package/build/utils/logging.js.map +1 -0
- package/build/utils/path-utils.js +21 -9
- package/build/utils/path-utils.js.map +1 -1
- package/docs/API_REFERENCE.md +283 -0
- package/docs/API_REFERENCE_zh.md +283 -0
- package/docs/CHANGELOG_zh.md +108 -0
- package/docs/DESIGN.md +72 -0
- package/docs/DESIGN_zh.md +72 -0
- package/docs/DEVELOPMENT.md +98 -0
- package/docs/DEVELOPMENT_zh.md +98 -0
- package/docs/README_zh.md +195 -0
- package/llms.txt +83 -0
- package/package.json +55 -13
package/llms.txt
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# n2n-memory
|
|
2
|
+
|
|
3
|
+
> Project-local MCP memory server for AI coding agents.
|
|
4
|
+
|
|
5
|
+
n2n-memory is an open-source Model Context Protocol (MCP) server that stores AI coding memory inside each project repository. It prevents cross-project memory pollution by keeping durable project knowledge in `.mcp/memory.json` and active task context in `.mcp/context.json`.
|
|
6
|
+
|
|
7
|
+
## Search intent coverage
|
|
8
|
+
|
|
9
|
+
- AI coding memory server
|
|
10
|
+
- project-local memory graph
|
|
11
|
+
- MCP server for AI coding agents
|
|
12
|
+
- local-first context storage
|
|
13
|
+
- repository-scoped memory for Claude/Cursor/VS Code
|
|
14
|
+
|
|
15
|
+
## What it is
|
|
16
|
+
|
|
17
|
+
- A local-first MCP memory server for AI coding assistants.
|
|
18
|
+
- A Git-friendly project knowledge graph stored as JSON.
|
|
19
|
+
- A tool-agnostic memory layer for Claude Desktop, Cursor, VS Code MCP clients, and other stdio MCP-compatible tools.
|
|
20
|
+
- A practical AI developer tool built for multi-project software development.
|
|
21
|
+
|
|
22
|
+
## Use cases
|
|
23
|
+
|
|
24
|
+
- Restore project context at the start of an AI coding session.
|
|
25
|
+
- Preserve architecture decisions, implementation notes, pitfalls, and active task state.
|
|
26
|
+
- Share durable AI project memory with a team through Git.
|
|
27
|
+
- Avoid memory pollution from global AI assistant memory stores.
|
|
28
|
+
- Query a project-local knowledge graph through MCP tools.
|
|
29
|
+
|
|
30
|
+
## Not for
|
|
31
|
+
|
|
32
|
+
- Cloud memory synchronization.
|
|
33
|
+
- Global personal memory across unrelated projects.
|
|
34
|
+
- Replacing source code search, static analysis, or repository maps.
|
|
35
|
+
- Replacing a vector database or semantic retrieval platform.
|
|
36
|
+
|
|
37
|
+
## Disambiguation
|
|
38
|
+
|
|
39
|
+
This project is an MCP memory server. It is not related to any network/VPN software named `n2n`.
|
|
40
|
+
|
|
41
|
+
## Storage model
|
|
42
|
+
|
|
43
|
+
- `.mcp/memory.json`: durable knowledge graph with entities, observations, and relations.
|
|
44
|
+
- `.mcp/context.json`: hot task context with active task, status, next steps, and update time.
|
|
45
|
+
- Existing unreadable JSON files are treated as data integrity errors.
|
|
46
|
+
- Exported files must stay inside the project root.
|
|
47
|
+
|
|
48
|
+
## Install
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npx -y @datafrog-io/n2n-memory
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Primary MCP tools
|
|
55
|
+
|
|
56
|
+
- `n2n_read_graph`
|
|
57
|
+
- `n2n_get_graph_summary`
|
|
58
|
+
- `n2n_add_entities`
|
|
59
|
+
- `n2n_add_observations`
|
|
60
|
+
- `n2n_create_relations`
|
|
61
|
+
- `n2n_update_context`
|
|
62
|
+
- `n2n_search`
|
|
63
|
+
- `n2n_open_nodes`
|
|
64
|
+
- `n2n_delete_entities`
|
|
65
|
+
- `n2n_delete_observations`
|
|
66
|
+
- `n2n_delete_relations`
|
|
67
|
+
- `n2n_export_markdown`
|
|
68
|
+
|
|
69
|
+
## Key docs
|
|
70
|
+
|
|
71
|
+
- `README.md`: overview, setup, workflow, FAQ.
|
|
72
|
+
- `docs/API_REFERENCE.md`: full MCP tool reference.
|
|
73
|
+
- `docs/DESIGN.md`: architecture and storage design.
|
|
74
|
+
- `docs/DEVELOPMENT.md`: development, testing, CI, publishing.
|
|
75
|
+
- `CHANGELOG.md`: release history.
|
|
76
|
+
|
|
77
|
+
## Package and repository
|
|
78
|
+
|
|
79
|
+
- npm: `@datafrog-io/n2n-memory`
|
|
80
|
+
- GitHub: `https://github.com/n2ns/n2n-memory`
|
|
81
|
+
- License: MIT
|
|
82
|
+
|
|
83
|
+
Built by N2NS Lab, the open-source lab from Datafrog, focused on practical AI developer tools.
|
package/package.json
CHANGED
|
@@ -1,29 +1,73 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datafrog-io/n2n-memory",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "Project-local knowledge-graph memory MCP server for AI context isolation.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"n2n-memory": "build/index.js"
|
|
8
8
|
},
|
|
9
|
-
"
|
|
9
|
+
"files": [
|
|
10
|
+
"build",
|
|
11
|
+
"docs",
|
|
12
|
+
"README.md",
|
|
13
|
+
"llms.txt",
|
|
14
|
+
"CHANGELOG.md",
|
|
15
|
+
"LICENSE"
|
|
16
|
+
],
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/n2ns/n2n-memory.git"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/n2ns/n2n-memory#readme",
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/n2ns/n2n-memory/issues"
|
|
24
|
+
},
|
|
10
25
|
"publishConfig": {
|
|
11
26
|
"access": "public",
|
|
12
27
|
"provenance": true
|
|
13
28
|
},
|
|
14
29
|
"type": "module",
|
|
15
30
|
"scripts": {
|
|
16
|
-
"
|
|
31
|
+
"clean": "node -e \"require('node:fs').rmSync('build', { recursive: true, force: true })\"",
|
|
32
|
+
"build": "npm run clean && tsc -p tsconfig.build.json",
|
|
17
33
|
"start": "node build/index.js",
|
|
18
34
|
"dev": "tsx src/index.ts",
|
|
19
|
-
"test": "
|
|
20
|
-
"lint": "eslint src/**/*.ts"
|
|
35
|
+
"test": "vitest run",
|
|
36
|
+
"lint": "eslint src/**/*.ts",
|
|
37
|
+
"audit": "npm audit",
|
|
38
|
+
"audit:prod": "npm audit --omit=dev",
|
|
39
|
+
"pack:dry-run": "npm pack --dry-run",
|
|
40
|
+
"check": "npm run lint && npm test && npm run build && npm run audit && npm run pack:dry-run",
|
|
41
|
+
"prepublishOnly": "npm run check"
|
|
21
42
|
},
|
|
22
43
|
"keywords": [
|
|
23
44
|
"mcp",
|
|
45
|
+
"mcp-server",
|
|
46
|
+
"model-context-protocol",
|
|
47
|
+
"modelcontextprotocol",
|
|
24
48
|
"memory",
|
|
49
|
+
"agent-memory",
|
|
50
|
+
"ai-memory",
|
|
51
|
+
"project-memory",
|
|
52
|
+
"project-local-memory",
|
|
53
|
+
"project-local-knowledge-graph",
|
|
54
|
+
"mcp-memory-server",
|
|
55
|
+
"coding-agent-memory",
|
|
56
|
+
"repository-memory",
|
|
57
|
+
"repository-context",
|
|
58
|
+
"context-memory",
|
|
59
|
+
"local-first-memory",
|
|
60
|
+
"coding-assistant-memory",
|
|
61
|
+
"project-memory-server",
|
|
25
62
|
"context",
|
|
26
63
|
"ai",
|
|
64
|
+
"ai-developer-tools",
|
|
65
|
+
"coding-agent",
|
|
66
|
+
"local-first",
|
|
67
|
+
"claude",
|
|
68
|
+
"claude-desktop",
|
|
69
|
+
"cursor",
|
|
70
|
+
"vscode",
|
|
27
71
|
"knowledge-graph"
|
|
28
72
|
],
|
|
29
73
|
"author": "DataFrog IO",
|
|
@@ -33,28 +77,26 @@
|
|
|
33
77
|
"npm": ">=10.0.0"
|
|
34
78
|
},
|
|
35
79
|
"dependencies": {
|
|
36
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
80
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
37
81
|
"@types/proper-lockfile": "^4.1.4",
|
|
38
82
|
"async-mutex": "^0.5.0",
|
|
39
|
-
"fs-extra": "^11.3.
|
|
83
|
+
"fs-extra": "^11.3.5",
|
|
40
84
|
"proper-lockfile": "^4.1.2",
|
|
41
|
-
"zod": "^4.
|
|
85
|
+
"zod": "^4.4.3"
|
|
42
86
|
},
|
|
43
87
|
"devDependencies": {
|
|
44
88
|
"@types/chai": "^5.2.3",
|
|
45
89
|
"@types/fs-extra": "^11.0.4",
|
|
46
|
-
"@types/mocha": "^10.0.10",
|
|
47
90
|
"@types/node": "^25.0.3",
|
|
48
91
|
"@types/sinon": "^21.0.0",
|
|
49
92
|
"@typescript-eslint/eslint-plugin": "^8.50.0",
|
|
50
93
|
"@typescript-eslint/parser": "^8.50.0",
|
|
51
94
|
"chai": "^6.2.1",
|
|
52
95
|
"eslint": "^9.39.2",
|
|
53
|
-
"mocha": "^11.7.5",
|
|
54
96
|
"sinon": "^21.0.1",
|
|
55
|
-
"ts-node": "^10.9.2",
|
|
56
97
|
"tsx": "^4.21.0",
|
|
57
98
|
"typescript": "^5.9.3",
|
|
58
|
-
"typescript-eslint": "^8.50.0"
|
|
99
|
+
"typescript-eslint": "^8.50.0",
|
|
100
|
+
"vitest": "^4.1.8"
|
|
59
101
|
}
|
|
60
|
-
}
|
|
102
|
+
}
|