nodebb-plugin-integration 0.4.2 → 0.4.4
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/README.md +199 -320
- package/README.ru.md +199 -347
- package/library.js +93 -115
- package/package.json +60 -57
- package/plugin.json +50 -33
- package/public/js/admin.js +58 -45
- package/public/templates/admin/plugins/integration.tpl +213 -0
- package/src/ai/embeddings.js +46 -253
- package/src/ai/indexer.js +156 -343
- package/src/ai/openai.js +74 -330
- package/src/ai/qdrant.js +114 -517
- package/src/ai/search.js +138 -251
- package/src/config/index.js +176 -133
- package/src/config/validation.js +250 -0
- package/src/events/index.js +174 -324
- package/src/mcp/manager.js +396 -0
- package/src/mcp/server.js +338 -172
- package/src/mcp/tools.js +158 -617
- package/src/nodebb/categories.js +39 -0
- package/src/nodebb/index.js +72 -305
- package/src/nodebb/meta.js +24 -273
- package/src/nodebb/posts.js +93 -348
- package/src/nodebb/privileges.js +68 -0
- package/src/nodebb/topics.js +91 -355
- package/src/nodebb/users.js +62 -345
- package/src/routes/api.js +255 -97
- package/src/routes/index.js +64 -49
- package/templates/admin/plugins/integration.tpl +0 -130
package/README.md
CHANGED
|
@@ -1,320 +1,199 @@
|
|
|
1
|
-
# NodeBB Integration Layer
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
## Architecture
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
Configure:
|
|
202
|
-
|
|
203
|
-
```
|
|
204
|
-
QDRANT_URL=http://localhost:6333
|
|
205
|
-
|
|
206
|
-
QDRANT_COLLECTION=nodebb_knowledge
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
The system automatically:
|
|
210
|
-
|
|
211
|
-
* checks collection;
|
|
212
|
-
* creates collection;
|
|
213
|
-
* stores vectors;
|
|
214
|
-
* performs similarity search.
|
|
215
|
-
|
|
216
|
-
## MCP Server
|
|
217
|
-
|
|
218
|
-
Start MCP:
|
|
219
|
-
|
|
220
|
-
```bash
|
|
221
|
-
npm run mcp
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
Available tools:
|
|
225
|
-
|
|
226
|
-
```
|
|
227
|
-
get_forum_info
|
|
228
|
-
|
|
229
|
-
get_post
|
|
230
|
-
|
|
231
|
-
get_topic
|
|
232
|
-
|
|
233
|
-
get_user
|
|
234
|
-
|
|
235
|
-
search_knowledge
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
Example:
|
|
239
|
-
|
|
240
|
-
```
|
|
241
|
-
search_knowledge
|
|
242
|
-
|
|
243
|
-
{
|
|
244
|
-
"query": "installation guide",
|
|
245
|
-
"limit": 5
|
|
246
|
-
}
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
## Project Structure
|
|
250
|
-
|
|
251
|
-
```
|
|
252
|
-
.
|
|
253
|
-
├── library.js
|
|
254
|
-
|
|
255
|
-
├── package.json
|
|
256
|
-
|
|
257
|
-
├── plugin.json
|
|
258
|
-
|
|
259
|
-
├── src
|
|
260
|
-
|
|
261
|
-
│ ├── ai
|
|
262
|
-
|
|
263
|
-
│ │ ├── embeddings.js
|
|
264
|
-
|
|
265
|
-
│ │ ├── openai.js
|
|
266
|
-
|
|
267
|
-
│ │ ├── qdrant.js
|
|
268
|
-
|
|
269
|
-
│ │ ├── indexer.js
|
|
270
|
-
|
|
271
|
-
│ │ └── search.js
|
|
272
|
-
|
|
273
|
-
│ │
|
|
274
|
-
|
|
275
|
-
│ ├── mcp
|
|
276
|
-
|
|
277
|
-
│ │ ├── server.js
|
|
278
|
-
|
|
279
|
-
│ │ └── tools.js
|
|
280
|
-
|
|
281
|
-
│ │
|
|
282
|
-
|
|
283
|
-
│ ├── nodebb
|
|
284
|
-
|
|
285
|
-
│ │ ├── meta.js
|
|
286
|
-
|
|
287
|
-
│ │ ├── posts.js
|
|
288
|
-
|
|
289
|
-
│ │ ├── topics.js
|
|
290
|
-
|
|
291
|
-
│ │ └── users.js
|
|
292
|
-
|
|
293
|
-
│ │
|
|
294
|
-
|
|
295
|
-
│ └── config
|
|
296
|
-
|
|
297
|
-
│ └── index.js
|
|
298
|
-
|
|
299
|
-
│
|
|
300
|
-
|
|
301
|
-
└── test
|
|
302
|
-
|
|
303
|
-
└── plugin.test.js
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
## Security
|
|
307
|
-
|
|
308
|
-
Never commit:
|
|
309
|
-
|
|
310
|
-
```
|
|
311
|
-
.env
|
|
312
|
-
|
|
313
|
-
OPENAI_API_KEY
|
|
314
|
-
|
|
315
|
-
NODEBB_API_KEY
|
|
316
|
-
```
|
|
317
|
-
|
|
318
|
-
## License
|
|
319
|
-
|
|
320
|
-
MIT
|
|
1
|
+
# NodeBB Integration Layer
|
|
2
|
+
|
|
3
|
+
Integration plugin for NodeBB forums providing MCP (Model Context Protocol), AI-powered semantic search, RAG retrieval and Qdrant vector storage.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- NodeBB integration
|
|
8
|
+
- MCP server using Streamable HTTP
|
|
9
|
+
- Separate MCP child process managed by NodeBB
|
|
10
|
+
- Bearer token authentication
|
|
11
|
+
- Internal API authentication between MCP and NodeBB
|
|
12
|
+
- OpenAI embeddings
|
|
13
|
+
- Qdrant vector storage and semantic search
|
|
14
|
+
- RAG retrieval with NodeBB access control
|
|
15
|
+
- Individual post indexing, including replies
|
|
16
|
+
- Configurable excluded categories
|
|
17
|
+
- OpenAI and Fake AI provider modes
|
|
18
|
+
- ACP configuration interface
|
|
19
|
+
- Automated tests
|
|
20
|
+
|
|
21
|
+
## Architecture
|
|
22
|
+
|
|
23
|
+
NodeBB → Integration Plugin → MCP / AI
|
|
24
|
+
|
|
25
|
+
MCP: Streamable HTTP → MCP Child Process → Internal NodeBB API → NodeBB Access Control
|
|
26
|
+
|
|
27
|
+
AI: OpenAI → Embeddings → Qdrant → Vector Search → Knowledge Retrieval
|
|
28
|
+
|
|
29
|
+
## Requirements
|
|
30
|
+
|
|
31
|
+
- Node.js >= 20
|
|
32
|
+
- npm >= 10
|
|
33
|
+
- NodeBB 4.x
|
|
34
|
+
|
|
35
|
+
AI functionality requires an OpenAI API key and a Qdrant server. MCP requires a running NodeBB instance.
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
Install the plugin using the NodeBB plugin management interface or your usual NodeBB plugin installation procedure.
|
|
40
|
+
|
|
41
|
+
Install dependencies in the plugin directory using npm install.
|
|
42
|
+
|
|
43
|
+
Restart NodeBB and configure the plugin in ACP → Plugins → NodeBB Integration.
|
|
44
|
+
|
|
45
|
+
## Configuration
|
|
46
|
+
|
|
47
|
+
The plugin is configured through the NodeBB ACP interface.
|
|
48
|
+
|
|
49
|
+
### AI Provider
|
|
50
|
+
|
|
51
|
+
Two providers are available.
|
|
52
|
+
|
|
53
|
+
**OpenAI**
|
|
54
|
+
|
|
55
|
+
Enables:
|
|
56
|
+
- OpenAI embedding generation
|
|
57
|
+
- Qdrant vector storage
|
|
58
|
+
- Post indexing
|
|
59
|
+
- Semantic search
|
|
60
|
+
- RAG retrieval
|
|
61
|
+
|
|
62
|
+
Configure the OpenAI API key, embedding model, embedding dimensions, Qdrant URL and collection name.
|
|
63
|
+
|
|
64
|
+
**Fake**
|
|
65
|
+
|
|
66
|
+
Disables AI functionality completely:
|
|
67
|
+
- OpenAI API is not called.
|
|
68
|
+
- Qdrant is not accessed.
|
|
69
|
+
- Embeddings are not generated.
|
|
70
|
+
- Post indexing is disabled.
|
|
71
|
+
- Semantic search is disabled.
|
|
72
|
+
|
|
73
|
+
NodeBB integration and MCP remain available.
|
|
74
|
+
|
|
75
|
+
OpenAI and Qdrant settings are preserved when switching providers. Selecting OpenAI again re-enables the AI pipeline.
|
|
76
|
+
|
|
77
|
+
Fake mode is useful for developing and testing the NodeBB and MCP integration without external AI services.
|
|
78
|
+
|
|
79
|
+
### Excluded Categories
|
|
80
|
+
|
|
81
|
+
Categories selected in ACP are excluded from AI indexing and semantic search.
|
|
82
|
+
|
|
83
|
+
## AI Pipeline
|
|
84
|
+
|
|
85
|
+
When OpenAI is enabled:
|
|
86
|
+
|
|
87
|
+
Forum Post → Embedding Generation → Qdrant Vector Storage → Semantic Search → NodeBB Access Control → Knowledge Retrieval
|
|
88
|
+
|
|
89
|
+
Each post is indexed independently, including replies.
|
|
90
|
+
|
|
91
|
+
Search results are checked against NodeBB permissions before post content is retrieved. Posts and topics that the service user cannot read are excluded.
|
|
92
|
+
|
|
93
|
+
Qdrant stores vectors and metadata only. Post text is retrieved from NodeBB after access checks.
|
|
94
|
+
|
|
95
|
+
## Qdrant
|
|
96
|
+
|
|
97
|
+
Configure the Qdrant URL, collection name and embedding dimensions through ACP.
|
|
98
|
+
|
|
99
|
+
The plugin checks whether the collection exists and creates it when necessary.
|
|
100
|
+
|
|
101
|
+
Qdrant is not accessed when Fake is selected.
|
|
102
|
+
|
|
103
|
+
## MCP Server
|
|
104
|
+
|
|
105
|
+
The MCP server is managed by the NodeBB plugin and runs as a separate child process.
|
|
106
|
+
|
|
107
|
+
Transport:
|
|
108
|
+
- Streamable HTTP
|
|
109
|
+
- Bearer token authentication
|
|
110
|
+
|
|
111
|
+
The MCP server communicates with NodeBB through an authenticated internal API using a separate secret managed by the plugin.
|
|
112
|
+
|
|
113
|
+
Configure in ACP:
|
|
114
|
+
- Enable or disable MCP
|
|
115
|
+
- Bind address
|
|
116
|
+
- Port
|
|
117
|
+
- NodeBB URL
|
|
118
|
+
- Bearer token
|
|
119
|
+
- Service user UID
|
|
120
|
+
|
|
121
|
+
The service user UID is configured by the administrator. MCP clients cannot override it.
|
|
122
|
+
|
|
123
|
+
### Available Tools
|
|
124
|
+
|
|
125
|
+
- get_forum_info — Get public forum information.
|
|
126
|
+
- get_post — Retrieve a post after access checks.
|
|
127
|
+
- get_topic — Retrieve a topic after access checks.
|
|
128
|
+
- get_user — Retrieve public user information.
|
|
129
|
+
- search_knowledge — Search indexed forum knowledge.
|
|
130
|
+
|
|
131
|
+
search_knowledge requires the OpenAI provider. In Fake mode, it returns an explicit AI-disabled error.
|
|
132
|
+
|
|
133
|
+
## Security
|
|
134
|
+
|
|
135
|
+
- MCP clients authenticate using a Bearer token.
|
|
136
|
+
- Internal API requests use a separate secret.
|
|
137
|
+
- Secret values are never returned to the ACP interface.
|
|
138
|
+
- Empty secret fields preserve existing values.
|
|
139
|
+
- User IDs supplied by MCP clients are not trusted.
|
|
140
|
+
- The configured service user is used for access checks.
|
|
141
|
+
- Post and topic permissions are checked before content is returned.
|
|
142
|
+
- Access-check failures deny access.
|
|
143
|
+
- Qdrant payloads contain identifiers and metadata, not post text.
|
|
144
|
+
|
|
145
|
+
Never commit API keys, tokens or other secrets.
|
|
146
|
+
|
|
147
|
+
## Development and Testing
|
|
148
|
+
|
|
149
|
+
Install dependencies: npm install
|
|
150
|
+
|
|
151
|
+
Syntax checks: npm run check
|
|
152
|
+
|
|
153
|
+
Tests: npm test
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
The test suite validates configuration, MCP tool arguments and other plugin components.
|
|
157
|
+
|
|
158
|
+
## Project Structure
|
|
159
|
+
|
|
160
|
+
library.js
|
|
161
|
+
package.json
|
|
162
|
+
plugin.json
|
|
163
|
+
public/
|
|
164
|
+
js/admin.js
|
|
165
|
+
templates/admin/plugins/integration.tpl
|
|
166
|
+
src/
|
|
167
|
+
ai/
|
|
168
|
+
embeddings.js
|
|
169
|
+
indexer.js
|
|
170
|
+
openai.js
|
|
171
|
+
qdrant.js
|
|
172
|
+
search.js
|
|
173
|
+
config/
|
|
174
|
+
index.js
|
|
175
|
+
validation.js
|
|
176
|
+
events/
|
|
177
|
+
index.js
|
|
178
|
+
mcp/
|
|
179
|
+
manager.js
|
|
180
|
+
server.js
|
|
181
|
+
tools.js
|
|
182
|
+
nodebb/
|
|
183
|
+
categories.js
|
|
184
|
+
index.js
|
|
185
|
+
meta.js
|
|
186
|
+
posts.js
|
|
187
|
+
privileges.js
|
|
188
|
+
topics.js
|
|
189
|
+
users.js
|
|
190
|
+
routes/
|
|
191
|
+
api.js
|
|
192
|
+
index.js
|
|
193
|
+
test/
|
|
194
|
+
config-validation.test.js
|
|
195
|
+
mcp-tools.test.js
|
|
196
|
+
|
|
197
|
+
## License
|
|
198
|
+
|
|
199
|
+
MIT
|