n2n-nexus 0.4.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.
@@ -0,0 +1,285 @@
1
+ # n2n-nexus
2
+
3
+ N2NS Lab 出品的本地优先 MCP 协同中枢,用于让多个 AI 助手、IDE 和运行环境共享同一份项目协作状态。
4
+
5
+ [![npm version](https://img.shields.io/npm/v/n2n-nexus)](https://www.npmjs.com/package/n2n-nexus)
6
+ [![npm total downloads](https://img.shields.io/npm/dt/n2n-nexus)](https://www.npmjs.com/package/n2n-nexus)
7
+ [![license](https://img.shields.io/github/license/n2ns/n2n-nexus)](https://github.com/n2ns/n2n-nexus/blob/main/LICENSE)
8
+ [![MCP Protocol](https://img.shields.io/badge/MCP-Protocol-blue)](https://modelcontextprotocol.io)
9
+ [![node version](https://img.shields.io/node/v/n2n-nexus)](https://nodejs.org)
10
+ [![DataFrog.io](https://datafrog.io/badges/datafrog.svg)](https://datafrog.io)
11
+
12
+ [English README](../README.md)
13
+
14
+ ---
15
+
16
+ > **一个 daemon,多个助手,共享项目状态。**
17
+
18
+ n2n-nexus 是一个开源的 Model Context Protocol (MCP) 协同服务器,适合同时使用多个 AI 编码助手的开发者和团队。一个长期运行的本地 daemon 保存项目状态、会议、消息、任务、共享文档和项目资产;每个 IDE 或 AI 助手通过轻量 MCP 适配器连接到同一个 daemon。
19
+
20
+ 当 Claude Desktop、Claude Code、Cursor、VS Code、Windsurf、JetBrains 或其它 MCP 客户端需要共享本地协作状态,而不是各自保留孤立聊天上下文时,可以使用 n2n-nexus。
21
+
22
+ ## 搜索定位
23
+
24
+ 如果你在搜索:
25
+
26
+ - 多 AI 助手协同 MCP
27
+ - 多 agent 本地协作服务器
28
+ - 本地 MCP 协同中枢
29
+ - AI 编码助手共享项目上下文
30
+ - 跨 IDE MCP 协作工具
31
+ - AI 助手项目注册表
32
+ - 编码 agent 会议和任务协同
33
+
34
+ n2n-nexus 面向这些场景设计:共享 daemon 状态、无状态 MCP 适配器、项目感知协作、本地存储和跨环境 IDE 工作流。
35
+
36
+ ## n2n-nexus 是什么?
37
+
38
+ n2n-nexus 为 AI 助手提供共享协作空间。不同助手不再只依赖自己的聊天上下文,而是可以通过 MCP 读取和更新同一个本地 daemon 中的项目状态。
39
+
40
+ **TL;DR**
41
+
42
+ - **安装**:`npx n2n-nexus daemon --port 5688`
43
+ - **协议**:Model Context Protocol (MCP),适配器通过 HTTP 连接 daemon
44
+ - **存储**:默认在 `~/.n2n-nexus` 下使用本地文件和 SQLite
45
+ - **适合**:多助手编码会话、项目交接、共享决策、会议记录、异步任务、项目 Manifest
46
+ - **不适合**:云端团队聊天、公开项目管理 SaaS、源码索引、向量搜索或远程数据库托管
47
+
48
+ ## 为什么使用它?
49
+
50
+ - 协调多个 AI 助手共同处理同一个项目。
51
+ - 在多个 IDE 之间共享项目 Manifest、内部说明、资产和拓扑关系。
52
+ - 将决策、提案、更新和会议内容保存在本地消息记录中。
53
+ - daemon 启动一次即可,Windows、WSL、SSH 主机、虚拟机或多个编辑器都可以连接。
54
+ - 避免为了交换上下文而给每个助手过宽的文件系统或后端权限。
55
+
56
+ ## 架构
57
+
58
+ ```text
59
+ ┌──────────────────────────────────────┐
60
+ │ n2n-nexus daemon │
61
+ │ 独立 HTTP 服务器 · 持续运行 │
62
+ │ 保存数据、工具、任务和消息 │
63
+ └──────────────┬───────────────────────┘
64
+ │ HTTP (NEXUS_ENDPOINT)
65
+ ┌───────┼───────┐
66
+ ▼ ▼ ▼
67
+ MCP-A MCP-B MCP-C
68
+ (Win) (WSL) (SSH/VM)
69
+ 每个 IDE 一个无状态适配器
70
+ ```
71
+
72
+ - **Daemon 是唯一数据源**:启动一次并保持运行。
73
+ - **MCP 适配器无状态**:每个 IDE 通过 `npx` 启动适配器,然后把工具调用转发给 daemon。
74
+ - **跨环境协作**:通过 `NEXUS_ENDPOINT` 让不同机器或 shell 指向同一个 daemon。daemon 默认只监听本机;只有在可信网络中才使用 `--host 0.0.0.0`。
75
+
76
+ ## 快速开始
77
+
78
+ ### 1. 启动 daemon
79
+
80
+ ```bash
81
+ npx n2n-nexus daemon --port 5688
82
+ ```
83
+
84
+ ### 2. 配置 MCP 客户端
85
+
86
+ ```json
87
+ {
88
+ "mcpServers": {
89
+ "n2n-nexus": {
90
+ "command": "npx",
91
+ "args": ["-y", "n2n-nexus", "mcp"],
92
+ "env": {
93
+ "NEXUS_ENDPOINT": "http://127.0.0.1:5688"
94
+ }
95
+ }
96
+ }
97
+ }
98
+ ```
99
+
100
+ 适配器可以先于 daemon 启动。daemon 可访问后,适配器会加载工具列表。
101
+
102
+ ### 跨环境端点示例
103
+
104
+ | 场景 | `NEXUS_ENDPOINT` |
105
+ | --- | --- |
106
+ | 同一台机器 | `http://127.0.0.1:5688` |
107
+ | WSL IDE 连接 Windows daemon | `http://host.docker.internal:5688` |
108
+ | Windows IDE 连接 WSL daemon | `http://<WSL-IP>:5688` |
109
+ | 远程机器 | `http://<Server-IP>:5688` |
110
+
111
+ ## 工具集
112
+
113
+ ### 会话和上下文
114
+
115
+ - `register_session_context`:声明当前活跃项目 ID。
116
+
117
+ ### 项目资产管理
118
+
119
+ - `sync_project_assets`:提交项目 Manifest 和内部文档。
120
+ - `update_project`:局部更新项目 Manifest。
121
+ - `rename_project`:重命名项目 ID 并更新关联关系。
122
+ - `upload_project_asset`:上传二进制或文本资产。
123
+ - `search_projects`:搜索项目注册表。
124
+ - `get_global_topology`:查看项目拓扑和依赖关系。
125
+
126
+ ### 消息和协作
127
+
128
+ - `send_message`:发送会议消息或全局消息。
129
+ - `read_messages`:增量读取未读消息。
130
+ - `update_global_strategy`:更新主策略文档。
131
+ - `sync_global_doc`:创建或更新共享文档。
132
+
133
+ ### 会议管理
134
+
135
+ - `start_meeting`:开启会议会话。
136
+ - `end_meeting`:关闭并锁定会议。
137
+ - `archive_meeting`:归档已关闭会议。
138
+ - `reopen_meeting`:重新打开已关闭或已归档会议。
139
+
140
+ ### 异步任务管理
141
+
142
+ - `create_task`:创建后台任务。
143
+ - `get_task`:查询任务状态和结果。
144
+ - `list_tasks`:按状态列出任务。
145
+ - `cancel_task`:取消等待中或运行中的任务。
146
+
147
+ ### 维护
148
+
149
+ - `host_maintenance`:清理或清空系统日志。
150
+ - `host_delete_project`:删除项目和资产。
151
+
152
+ ## 数据存储
153
+
154
+ 默认存储根目录:
155
+
156
+ | 平台 | 路径 |
157
+ | --- | --- |
158
+ | Linux / WSL | `~/.n2n-nexus` |
159
+ | Windows | `%USERPROFILE%\.n2n-nexus` |
160
+ | macOS | `~/.n2n-nexus` |
161
+
162
+ 可以通过 `--root <path>` 或 `NEXUS_ROOT` 覆盖。
163
+
164
+ ```text
165
+ ~/.n2n-nexus/
166
+ ├── global/
167
+ │ ├── blueprint.md
168
+ │ ├── docs_index.json
169
+ │ └── docs/
170
+ ├── projects/
171
+ │ └── {project-id}/
172
+ │ ├── manifest.json
173
+ │ ├── internal_blueprint.md
174
+ │ └── assets/
175
+ ├── registry.json
176
+ └── nexus.db
177
+ ```
178
+
179
+ ## 项目 ID 规范
180
+
181
+ 项目 ID 使用 `[prefix]_[name]` 格式。
182
+
183
+ | 前缀 | 分类 | 示例 |
184
+ | --- | --- | --- |
185
+ | `web_` | 网站 | `web_datafrog.io` |
186
+ | `api_` | 后端服务 | `api_user-auth` |
187
+ | `mcp_` | MCP 服务器 | `mcp_nexus` |
188
+ | `lib_` | 库/SDK | `lib_crypto-core` |
189
+ | `chrome_` | Chrome 扩展 | `chrome_evisa-helper` |
190
+ | `vscode_` | VS Code 扩展 | `vscode_super-theme` |
191
+ | `desktop_` | 桌面应用 | `desktop_main-hub` |
192
+ | `infra_` | 基础设施 / DevOps | `infra_k8s-config` |
193
+ | `doc_` | 文档 | `doc_coding-guide` |
194
+
195
+ ## CLI 参考
196
+
197
+ ```bash
198
+ # 启动 daemon
199
+ n2n-nexus daemon [--port 5688] [--root ~/.n2n-nexus] [--host 127.0.0.1]
200
+
201
+ # 启动 MCP 适配器
202
+ NEXUS_ENDPOINT=http://127.0.0.1:5688 n2n-nexus mcp
203
+ ```
204
+
205
+ ### 环境变量
206
+
207
+ | 变量 | 说明 | 默认值 |
208
+ | --- | --- | --- |
209
+ | `NEXUS_ENDPOINT` | MCP 适配器连接的 daemon 地址 | `http://127.0.0.1:5688` |
210
+ | `NEXUS_ROOT` | daemon 存储根目录 | `~/.n2n-nexus` |
211
+ | `NEXUS_HOST` | daemon 监听地址 | `127.0.0.1` |
212
+ | `NEXUS_INSTANCE_ID` | 覆盖 MCP 实例 ID | 自动生成 |
213
+
214
+ ## 安全和治理说明
215
+
216
+ - n2n-nexus 默认将协作数据保存在本地。
217
+ - 不要把密钥、凭据、客户数据或私有 token 写入会议消息或项目资产,除非你的本地策略允许。
218
+ - 删除项目等破坏性工具应通过明确的审核流程使用。
219
+ - 将 daemon 暴露到 localhost 之外属于运维选择;使用远程端点时请限制网络访问。
220
+ - 项目 Manifest 和内部文档可能包含敏感实现信息,应按内部资料处理。
221
+
222
+ ## 实战示例
223
+
224
+ 文档中包含一个多 AI 助手协同架构和协议决策的示例会话:
225
+
226
+ | 文件 | 说明 |
227
+ | --- | --- |
228
+ | [会议纪要](./MEETING_MINUTES_2025-12-29.md) | 结构化决策和测试记录 |
229
+ | [讨论日志](./discussion_2025-12-29_en.md) | 可读的讨论记录 |
230
+
231
+ ## 本地开发
232
+
233
+ ```bash
234
+ git clone https://github.com/n2ns/n2n-nexus.git
235
+ cd n2n-nexus
236
+ npm install
237
+ npm run build
238
+
239
+ # 运行 daemon
240
+ node build/index.js daemon --root /tmp/nexus-test --port 5688
241
+
242
+ # 运行 MCP 适配器
243
+ NEXUS_ENDPOINT=http://127.0.0.1:5688 node build/index.js mcp
244
+ ```
245
+
246
+ ## FAQ
247
+
248
+ ### n2n-nexus 是项目管理 SaaS 吗?
249
+
250
+ 不是。它是给 AI 助手使用的本地 MCP 协同服务器,状态保存在本地,并通过 MCP 工具暴露给客户端。
251
+
252
+ ### 它会替代 n2n-memory 吗?
253
+
254
+ 不会。`n2n-memory` 是单仓库的本地记忆工具。`n2n-nexus` 是多助手协同中枢,处理项目 Manifest、消息、会议、任务和共享文档。
255
+
256
+ ### 支持 Claude Desktop、Cursor、VS Code 等客户端吗?
257
+
258
+ 支持,只要客户端可以运行本地 MCP command server。IDE 启动适配器,适配器通过 `NEXUS_ENDPOINT` 连接本地 daemon。
259
+
260
+ ### 可以跨 Windows 和 WSL 协作吗?
261
+
262
+ 可以。在一个环境中运行 daemon,然后让每个适配器通过 `NEXUS_ENDPOINT` 指向它。
263
+
264
+ ### 会把数据发送到云端吗?
265
+
266
+ 不需要云服务。数据保存在配置的本地目录中。如果你将 daemon 暴露给远程机器,那属于你自己的网络配置。
267
+
268
+ ### 它是向量数据库或源码索引器吗?
269
+
270
+ 不是。n2n-nexus 协调项目元数据、消息、会议、文档、任务和资产,不做语义源码搜索。
271
+
272
+ ## 相关文档
273
+
274
+ - [架构文档](./ARCHITECTURE_zh.md)
275
+ - [AI 助手指南](./ASSISTANT_GUIDE.md)
276
+ - [英文 README](../README.md)
277
+ - [llms.txt](../llms.txt)
278
+
279
+ ## 许可证
280
+
281
+ 本项目使用 [Apache-2.0 License](../LICENSE)。
282
+
283
+ ---
284
+
285
+ Built by N2NS Lab, short for Next-to-Native Systems Lab, Datafrog's open-source lab for practical AI developer tools.
package/llms.txt ADDED
@@ -0,0 +1,46 @@
1
+ # n2n-nexus
2
+
3
+ n2n-nexus is a local-first Model Context Protocol (MCP) coordination hub from N2NS Lab for multi-AI assistant collaboration. It uses a long-running local daemon as the source of truth and stateless MCP adapters for IDEs and AI coding assistants.
4
+
5
+ ## Core positioning
6
+
7
+ - Local MCP coordination hub for multi-AI assistant collaboration.
8
+ - Shared project context, meetings, messages, tasks, project manifests, docs, and assets.
9
+ - Designed for Claude Desktop, Claude Code, Cursor, VS Code, Windsurf, JetBrains, and other MCP-enabled clients.
10
+ - Useful when several AI assistants or IDEs need to coordinate around the same local project state.
11
+
12
+ ## What it is not
13
+
14
+ - Not a project management SaaS.
15
+ - Not a vector database.
16
+ - Not a source code indexer.
17
+ - Not a cloud sync service.
18
+ - Not a replacement for repository-local memory tools such as n2n-memory.
19
+
20
+ ## Install
21
+
22
+ Start the daemon:
23
+
24
+ ```bash
25
+ npx n2n-nexus daemon --port 5688
26
+ ```
27
+
28
+ Configure MCP adapters with:
29
+
30
+ ```json
31
+ {
32
+ "command": "npx",
33
+ "args": ["-y", "n2n-nexus", "mcp"],
34
+ "env": {
35
+ "NEXUS_ENDPOINT": "http://127.0.0.1:5688"
36
+ }
37
+ }
38
+ ```
39
+
40
+ ## Storage
41
+
42
+ Default storage root is `~/.n2n-nexus`, containing global docs, project manifests, project assets, registry metadata, and SQLite state.
43
+
44
+ ## Brand
45
+
46
+ Built by N2NS Lab, short for Next-to-Native Systems Lab, Datafrog's open-source lab for practical AI developer tools.
package/package.json ADDED
@@ -0,0 +1,90 @@
1
+ {
2
+ "name": "n2n-nexus",
3
+ "version": "0.4.2",
4
+ "description": "Local-first MCP coordination hub from N2NS Lab for multi-AI assistant collaboration.",
5
+ "main": "build/index.js",
6
+ "type": "module",
7
+ "bin": {
8
+ "n2n-nexus": "build/index.js"
9
+ },
10
+ "files": [
11
+ "build",
12
+ "README.md",
13
+ "llms.txt",
14
+ "CHANGELOG.md",
15
+ "LICENSE",
16
+ "docs/README_zh.md",
17
+ "docs/ARCHITECTURE.md",
18
+ "docs/ARCHITECTURE_zh.md",
19
+ "docs/ASSISTANT_GUIDE.md"
20
+ ],
21
+ "keywords": [
22
+ "mcp",
23
+ "mcp-server",
24
+ "model-context-protocol",
25
+ "modelcontextprotocol",
26
+ "multi-agent",
27
+ "multi-agent-coordination",
28
+ "multi-ai",
29
+ "ai-agent",
30
+ "ai-agent-coordination",
31
+ "ai-assistant",
32
+ "ai-assistant-collaboration",
33
+ "coding-agent",
34
+ "coding-assistant",
35
+ "project-coordination",
36
+ "project-context",
37
+ "project-registry",
38
+ "local-first",
39
+ "local-first-mcp",
40
+ "cross-ide",
41
+ "ide-collaboration",
42
+ "claude",
43
+ "claude-desktop",
44
+ "cursor",
45
+ "vscode",
46
+ "windsurf",
47
+ "jetbrains",
48
+ "developer-tools",
49
+ "ai-developer-tools"
50
+ ],
51
+ "author": "N2NS Lab",
52
+ "license": "Apache-2.0",
53
+ "repository": {
54
+ "type": "git",
55
+ "url": "git+https://github.com/n2ns/n2n-nexus.git"
56
+ },
57
+ "homepage": "https://github.com/n2ns/n2n-nexus#readme",
58
+ "bugs": {
59
+ "url": "https://github.com/n2ns/n2n-nexus/issues"
60
+ },
61
+ "engines": {
62
+ "node": ">=18.0.0"
63
+ },
64
+ "scripts": {
65
+ "build": "tsc",
66
+ "start": "node build/index.js",
67
+ "daemon": "node build/index.js daemon",
68
+ "dev": "tsc -w",
69
+ "test": "vitest run",
70
+ "test:publish": "npm run build && npm test && npm pack --dry-run",
71
+ "test:integration": "vitest run tests/daemon_projects.test.ts tests/daemon_messages.test.ts tests/message_cursor.test.ts",
72
+ "lint": "eslint src/**",
73
+ "prepublishOnly": "npm run build && npm test"
74
+ },
75
+ "dependencies": {
76
+ "@modelcontextprotocol/sdk": "^1.29.0",
77
+ "better-sqlite3": "^12.10.1",
78
+ "zod": "^4.4.3"
79
+ },
80
+ "devDependencies": {
81
+ "@eslint/js": "^10.0.1",
82
+ "@types/better-sqlite3": "^7.6.13",
83
+ "@types/node": "^25.9.3",
84
+ "eslint": "^10.5.0",
85
+ "lefthook": "^2.1.9",
86
+ "typescript": "^6.0.3",
87
+ "typescript-eslint": "^8.61.0",
88
+ "vitest": "^4.1.8"
89
+ }
90
+ }