@hiai-gg/docsmint 0.6.8 → 0.7.1

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.
Files changed (138) hide show
  1. package/README.md +90 -99
  2. package/backend/src/lib/api-keys.ts +14 -6
  3. package/backend/src/lib/lifecycle-service.ts +397 -73
  4. package/dist/backend/index.js +13039 -10865
  5. package/dist/backend-account-runtime-cleanup.js +152 -42
  6. package/dist/backend-api-key-facade.js +207 -61
  7. package/dist/backend-pipeline-cancellation.js +144 -42
  8. package/dist/client.d.ts +12 -2
  9. package/dist/client.js +83 -30
  10. package/dist/frontend/{CategoryDialog-CbXBMBZB.js → CategoryDialog-t_WIvFAG.js} +5 -5
  11. package/dist/frontend/{ConfirmDialog-DgMTQBq4.js → ConfirmDialog-_LlrA--f.js} +3 -3
  12. package/dist/frontend/{CreateSnapshotDialog-FUq-ZfBH.js → CreateSnapshotDialog-DW3PwAt5.js} +4 -4
  13. package/dist/frontend/{DatePicker-D6E-EEtZ.js → DatePicker-CAw0wZZK.js} +9 -9
  14. package/dist/frontend/{DeleteDialog-8k6JYWCx.js → DeleteDialog-L1A3FhMM.js} +1 -1
  15. package/dist/frontend/{FolderNode-DAAn_T8_.js → FolderNode-DzTqitR8.js} +2 -2
  16. package/dist/frontend/{HiAiEditor-DSVG3GNd.js → HiAiEditor-B7MK19_j.js} +7 -7
  17. package/dist/frontend/{SettingsDialog-BDNgf5rv.js → SettingsDialog-CS5L4nnU.js} +13 -13
  18. package/dist/frontend/ShareDialog-CwFa8mlk.js +281 -0
  19. package/dist/frontend/{Sidebar-DX08utdV.js → Sidebar-CDaFFmaQ.js} +18 -17
  20. package/dist/frontend/{TagCreateDialog-Bb0-Vtzh.js → TagCreateDialog-C7Avn2_h.js} +4 -4
  21. package/dist/frontend/api/attachments.js +1 -1
  22. package/dist/frontend/api/settings.js +1 -1
  23. package/dist/frontend/app-shell.js +3 -3
  24. package/dist/frontend/{attachments-B8AuDjno.js → attachments-B2aH3hXF.js} +10 -9
  25. package/dist/frontend/{auth-client-Cygmp1I2.js → auth-client-CnDZwPfp.js} +11 -11
  26. package/dist/frontend/components/category-dialog.js +1 -1
  27. package/dist/frontend/components/create-snapshot-dialog.js +1 -1
  28. package/dist/frontend/components/delete-dialog.js +1 -1
  29. package/dist/frontend/components/editor/compact-editor.js +1 -1
  30. package/dist/frontend/components/editor/document-editor.js +1 -1
  31. package/dist/frontend/components/editor/document-title.js +1 -1
  32. package/dist/frontend/components/editor/markdown-toggle.js +1 -1
  33. package/dist/frontend/components/folder-node.js +1 -1
  34. package/dist/frontend/components/save-as-dialog.js +4 -4
  35. package/dist/frontend/components/settings.js +1 -1
  36. package/dist/frontend/components/share-dialog.d.ts +2 -1
  37. package/dist/frontend/components/share-dialog.js +1 -1
  38. package/dist/frontend/components/sidebar.js +1 -1
  39. package/dist/frontend/components/tag-create-dialog.js +1 -1
  40. package/dist/frontend/components/version-history.js +3 -3
  41. package/dist/frontend/{confirm-dialog-CzmoZw3a.js → confirm-dialog-BW2h2NE8.js} +5 -5
  42. package/dist/frontend/dashboard.js +1008 -998
  43. package/dist/frontend/{db-ByrlYfaI.js → db-Bo1t_76T.js} +1 -1
  44. package/dist/frontend/{dialog-Ce79C9fd.js → dialog-C2iKObEu.js} +7 -7
  45. package/dist/frontend/{dropdown-menu-CJ_7V3N0.js → dropdown-menu-BXIl2E26.js} +12 -12
  46. package/dist/frontend/{floating-layer-anchor-S5RSefGN.js → floating-layer-anchor-BGIndLY-.js} +63 -63
  47. package/dist/frontend/i18n.js +1 -1
  48. package/dist/frontend/{identity-DyWeNzu_.js → identity-Ynrglr5i.js} +1 -1
  49. package/dist/frontend/{input-BWlOML_m.js → input-eHFb2qiL.js} +2 -2
  50. package/dist/frontend/{label-C2HfJNQ2.js → label-_I1iiaNU.js} +2 -2
  51. package/dist/frontend/messages-DTRe4U2V.js +1093 -0
  52. package/dist/frontend/offline/identity.js +1 -1
  53. package/dist/frontend/search.js +3 -3
  54. package/dist/frontend/{select-value-JCAp2PmU.js → select-value-CtMyrvDJ.js} +18 -18
  55. package/dist/frontend/{settings-DSrUl4hW.js → settings-BR48ihB4.js} +6 -23
  56. package/dist/frontend/{textarea-DOAE-h42.js → textarea-2eslfANY.js} +2 -2
  57. package/dist/frontend/{utils-BPDRytUU.js → utils-CDBqTgoV.js} +1 -1
  58. package/dist/frontend-ssr/api/attachments.js +1 -1
  59. package/dist/frontend-ssr/api/settings.js +1 -1
  60. package/dist/frontend-ssr/app-shell.js +3 -3
  61. package/dist/frontend-ssr/assets/{CategoryDialog-QHEv_9N4.js → CategoryDialog-B3MrZUho.js} +5 -5
  62. package/dist/frontend-ssr/assets/{ConfirmDialog-BhAelejz.js → ConfirmDialog-D1BDXXll.js} +3 -3
  63. package/dist/frontend-ssr/assets/{CreateSnapshotDialog-CI8vXXcN.js → CreateSnapshotDialog-NM0n1Whr.js} +4 -4
  64. package/dist/frontend-ssr/assets/{DatePicker-D84cJ-Eq.js → DatePicker-Dcok9XVm.js} +4 -4
  65. package/dist/frontend-ssr/assets/{DeleteDialog-DG9Lm38J.js → DeleteDialog-oHT_p_vG.js} +1 -1
  66. package/dist/frontend-ssr/assets/{FolderNode-kmilhDjO.js → FolderNode-B84NL8Rg.js} +2 -2
  67. package/dist/frontend-ssr/assets/{HiAiEditor-CUOJmKzT.js → HiAiEditor-tU0jmp6L.js} +6 -6
  68. package/dist/frontend-ssr/assets/{SettingsDialog-BjJIiVLc.js → SettingsDialog-Dkp79L1B.js} +13 -13
  69. package/dist/frontend-ssr/assets/{ShareDialog-C9C-XTm4.js → ShareDialog-B1-30sRR.js} +20 -7
  70. package/dist/frontend-ssr/assets/{Sidebar-C2sUfGNk.js → Sidebar-CGp45ngo.js} +14 -13
  71. package/dist/frontend-ssr/assets/{TagCreateDialog-DUPMitlL.js → TagCreateDialog-CGGtYSso.js} +4 -4
  72. package/dist/frontend-ssr/assets/{attachments-Cj3fQyUp.js → attachments-BdkOp8ha.js} +5 -4
  73. package/dist/frontend-ssr/assets/{auth-client-x26kqY8Z.js → auth-client-CojKIzqy.js} +13 -13
  74. package/dist/frontend-ssr/assets/{confirm-dialog-XuyaL8sr.js → confirm-dialog-B-oV5wYk.js} +5 -5
  75. package/dist/frontend-ssr/assets/{db-CnxeO66n.js → db-BhwJPEkn.js} +1 -1
  76. package/dist/frontend-ssr/assets/{dialog-BOV1u6zP.js → dialog-1SB5neow.js} +8 -8
  77. package/dist/frontend-ssr/assets/{dropdown-menu-Dn_vQq9b.js → dropdown-menu-DqoOkdqB.js} +12 -12
  78. package/dist/frontend-ssr/assets/{floating-layer-anchor-BIAu-252.js → floating-layer-anchor-BoiiIEiK.js} +71 -71
  79. package/dist/frontend-ssr/assets/{identity-B3uHoDtf.js → identity-DcMMBKWg.js} +1 -1
  80. package/dist/frontend-ssr/assets/{input-DezGsU3y.js → input-Df-QP3Km.js} +2 -2
  81. package/dist/frontend-ssr/assets/{label-Bj8-TfFN.js → label-CbUOUz6L.js} +2 -2
  82. package/dist/frontend-ssr/assets/{messages-BAQzILs4.js → messages-B1TjVIH8.js} +2 -2
  83. package/dist/frontend-ssr/assets/{select-value-DBhbkNcc.js → select-value-CXEDWrZg.js} +18 -18
  84. package/dist/frontend-ssr/assets/{settings-Bk5Hk9Vq.js → settings-Mp8EuFSn.js} +3 -21
  85. package/dist/frontend-ssr/assets/{textarea-Dev-qSEc.js → textarea-CHh8NuSS.js} +2 -2
  86. package/dist/frontend-ssr/assets/{utils-DtlPPXpJ.js → utils-DtX0ta7y.js} +1 -1
  87. package/dist/frontend-ssr/components/category-dialog.js +1 -1
  88. package/dist/frontend-ssr/components/create-snapshot-dialog.js +1 -1
  89. package/dist/frontend-ssr/components/delete-dialog.js +1 -1
  90. package/dist/frontend-ssr/components/editor/compact-editor.js +1 -1
  91. package/dist/frontend-ssr/components/editor/document-editor.js +1 -1
  92. package/dist/frontend-ssr/components/editor/document-title.js +1 -1
  93. package/dist/frontend-ssr/components/editor/markdown-toggle.js +1 -1
  94. package/dist/frontend-ssr/components/folder-node.js +1 -1
  95. package/dist/frontend-ssr/components/save-as-dialog.js +4 -4
  96. package/dist/frontend-ssr/components/settings.js +1 -1
  97. package/dist/frontend-ssr/components/share-dialog.js +1 -1
  98. package/dist/frontend-ssr/components/sidebar.js +1 -1
  99. package/dist/frontend-ssr/components/tag-create-dialog.js +1 -1
  100. package/dist/frontend-ssr/components/version-history.js +3 -3
  101. package/dist/frontend-ssr/dashboard.js +32 -30
  102. package/dist/frontend-ssr/i18n.js +1 -1
  103. package/dist/frontend-ssr/offline/identity.js +1 -1
  104. package/dist/frontend-ssr/search.js +3 -3
  105. package/dist/index.d.ts +5 -5
  106. package/dist/index.js +2 -2
  107. package/dist/lifecycle-persistent.d.ts +1 -1
  108. package/dist/lifecycle-runtime.js +52659 -338
  109. package/dist/mcp-cli.js +1056 -0
  110. package/dist/mcp-server.d.ts +39 -0
  111. package/dist/mcp-server.js +1053 -0
  112. package/dist/storage-quota.d.ts +5 -1
  113. package/dist/types.d.ts +7 -0
  114. package/dist/workspace.d.ts +11 -2
  115. package/dist/workspace.js +82 -10
  116. package/package.json +7 -13
  117. package/packages/cli/src/index.ts +4 -3
  118. package/packages/db/src/client.ts +56 -5
  119. package/packages/db/src/schema.ts +192 -1
  120. package/packages/db/src/with-tenant.ts +20 -2
  121. package/server.json +42 -5
  122. package/dist/frontend/ShareDialog-2Mty7hm4.js +0 -258
  123. package/dist/frontend/messages-DIovIZrK.js +0 -1093
  124. package/packages/mcp-server/src/capabilities.ts +0 -189
  125. package/packages/mcp-server/src/client.ts +0 -225
  126. package/packages/mcp-server/src/index.ts +0 -8
  127. package/packages/mcp-server/src/server.ts +0 -87
  128. package/packages/mcp-server/src/tools/create-document.ts +0 -34
  129. package/packages/mcp-server/src/tools/create-folder.ts +0 -31
  130. package/packages/mcp-server/src/tools/create-snapshot.ts +0 -27
  131. package/packages/mcp-server/src/tools/export-document.ts +0 -22
  132. package/packages/mcp-server/src/tools/get-document.ts +0 -22
  133. package/packages/mcp-server/src/tools/list-documents.ts +0 -34
  134. package/packages/mcp-server/src/tools/list-folders.ts +0 -26
  135. package/packages/mcp-server/src/tools/search.ts +0 -39
  136. package/packages/mcp-server/src/tools/update-document.ts +0 -38
  137. package/packages/mcp-server/src/tools/version-history.ts +0 -27
  138. package/packages/mcp-server/src/types.ts +0 -126
package/README.md CHANGED
@@ -17,13 +17,18 @@ server.
17
17
  [![Stars](https://img.shields.io/github/stars/hiai-gg/docsmint)](https://github.com/hiai-gg/docsmint/stargazers)
18
18
  [![CI](https://github.com/hiai-gg/docsmint/actions/workflows/ci.yml/badge.svg)](https://github.com/hiai-gg/docsmint/actions/workflows/ci.yml)
19
19
  [![Bun](https://img.shields.io/badge/Runtime-Bun_1.3-black?logo=bun&logoColor=white)](https://bun.sh)
20
- [![TypeScript](https://img.shields.io/badge/TypeScript-5.x-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org)
20
+ [![TypeScript](https://img.shields.io/badge/TypeScript-6.x-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org)
21
21
  [![Svelte](https://img.shields.io/badge/Svelte-5.x-FF3E00?logo=svelte&logoColor=white)](https://svelte.dev)
22
22
  [![Elysia](https://img.shields.io/badge/Elysia-1.4-lightgrey?logo=elysia&logoColor=white)](https://elysiajs.com)
23
23
  [![Tailwind_CSS](https://img.shields.io/badge/Tailwind_CSS-v4-06B6D4?logo=tailwindcss&logoColor=white)](https://tailwindcss.com)
24
24
  [![Drizzle_ORM](https://img.shields.io/badge/Drizzle_ORM-0.45-C5F74F?logo=drizzle&logoColor=black)](https://orm.drizzle.team)
25
25
  [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md)
26
- [![MCP Badge](https://lobehub.com/badge/mcp/hiai-gg-docsmint?style=plastic)](https://lobehub.com/mcp/hiai-gg-docsmint)
26
+ [![MCP Badge](https://lobehub.com/badge/mcp/hiai-gg-docsmint)](https://lobehub.com/mcp/hiai-gg-docsmint)
27
+
28
+ [GitHub](https://github.com/HiAi-gg/docsmint) ·
29
+ [Docker Hub](https://hub.docker.com/r/vgalibov/docsmint) ·
30
+ [npm](https://www.npmjs.com/package/@hiai-gg/docsmint) ·
31
+ [LobeHub MCP](https://lobehub.com/mcp/hiai-gg-docsmint)
27
32
 
28
33
  <img width="1920" height="974" alt="DocsMint installable document workspace" src="https://github.com/user-attachments/assets/94701d01-a361-4ca1-b16d-de2a0c64d684" />
29
34
 
@@ -40,99 +45,22 @@ server.
40
45
  - **Own the full stack**: application data, vectors, graph, queue, and files run
41
46
  on infrastructure you control.
42
47
 
43
- ## What's new in DocsMint 0.6.8?
44
-
45
- - **Workspace-safe recovery.** Explicit operator reindexing carries the
46
- document's workspace into every durable pipeline stage, including RLS reads.
47
- - **Consistent operator authentication.** Both documented admin key headers
48
- bypass interactive rate limits during maintenance operations.
49
-
50
- DocsMint 0.6.8 includes the self-host reliability fixes introduced in 0.6.7:
51
-
52
- - **Reliable HTTPS sessions.** Every protected SvelteKit route accepts Better
53
- Auth's secure production cookie as well as the local-development cookie.
54
- - **Cleaner retrieval.** Deleted documents are excluded before exact, lexical,
55
- fuzzy, vector, chunk, and graph ranking.
56
- - **Explicit GraphRAG providers.** Entity extraction requires its own
57
- chat-completion URL and never sends chat requests to an embedding endpoint.
58
- - **Safer self-host defaults.** Auth origins are validated configuration, the
59
- SeaweedFS Filer UI binds to loopback, folder moves refresh knowledge
60
- metadata, and backups exclude `.env`.
61
-
62
- DocsMint 0.6.7 includes the safe index recovery introduced in 0.6.6:
63
-
64
- - **Safe explicit index recovery.** Admin document reindexing keeps the active
65
- generation searchable until a new generation has passed embedding, graph,
66
- summary, and finalize stages.
67
- - **Truthful queue admission.** Maintenance requests force a replacement
68
- generation and report an error when durable enqueue fails instead of
69
- returning a false-positive success.
70
- - **Verified MCP distribution.** The official MCP Registry manifest, npm stdio
71
- package, hosted Streamable HTTP endpoint, bundled Skill, prompts, resources,
72
- and 17-tool catalog remain one versioned contract.
73
-
74
- DocsMint 0.6.6 includes the registry metadata fixes released in 0.6.3-0.6.5
75
- and the complete MCP foundation introduced in 0.6.2:
76
-
77
- - **Official MCP identity.** DocsMint now publishes the verified
78
- `io.github.HiAi-gg/docsmint` registry identity for both the npm stdio server
79
- and the hosted Streamable HTTP endpoint.
80
- - **One capability implementation.** The public `@hiai-gg/docsmint/mcp`
81
- contract lets hosts provide a scoped API client while reusing the same 17
82
- tools, two prompts, three resources, and bundled document-manager Skill.
83
- - **Current protocol runtime.** The MCP server uses the stable v2 server
84
- package and retains compatible stdio negotiation for existing clients.
85
-
86
- DocsMint 0.6.2 includes the reliable knowledge refresh and scoped automation
87
- foundation introduced in 0.6.1:
88
-
89
- - **Reliable knowledge refreshes.** Explicit full reindexing now supersedes
90
- failed or stuck generations, retries release stale extraction claims, and
91
- publishes embeddings, summaries, and graph projections only for the current
92
- document generation.
93
- - **Safer scoped automation.** Global keys can manage the complete document
94
- domain, while category keys stay confined to their category, folders,
95
- documents, tags, graph traversal, and index operations according to explicit
96
- `read`, `edit`, and `write` permissions.
97
- - **Portable agent integration.** The MCP package exposes 17 document-manager
98
- tools, two reusable prompts, three context resources, and a bundled Skill,
99
- with Bunx, NPX, and local-checkout installation paths.
100
- - **Compatible frontend packaging.** Published frontend entrypoints resolve the
101
- canonical hiai-ui exports used by the source build and packed consumers.
102
-
103
- DocsMint 0.6.1 includes the mobile and PWA foundation introduced in 0.6.0:
104
-
105
- - **Installable, update-safe PWA.** A versioned service worker, responsive app
106
- shell, install prompt, and deterministic offline fallback make DocsMint feel
107
- at home on desktop and mobile browsers.
108
- - **Private offline reading and explicit drafts.** Identity-partitioned local
109
- snapshots keep selected documents readable offline. Drafts autosave locally,
110
- then return through a deliberate review-and-apply flow after reconnecting;
111
- DocsMint never silently replays offline mutations.
112
- - **Touch-safe mobile navigation.** Sidebar document actions, Copy controls, and
113
- overflow menus remain reachable on touch devices without depending on hover,
114
- with accessible targets and narrow-screen layouts.
115
- - **A flexible editor contract.** Reactive visual/Markdown mode preferences,
116
- Minimal toolbar support, and a reusable compact TipTap editor let hosts match
117
- the writing surface to the task without forking editor internals.
118
- - **Stable document discovery.** The public API and TypeScript SDK provide
119
- deterministic cursor pagination and global sorting by title, category,
120
- folder, or update time, with canonical category and folder metadata.
121
- - **Clear public and restricted sharing.** Share creation exposes the resulting
122
- URL for both public links and restricted invitation workflows, with an
123
- explicit Copy action that works on narrow screens.
124
- - **Knowledge built for agents.** REST, the typed SDK, CLI, and MCP server expose
125
- scoped document operations, while multilingual hybrid search and GraphRAG
126
- help people and AI agents retrieve connected knowledge instead of isolated
127
- keyword matches.
128
-
129
- DocsMint combines an installable self-hosted PWA knowledge base, mobile document
130
- workspace, offline reading, local drafts, multilingual semantic search,
131
- GraphRAG, MCP, a TypeScript SDK, CLI, and composable frontend hosts in one
132
- open-source system.
133
-
134
- For self-hosted customization, see [PWA hosting](docs/PWA_HOSTING.md) and
135
- [extension points](docs/EXTENDING.md).
48
+ ## What's new in 0.7.0?
49
+
50
+ - **Signed workspace assertions.** Trusted server-to-server hosts can restrict
51
+ an assertion to one category with independent `read`, `edit`, and `write`
52
+ permissions. An omitted scope remains workspace-wide and role-derived.
53
+ - **Consistent effective-category authorization.** Direct and folder-inherited
54
+ categories are enforced before counts, pagination, indexing, search, and
55
+ GraphRAG retrieval. Index status is read-only; refresh requires write.
56
+ - **Release-safe indexing.** Context-aware embedding generations and recovery
57
+ prevent stale metadata work from becoming active.
58
+
59
+ This OSS release adds no host RBAC, billing, invitations, or product UI. The
60
+ 0.6.x reliability work — workspace-safe reindex, HTTPS sessions, trash-aware
61
+ retrieval, explicit GraphRAG providers, MCP Registry identity, and the
62
+ installable PWA ships in this line. See the [changelog](CHANGELOG.md) for
63
+ the complete history and the [roadmap](docs/ROADMAP.md) for what comes next.
136
64
 
137
65
  ## Fastest installation: give this prompt to your agent
138
66
 
@@ -175,6 +103,20 @@ On its first run, the script creates an ignored root `.env`, generates the
175
103
  database, authentication, and storage secrets, builds the PostgreSQL image,
176
104
  applies migrations, and starts the complete application.
177
105
 
106
+ Published application images are on
107
+ [Docker Hub](https://hub.docker.com/r/vgalibov/docsmint). There is no untagged
108
+ `latest` image; pull the role-specific tags:
109
+
110
+ ```bash
111
+ docker pull vgalibov/docsmint:api-latest
112
+ docker pull vgalibov/docsmint:web-latest
113
+ docker pull vgalibov/docsmint:caddy-latest
114
+ ```
115
+
116
+ Use versioned tags such as `api-v0.7.1` for reproducible deploys. The
117
+ quickstart still builds the Compose stack from this repository so PostgreSQL,
118
+ Redis, and SeaweedFS start together with the application.
119
+
178
120
  For OpenRouter, add one value to `.env` and run the script again:
179
121
 
180
122
  ```dotenv
@@ -223,6 +165,9 @@ The canonical local ports are:
223
165
  See [Deployment](docs/DEPLOYMENT.md) for domains, TLS, provider tuning,
224
166
  backups, and production operation.
225
167
 
168
+ Embedding provider URLs, models, and credentials are deployment configuration.
169
+ They are never stored in browser settings or local storage.
170
+
226
171
  ## Use DocsMint from the terminal
227
172
 
228
173
  The published package includes the CLI. It connects to an already running
@@ -241,7 +186,7 @@ bunx --package @hiai-gg/docsmint docsmint search "project architecture"
241
186
  bunx --package @hiai-gg/docsmint docsmint list
242
187
  bunx --package @hiai-gg/docsmint docsmint read <document-id>
243
188
  bunx --package @hiai-gg/docsmint docsmint create \
244
- --title "Release notes" --content "# Version 0.2.9"
189
+ --title "Release notes" --content "# Highlights"
245
190
  ```
246
191
 
247
192
  Credentials can also be supplied through `HIAI_DOCS_URL` and
@@ -259,8 +204,8 @@ context resources, and a document-manager skill for agent clients.
259
204
  {
260
205
  "mcpServers": {
261
206
  "docsmint": {
262
- "command": "bunx",
263
- "args": ["--package", "@hiai-gg/docsmint", "docsmint-mcp"],
207
+ "command": "npx",
208
+ "args": ["-y", "@hiai-gg/docsmint", "docsmint-mcp"],
264
209
  "env": {
265
210
  "HIAI_DOCS_URL": "http://localhost:50700",
266
211
  "HIAI_DOCS_API_KEY": "your-global-or-category-key"
@@ -273,14 +218,59 @@ context resources, and a document-manager skill for agent clients.
273
218
  Run the server directly to verify the installation:
274
219
 
275
220
  ```bash
276
- bunx --package @hiai-gg/docsmint docsmint-mcp
221
+ npx -y @hiai-gg/docsmint docsmint-mcp
277
222
  ```
278
223
 
224
+ `npx` is the install path LobeHub and Node MCP clients validate. Bun checkouts can use
225
+ `bunx --package @hiai-gg/docsmint docsmint-mcp` instead. The process speaks MCP on
226
+ stdio and advertises tools, prompts, and resources without a running DocsMint API.
227
+
279
228
  The server uses stdio and works with MCP-capable clients such as Claude
280
229
  Desktop, Cursor, and coding agents that accept standard MCP configuration. See
281
230
  the [MCP guide](packages/mcp-server/README.md) for its 17 tools, prompts,
282
231
  resources, skill, and API routes.
283
232
 
233
+ ## MCP Features
234
+
235
+ ### Tools (17)
236
+
237
+ - `search_documents`: Hybrid search (full-text + semantic pgvector).
238
+ - `get_document`: Fetch document content and metadata.
239
+ - `create_document`: Create a document with optional markdown, folder, and category.
240
+ - `update_document`: Update title, content, folder, or category (new version on each save).
241
+ - `list_documents`: Paginated document list, optionally filtered by folder or tag.
242
+ - `list_folders`: List folders, optionally under a parent.
243
+ - `create_folder`: Create a folder, optionally nested.
244
+ - `create_snapshot`: Create a named snapshot of the current document.
245
+ - `get_version_history`: List versions, optionally snapshots only.
246
+ - `export_document`: Export a document as Markdown.
247
+ - `list_categories`: List categories visible to the API key.
248
+ - `create_category`: Create a category (workspace key with write access).
249
+ - `list_tags`: List tags in the workspace or bound category.
250
+ - `get_related_documents`: Traverse the knowledge graph from one authorized document.
251
+ - `search_knowledge_graph`: Search connected knowledge from authorized seed documents.
252
+ - `get_document_index_status`: Read indexing and knowledge-pipeline status.
253
+ - `refresh_document_index`: Request reindexing after a document or metadata change.
254
+
255
+ ### Prompts (2)
256
+
257
+ - `organize_workspace`: Plan safe document organization using DocsMint categories and folders.
258
+ - `research_workspace`: Research a question with hybrid search and GraphRAG citing document IDs.
259
+
260
+ ### Resources (3)
261
+
262
+ - `docsmint://guide/editor`: Editor usage guide.
263
+ - `docsmint://guide/search`: Search and GraphRAG guide.
264
+ - `docsmint://workspace/catalog`: Live scoped workspace catalog.
265
+
266
+ ### Skills (1)
267
+
268
+ - [`docsmint-document-manager`](skills/docsmint-document-manager/SKILL.md):
269
+ create, organize, edit, and research DocsMint documents through the 17 MCP
270
+ tools, including hybrid search, GraphRAG, and index refresh.
271
+
272
+ The same Skill ships in the npm package under `skills/docsmint-document-manager/SKILL.md`.
273
+
284
274
  ## Agent skills after installation
285
275
 
286
276
  The MCP tools are the recommended portable agent skills. A category-bound agent
@@ -410,6 +400,7 @@ deployment.
410
400
 
411
401
  - [Documentation index](docs/README.md)
412
402
  - [Product usage](docs/USAGE.md)
403
+ - [Roadmap](docs/ROADMAP.md)
413
404
  - [REST API](docs/API.md) and [OpenAPI JSON](docs/openapi.json)
414
405
  - [Architecture](docs/ARCHITECTURE.md)
415
406
  - [Deployment and operations](docs/DEPLOYMENT.md)
@@ -5,6 +5,7 @@ import {
5
5
  ZERO_UUID,
6
6
  } from "@hiai-docs/db/with-tenant";
7
7
  import { and, desc, eq } from "drizzle-orm";
8
+ import { isAccountPurgeFencedError } from "./account-purge-fence";
8
9
  import { decryptApiKey, encryptApiKey } from "./api-key-encryption";
9
10
 
10
11
  const API_KEY_ADMIN_TENANT = adminTenantContext(ZERO_UUID);
@@ -228,12 +229,19 @@ export async function validateApiKey(key: string): Promise<{
228
229
  if (!scopes) return null;
229
230
 
230
231
  // Update last_used_at
231
- await withTenant(API_KEY_ADMIN_TENANT, (tx) =>
232
- tx
233
- .update(apiKeys)
234
- .set({ lastUsedAt: new Date() })
235
- .where(eq(apiKeys.id, row.id)),
236
- );
232
+ try {
233
+ await withTenant(API_KEY_ADMIN_TENANT, (tx) =>
234
+ tx
235
+ .update(apiKeys)
236
+ .set({ lastUsedAt: new Date() })
237
+ .where(eq(apiKeys.id, row.id)),
238
+ );
239
+ } catch (error) {
240
+ // Preserve the authenticated principal so guarded routes return the
241
+ // stable public fence error. The key row itself remains frozen until
242
+ // lifecycle cleanup deletes it.
243
+ if (!isAccountPurgeFencedError(error)) throw error;
244
+ }
237
245
 
238
246
  return {
239
247
  id: row.id,