tgo-wiki 0.1.0
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 +32 -0
- package/README.md +255 -0
- package/docs/mcp-usage.md +631 -0
- package/docs/v0-acceptance.md +105 -0
- package/docs/v0-delivery-checklist.md +57 -0
- package/docs/v1-acceptance.md +39 -0
- package/docs/v2-acceptance.md +165 -0
- package/package.json +69 -0
- package/packages/core/src/config/config-loader.ts +109 -0
- package/packages/core/src/config/defaults.ts +74 -0
- package/packages/core/src/config/workspace-resolver.ts +40 -0
- package/packages/core/src/documents/command-document-parser.ts +206 -0
- package/packages/core/src/documents/document-id.ts +26 -0
- package/packages/core/src/documents/document-parser-registry.ts +126 -0
- package/packages/core/src/documents/document-service.ts +656 -0
- package/packages/core/src/documents/document-store.ts +132 -0
- package/packages/core/src/documents/document-types.ts +33 -0
- package/packages/core/src/documents/pdf-text-parser.ts +35 -0
- package/packages/core/src/documents/text-markdown-parser.ts +50 -0
- package/packages/core/src/errors.ts +46 -0
- package/packages/core/src/git/git-service.ts +68 -0
- package/packages/core/src/index.ts +38 -0
- package/packages/core/src/markdown/markdown-scanner.ts +90 -0
- package/packages/core/src/permissions/permission-service.ts +50 -0
- package/packages/core/src/publish/publish-service.ts +142 -0
- package/packages/core/src/result.ts +13 -0
- package/packages/core/src/services/session-workflow-service.ts +493 -0
- package/packages/core/src/services/wiki-service.ts +119 -0
- package/packages/core/src/services/workspace-service.ts +223 -0
- package/packages/core/src/session/session-id.ts +14 -0
- package/packages/core/src/session/session-service.ts +77 -0
- package/packages/core/src/session/session-store.ts +91 -0
- package/packages/core/src/session/session-types.ts +17 -0
- package/packages/core/src/sources/source-id.ts +19 -0
- package/packages/core/src/sources/source-paths.ts +15 -0
- package/packages/core/src/sources/source-service.ts +416 -0
- package/packages/core/src/sources/source-types.ts +77 -0
- package/packages/core/src/sources/source-validator.ts +132 -0
- package/packages/core/src/sources/source-writer.ts +419 -0
- package/packages/core/src/validation/frontmatter-validator.ts +128 -0
- package/packages/core/src/validation/link-validator.ts +55 -0
- package/packages/core/src/validation/path-validator.ts +65 -0
- package/packages/core/src/validation/source-reference-validator.ts +191 -0
- package/packages/core/src/validation/validation-service.ts +106 -0
- package/packages/core/src/vfs/vfs-command-parser.ts +69 -0
- package/packages/core/src/vfs/vfs-service.ts +498 -0
- package/packages/core/src/web/html-to-markdown.ts +144 -0
- package/packages/core/src/web/static-web-fetcher.ts +537 -0
- package/packages/core/src/web/web-id.ts +26 -0
- package/packages/core/src/web/web-ingestion-service.ts +335 -0
- package/packages/core/src/web/web-paths.ts +6 -0
- package/packages/core/src/web/web-types.ts +33 -0
- package/packages/server/src/cli.ts +56 -0
- package/packages/server/src/context.ts +7 -0
- package/packages/server/src/index.ts +2 -0
- package/packages/server/src/mcp-server.ts +111 -0
- package/packages/server/src/schemas/documents.ts +17 -0
- package/packages/server/src/schemas/read.ts +16 -0
- package/packages/server/src/schemas/session.ts +31 -0
- package/packages/server/src/schemas/sources.ts +12 -0
- package/packages/server/src/schemas/web.ts +23 -0
- package/packages/server/src/tools/document-tools.ts +46 -0
- package/packages/server/src/tools/publish-tools.ts +33 -0
- package/packages/server/src/tools/read-tools.ts +52 -0
- package/packages/server/src/tools/response.ts +24 -0
- package/packages/server/src/tools/session-tools.ts +100 -0
- package/packages/server/src/tools/source-tools.ts +32 -0
- package/packages/server/src/tools/web-tools.ts +26 -0
|
@@ -0,0 +1,631 @@
|
|
|
1
|
+
# Agent Wiki MCP Usage
|
|
2
|
+
|
|
3
|
+
Date: 2026-06-12
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
This guide shows how to run the Agent Wiki MCP server and call its public tools. It is written for agent clients that connect over stdio JSON-RPC.
|
|
8
|
+
|
|
9
|
+
v2 supports local workspace initialization, stable wiki reads, isolated edit sessions, document ingestion, web ingestion, source reads, validation, diff, session commits, and fast-forward publish. v0 remains documented below as the historical baseline that later releases extend.
|
|
10
|
+
|
|
11
|
+
## Local Setup
|
|
12
|
+
|
|
13
|
+
Install Bun first; the published CLI runs TypeScript directly with the `bun` runtime:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
curl -fsSL https://bun.sh/install | bash
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Install the CLI:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
bun add -g tgo-wiki
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Create a local wiki workspace:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
workspace="$(mktemp -d)"
|
|
29
|
+
tgo-wiki init --workspace "$workspace"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Inspect workspace status:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
tgo-wiki status --workspace "$workspace"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
From a source checkout before publishing, install dependencies with `bun install --frozen-lockfile` and replace `tgo-wiki` with `bun packages/server/src/cli.ts`.
|
|
39
|
+
|
|
40
|
+
`init` prints:
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"workspaceRoot": "/tmp/example",
|
|
45
|
+
"stableCommit": "0123456789abcdef0123456789abcdef01234567"
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
`status` prints the stable branch, commit, worktree, dirty flag, and session count:
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"workspaceRoot": "/tmp/example",
|
|
54
|
+
"repoPath": "/tmp/example/repo",
|
|
55
|
+
"branch": "wiki/stable",
|
|
56
|
+
"commit": "0123456789abcdef0123456789abcdef01234567",
|
|
57
|
+
"worktree": "/tmp/example/worktrees/stable",
|
|
58
|
+
"dirty": false,
|
|
59
|
+
"sessionCount": 0
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Start the MCP Server
|
|
64
|
+
|
|
65
|
+
Start a read-only server:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
tgo-wiki mcp --workspace "$workspace" --role reader
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Start a writer server:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
tgo-wiki mcp --workspace "$workspace" --role writer
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Start a publisher server:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
tgo-wiki mcp --workspace "$workspace" --role publisher
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The server speaks newline-delimited JSON-RPC over stdio. Each request or notification should be serialized as one JSON object followed by `\n`.
|
|
84
|
+
|
|
85
|
+
## Initialize MCP
|
|
86
|
+
|
|
87
|
+
Send `initialize`:
|
|
88
|
+
|
|
89
|
+
```json
|
|
90
|
+
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"example-client","version":"0.0.0"}}}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Then send the initialized notification:
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
{"jsonrpc":"2.0","method":"notifications/initialized","params":{}}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
List tools:
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Call a tool with:
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"wiki_read","arguments":{"path":"wiki/index.md","include_frontmatter":true}}}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Successful tool calls return `content` and `structuredContent`. Tool-level failures return `isError: true` and a typed error under `structuredContent.error`.
|
|
112
|
+
|
|
113
|
+
## Roles
|
|
114
|
+
|
|
115
|
+
`reader` can call:
|
|
116
|
+
|
|
117
|
+
- `vfs_exec`
|
|
118
|
+
- `wiki_read`
|
|
119
|
+
- `wiki_channel_status`
|
|
120
|
+
- `source_list`
|
|
121
|
+
- `source_read`
|
|
122
|
+
|
|
123
|
+
`writer` can call every reader tool plus:
|
|
124
|
+
|
|
125
|
+
- `wiki_session_start`
|
|
126
|
+
- `wiki_session_patch`
|
|
127
|
+
- `wiki_session_validate`
|
|
128
|
+
- `wiki_session_diff`
|
|
129
|
+
- `wiki_session_commit`
|
|
130
|
+
- `document_upload`
|
|
131
|
+
- `document_parse`
|
|
132
|
+
|
|
133
|
+
`publisher` and `admin` can call every reader/writer tool plus:
|
|
134
|
+
|
|
135
|
+
- `web_fetch`
|
|
136
|
+
- `wiki_publish_session`
|
|
137
|
+
|
|
138
|
+
`web_fetch` is publisher/admin-only because it performs server-side network I/O. It rejects private, loopback, link-local, multicast, and reserved network targets by default, including redirects to those targets. Workspaces that intentionally fetch local or internal pages can add exact hostnames or IP literals to `web.allowedPrivateHosts`.
|
|
139
|
+
|
|
140
|
+
## Tool Reference
|
|
141
|
+
|
|
142
|
+
### `vfs_exec`
|
|
143
|
+
|
|
144
|
+
Runs an allowed read-only VFS command against stable wiki content.
|
|
145
|
+
|
|
146
|
+
Input:
|
|
147
|
+
|
|
148
|
+
```json
|
|
149
|
+
{"command":"pwd"}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Optional input:
|
|
153
|
+
|
|
154
|
+
```json
|
|
155
|
+
{"command":"cat wiki/index.md","ref":"stable"}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Output fields:
|
|
159
|
+
|
|
160
|
+
- `stdout`
|
|
161
|
+
- `stderr`
|
|
162
|
+
- `exit_code`
|
|
163
|
+
- `cwd`
|
|
164
|
+
- `ref`
|
|
165
|
+
|
|
166
|
+
### `wiki_read`
|
|
167
|
+
|
|
168
|
+
Reads one stable Markdown page.
|
|
169
|
+
|
|
170
|
+
Input:
|
|
171
|
+
|
|
172
|
+
```json
|
|
173
|
+
{"path":"wiki/index.md","include_frontmatter":true}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Output fields:
|
|
177
|
+
|
|
178
|
+
- `path`
|
|
179
|
+
- `ref`
|
|
180
|
+
- `frontmatter`, when `include_frontmatter` is true
|
|
181
|
+
- `content`
|
|
182
|
+
- `sha`
|
|
183
|
+
|
|
184
|
+
### `wiki_channel_status`
|
|
185
|
+
|
|
186
|
+
Reports stable channel status.
|
|
187
|
+
|
|
188
|
+
Input:
|
|
189
|
+
|
|
190
|
+
```json
|
|
191
|
+
{"channel":"stable"}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Output fields:
|
|
195
|
+
|
|
196
|
+
- `channel`
|
|
197
|
+
- `branch`
|
|
198
|
+
- `commit`
|
|
199
|
+
- `worktree`
|
|
200
|
+
- `dirty`
|
|
201
|
+
|
|
202
|
+
### `wiki_session_start`
|
|
203
|
+
|
|
204
|
+
Creates an isolated edit session from stable by default.
|
|
205
|
+
|
|
206
|
+
Input:
|
|
207
|
+
|
|
208
|
+
```json
|
|
209
|
+
{"purpose":"update the home page","agent_id":"example-agent"}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Output fields:
|
|
213
|
+
|
|
214
|
+
- `session_id`
|
|
215
|
+
- `branch`
|
|
216
|
+
- `worktree`
|
|
217
|
+
- `base_ref`
|
|
218
|
+
- `base_commit`
|
|
219
|
+
|
|
220
|
+
### `wiki_session_patch`
|
|
221
|
+
|
|
222
|
+
Replaces a Markdown page in a session worktree. Full content replacement is required. Unified patch input is not supported. Direct writes to `sources/**` are rejected with `source_write_denied`; use ingestion tools such as `document_upload` plus `document_parse`, or `web_fetch`, to create source files.
|
|
223
|
+
|
|
224
|
+
Input:
|
|
225
|
+
|
|
226
|
+
```json
|
|
227
|
+
{
|
|
228
|
+
"session_id": "SESSION_ID",
|
|
229
|
+
"path": "wiki/index.md",
|
|
230
|
+
"content": "---\ntitle: \"Home\"\nsummary: \"Entry point for the wiki.\"\ntags: [\"home\"]\nupdated: \"2026-06-11\"\n---\n\n# Home\n\nUpdated content.\n",
|
|
231
|
+
"reason": "refresh home page copy"
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
Output fields:
|
|
236
|
+
|
|
237
|
+
- `path`
|
|
238
|
+
- `changed`
|
|
239
|
+
- `sha_before`, when the file already existed
|
|
240
|
+
- `sha_after`
|
|
241
|
+
|
|
242
|
+
### `wiki_session_validate`
|
|
243
|
+
|
|
244
|
+
Validates changed Markdown pages in a session, including optional `sources` frontmatter references when present.
|
|
245
|
+
|
|
246
|
+
Input:
|
|
247
|
+
|
|
248
|
+
```json
|
|
249
|
+
{"session_id":"SESSION_ID"}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
Optional focused validation:
|
|
253
|
+
|
|
254
|
+
```json
|
|
255
|
+
{"session_id":"SESSION_ID","paths":["wiki/index.md"]}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
Output fields:
|
|
259
|
+
|
|
260
|
+
- `ok`
|
|
261
|
+
- `errors`
|
|
262
|
+
- `warnings`
|
|
263
|
+
|
|
264
|
+
### `wiki_session_diff`
|
|
265
|
+
|
|
266
|
+
Shows committed and working diff for a session.
|
|
267
|
+
|
|
268
|
+
Input:
|
|
269
|
+
|
|
270
|
+
```json
|
|
271
|
+
{"session_id":"SESSION_ID"}
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
Optional focused diff:
|
|
275
|
+
|
|
276
|
+
```json
|
|
277
|
+
{"session_id":"SESSION_ID","paths":["wiki/index.md"]}
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
Output fields:
|
|
281
|
+
|
|
282
|
+
- `session_id`
|
|
283
|
+
- `base_ref`
|
|
284
|
+
- `diff`
|
|
285
|
+
- `committed_diff`
|
|
286
|
+
- `working_diff`
|
|
287
|
+
- `changed_files`
|
|
288
|
+
|
|
289
|
+
### `wiki_session_commit`
|
|
290
|
+
|
|
291
|
+
Commits validated session changes on the session branch, including wiki pages and ingestion-generated source files.
|
|
292
|
+
|
|
293
|
+
Input:
|
|
294
|
+
|
|
295
|
+
```json
|
|
296
|
+
{"session_id":"SESSION_ID","message":"docs: update home page"}
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
Output fields:
|
|
300
|
+
|
|
301
|
+
- `commit`
|
|
302
|
+
- `branch`
|
|
303
|
+
- `changed_files`
|
|
304
|
+
|
|
305
|
+
Committing a session branch does not publish or mutate stable content. Use `wiki_publish_session` as `publisher` or `admin` to fast-forward stable after commit.
|
|
306
|
+
|
|
307
|
+
### `document_upload`
|
|
308
|
+
|
|
309
|
+
Stores a raw document blob under workspace state outside git.
|
|
310
|
+
|
|
311
|
+
Supported MIME types:
|
|
312
|
+
|
|
313
|
+
- `application/pdf`
|
|
314
|
+
- `text/markdown`
|
|
315
|
+
- `text/x-markdown`
|
|
316
|
+
- `text/plain`
|
|
317
|
+
|
|
318
|
+
Input:
|
|
319
|
+
|
|
320
|
+
```json
|
|
321
|
+
{
|
|
322
|
+
"session_id": "SESSION_ID",
|
|
323
|
+
"file_name": "handbook.pdf",
|
|
324
|
+
"mime_type": "application/pdf",
|
|
325
|
+
"content_base64": "JVBERi0xLjQK"
|
|
326
|
+
}
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
Markdown input:
|
|
330
|
+
|
|
331
|
+
```json
|
|
332
|
+
{
|
|
333
|
+
"session_id": "SESSION_ID",
|
|
334
|
+
"file_name": "plan.md",
|
|
335
|
+
"mime_type": "text/markdown",
|
|
336
|
+
"content_base64": "IyBQbGFuCg=="
|
|
337
|
+
}
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
Output fields:
|
|
341
|
+
|
|
342
|
+
- `document_id`
|
|
343
|
+
- `blob_sha256`
|
|
344
|
+
- `size`
|
|
345
|
+
- `status`
|
|
346
|
+
|
|
347
|
+
### `document_parse`
|
|
348
|
+
|
|
349
|
+
Parses an uploaded document into git-tracked source files in a session worktree.
|
|
350
|
+
|
|
351
|
+
Input:
|
|
352
|
+
|
|
353
|
+
```json
|
|
354
|
+
{"session_id":"SESSION_ID","document_id":"DOCUMENT_ID"}
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
Output fields:
|
|
358
|
+
|
|
359
|
+
- `document_id`
|
|
360
|
+
- `version`
|
|
361
|
+
- `raw_markdown_path`
|
|
362
|
+
- `metadata_path`
|
|
363
|
+
- `status`
|
|
364
|
+
- `warnings`
|
|
365
|
+
|
|
366
|
+
The parsed source is written under `sources/<document_id>/raw.md`, with metadata in `sources/<document_id>/metadata.json`.
|
|
367
|
+
|
|
368
|
+
For Markdown uploads, `raw.md` preserves the uploaded Markdown body. For plain text uploads, `document_parse` wraps the text in readable Markdown with a generated H1 and parser header. Source files still are not wiki pages and do not use wiki frontmatter.
|
|
369
|
+
|
|
370
|
+
Command parser configuration:
|
|
371
|
+
|
|
372
|
+
Workspace config can enable external command parsers under `documents.parsers`.
|
|
373
|
+
|
|
374
|
+
```json
|
|
375
|
+
{
|
|
376
|
+
"documents": {
|
|
377
|
+
"parsers": {
|
|
378
|
+
"marker": {
|
|
379
|
+
"enabled": true,
|
|
380
|
+
"command": "marker_single --output-format markdown -",
|
|
381
|
+
"supportedMimeTypes": ["application/pdf"],
|
|
382
|
+
"version": "marker-single",
|
|
383
|
+
"timeoutMs": 60000
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
Command parser MVP rules:
|
|
391
|
+
|
|
392
|
+
- The command runs locally where the MCP server runs.
|
|
393
|
+
- The uploaded document bytes are written to stdin.
|
|
394
|
+
- `TGO_DOCUMENT_ID`, `TGO_FILE_NAME`, `TGO_MIME_TYPE`, and `TGO_PARSED_AT` are provided as environment variables.
|
|
395
|
+
- stdout must be Markdown and becomes `sources/<document_id>/raw.md`.
|
|
396
|
+
- stderr is not written to `raw.md`; failures return `parse_failed`.
|
|
397
|
+
- Shell syntax such as pipes and redirects is not supported.
|
|
398
|
+
|
|
399
|
+
### `web_fetch`
|
|
400
|
+
|
|
401
|
+
Fetches one public static HTML page into an open session as a raw source. Only `publisher` and `admin` roles can call this tool.
|
|
402
|
+
|
|
403
|
+
Input:
|
|
404
|
+
|
|
405
|
+
```json
|
|
406
|
+
{
|
|
407
|
+
"session_id": "SESSION_ID",
|
|
408
|
+
"url": "https://example.com/docs"
|
|
409
|
+
}
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
Output fields:
|
|
413
|
+
|
|
414
|
+
- `source_id`
|
|
415
|
+
- `version`
|
|
416
|
+
- `raw_markdown_path`
|
|
417
|
+
- `metadata_path`
|
|
418
|
+
- `html_blob_sha256`
|
|
419
|
+
- `status`
|
|
420
|
+
- `title`, when available
|
|
421
|
+
- `warnings`
|
|
422
|
+
|
|
423
|
+
The original HTML blob is stored outside git under `state/web/blobs/sha256/<sha256>`. The generated source files are written into the session worktree under `sources/<source_id>/raw.md` and `sources/<source_id>/metadata.json`.
|
|
424
|
+
|
|
425
|
+
The tool returns `source_id`, but the existing source APIs still use the `document_id` input name. Pass the returned `source_id` as `document_id` when calling `source_read`:
|
|
426
|
+
|
|
427
|
+
```json
|
|
428
|
+
{
|
|
429
|
+
"document_id": "web_20260613_ab12cd34ef567890",
|
|
430
|
+
"ref": "SESSION_ID"
|
|
431
|
+
}
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
Use the same id in wiki page frontmatter `sources` when patching derived pages:
|
|
435
|
+
|
|
436
|
+
```markdown
|
|
437
|
+
---
|
|
438
|
+
title: "Example Docs"
|
|
439
|
+
summary: "Notes derived from the fetched web source."
|
|
440
|
+
tags: ["web", "imported"]
|
|
441
|
+
updated: "2026-06-13"
|
|
442
|
+
sources:
|
|
443
|
+
- web_20260613_ab12cd34ef567890
|
|
444
|
+
---
|
|
445
|
+
|
|
446
|
+
# Example Docs
|
|
447
|
+
|
|
448
|
+
The published page content should cite the fetched source id in frontmatter.
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
### `source_list`
|
|
452
|
+
|
|
453
|
+
Lists ingestion-generated sources from stable or a session ref, including parsed documents and fetched web sources.
|
|
454
|
+
|
|
455
|
+
Input:
|
|
456
|
+
|
|
457
|
+
```json
|
|
458
|
+
{"ref":"stable"}
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
Session ref input:
|
|
462
|
+
|
|
463
|
+
```json
|
|
464
|
+
{"ref":"SESSION_ID"}
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
Output fields:
|
|
468
|
+
|
|
469
|
+
- `sources`
|
|
470
|
+
|
|
471
|
+
### `source_read`
|
|
472
|
+
|
|
473
|
+
Reads an ingestion-generated source file from stable or a session ref.
|
|
474
|
+
|
|
475
|
+
Input:
|
|
476
|
+
|
|
477
|
+
```json
|
|
478
|
+
{"document_id":"DOCUMENT_ID","ref":"SESSION_ID"}
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
Stable input:
|
|
482
|
+
|
|
483
|
+
```json
|
|
484
|
+
{"document_id":"DOCUMENT_ID","ref":"stable"}
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
Output fields:
|
|
488
|
+
|
|
489
|
+
- `document_id`
|
|
490
|
+
- `ref`
|
|
491
|
+
- `metadata`
|
|
492
|
+
- `raw_markdown`
|
|
493
|
+
|
|
494
|
+
### `wiki_publish_session`
|
|
495
|
+
|
|
496
|
+
Fast-forwards stable to a committed clean session branch.
|
|
497
|
+
|
|
498
|
+
Input:
|
|
499
|
+
|
|
500
|
+
```json
|
|
501
|
+
{"session_id":"SESSION_ID","channel":"stable","mode":"ff-only"}
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
Output fields:
|
|
505
|
+
|
|
506
|
+
- `ok`
|
|
507
|
+
- `channel`
|
|
508
|
+
- `previous_commit`
|
|
509
|
+
- `published_commit`
|
|
510
|
+
|
|
511
|
+
## Complete v2 Web Ingestion Flow
|
|
512
|
+
|
|
513
|
+
Start the server with `--role publisher` or `--role admin`, then initialize MCP.
|
|
514
|
+
|
|
515
|
+
```text
|
|
516
|
+
wiki_session_start
|
|
517
|
+
web_fetch
|
|
518
|
+
source_read with ref = session_id
|
|
519
|
+
wiki_session_patch with frontmatter.sources citing returned source_id
|
|
520
|
+
wiki_session_validate
|
|
521
|
+
wiki_session_diff
|
|
522
|
+
wiki_session_commit
|
|
523
|
+
wiki_publish_session as publisher/admin
|
|
524
|
+
source_read from stable
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
For separated duties, a writer can start the session, patch, validate, diff, and commit. A publisher or admin performs `web_fetch` and the final publish step.
|
|
528
|
+
|
|
529
|
+
## Complete v1 Document Ingestion Flow
|
|
530
|
+
|
|
531
|
+
Start the server with `--role publisher` or `--role admin`, then initialize MCP.
|
|
532
|
+
|
|
533
|
+
```text
|
|
534
|
+
wiki_session_start
|
|
535
|
+
document_upload
|
|
536
|
+
document_parse
|
|
537
|
+
source_read with ref = session_id
|
|
538
|
+
wiki_session_patch with frontmatter.sources
|
|
539
|
+
wiki_session_validate
|
|
540
|
+
wiki_session_diff
|
|
541
|
+
wiki_session_commit
|
|
542
|
+
wiki_publish_session as publisher/admin
|
|
543
|
+
source_read from stable
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
For separated duties, a writer can perform upload, parse, patch, validate, diff, and commit; a publisher or admin performs the final publish step.
|
|
547
|
+
|
|
548
|
+
## Historical v0 Writer Flow
|
|
549
|
+
|
|
550
|
+
Start the server with `--role writer`, then initialize MCP.
|
|
551
|
+
|
|
552
|
+
Read stable content:
|
|
553
|
+
|
|
554
|
+
```json
|
|
555
|
+
{"jsonrpc":"2.0","id":10,"method":"tools/call","params":{"name":"wiki_read","arguments":{"path":"wiki/index.md","include_frontmatter":true}}}
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
Start a session:
|
|
559
|
+
|
|
560
|
+
```json
|
|
561
|
+
{"jsonrpc":"2.0","id":11,"method":"tools/call","params":{"name":"wiki_session_start","arguments":{"purpose":"update home page"}}}
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
Use the returned `session_id`, then replace the page with complete Markdown content:
|
|
565
|
+
|
|
566
|
+
```json
|
|
567
|
+
{"jsonrpc":"2.0","id":12,"method":"tools/call","params":{"name":"wiki_session_patch","arguments":{"session_id":"SESSION_ID","path":"wiki/index.md","content":"---\ntitle: \"Home\"\nsummary: \"Entry point for the wiki.\"\ntags: [\"home\"]\nupdated: \"2026-06-11\"\n---\n\n# Home\n\nUpdated content.\n","reason":"refresh home page copy"}}}
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
Validate:
|
|
571
|
+
|
|
572
|
+
```json
|
|
573
|
+
{"jsonrpc":"2.0","id":13,"method":"tools/call","params":{"name":"wiki_session_validate","arguments":{"session_id":"SESSION_ID"}}}
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
Inspect diff:
|
|
577
|
+
|
|
578
|
+
```json
|
|
579
|
+
{"jsonrpc":"2.0","id":14,"method":"tools/call","params":{"name":"wiki_session_diff","arguments":{"session_id":"SESSION_ID"}}}
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
Commit the session branch:
|
|
583
|
+
|
|
584
|
+
```json
|
|
585
|
+
{"jsonrpc":"2.0","id":15,"method":"tools/call","params":{"name":"wiki_session_commit","arguments":{"session_id":"SESSION_ID","message":"docs: update home page"}}}
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
After commit, `wiki_read` still reads stable. In the v0 historical flow there is no publish step, so committed session content remains isolated on the session branch.
|
|
589
|
+
|
|
590
|
+
## Common Errors
|
|
591
|
+
|
|
592
|
+
Permission denied:
|
|
593
|
+
|
|
594
|
+
```json
|
|
595
|
+
{
|
|
596
|
+
"isError": true,
|
|
597
|
+
"structuredContent": {
|
|
598
|
+
"error": {
|
|
599
|
+
"code": "permission_denied",
|
|
600
|
+
"message": "reader cannot use wiki_session_start"
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
Common tool-level error codes:
|
|
607
|
+
|
|
608
|
+
- `permission_denied`: the server role cannot call that tool.
|
|
609
|
+
- `unsupported_channel`: a requested `ref`, `channel`, or publish mode is not supported.
|
|
610
|
+
- `invalid_path`: the requested path is invalid or escapes the wiki root.
|
|
611
|
+
- `validation_failed`: validation found errors before commit.
|
|
612
|
+
- `source_write_denied`: session patch attempted to write under `sources/**`.
|
|
613
|
+
- `session_dirty`: there are no session changes to commit, or the session state is not committable.
|
|
614
|
+
- `session_not_found`: the session id does not refer to known session metadata.
|
|
615
|
+
|
|
616
|
+
Schema-level input validation errors are returned by the MCP SDK as `isError: true` with text content. For example, sending a `patch` key to `wiki_session_patch` instead of `content` is rejected before the tool handler runs.
|
|
617
|
+
|
|
618
|
+
## v0 Historical Scope
|
|
619
|
+
|
|
620
|
+
v0 supported local workspace initialization, stable wiki reads, isolated edit sessions, validation, diff, and session commits. Publishing, rollback, search, ingestion, and QA tools were intentionally out of scope.
|
|
621
|
+
|
|
622
|
+
These tools did not appear in `tools/list` for v0:
|
|
623
|
+
|
|
624
|
+
- `wiki_publish_session`
|
|
625
|
+
- `wiki_rollback`
|
|
626
|
+
- `wiki_search`
|
|
627
|
+
- document ingestion tools
|
|
628
|
+
- web ingestion tools
|
|
629
|
+
- QA or semantic search tools
|
|
630
|
+
|
|
631
|
+
Use [v2-acceptance.md](./v2-acceptance.md) for the current release gate. Use [v1-acceptance.md](./v1-acceptance.md) and [v0-acceptance.md](./v0-acceptance.md) for historical acceptance policy.
|