@datafrog-io/n2n-memory 1.0.0 → 1.0.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/LICENSE CHANGED
@@ -1,15 +1,21 @@
1
- ISC License
1
+ MIT License
2
2
 
3
- Copyright (c) 2025, James
3
+ Copyright (c) 2024 DataFrog IO
4
4
 
5
- Permission to use, copy, modify, and/or distribute this software for any
6
- purpose with or without fee is hereby granted, provided that the above
7
- copyright notice and this permission notice appear in all copies.
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
8
11
 
9
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,60 +1,125 @@
1
- # N2N 记忆 (N2N Memory) MCP 服务
1
+ # n2n-memory
2
+
3
+ [English](#english) | [中文](#中文)
4
+
5
+ ---
6
+
7
+ <a name="english"></a>
8
+ ## English
9
+
10
+ A specialized MCP server designed to solve "memory pollution" during AI-assisted cross-project development. It persists AI's cognitive fragments directly within each project's own directory.
11
+
12
+ ### 🌟 Key Highlights
13
+ - **Project-Level Physical Isolation**: Memory files are stored at `[Project Root]/.mcp/memory.json`.
14
+ - **Git-Friendly**: JSON data is automatically sorted by key to generate clean and readable `git diff`.
15
+ - **Tool Agnostic**: Uses the `.mcp` naming convention, not tied to any specific AI brand or IDE plugin.
16
+ - **Assets for Your Code**: Memory stays with your code; team members can share AI's understanding of the architecture by simply pulling the repository.
17
+
18
+ ### 🚀 Quick Start
19
+
20
+ #### 1. Installation & Config (IDE / Claude Desktop)
21
+
22
+ The easiest way to use this is via `npx`:
23
+
24
+ ##### Claude Desktop
25
+ File Path: `%APPDATA%\Claude\claude_desktop_config.json`
26
+
27
+ ```json
28
+ {
29
+ "mcpServers": {
30
+ "n2n-memory": {
31
+ "command": "npx",
32
+ "args": ["-y", "@datafrog-io/n2n-memory"]
33
+ }
34
+ }
35
+ }
36
+ ```
37
+
38
+ ##### Cursor / VSCode (MCP Plugin)
39
+ Add in the MCP settings panel:
40
+ - **Name**: `n2n-memory`
41
+ - **Type**: `command`
42
+ - **Command**: `npx -y @datafrog-io/n2n-memory`
43
+
44
+ #### 2. Usage Guide
45
+
46
+ This service is path-driven. AI assistants should pay attention to:
47
+
48
+ 1. **Absolute Paths**: When calling any `n2n_*` tool, the absolute path of the current project root (`projectPath`) must be provided.
49
+ 2. **Auto Storage**: Memory is automatically saved to `[ProjectPath]/.mcp/memory.json`.
50
+ 3. **Collaboration**: It is recommended to commit `.mcp/memory.json` to your Git repository to share the knowledge graph with your team.
51
+
52
+ ##### Available Tools:
53
+ - `n2n_add_entities`: Create new entities.
54
+ - `n2n_add_observations`: Append observations or facts.
55
+ - `n2n_create_relations`: Establish connections between entities.
56
+ - `n2n_read_graph`: Read the entire knowledge graph.
57
+ - `n2n_search`: Search the graph via keywords (names, types, observations).
58
+
59
+ ---
60
+
61
+ <a name="中文"></a>
62
+ ## 中文
2
63
 
3
64
  这是一个专为解决 AI 跨项目开发时“记忆污染”而设计的 MCP 服务。它将 AI 的认知碎片持久化在每个项目自己的目录下。
4
65
 
5
- ## 核心亮点
66
+ ### 🌟 核心亮点
6
67
  - **项目级物理隔离**: 记忆文件存储在 `[项目根目录]/.mcp/memory.json`。
7
68
  - **Git 版本可控**: 自动对 JSON 数据进行字典序排序,生成清晰的 `git diff`。
8
69
  - **工具中立**: 使用 `.mcp` 命名,不绑定任何特定 AI 品牌或 IDE 插件。
9
- - **资产化**: 记忆随代码走,团队成员拉取仓库即可共享 AI 对架构的理解。
70
+ - **知识资产化**: 记忆随代码走,团队成员拉取仓库即可共享 AI 对架构的理解。
10
71
 
11
- ## 快速配置
72
+ ### 🚀 快速配置
12
73
 
13
- ### 1. JSON 配置 (IDE / Claude Desktop)
74
+ #### 1. JSON 配置 (IDE / Claude Desktop)
14
75
 
15
- 根据您使用的客户端,在相应的 MCP 配置文件中添加以下内容:
76
+ 推荐使用 `npx` 模式直接运行:
16
77
 
17
- #### Claude Desktop
78
+ ##### Claude Desktop
18
79
  配置文件路径: `%APPDATA%\Claude\claude_desktop_config.json`
19
80
 
20
81
  ```json
21
82
  {
22
83
  "mcpServers": {
23
84
  "n2n-memory": {
24
- "command": "node",
25
- "args": ["D:/DevSpace/MCP_N2N_Memory/build/index.js"]
85
+ "command": "npx",
86
+ "args": ["-y", "@datafrog-io/n2n-memory"]
26
87
  }
27
88
  }
28
89
  }
29
90
  ```
30
91
 
31
- #### Cursor / VSCode (MCP 插件)
92
+ ##### Cursor / VSCode (MCP 插件)
32
93
  在 MCP 设置面板中添加:
33
94
  - **Name**: `n2n-memory`
34
95
  - **Type**: `command`
35
- - **Command**: `node D:/DevSpace/MCP_N2N_Memory/build/index.js`
96
+ - **Command**: `npx -y @datafrog-io/n2n-memory`
36
97
 
37
- ### 2. 使用指南 (Usage Guide)
98
+ #### 2. 使用指南 (Usage Guide)
38
99
 
39
100
  本服务完全由路径驱动,AI 助手在调用工具时需要关注以下几点:
40
101
 
41
102
  1. **绝对路径**: 调用任何 `n2n_*` 工具时,必须传入当前项目根目录的**绝对路径**(`projectPath`)。
42
103
  2. **自动存储**: 记忆将自动保存在 `[项目路径]/.mcp/memory.json`。
43
- 3. **协作共享**: 建议将 `.mcp/memory.json` 提交至 Git 仓库,以便团队成员共享 AI 对代码架构的理解。
104
+ 3. **协作共享**: 建议将 `.mcp/memory.json` 提交至 Git 仓库,以便团队成员共享知识图谱。
44
105
 
45
- #### 常用场景指令示例:
106
+ ##### 常用工具示例:
46
107
  - `n2n_add_entities`: 创建新实体。
47
108
  - `n2n_add_observations`: 追加观测事实。
48
109
  - `n2n_create_relations`: 建立实体间联系。
49
110
  - `n2n_read_graph`: 读取完整图谱。
50
111
  - `n2n_search`: 关键词搜索图谱(支持实体名、类型、观测事实)。
51
- - *"将这个新发现的 Bug 记录到内存中"* -> AI 将调用 `n2n_add_observations`。
52
112
 
53
- ## 文档指引 (Docs)
113
+ ---
114
+
115
+ ## 📖 Related Docs | 文档指引
116
+
117
+ - **[Design Solution | 设计方案](./docs/DESIGN.md)**: Why project-level isolation?
118
+ - **[API Reference | API 参考手册](./docs/API_REFERENCE.md)**: Tool descriptions and schema.
119
+ - **[Development | 开发指南](./docs/DEVELOPMENT.md)**: How to build, test and extend.
54
120
 
55
- - **[设计方案](./docs/DESIGN.md)**: 了解为什么要进行物理隔离以及核心架构设计。
56
- - **[API 参考手册](./docs/API_REFERENCE.md)**: 详细描述了可用的 Tool 及其参数结构。
57
- - **[开发与维护](./docs/DEVELOPMENT.md)**: 指导如何构建、测试和扩展本项目。
121
+ ## 📄 License | 许可证
122
+ This project is licensed under the [MIT License](./LICENSE). | 本项目采用 [MIT 许可证](./LICENSE)。
58
123
 
59
- ## 许可证
60
- 本项目采用 [ISC 许可证](./LICENSE)
124
+ ---
125
+ **N2N Studio [@n2ns](https://github.com/n2ns)**
@@ -1,4 +1,4 @@
1
- # N2N Memory API 参数参考手册
1
+ # n2n-memory API 参考手册
2
2
 
3
3
  本项目提供了一套基于项目本地路径的知识图谱管理工具。所有工具均要求传入 `projectPath` 以确保记忆的物理隔离。
4
4
 
package/docs/DESIGN.md CHANGED
@@ -1,4 +1,4 @@
1
- # N2N Memory (N2N 记忆) 开发方案
1
+ # n2n-memory 开发方案
2
2
 
3
3
  ## 1. 背景与目标
4
4
  解决全局 MCP Memory Server 导致的跨项目“记忆污染”与幻觉问题。通过将 AI 的认知碎片直接持久化在项目源码目录下,实现项目级的物理隔离与知识共享。
@@ -1,4 +1,4 @@
1
- # 开发与维护手册
1
+ # n2n-memory 开发指南
2
2
 
3
3
  本手册记录了 N2N Memory MCP Server 的日常开发、测试及构建流程。
4
4
 
package/package.json CHANGED
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "@datafrog-io/n2n-memory",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "bin": {
7
7
  "n2n-memory": "build/index.js"
8
8
  },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/n2ns/n2n-memory.git"
12
+ },
9
13
  "type": "module",
10
14
  "scripts": {
11
15
  "build": "tsc",
@@ -16,7 +20,7 @@
16
20
  },
17
21
  "keywords": [],
18
22
  "author": "",
19
- "license": "ISC",
23
+ "license": "MIT",
20
24
  "dependencies": {
21
25
  "@modelcontextprotocol/sdk": "^1.25.1",
22
26
  "fs-extra": "^11.3.3",
@@ -39,4 +43,4 @@
39
43
  "typescript": "^5.9.3",
40
44
  "typescript-eslint": "^8.50.0"
41
45
  }
42
- }
46
+ }