@imenam/mcp-documentor 1.0.74 → 1.0.76
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 +271 -259
- package/dist/shared/schemas/doc.schema.d.ts +1 -4
- package/dist/shared/schemas/doc.schema.js +1 -4
- package/dist/src/cli/setup-mcp.d.ts +20 -1
- package/dist/src/cli/setup-mcp.js +65 -6
- package/dist/src/core/storage-engine.d.ts +14 -15
- package/dist/src/core/storage-engine.js +15 -51
- package/dist/src/gui-worker.js +91 -34
- package/dist/src/index.js +99 -106
- package/dist/src/tools/check-links.js +1 -1
- package/dist/src/tools/list-projects.js +7 -5
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/gui/dist/assets/{arc-BNuZ3dSL.js → arc-CsM5OJTM.js} +1 -1
- package/gui/dist/assets/{architectureDiagram-3BPJPVTR-D8g3tPQx.js → architectureDiagram-3BPJPVTR-BwIu1llT.js} +1 -1
- package/gui/dist/assets/{blockDiagram-GPEHLZMM-limhup8_.js → blockDiagram-GPEHLZMM-BVijVnPI.js} +1 -1
- package/gui/dist/assets/{c4Diagram-AAUBKEIU-Ct39JMIy.js → c4Diagram-AAUBKEIU-D-rcZUZu.js} +1 -1
- package/gui/dist/assets/channel-DKPwwuQf.js +1 -0
- package/gui/dist/assets/{chunk-2J33WTMH-BkLJTezj.js → chunk-2J33WTMH-ByfTGREe.js} +1 -1
- package/gui/dist/assets/{chunk-4BX2VUAB-CR5NbhDR.js → chunk-4BX2VUAB-B_5oCXyz.js} +1 -1
- package/gui/dist/assets/{chunk-55IACEB6-CtQYMnJS.js → chunk-55IACEB6-Bc2Kq9HD.js} +1 -1
- package/gui/dist/assets/{chunk-727SXJPM-B2q7tUn8.js → chunk-727SXJPM-CVwmKEMQ.js} +1 -1
- package/gui/dist/assets/{chunk-AQP2D5EJ-Bbcnrfrp.js → chunk-AQP2D5EJ-BkMuEFxD.js} +1 -1
- package/gui/dist/assets/{chunk-FMBD7UC4-D8gd4zRe.js → chunk-FMBD7UC4-CU7EDl9I.js} +1 -1
- package/gui/dist/assets/{chunk-ND2GUHAM-DiZKzZtG.js → chunk-ND2GUHAM-1b34Dtkn.js} +1 -1
- package/gui/dist/assets/{chunk-QZHKN3VN-CrKx-e2_.js → chunk-QZHKN3VN-DnUfMecI.js} +1 -1
- package/gui/dist/assets/classDiagram-4FO5ZUOK-CnCvVGW9.js +1 -0
- package/gui/dist/assets/classDiagram-v2-Q7XG4LA2-CnCvVGW9.js +1 -0
- package/gui/dist/assets/{cose-bilkent-S5V4N54A-BDUCVkTl.js → cose-bilkent-S5V4N54A-D9OBrxKr.js} +1 -1
- package/gui/dist/assets/{dagre-BM42HDAG-DkoYBHXK.js → dagre-BM42HDAG-zDqwL8xs.js} +1 -1
- package/gui/dist/assets/{diagram-2AECGRRQ-BT1YJHon.js → diagram-2AECGRRQ-ejbP8WIj.js} +1 -1
- package/gui/dist/assets/{diagram-5GNKFQAL-C00r6F35.js → diagram-5GNKFQAL-Cv9WmtFO.js} +1 -1
- package/gui/dist/assets/{diagram-KO2AKTUF-B4wcN5a_.js → diagram-KO2AKTUF-BI0ybJiN.js} +1 -1
- package/gui/dist/assets/{diagram-LMA3HP47-B9FqCfel.js → diagram-LMA3HP47-DlVGttLq.js} +1 -1
- package/gui/dist/assets/{diagram-OG6HWLK6-COPCDzdG.js → diagram-OG6HWLK6-DjoAH-Fq.js} +1 -1
- package/gui/dist/assets/{erDiagram-TEJ5UH35-BGQGT2wN.js → erDiagram-TEJ5UH35-BVQHVGK4.js} +1 -1
- package/gui/dist/assets/{flowDiagram-I6XJVG4X-A7jKWUpi.js → flowDiagram-I6XJVG4X-oZP2Z-6T.js} +1 -1
- package/gui/dist/assets/{ganttDiagram-6RSMTGT7-NhFkpY-x.js → ganttDiagram-6RSMTGT7-dy4QyEOP.js} +1 -1
- package/gui/dist/assets/{gitGraphDiagram-PVQCEYII-z0AqyYG4.js → gitGraphDiagram-PVQCEYII-BxgLy7Ln.js} +1 -1
- package/gui/dist/assets/{index-Dub5OLKk.js → index-Dtv0slFQ.js} +66 -66
- package/gui/dist/assets/{infoDiagram-5YYISTIA-D69UR9u9.js → infoDiagram-5YYISTIA-DNOdinpR.js} +1 -1
- package/gui/dist/assets/{ishikawaDiagram-YF4QCWOH-DSTqIoro.js → ishikawaDiagram-YF4QCWOH-C4pQ434G.js} +1 -1
- package/gui/dist/assets/{journeyDiagram-JHISSGLW-CekXdcoE.js → journeyDiagram-JHISSGLW-CBrVYW94.js} +1 -1
- package/gui/dist/assets/{kanban-definition-UN3LZRKU-CseGvFK9.js → kanban-definition-UN3LZRKU-Df-rgiY8.js} +1 -1
- package/gui/dist/assets/{linear-BtVl_9_C.js → linear-B_6fRXVt.js} +1 -1
- package/gui/dist/assets/{mindmap-definition-RKZ34NQL-XLjQIU37.js → mindmap-definition-RKZ34NQL-CRAd_VDM.js} +1 -1
- package/gui/dist/assets/{pieDiagram-4H26LBE5-BcvUzWoW.js → pieDiagram-4H26LBE5-CJkmLrDI.js} +1 -1
- package/gui/dist/assets/{quadrantDiagram-W4KKPZXB-BzoYEmNW.js → quadrantDiagram-W4KKPZXB-D-rDEcnF.js} +1 -1
- package/gui/dist/assets/{requirementDiagram-4Y6WPE33-icKC1_Nd.js → requirementDiagram-4Y6WPE33-DE8MhSMe.js} +1 -1
- package/gui/dist/assets/{sankeyDiagram-5OEKKPKP-mi3i-2dZ.js → sankeyDiagram-5OEKKPKP-BwlxtrUs.js} +1 -1
- package/gui/dist/assets/{sequenceDiagram-3UESZ5HK-XrcDkRlM.js → sequenceDiagram-3UESZ5HK-B4LjBzWg.js} +1 -1
- package/gui/dist/assets/{stateDiagram-AJRCARHV-UXaqrCNT.js → stateDiagram-AJRCARHV-Bv72afPK.js} +1 -1
- package/gui/dist/assets/stateDiagram-v2-BHNVJYJU-BKJDOkkR.js +1 -0
- package/gui/dist/assets/{timeline-definition-PNZ67QCA-yd6607p6.js → timeline-definition-PNZ67QCA-CBxgf8iW.js} +1 -1
- package/gui/dist/assets/{vennDiagram-CIIHVFJN-BsRqUcIp.js → vennDiagram-CIIHVFJN-DPSdK06q.js} +1 -1
- package/gui/dist/assets/{wardley-L42UT6IY-BmdA7yk0.js → wardley-L42UT6IY-JIAzuoPm.js} +1 -1
- package/gui/dist/assets/{wardleyDiagram-YWT4CUSO-CRdmckD8.js → wardleyDiagram-YWT4CUSO-YDfaF1wT.js} +1 -1
- package/gui/dist/assets/{xychartDiagram-2RQKCTM6-DWpNIQY-.js → xychartDiagram-2RQKCTM6-DHlPryZX.js} +1 -1
- package/gui/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/src/tools/set-project.d.ts +0 -14
- package/dist/src/tools/set-project.js +0 -18
- package/gui/dist/assets/channel-uoEIgtym.js +0 -1
- package/gui/dist/assets/classDiagram-4FO5ZUOK-DmhYb54l.js +0 -1
- package/gui/dist/assets/classDiagram-v2-Q7XG4LA2-DmhYb54l.js +0 -1
- package/gui/dist/assets/stateDiagram-v2-BHNVJYJU-Bhdu4lv4.js +0 -1
package/README.md
CHANGED
|
@@ -1,259 +1,271 @@
|
|
|
1
|
-
# @imenam/mcp-documentor
|
|
2
|
-
|
|
3
|
-
An MCP server to create, manage, and search project documentation — with staleness tracking and optional semantic search.
|
|
4
|
-
|
|
5
|
-
Connect it to Cursor, Claude Desktop, or any MCP-compatible agent to let your AI document, browse and verify your codebase docs without leaving the chat.
|
|
6
|
-
|
|
7
|
-
## Features
|
|
8
|
-
|
|
9
|
-
- **Create & update docs** — write markdown documentation entries linked to source files; prefer partial edits via `patch_doc`
|
|
10
|
-
- **Staleness tracking** — automatically detects when tracked files have changed since the last doc update
|
|
11
|
-
- **Portable code references** — tracked-file paths are stored relative to a configurable code root (`MCP_DOCUMENTOR_CODE_ROOT`), so synced docs resolve their source files on any machine regardless of where the repos live
|
|
12
|
-
- **Semantic search** — find relevant docs by meaning (requires an OpenAI API key)
|
|
13
|
-
- **Multi-project support** — organize docs into separate projects; MCP
|
|
14
|
-
- **GUI** — built-in web interface
|
|
15
|
-
- **Proxy-aware** — integrates with the [proxy-setup](https://github.com/Imena/proxy-setup) for GUI exposure
|
|
16
|
-
- **Links & structure** — `check_links`, `get_doc_tree`, `move_doc`, and `git_diff_doc` for maintenance workflows
|
|
17
|
-
- **Image support** — upload images to a project's assets via `upload_image` (local file path) or directly from the GUI editor; images are stored per-project and rendered inline in the viewer and in PDF exports
|
|
18
|
-
- **GitHub sync** — share your documentation across machines by backing the data directory with a private GitHub repo; the repo/token are fixed by the administrator via environment variables, and the agent can only `pull_docs` / `push_docs` / `sync_docs`
|
|
19
|
-
|
|
20
|
-
## Installation
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
npx -y @imenam/mcp-documentor
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
Or install globally:
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
npm install -g @imenam/mcp-documentor
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
Global install exposes:
|
|
33
|
-
|
|
34
|
-
- `mcp-documentor` — MCP server
|
|
35
|
-
- `mcp-documentor-migrate` — CLI helper for migrating inline doc links (see `scripts/migrate-links.js`)
|
|
36
|
-
- `mcp-documentor-migrate-paths` — one-shot migration of tracked-file paths from absolute to code-root-relative (see [Portable tracked-file paths](#portable-tracked-file-paths))
|
|
37
|
-
|
|
38
|
-
## MCP Configuration
|
|
39
|
-
|
|
40
|
-
### Quick setup
|
|
41
|
-
|
|
42
|
-
From the repo you want to document, generate a ready-to-fill `.mcp.json` in the current directory:
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
npx @imenam/mcp-documentor --claude-setup-mcp
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
It creates the `mcp-documentor` entry with the usual environment variables as empty placeholders —
|
|
49
|
-
an empty variable is simply inactive, so the generated config runs as-is and you only fill in what
|
|
50
|
-
you need. An existing `.mcp.json` is merged, other servers are preserved, and an existing
|
|
51
|
-
`mcp-documentor` entry is only replaced when `--force` is passed.
|
|
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
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
1
|
+
# @imenam/mcp-documentor
|
|
2
|
+
|
|
3
|
+
An MCP server to create, manage, and search project documentation — with staleness tracking and optional semantic search.
|
|
4
|
+
|
|
5
|
+
Connect it to Cursor, Claude Desktop, or any MCP-compatible agent to let your AI document, browse and verify your codebase docs without leaving the chat.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Create & update docs** — write markdown documentation entries linked to source files; prefer partial edits via `patch_doc`
|
|
10
|
+
- **Staleness tracking** — automatically detects when tracked files have changed since the last doc update
|
|
11
|
+
- **Portable code references** — tracked-file paths are stored relative to a configurable code root (`MCP_DOCUMENTOR_CODE_ROOT`), so synced docs resolve their source files on any machine regardless of where the repos live
|
|
12
|
+
- **Semantic search** — find relevant docs by meaning (requires an OpenAI API key)
|
|
13
|
+
- **Multi-project support** — organize docs into separate projects; every MCP tool names the project it targets, and the GUI's project selector is a per-browser view preference
|
|
14
|
+
- **GUI** — built-in web interface, either behind the proxy (`PROXY_URL`) or served directly on a local port (`APP_PORT`); with neither, the GUI worker is not started
|
|
15
|
+
- **Proxy-aware** — integrates with the [proxy-setup](https://github.com/Imena/proxy-setup) for GUI exposure
|
|
16
|
+
- **Links & structure** — `check_links`, `get_doc_tree`, `move_doc`, and `git_diff_doc` for maintenance workflows
|
|
17
|
+
- **Image support** — upload images to a project's assets via `upload_image` (local file path) or directly from the GUI editor; images are stored per-project and rendered inline in the viewer and in PDF exports
|
|
18
|
+
- **GitHub sync** — share your documentation across machines by backing the data directory with a private GitHub repo; the repo/token are fixed by the administrator via environment variables, and the agent can only `pull_docs` / `push_docs` / `sync_docs`
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx -y @imenam/mcp-documentor
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Or install globally:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install -g @imenam/mcp-documentor
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Global install exposes:
|
|
33
|
+
|
|
34
|
+
- `mcp-documentor` — MCP server
|
|
35
|
+
- `mcp-documentor-migrate` — CLI helper for migrating inline doc links (see `scripts/migrate-links.js`)
|
|
36
|
+
- `mcp-documentor-migrate-paths` — one-shot migration of tracked-file paths from absolute to code-root-relative (see [Portable tracked-file paths](#portable-tracked-file-paths))
|
|
37
|
+
|
|
38
|
+
## MCP Configuration
|
|
39
|
+
|
|
40
|
+
### Quick setup
|
|
41
|
+
|
|
42
|
+
From the repo you want to document, generate a ready-to-fill `.mcp.json` in the current directory:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npx @imenam/mcp-documentor --claude-setup-mcp
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
It creates the `mcp-documentor` entry with the usual environment variables as empty placeholders —
|
|
49
|
+
an empty variable is simply inactive, so the generated config runs as-is and you only fill in what
|
|
50
|
+
you need. An existing `.mcp.json` is merged, other servers are preserved, and an existing
|
|
51
|
+
`mcp-documentor` entry is only replaced when `--force` is passed.
|
|
52
|
+
|
|
53
|
+
Two flags let you pick how the GUI is exposed straight from the command line, instead of editing
|
|
54
|
+
the JSON afterwards:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# GUI behind the central proxy
|
|
58
|
+
npx @imenam/mcp-documentor --claude-setup-mcp --proxy_url=http://localhost:3000
|
|
59
|
+
|
|
60
|
+
# GUI served directly, no proxy: http://localhost:4500
|
|
61
|
+
npx @imenam/mcp-documentor --claude-setup-mcp --app_port=4500
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The two flags are mutually exclusive — passing both fails.
|
|
65
|
+
|
|
66
|
+
### Manual setup
|
|
67
|
+
|
|
68
|
+
Add to your MCP client config (e.g. Cursor `mcp.json`):
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"mcpServers": {
|
|
73
|
+
"mcp-documentor": {
|
|
74
|
+
"command": "npx",
|
|
75
|
+
"args": ["-y", "@imenam/mcp-documentor"],
|
|
76
|
+
"env": {
|
|
77
|
+
"OPENAI_API_KEY": "sk-..."
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Environment Variables
|
|
85
|
+
|
|
86
|
+
| Variable | Required | Description |
|
|
87
|
+
|---|---|---|
|
|
88
|
+
| `OPENAI_API_KEY` | No | Enables semantic search via OpenAI embeddings (`search_docs`) |
|
|
89
|
+
| `MCP_DOCUMENTOR_OPENAI_MODEL` | No | Embedding model (default: `text-embedding-3-small`) |
|
|
90
|
+
| `PROXY_URL` | No | URL of the proxy server: it allocates the port and mounts the GUI under `APP_PATH` |
|
|
91
|
+
| `APP_PORT` | No | Local port used **when `PROXY_URL` is unset**: the GUI is served directly at `http://localhost:<port>`, at the root. Lets you use the interface without the central hub. `PROXY_URL` wins if both are set; with neither, the GUI is disabled and the MCP tools still work |
|
|
92
|
+
| `APP_GROUP` | No | Groups the app under a collapsible section (folded by default) in the proxy dashboard. Apps sharing the same value appear together; if unset, the app lands in the default "ungrouped" section |
|
|
93
|
+
| `MCP_DATA_DIR` | No | Overrides the default data directory (see Data storage) |
|
|
94
|
+
| `MCP_LOG_DIR` | No | Overrides the log directory of both the server and the GUI worker (default: `<package>/.docs-data/logs`). Must be set in the MCP client config — the package `.env` is loaded after the logger starts |
|
|
95
|
+
| `MCP_DOCUMENTOR_CODE_ROOT` | No | Base directory that tracked-file paths are stored relative to, keeping docs portable across machines (see [Portable tracked-file paths](#portable-tracked-file-paths)) |
|
|
96
|
+
| `MCP_DOCUMENTOR_CODE_ROOTS` | No | JSON map of per-project code-root overrides, e.g. `{"my-proj":"/srv/my-proj"}` |
|
|
97
|
+
| `READ_ONLY` | No | When set to `1`/`true`/`yes`, disables all create/update/delete tools and GUI write actions (read-only mode) |
|
|
98
|
+
| `MCP_DOCUMENTOR_SYNC_REMOTE` | No | HTTPS URL of the private GitHub repo to sync with; enables GitHub sync when set |
|
|
99
|
+
| `MCP_DOCUMENTOR_SYNC_BRANCH` | No | Branch of the documentation sync repo to push/pull docs on (default: `main`) |
|
|
100
|
+
| `MCP_DOCUMENTOR_SYNC_TOKEN` | No | Fine-grained GitHub PAT used for HTTPS auth (see GitHub sync) |
|
|
101
|
+
| `SYNC_PULL_ON_START` | No | Set to `false` to disable the automatic pull at server startup |
|
|
102
|
+
|
|
103
|
+
Optional `.env` at the package root (directory containing `package.json` discovered from the installed binary) is loaded when present.
|
|
104
|
+
|
|
105
|
+
## Available Tools
|
|
106
|
+
|
|
107
|
+
Every tool that targets a specific documentation entry takes a **mandatory `project`**. It is never
|
|
108
|
+
guessed and there is no "active project" to fall back to: resolving a doc path across projects is
|
|
109
|
+
what made operations silently hit the wrong project when the same path existed in several. Tools
|
|
110
|
+
that work on a whole project (`list_docs`, `get_doc_tree`, `check_freshness` without a `path`,
|
|
111
|
+
`reindex_embeddings`) keep `project` optional, since omitting it means "all projects".
|
|
112
|
+
|
|
113
|
+
| Tool | Description |
|
|
114
|
+
|---|---|
|
|
115
|
+
| `create_doc` | Create a new documentation entry linked to source files (`project` required) |
|
|
116
|
+
| `get_doc` | Retrieve a documentation entry with full content (`project` required) |
|
|
117
|
+
| `get_doc_metadata` | Get metadata and freshness status without loading content (`project` required) |
|
|
118
|
+
| `list_docs` | List docs with staleness indicators (optionally filter by project) |
|
|
119
|
+
| `get_doc_tree` | Return folder/doc structure for a project (or all projects) |
|
|
120
|
+
| `update_doc` | Fully replace content and/or metadata (`project` required; prefer `patch_doc` for small edits) |
|
|
121
|
+
| `patch_doc` | Search-and-replace a fragment of a doc’s content (`project` required) |
|
|
122
|
+
| `move_doc` | Change a doc’s path (folder/name) within its project (`project` required) |
|
|
123
|
+
| `delete_doc` | Permanently delete a documentation entry (`project` required) |
|
|
124
|
+
| `search_docs` | Semantic search over docs (natural language; requires OpenAI) |
|
|
125
|
+
| `check_freshness` | Staleness for one doc (`project` required) or a full project scan |
|
|
126
|
+
| `refresh_file_snapshot` | Mark tracked files as up-to-date without editing the doc (`project` required) |
|
|
127
|
+
| `git_diff_doc` | Git diff for tracked files vs snapshot baseline (`project` required) |
|
|
128
|
+
| `check_links` | Validate `related_docs`, `doc://` links, and `#heading` anchors (`project` required) |
|
|
129
|
+
| `list_projects` | List all documentation projects |
|
|
130
|
+
| `upload_image` | Upload an image from a local file path to a project's assets (`project` required); returns the markdown link to insert |
|
|
131
|
+
| `sync_status` | Show branch, ahead/behind counts, conflicted files, and uncommitted changes |
|
|
132
|
+
| `pull_docs` | Pull updates from the remote (defensive fast-forward; reindexes new docs) |
|
|
133
|
+
| `push_docs` | Commit local doc changes and push them to the remote |
|
|
134
|
+
| `sync_docs` | Full sync: pull then push (push skipped if the pull reveals a conflict) |
|
|
135
|
+
| `resolve_sync_conflict` | Bulk-resolve merge conflicts by keeping `mine` or `theirs`, then stage |
|
|
136
|
+
|
|
137
|
+
## Images in documents
|
|
138
|
+
|
|
139
|
+
Images can be embedded in any documentation entry using standard markdown syntax:
|
|
140
|
+
|
|
141
|
+
```markdown
|
|
142
|
+
 <!-- local upload -->
|
|
143
|
+
 <!-- external URL -->
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**Via the MCP tool** — use `upload_image` with the absolute path of the file on the server:
|
|
147
|
+
|
|
148
|
+
```json
|
|
149
|
+
{
|
|
150
|
+
"filename": "screenshot.png",
|
|
151
|
+
"filePath": "/absolute/path/to/screenshot.png",
|
|
152
|
+
"alt": "Architecture diagram"
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
The tool copies the file into `.docs-data/projects/{project}/assets/` and returns the ready-to-use markdown snippet.
|
|
157
|
+
|
|
158
|
+
**Via the GUI editor** — click the **🖼 Image** button in the editor toolbar to open the image panel:
|
|
159
|
+
- **Upload tab** — pick a local file; it is uploaded automatically and the markdown link is inserted at the cursor position
|
|
160
|
+
- **URL tab** — paste any external image URL; the markdown link is inserted at the cursor position
|
|
161
|
+
- **Project images gallery** — click any previously uploaded image to re-insert it
|
|
162
|
+
|
|
163
|
+
## Syncing across machines with GitHub
|
|
164
|
+
|
|
165
|
+
You can share documentation between several machines by backing the data directory with a **private** GitHub repository. The approach is git-based: only the human-readable markdown, assets, and the shared project list are versioned. Derived state (embeddings) is regenerated locally, and version history stays local to each machine.
|
|
166
|
+
|
|
167
|
+
### What is and isn't synced
|
|
168
|
+
|
|
169
|
+
| Synced (versioned) | Local only (gitignored) |
|
|
170
|
+
|---|---|
|
|
171
|
+
| `projects/**` (markdown + assets) | `embeddings.db` (regenerated after pull) |
|
|
172
|
+
| `config.json` (project list) | `history.db` (per-machine version history) |
|
|
173
|
+
|
|
174
|
+
### Setup
|
|
175
|
+
|
|
176
|
+
The sync target is **administrator-controlled**: the repository, branch and token are read from environment variables and **cannot be set or changed by the agent**. The agent can only pull/push against whatever repo you configured.
|
|
177
|
+
|
|
178
|
+
1. Create an **empty private repo** on GitHub (e.g. `my-docs`).
|
|
179
|
+
2. Create a **fine-grained PAT** scoped to that single repo (Repository permissions → **Contents: Read and write**).
|
|
180
|
+
3. Add the sync environment variables to your MCP client config, per machine:
|
|
181
|
+
|
|
182
|
+
```jsonc
|
|
183
|
+
{
|
|
184
|
+
"mcpServers": {
|
|
185
|
+
"mcp-documentor": {
|
|
186
|
+
"command": "npx",
|
|
187
|
+
"args": ["-y", "@imenam/mcp-documentor"],
|
|
188
|
+
"env": {
|
|
189
|
+
"MCP_DOCUMENTOR_SYNC_REMOTE": "https://github.com/<you>/my-docs.git",
|
|
190
|
+
"MCP_DOCUMENTOR_SYNC_BRANCH": "main", // branch of the docs sync repo, optional, defaults to "main"
|
|
191
|
+
"MCP_DOCUMENTOR_SYNC_TOKEN": "github_pat_..."
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
The token is injected into the `origin` URL inside `.git/config` only (which git never commits) — it is never pushed.
|
|
199
|
+
|
|
200
|
+
### Daily workflow
|
|
201
|
+
|
|
202
|
+
- `sync_docs` — pull then push in one step (recommended).
|
|
203
|
+
- `pull_docs` / `push_docs` — granular control.
|
|
204
|
+
- `sync_status` — inspect ahead/behind, conflicts, and uncommitted changes.
|
|
205
|
+
|
|
206
|
+
By default the server also performs a **defensive pull at startup**: it only fast-forwards a clean working tree and never overwrites local changes (disable with `SYNC_PULL_ON_START=false`). On the first run, a machine with no local data simply clones the remote.
|
|
207
|
+
|
|
208
|
+
### Conflicts
|
|
209
|
+
|
|
210
|
+
Because docs are plain markdown, merge conflicts are readable. When `pull_docs` reports a conflict:
|
|
211
|
+
|
|
212
|
+
- edit the conflicted `.md` files directly (remove the `<<<<<<<` / `>>>>>>>` markers), **or**
|
|
213
|
+
- run `resolve_sync_conflict` with `strategy: "mine"` or `"theirs"` to take one side in bulk,
|
|
214
|
+
|
|
215
|
+
then run `push_docs` to publish the resolution. If you have **uncommitted** local changes while the remote has moved, the pull reports `diverged` without touching anything — push your changes first, then pull again.
|
|
216
|
+
|
|
217
|
+
> Read-only machines (`READ_ONLY=1`) can still `pull_docs` and `sync_status`, but `push_docs`, `sync_docs`, and `resolve_sync_conflict` are disabled.
|
|
218
|
+
|
|
219
|
+
## Portable tracked-file paths
|
|
220
|
+
|
|
221
|
+
When docs are synced across machines, absolute tracked-file paths break: the codebase rarely lives at the same absolute location everywhere. To stay portable, tracked-file paths are stored **relative to a configurable code root** and resolved back to absolute paths on demand.
|
|
222
|
+
|
|
223
|
+
Agents keep passing **absolute** paths to `create_doc` / `update_doc` (and in `[copy-from-codebase|…]` tags) as usual — the conversion to a stored relative path happens automatically server-side. No change in how the agent works.
|
|
224
|
+
|
|
225
|
+
### Configuration
|
|
226
|
+
|
|
227
|
+
Set the code root per machine (it is machine-local, so it lives in the environment, never in the synced data):
|
|
228
|
+
|
|
229
|
+
```jsonc
|
|
230
|
+
{
|
|
231
|
+
"env": {
|
|
232
|
+
"MCP_DOCUMENTOR_CODE_ROOT": "/home/you/code/repos",
|
|
233
|
+
// optional per-project overrides when repos don't share a common parent:
|
|
234
|
+
"MCP_DOCUMENTOR_CODE_ROOTS": "{\"my-proj\":\"/srv/my-proj\"}"
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Resolution precedence: `MCP_DOCUMENTOR_CODE_ROOTS[project]` → `MCP_DOCUMENTOR_CODE_ROOT` → none.
|
|
240
|
+
|
|
241
|
+
| Stored path | On read |
|
|
242
|
+
|---|---|
|
|
243
|
+
| Relative + code root configured | resolved against the root |
|
|
244
|
+
| Relative + **no** root on this machine | reported as `unverifiable` (source absent) instead of a false `stale` |
|
|
245
|
+
| Absolute (legacy, or file outside the root) | used as-is |
|
|
246
|
+
|
|
247
|
+
The feature is **opt-in**: with no code root configured, behaviour is unchanged (paths stored and resolved as absolute).
|
|
248
|
+
|
|
249
|
+
### Migrating existing docs
|
|
250
|
+
|
|
251
|
+
Docs created before this feature store absolute paths. Convert them in one shot with the bundled `mcp-documentor-migrate-paths`:
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
MCP_DOCUMENTOR_CODE_ROOT="/home/you/code/repos" \
|
|
255
|
+
MCP_DATA_DIR="/path/to/your/data" \
|
|
256
|
+
npx -p @imenam/mcp-documentor mcp-documentor-migrate-paths --dry-run
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Review the report (`converted` / `kept absolute (outside root)` / `projects skipped`), then re-run without `--dry-run`. Finally publish with `sync_docs` (never commit the data dir by hand). The data dir is resolved like the server: `--data-dir` flag → `MCP_DATA_DIR` → package-relative fallback.
|
|
260
|
+
|
|
261
|
+
This is a **one-time** operation, and must run on the machine whose OS/filesystem **created** the stored absolute paths (path semantics differ between Windows and POSIX). Once migrated and synced, every other machine just `pull_docs` and sets its own `MCP_DOCUMENTOR_CODE_ROOT` — no migration needed.
|
|
262
|
+
|
|
263
|
+
## Data Storage
|
|
264
|
+
|
|
265
|
+
By default, data lives under **`.docs-data`** next to the resolved package root (the folder that contains `package.json` for the running install). Set **`MCP_DATA_DIR`** to use another directory. Contents include projects, SQLite/embeddings, and logs under `.docs-data/logs`. This tree is **not** part of the npm package; it is created at runtime.
|
|
266
|
+
|
|
267
|
+
There is no server-side "active project": every MCP tool call names its project, and the GUI's selector only changes what that browser displays (kept in the URL and in `localStorage`). A legacy `currentProject` left in `config.json` is dropped on first read. GitHub sync settings live in environment variables, not on disk.
|
|
268
|
+
|
|
269
|
+
## License
|
|
270
|
+
|
|
271
|
+
ISC
|
|
@@ -164,16 +164,13 @@ export declare const PatchDocArgsSchema: z.ZodObject<{
|
|
|
164
164
|
replacement_file: z.ZodOptional<z.ZodString>;
|
|
165
165
|
}, z.core.$strip>;
|
|
166
166
|
export declare const CheckLinksArgsSchema: z.ZodObject<{
|
|
167
|
-
project: z.
|
|
167
|
+
project: z.ZodString;
|
|
168
168
|
}, z.core.$strip>;
|
|
169
169
|
export declare const GitDiffDocArgsSchema: z.ZodObject<{
|
|
170
170
|
paths: z.ZodArray<z.ZodString>;
|
|
171
171
|
project: z.ZodString;
|
|
172
172
|
file_paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
173
173
|
}, z.core.$strip>;
|
|
174
|
-
export declare const SetProjectArgsSchema: z.ZodObject<{
|
|
175
|
-
project: z.ZodString;
|
|
176
|
-
}, z.core.$strip>;
|
|
177
174
|
export declare const ListDocVersionsArgsSchema: z.ZodObject<{
|
|
178
175
|
path: z.ZodString;
|
|
179
176
|
project: z.ZodString;
|
|
@@ -124,16 +124,13 @@ export const PatchDocArgsSchema = z.object({
|
|
|
124
124
|
message: "Either replacement or replacement_file is required",
|
|
125
125
|
});
|
|
126
126
|
export const CheckLinksArgsSchema = z.object({
|
|
127
|
-
project:
|
|
127
|
+
project: requiredProject("the link check").describe("Project whose entries are checked. Mandatory — links are never checked across projects, and there is no current-project fallback."),
|
|
128
128
|
});
|
|
129
129
|
export const GitDiffDocArgsSchema = z.object({
|
|
130
130
|
paths: z.array(z.string()).min(1).describe("Paths of documentation entries to diff, e.g. ['backend/auth/authentication']"),
|
|
131
131
|
project: requiredProject("the diff").describe("Project holding every entry listed in paths. Mandatory — entries are never resolved across projects. Call once per project if they are spread across several."),
|
|
132
132
|
file_paths: z.array(z.string()).optional().describe("Specific tracked files to diff, as absolute paths (matched against the stored paths, relative or absolute). All tracked files if omitted."),
|
|
133
133
|
});
|
|
134
|
-
export const SetProjectArgsSchema = z.object({
|
|
135
|
-
project: z.string().describe("Project name to switch to (created if it does not exist)"),
|
|
136
|
-
});
|
|
137
134
|
export const ListDocVersionsArgsSchema = z.object({
|
|
138
135
|
path: z.string(),
|
|
139
136
|
project: requiredProject("history lookup"),
|
|
@@ -1,5 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Comment la GUI sera exposée. `undefined` des deux côtés = rien n'a été passé
|
|
3
|
+
* en ligne de commande : on retombe sur le placeholder PROXY_URL à compléter.
|
|
4
|
+
*/
|
|
5
|
+
export interface GuiExposure {
|
|
6
|
+
proxyUrl?: string;
|
|
7
|
+
appPort?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Traduit `--proxy_url=` / `--app_port=` en mode d'exposition de la GUI.
|
|
11
|
+
* Les deux ensemble sont refusés : au runtime PROXY_URL primerait toujours,
|
|
12
|
+
* donc un fichier portant les deux serait silencieusement trompeur.
|
|
13
|
+
*/
|
|
14
|
+
export declare function parseGuiExposure(argv: string[]): {
|
|
15
|
+
exposure: GuiExposure;
|
|
16
|
+
} | {
|
|
17
|
+
error: string;
|
|
18
|
+
};
|
|
1
19
|
export interface SetupMcpOptions {
|
|
2
20
|
cwd: string;
|
|
3
21
|
force: boolean;
|
|
22
|
+
exposure?: GuiExposure;
|
|
4
23
|
}
|
|
5
|
-
export declare function runSetupMcp({ cwd, force }: SetupMcpOptions): number;
|
|
24
|
+
export declare function runSetupMcp({ cwd, force, exposure }: SetupMcpOptions): number;
|