@profullstack/readm3 0.3.0 → 0.4.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/README.md +125 -4
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +8 -2
- package/dist/cli.js.map +1 -1
- package/dist/cloud-cli.d.ts +4 -0
- package/dist/cloud-cli.d.ts.map +1 -0
- package/dist/cloud-cli.js +192 -0
- package/dist/cloud-cli.js.map +1 -0
- package/dist/cloud-client.d.ts +14 -0
- package/dist/cloud-client.d.ts.map +1 -0
- package/dist/cloud-client.js +62 -0
- package/dist/cloud-client.js.map +1 -0
- package/dist/mcp.d.ts +2 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +301 -0
- package/dist/mcp.js.map +1 -0
- package/package.json +12 -6
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# readm3
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Markdown editing and sharing for people and teams, with a terminal reader and editor. File browser on the left, the rendered
|
|
4
4
|
document on the right, and nothing else in the way. Press `e` to edit the file
|
|
5
5
|
you are looking at, `esc` to see it rendered again.
|
|
6
6
|
|
|
@@ -113,8 +113,8 @@ and add a paragraph, not a replacement for your editor. `$EDITOR` is still
|
|
|
113
113
|
|
|
114
114
|
## What it renders
|
|
115
115
|
|
|
116
|
-
Parsing is [marked](https://github.com/markedjs/marked) — CommonMark and GFM
|
|
117
|
-
|
|
116
|
+
Parsing is [marked](https://github.com/markedjs/marked) — CommonMark and GFM.
|
|
117
|
+
The terminal UI uses HQTUI; the cloud tools use the official MCP SDK.
|
|
118
118
|
|
|
119
119
|
Headings, **bold**, *italic*, `inline code`, links, reference links, bare URLs,
|
|
120
120
|
fenced and indented code blocks with a language label, ordered and unordered
|
|
@@ -215,14 +215,106 @@ Windows Terminal.
|
|
|
215
215
|
```bash
|
|
216
216
|
bun install
|
|
217
217
|
bun src/cli.ts . # run it against its own repo
|
|
218
|
-
bun test test
|
|
218
|
+
bun test ./test # 68 tests, no TTY needed
|
|
219
219
|
npm test # the same tests on node
|
|
220
220
|
bun run typecheck
|
|
221
221
|
bun run build
|
|
222
222
|
```
|
|
223
223
|
|
|
224
|
+
## Shared documents, organizations, and teams
|
|
225
|
+
|
|
226
|
+
Read and edit online at https://readm3.com/viewer, and manage your account at
|
|
227
|
+
https://readm3.com/admin. Create private Markdown files, share view or edit links,
|
|
228
|
+
add named collaborators, and grant access to an organization or team. Every link
|
|
229
|
+
opens in read mode. File owners manage permissions and deletion; editors save new
|
|
230
|
+
versions; the super administrator can manage every user's documents.
|
|
231
|
+
|
|
232
|
+
Every online save creates an immutable version with a short ID and SHA-256 checksum.
|
|
233
|
+
Stale saves are rejected so concurrent edits cannot silently overwrite each other.
|
|
234
|
+
Owners can restore prior versions, pin links to a version, and revoke links.
|
|
235
|
+
|
|
236
|
+
```sh
|
|
237
|
+
readm3 login --token-stdin # token from /admin → API tokens
|
|
238
|
+
readm3 orgs list
|
|
239
|
+
readm3 share README.md --org ORG_ID # view link by default
|
|
240
|
+
readm3 docs update DOC_ID notes.md --base VERSION_ID
|
|
241
|
+
readm3 docs history DOC_ID
|
|
242
|
+
readm3 mcp # stdio MCP, same account permissions
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
The REST API is at `/api/v1`, with all operations also available through
|
|
246
|
+
`POST /api/v1/actions` and `readm3 cloud OPERATION --args JSON`.
|
|
247
|
+
Full permissions, accounts, CLI, API, and MCP documentation: https://readm3.com/sharing.
|
|
248
|
+
|
|
249
|
+
## Web reader
|
|
250
|
+
|
|
251
|
+
Open https://readm3.com/viewer for the same two-pane Markdown reader in your browser.
|
|
252
|
+
Open local files or a folder, drop Markdown files into the window, open a raw URL or
|
|
253
|
+
GitHub file link, or start a new note. The explorer filters files, prunes hidden and
|
|
254
|
+
build directories, and sorts README first. All nine themes and Markdown flavors use
|
|
255
|
+
the same renderer as the terminal.
|
|
256
|
+
|
|
257
|
+
Press `/` to filter, `e` to edit, `Escape` to return to reading, and `?` for shortcuts.
|
|
258
|
+
`Ctrl+S` / `⌘S` downloads the current Markdown. Files and edits are saved in IndexedDB
|
|
259
|
+
on this device; originals on disk are never overwritten. Reopening a file adds a copy
|
|
260
|
+
so an existing draft is preserved. Clearing browser site data removes the workspace.
|
|
261
|
+
|
|
262
|
+
Install through your browser’s app menu, or Share → Add to Home Screen on iOS.
|
|
263
|
+
After the first visit, the application and saved workspace work offline. Remote URLs
|
|
264
|
+
need a connection and a host that permits browser access (CORS); files are fetched
|
|
265
|
+
directly with no credentials or server proxy. Local files are uploaded only when you explicitly choose Share → Save online.
|
|
266
|
+
|
|
267
|
+
Imports are limited to 4 MB per file, 20 MB per workspace, and 1,000 files.
|
|
268
|
+
|
|
224
269
|
## The website
|
|
225
270
|
|
|
271
|
+
### Accounts
|
|
272
|
+
|
|
273
|
+
Open https://readm3.com/account to create an email-verified account or sign in.
|
|
274
|
+
The email link expires after 15 minutes and works once. A confirmation button
|
|
275
|
+
prevents email scanners from consuming links. Accounts are created only after
|
|
276
|
+
verification; returning users sign in to the same identity. Account settings
|
|
277
|
+
include display name, sign out, and sign out on all devices.
|
|
278
|
+
|
|
279
|
+
The server stores accounts, hashed sessions, verification challenges, and rate
|
|
280
|
+
limits in SQLite. Set `READM3_DB` to a persistent volume path (production uses
|
|
281
|
+
`/data/readm3.sqlite`), `READM3_URL` to the canonical public origin,
|
|
282
|
+
`READM3_MAIL_FROM` to a verified sender, and `RESEND_API_KEY` to an email-sending key.
|
|
283
|
+
Missing or failed mail delivery returns an error; verification links are never
|
|
284
|
+
printed to logs. Production cookies are Secure, HttpOnly, SameSite=Lax, and
|
|
285
|
+
host-scoped. The account page and APIs are excluded from offline caches.
|
|
286
|
+
|
|
287
|
+
On Railway, attach a volume at `/data`, keep a single replica, and set
|
|
288
|
+
`RAILWAY_RUN_UID=0` for the root-owned volume. Back up the volume before changing
|
|
289
|
+
the account schema. The local reader remains usable without an account.
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
bun run test:accounts # account security tests and browser signup flow
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
The account service is `server/accounts.ts`. It can accept an existing Bun SQLite
|
|
296
|
+
`Database` so workspace APIs share the same `users` and `sessions` tables.
|
|
297
|
+
`account_emails` holds the verified identity associated with each user ID.
|
|
298
|
+
Use `Accounts.authenticate(token)` or `Accounts.requireAccount(request)` when
|
|
299
|
+
authorizing organization, team, role, or API-token operations: these methods
|
|
300
|
+
reject sessions whose user has no verified email. Browser sessions use
|
|
301
|
+
`__Host-readm3_session` over HTTPS and `readm3_session` on localhost.
|
|
302
|
+
Do not enable a separate unverified registration or password-recovery path.
|
|
303
|
+
|
|
304
|
+
| Endpoint | Purpose |
|
|
305
|
+
| --- | --- |
|
|
306
|
+
| `POST /api/auth/email` | Send a sign-in link for an email address |
|
|
307
|
+
| `POST /api/auth/preview` | Show the email associated with an unconsumed link |
|
|
308
|
+
| `POST /api/auth/verify` | Consume the link and set a browser session |
|
|
309
|
+
| `GET /api/auth/session` | Return the verified account, or `null` |
|
|
310
|
+
| `POST /api/auth/profile` | Update the current account's display name |
|
|
311
|
+
| `POST /api/auth/logout` | Revoke the current session |
|
|
312
|
+
| `POST /api/auth/logout-all` | Revoke all sessions belonging to the account |
|
|
313
|
+
|
|
314
|
+
POST requests require JSON and an `Origin` matching `READM3_URL`.
|
|
315
|
+
|
|
316
|
+
### Building and serving
|
|
317
|
+
|
|
226
318
|
[readm3.com](https://readm3.com) is built from this repository by `site/build.ts`,
|
|
227
319
|
which renders every document on the page through `renderMarkdown` and takes every
|
|
228
320
|
color from a real HQTUI theme. There is no second implementation to keep in sync:
|
|
@@ -231,6 +323,35 @@ change the parser and the site changes with it.
|
|
|
231
323
|
```bash
|
|
232
324
|
bun run site:build # writes site/dist
|
|
233
325
|
bun run site:start # serves it on $PORT, default 3000
|
|
326
|
+
bun x playwright install chromium # once, for browser checks
|
|
327
|
+
bun run test:site # imports, editing, persistence, offline PWA, and mobile layout
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
The site build bundles `site/viewer.ts` for browsers, generates content-addressed
|
|
331
|
+
assets, and precaches the viewer shell through a service worker scoped to `/viewer`.
|
|
332
|
+
Updates wait until the reader chooses **Update available**; drafts are saved before
|
|
333
|
+
reloading. The web viewer does not load the marketing site’s third-party scripts.
|
|
334
|
+
|
|
335
|
+
## Hosting shared documents
|
|
336
|
+
|
|
337
|
+
The web server uses Bun and SQLite. Set `READM3_DB` to a database file on persistent
|
|
338
|
+
storage, and `READM3_URL` to the public HTTPS origin. The Docker image uses
|
|
339
|
+
`/data/readm3.sqlite`; mount a volume at `/data`. On Railway set `RAILWAY_RUN_UID=0`
|
|
340
|
+
for access to the mounted volume. Use one service replica for SQLite and configure
|
|
341
|
+
volume backups in the hosting platform.
|
|
342
|
+
|
|
343
|
+
Set `READM3_ADMIN_BOOTSTRAP_SECRET` to a random secret. Sign in at `/account` as
|
|
344
|
+
the intended super administrator, then open `/admin#claim=YOUR_SECRET`. This is a
|
|
345
|
+
one-time claim stored in the database. Never publish this URL; remove the environment
|
|
346
|
+
secret after claiming. Email sign-in never grants administrator access by itself.
|
|
347
|
+
|
|
348
|
+
Accounts use verified email sign-in and HttpOnly cookies. API tokens and share
|
|
349
|
+
capabilities are stored as SHA-256 hashes. Shared documents are not cached in the
|
|
350
|
+
PWA or saved in the browser's local workspace, so revocation applies to future access.
|
|
351
|
+
|
|
352
|
+
```sh
|
|
353
|
+
bun run test:server # auth, roles, version history, persistence, CLI and MCP
|
|
354
|
+
bun run test:site # local/offline reader plus browser sharing and admin workflows
|
|
234
355
|
```
|
|
235
356
|
|
|
236
357
|
## License
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ColorMode } from "./print.ts";
|
|
2
2
|
import { type ViewerOptions } from "./viewer.ts";
|
|
3
|
-
export declare const VERSION = "0.
|
|
3
|
+
export declare const VERSION = "0.4.0";
|
|
4
4
|
/** The help text, exported so a test can hold it to the flags it documents. */
|
|
5
5
|
export declare const USAGE: string;
|
|
6
6
|
export interface ParsedArgs extends ViewerOptions {
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAQA,OAAO,EAA8B,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EAAO,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAQA,OAAO,EAA8B,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EAAO,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAGtD,eAAO,MAAM,OAAO,UAAU,CAAC;AAE/B,+EAA+E;AAC/E,eAAO,MAAM,KAAK,QA2CH,CAAC;AAEhB,MAAM,WAAW,UAAW,SAAQ,aAAa;IAC/C,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,sDAAsD;IACtD,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,SAAS,CAAC;IACjB,uDAAuD;IACvD,QAAQ,EAAE,OAAO,CAAC;CACnB;AAID,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CA6GpD;AAED,wBAAsB,IAAI,CAAC,IAAI,GAAE,MAAM,EAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAyChF"}
|
package/dist/cli.js
CHANGED
|
@@ -8,7 +8,8 @@ import { themeList } from "@profullstack/hqtui";
|
|
|
8
8
|
import { FLAVORS, isFlavor } from "./flavors.js";
|
|
9
9
|
import { printDocument, COLOR_MODES } from "./print.js";
|
|
10
10
|
import { run } from "./viewer.js";
|
|
11
|
-
|
|
11
|
+
import { isCloudCommand, cloudMain, CLOUD_USAGE } from "./cloud-cli.js";
|
|
12
|
+
export const VERSION = "0.4.0";
|
|
12
13
|
/** The help text, exported so a test can hold it to the flags it documents. */
|
|
13
14
|
export const USAGE = `readm3 — a terminal markdown reader and editor
|
|
14
15
|
|
|
@@ -52,7 +53,8 @@ Editing
|
|
|
52
53
|
ctrl+a ctrl+e line start / end ctrl+u kill to start of line
|
|
53
54
|
ctrl+arrow move by word enter split, continuing a list
|
|
54
55
|
ctrl+g keys for editing tab indent two spaces
|
|
55
|
-
|
|
56
|
+
|
|
57
|
+
${CLOUD_USAGE}`;
|
|
56
58
|
class UsageError extends Error {
|
|
57
59
|
}
|
|
58
60
|
export function parseArgs(argv) {
|
|
@@ -169,6 +171,10 @@ export function parseArgs(argv) {
|
|
|
169
171
|
return parsed;
|
|
170
172
|
}
|
|
171
173
|
export async function main(argv = process.argv.slice(2)) {
|
|
174
|
+
if (isCloudCommand(argv[0])) {
|
|
175
|
+
await cloudMain(argv);
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
172
178
|
let args;
|
|
173
179
|
try {
|
|
174
180
|
args = parseArgs(argv);
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAe,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,WAAW,EAAkB,MAAM,YAAY,CAAC;AACxE,OAAO,EAAE,GAAG,EAAsB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.js","sour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QACnC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACpF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const CLOUD_USAGE = "Shared Markdown\n readm3 login --token-stdin Save a personal API token securely\n readm3 logout Remove the local token\n readm3 share FILE --org ID [--role view|edit]\n readm3 docs list [--org ID] [--search TEXT] [--limit N] [--offset N]\n readm3 docs get ID [--raw]\n readm3 docs create FILE --org ID [--title NAME]\n readm3 docs update ID FILE --base VERSION\n readm3 docs delete ID\n readm3 docs history ID\n readm3 docs restore ID --version VERSION --base CURRENT\n readm3 docs share ID [--role view|edit] [--version VERSION]\n readm3 docs revoke ID --share SHARE_ID\n readm3 docs transfer ID --username USERNAME\n readm3 shared get URL [--raw]\n readm3 shared update URL FILE --base VERSION\n readm3 orgs list | create --name NAME | update ID --name NAME | delete ID\n readm3 teams list --org ID | create --org ID --name NAME\n readm3 members list --org ID\n readm3 cloud OPERATION --args '{\"key\":\"value\"}'\n readm3 mcp Start the stdio MCP server\n\nFILE may be - for stdin. --raw prints Markdown; other results are JSON.\nREADM3_URL selects a self-hosted server; READM3_TOKEN supplies an API token.\nView links cannot write. Edit links can save versions. Owners administer files.\nUse readm3 cloud for the full API, including team membership and permissions.\n";
|
|
2
|
+
export declare function isCloudCommand(command: string | undefined): boolean;
|
|
3
|
+
export declare function cloudMain(argv: string[]): Promise<void>;
|
|
4
|
+
//# sourceMappingURL=cloud-cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloud-cli.d.ts","sourceRoot":"","sources":["../src/cloud-cli.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,WAAW,m1CA0BvB,CAAC;AAaF,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,WAEzD;AACD,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,iBAiJ7C"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { basename } from "node:path";
|
|
3
|
+
import { cloudAction, cloudConfig, cloudRequest, clearCloudConfig, saveCloudConfig, sharedLocation, } from "./cloud-client.js";
|
|
4
|
+
export const CLOUD_USAGE = `Shared Markdown
|
|
5
|
+
readm3 login --token-stdin Save a personal API token securely
|
|
6
|
+
readm3 logout Remove the local token
|
|
7
|
+
readm3 share FILE --org ID [--role view|edit]
|
|
8
|
+
readm3 docs list [--org ID] [--search TEXT] [--limit N] [--offset N]
|
|
9
|
+
readm3 docs get ID [--raw]
|
|
10
|
+
readm3 docs create FILE --org ID [--title NAME]
|
|
11
|
+
readm3 docs update ID FILE --base VERSION
|
|
12
|
+
readm3 docs delete ID
|
|
13
|
+
readm3 docs history ID
|
|
14
|
+
readm3 docs restore ID --version VERSION --base CURRENT
|
|
15
|
+
readm3 docs share ID [--role view|edit] [--version VERSION]
|
|
16
|
+
readm3 docs revoke ID --share SHARE_ID
|
|
17
|
+
readm3 docs transfer ID --username USERNAME
|
|
18
|
+
readm3 shared get URL [--raw]
|
|
19
|
+
readm3 shared update URL FILE --base VERSION
|
|
20
|
+
readm3 orgs list | create --name NAME | update ID --name NAME | delete ID
|
|
21
|
+
readm3 teams list --org ID | create --org ID --name NAME
|
|
22
|
+
readm3 members list --org ID
|
|
23
|
+
readm3 cloud OPERATION --args '{"key":"value"}'
|
|
24
|
+
readm3 mcp Start the stdio MCP server
|
|
25
|
+
|
|
26
|
+
FILE may be - for stdin. --raw prints Markdown; other results are JSON.
|
|
27
|
+
READM3_URL selects a self-hosted server; READM3_TOKEN supplies an API token.
|
|
28
|
+
View links cannot write. Edit links can save versions. Owners administer files.
|
|
29
|
+
Use readm3 cloud for the full API, including team membership and permissions.
|
|
30
|
+
`;
|
|
31
|
+
const commands = new Set([
|
|
32
|
+
"login",
|
|
33
|
+
"logout",
|
|
34
|
+
"share",
|
|
35
|
+
"docs",
|
|
36
|
+
"shared",
|
|
37
|
+
"orgs",
|
|
38
|
+
"teams",
|
|
39
|
+
"members",
|
|
40
|
+
"cloud",
|
|
41
|
+
"mcp",
|
|
42
|
+
]);
|
|
43
|
+
export function isCloudCommand(command) {
|
|
44
|
+
return !!command && commands.has(command);
|
|
45
|
+
}
|
|
46
|
+
export async function cloudMain(argv) {
|
|
47
|
+
if (argv.includes("--help") || argv.includes("-h")) {
|
|
48
|
+
process.stdout.write(CLOUD_USAGE);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const command = argv[0];
|
|
52
|
+
if (command === "mcp") {
|
|
53
|
+
const { runMcp } = await import("./mcp.js");
|
|
54
|
+
await runMcp();
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const flags = {};
|
|
58
|
+
const positional = [];
|
|
59
|
+
for (let i = 1; i < argv.length; i++) {
|
|
60
|
+
const value = argv[i];
|
|
61
|
+
if (value.startsWith("--")) {
|
|
62
|
+
const name = value.slice(2);
|
|
63
|
+
if (["raw", "token-stdin", "json"].includes(name))
|
|
64
|
+
flags[name] = "true";
|
|
65
|
+
else {
|
|
66
|
+
if (!argv[i + 1] || argv[i + 1].startsWith("--"))
|
|
67
|
+
throw new Error(`${value} needs a value.`);
|
|
68
|
+
flags[name] = argv[++i];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else
|
|
72
|
+
positional.push(value);
|
|
73
|
+
}
|
|
74
|
+
const output = (value) => process.stdout.write(JSON.stringify(value, null, 2) + "\n");
|
|
75
|
+
const fileSource = (file) => {
|
|
76
|
+
if (!file)
|
|
77
|
+
throw new Error("A Markdown file is required.");
|
|
78
|
+
const value = readFileSync(file === "-" ? 0 : file, "utf8");
|
|
79
|
+
if (Buffer.byteLength(value) > 1024 * 1024)
|
|
80
|
+
throw new Error("Shared documents are limited to 1 MB.");
|
|
81
|
+
return value;
|
|
82
|
+
};
|
|
83
|
+
if (command === "login") {
|
|
84
|
+
if (!flags["token-stdin"])
|
|
85
|
+
throw new Error("Use --token-stdin and paste the API token, then end input (Ctrl+D). Tokens are created at /admin.");
|
|
86
|
+
const token = readFileSync(0, "utf8").trim();
|
|
87
|
+
if (!token)
|
|
88
|
+
throw new Error("No token supplied.");
|
|
89
|
+
const config = { ...cloudConfig(), token };
|
|
90
|
+
const user = await cloudAction("account_me", {}, config);
|
|
91
|
+
saveCloudConfig(config);
|
|
92
|
+
output({ signedIn: true, user });
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (command === "logout") {
|
|
96
|
+
clearCloudConfig();
|
|
97
|
+
output({
|
|
98
|
+
signedOut: true,
|
|
99
|
+
note: "Revoke the token in /admin to invalidate other copies.",
|
|
100
|
+
});
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (command === "cloud") {
|
|
104
|
+
if (!positional[0])
|
|
105
|
+
throw new Error(CLOUD_USAGE);
|
|
106
|
+
const args = flags.args ? JSON.parse(flags.args) : {};
|
|
107
|
+
output(await cloudAction(positional[0], args));
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (command === "shared") {
|
|
111
|
+
const [verb, url, file] = positional;
|
|
112
|
+
if (!["get", "update"].includes(verb))
|
|
113
|
+
throw new Error("Use shared get or shared update.");
|
|
114
|
+
if (!url)
|
|
115
|
+
throw new Error("A shared document URL is required.");
|
|
116
|
+
const { token, config } = sharedLocation(url);
|
|
117
|
+
const result = await cloudRequest(`shared/${token}`, verb === "update" ? "PATCH" : "GET", verb === "update"
|
|
118
|
+
? { source: fileSource(file), baseVersion: flags.base }
|
|
119
|
+
: undefined, config);
|
|
120
|
+
if (!["get", "update"].includes(verb))
|
|
121
|
+
throw new Error("Use shared get or shared update.");
|
|
122
|
+
if (flags.raw)
|
|
123
|
+
process.stdout.write(result.version.source);
|
|
124
|
+
else
|
|
125
|
+
output(result);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const args = {};
|
|
129
|
+
const names = {
|
|
130
|
+
org: "orgId",
|
|
131
|
+
team: "teamId",
|
|
132
|
+
base: "baseVersion",
|
|
133
|
+
version: "versionId",
|
|
134
|
+
share: "shareId",
|
|
135
|
+
user: "userId",
|
|
136
|
+
};
|
|
137
|
+
for (const [name, value] of Object.entries(flags))
|
|
138
|
+
if (!["raw", "json"].includes(name))
|
|
139
|
+
args[names[name] || name] = value;
|
|
140
|
+
if (command === "share") {
|
|
141
|
+
const file = positional[0];
|
|
142
|
+
const doc = await cloudAction("documents_create", {
|
|
143
|
+
...args,
|
|
144
|
+
title: flags.title || basename(file || "Document.md"),
|
|
145
|
+
source: fileSource(file),
|
|
146
|
+
});
|
|
147
|
+
output(await cloudAction("shares_create", {
|
|
148
|
+
documentId: doc.id,
|
|
149
|
+
role: flags.role || "view",
|
|
150
|
+
}));
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const [verb, identifier, file] = positional;
|
|
154
|
+
if (command === "docs") {
|
|
155
|
+
const operations = {
|
|
156
|
+
list: "documents_list",
|
|
157
|
+
get: "documents_get",
|
|
158
|
+
create: "documents_create",
|
|
159
|
+
update: "documents_update",
|
|
160
|
+
delete: "documents_delete",
|
|
161
|
+
history: "versions_list",
|
|
162
|
+
restore: "versions_restore",
|
|
163
|
+
share: "shares_create",
|
|
164
|
+
revoke: "shares_revoke",
|
|
165
|
+
transfer: "documents_transfer",
|
|
166
|
+
};
|
|
167
|
+
const op = operations[verb];
|
|
168
|
+
if (!op)
|
|
169
|
+
throw new Error(CLOUD_USAGE);
|
|
170
|
+
if (verb === "create") {
|
|
171
|
+
args.source = fileSource(identifier);
|
|
172
|
+
args.title = flags.title || basename(identifier || "Document.md");
|
|
173
|
+
}
|
|
174
|
+
else if (verb !== "list")
|
|
175
|
+
args.documentId = identifier;
|
|
176
|
+
if (verb === "update")
|
|
177
|
+
args.source = fileSource(file);
|
|
178
|
+
const result = await cloudAction(op, args);
|
|
179
|
+
if (flags.raw && result.version)
|
|
180
|
+
process.stdout.write(result.version.source);
|
|
181
|
+
else
|
|
182
|
+
output(result);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
const prefix = command === "orgs" ? "organizations" : command;
|
|
186
|
+
if (!["list", "create", "update", "delete", "remove"].includes(verb))
|
|
187
|
+
throw new Error(CLOUD_USAGE);
|
|
188
|
+
if (identifier)
|
|
189
|
+
args[command === "orgs" ? "orgId" : command === "teams" ? "teamId" : "userId"] = identifier;
|
|
190
|
+
output(await cloudAction(`${prefix}_${verb}`, args));
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=cloud-cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloud-cli.js","sourceRoot":"","sources":["../src/cloud-cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EACL,WAAW,EACX,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,cAAc,GACf,MAAM,mBAAmB,CAAC;AAC3B,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;CA0B1B,CAAC;AACF,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC;IACvB,OAAO;IACP,QAAQ;IACR,OAAO;IACP,MAAM;IACN,QAAQ;IACR,MAAM;IACN,OAAO;IACP,SAAS;IACT,OAAO;IACP,KAAK;CACN,CAAC,CAAC;AACH,MAAM,UAAU,cAAc,CAAC,OAA2B;IACxD,OAAO,CAAC,CAAC,OAAO,IAAI,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAC5C,CAAC;AACD,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,IAAc;IAC5C,IAAI,I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G,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC;IAC9D,IAAI,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,IAAK,CAAC;QACnE,MAAM,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC;IAC/B,IAAI,UAAU;QACZ,IAAI,CACF,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CACzE,GAAG,UAAU,CAAC;IACjB,MAAM,CAAC,MAAM,WAAW,CAAC,GAAG,MAAM,IAAI,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface CloudConfig {
|
|
2
|
+
url: string;
|
|
3
|
+
token?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function cloudConfig(): CloudConfig;
|
|
6
|
+
export declare function saveCloudConfig(config: CloudConfig): void;
|
|
7
|
+
export declare function clearCloudConfig(): void;
|
|
8
|
+
export declare function cloudRequest<T = unknown>(path: string, method?: string, body?: unknown, config?: CloudConfig): Promise<T>;
|
|
9
|
+
export declare function cloudAction<T = unknown>(operation: string, args?: Record<string, unknown>, config?: CloudConfig): Promise<T>;
|
|
10
|
+
export declare function sharedLocation(value: string): {
|
|
11
|
+
token: string;
|
|
12
|
+
config: CloudConfig;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=cloud-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloud-client.d.ts","sourceRoot":"","sources":["../src/cloud-client.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAGD,wBAAgB,WAAW,IAAI,WAAW,CAoBzC;AACD,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,QAKlD;AACD,wBAAgB,gBAAgB,SAG/B;AACD,wBAAsB,YAAY,CAAC,CAAC,GAAG,OAAO,EAC5C,IAAI,EAAE,MAAM,EACZ,MAAM,SAAQ,EACd,IAAI,CAAC,EAAE,OAAO,EACd,MAAM,cAAgB,GACrB,OAAO,CAAC,CAAC,CAAC,CAcZ;AACD,wBAAsB,WAAW,CAAC,CAAC,GAAG,OAAO,EAC3C,SAAS,EAAE,MAAM,EACjB,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EAClC,MAAM,cAAgB,GACrB,OAAO,CAAC,CAAC,CAAC,CAMZ;AACD,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,WAAW,CAAC;CACrB,CAMA"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync, mkdirSync, chmodSync, existsSync, unlinkSync, } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
const configDir = () => join(process.env.XDG_CONFIG_HOME || join(homedir(), ".config"), "readm3");
|
|
5
|
+
export function cloudConfig() {
|
|
6
|
+
let saved = {};
|
|
7
|
+
try {
|
|
8
|
+
saved = JSON.parse(readFileSync(join(configDir(), "cloud.json"), "utf8"));
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
/* Environment-only use is supported. */
|
|
12
|
+
}
|
|
13
|
+
const url = (process.env.READM3_URL ||
|
|
14
|
+
saved.url ||
|
|
15
|
+
"https://readm3.com").replace(/\/$/, "");
|
|
16
|
+
const parsed = new URL(url);
|
|
17
|
+
if (!["http:", "https:"].includes(parsed.protocol) ||
|
|
18
|
+
parsed.username ||
|
|
19
|
+
parsed.password)
|
|
20
|
+
throw new Error("READM3_URL must be an HTTP(S) origin.");
|
|
21
|
+
return { url: parsed.origin, token: process.env.READM3_TOKEN || saved.token };
|
|
22
|
+
}
|
|
23
|
+
export function saveCloudConfig(config) {
|
|
24
|
+
mkdirSync(configDir(), { recursive: true, mode: 0o700 });
|
|
25
|
+
const path = join(configDir(), "cloud.json");
|
|
26
|
+
writeFileSync(path, JSON.stringify(config) + "\n", { mode: 0o600 });
|
|
27
|
+
chmodSync(path, 0o600);
|
|
28
|
+
}
|
|
29
|
+
export function clearCloudConfig() {
|
|
30
|
+
const path = join(configDir(), "cloud.json");
|
|
31
|
+
if (existsSync(path))
|
|
32
|
+
unlinkSync(path);
|
|
33
|
+
}
|
|
34
|
+
export async function cloudRequest(path, method = "GET", body, config = cloudConfig()) {
|
|
35
|
+
const response = await fetch(`${config.url}/api/v1/${path}`, {
|
|
36
|
+
method,
|
|
37
|
+
headers: {
|
|
38
|
+
...(config.token ? { authorization: `Bearer ${config.token}` } : {}),
|
|
39
|
+
...(body === undefined ? {} : { "content-type": "application/json" }),
|
|
40
|
+
},
|
|
41
|
+
body: body === undefined ? undefined : JSON.stringify(body),
|
|
42
|
+
signal: AbortSignal.timeout(30000),
|
|
43
|
+
redirect: "error",
|
|
44
|
+
});
|
|
45
|
+
const value = (await response.json());
|
|
46
|
+
if (!response.ok)
|
|
47
|
+
throw new Error(value.error || `HTTP ${response.status}`);
|
|
48
|
+
return value;
|
|
49
|
+
}
|
|
50
|
+
export async function cloudAction(operation, args = {}, config = cloudConfig()) {
|
|
51
|
+
if (!config.token)
|
|
52
|
+
throw new Error("Sign in at readm3.com/admin, create an API token, and run readm3 login --token-stdin (or set READM3_TOKEN).");
|
|
53
|
+
return cloudRequest("actions", "POST", { operation, args }, config);
|
|
54
|
+
}
|
|
55
|
+
export function sharedLocation(value) {
|
|
56
|
+
const url = new URL(value);
|
|
57
|
+
const match = url.pathname.match(/^\/s\/([\w-]{43})$/);
|
|
58
|
+
if (!match || !["https:", "http:"].includes(url.protocol))
|
|
59
|
+
throw new Error("Use a readm3 shared document URL.");
|
|
60
|
+
return { token: match[1], config: { url: url.origin } };
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=cloud-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloud-client.js","sourceRoot":"","sources":["../src/cloud-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,aAAa,EACb,SAAS,EACT,SAAS,EACT,UAAU,EACV,UAAU,GACX,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAKjC,MAAM,SAAS,GAAG,GAAG,EAAE,CACrB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,EAAE,QAAQ,CAAC,CAAC;AAC5E,MAAM,UAAU,WAAW;IACzB,IAAI,KAAK,GAAyB,EAAE,CAAC;IACrC,IAAI,CAAC;QACH,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,YAAY,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5E,CAAC;IAAC,MAAM,CAAC;QACP,wCAAwC;IAC1C,CAAC;IACD,MAAM,GAAG,GAAG,CACV,OAAO,CAAC,GAAG,CAAC,UAAU;QACtB,KAAK,CAAC,GAAG;QACT,oBAAoB,CACrB,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACrB,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IAC5B,IACE,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC;QAC9C,MAAM,CAAC,QAAQ;QACf,MAAM,CAAC,QAAQ;QAEf,MAAM,IAAI,KAAK,CAA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,CAAC;AAC1D,CAAC"}
|
package/dist/mcp.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AA6PA,wBAAsB,MAAM,kBAsD3B"}
|
package/dist/mcp.js
ADDED
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
2
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
4
|
+
import { cloudAction, cloudRequest, sharedLocation } from "./cloud-client.js";
|
|
5
|
+
const string = { type: "string" };
|
|
6
|
+
const role = { type: "string", enum: ["view", "edit"] };
|
|
7
|
+
const definitions = [
|
|
8
|
+
["account_me", "Show the authenticated readm3 user.", {}, []],
|
|
9
|
+
["organizations_list", "List organizations you belong to.", {}, []],
|
|
10
|
+
[
|
|
11
|
+
"organizations_create",
|
|
12
|
+
"Create an organization owned by you.",
|
|
13
|
+
{ name: string },
|
|
14
|
+
["name"],
|
|
15
|
+
],
|
|
16
|
+
[
|
|
17
|
+
"organizations_update",
|
|
18
|
+
"Rename an organization. Organization owner only.",
|
|
19
|
+
{ orgId: string, name: string },
|
|
20
|
+
["orgId", "name"],
|
|
21
|
+
],
|
|
22
|
+
[
|
|
23
|
+
"organizations_delete",
|
|
24
|
+
"Delete an empty organization. Organization owner only.",
|
|
25
|
+
{ orgId: string },
|
|
26
|
+
["orgId"],
|
|
27
|
+
],
|
|
28
|
+
["members_list", "List organization members.", { orgId: string }, ["orgId"]],
|
|
29
|
+
[
|
|
30
|
+
"members_update",
|
|
31
|
+
"Change membership role. Organization owner only.",
|
|
32
|
+
{
|
|
33
|
+
orgId: string,
|
|
34
|
+
userId: string,
|
|
35
|
+
role: { type: "string", enum: ["member", "owner"] },
|
|
36
|
+
},
|
|
37
|
+
["orgId", "userId", "role"],
|
|
38
|
+
],
|
|
39
|
+
[
|
|
40
|
+
"members_remove",
|
|
41
|
+
"Remove organization membership. Organization owner only.",
|
|
42
|
+
{ orgId: string, userId: string },
|
|
43
|
+
["orgId", "userId"],
|
|
44
|
+
],
|
|
45
|
+
[
|
|
46
|
+
"invitations_create",
|
|
47
|
+
"Create a one-use organization invitation link valid for seven days. No email is sent.",
|
|
48
|
+
{
|
|
49
|
+
orgId: string,
|
|
50
|
+
role: { type: "string", enum: ["member", "owner"] },
|
|
51
|
+
teamId: string,
|
|
52
|
+
},
|
|
53
|
+
["orgId"],
|
|
54
|
+
],
|
|
55
|
+
[
|
|
56
|
+
"invitations_list",
|
|
57
|
+
"List pending organization invitations.",
|
|
58
|
+
{ orgId: string },
|
|
59
|
+
["orgId"],
|
|
60
|
+
],
|
|
61
|
+
[
|
|
62
|
+
"invitations_accept",
|
|
63
|
+
"Accept an organization invitation using its token.",
|
|
64
|
+
{ token: string },
|
|
65
|
+
["token"],
|
|
66
|
+
],
|
|
67
|
+
[
|
|
68
|
+
"invitations_revoke",
|
|
69
|
+
"Revoke an organization invitation.",
|
|
70
|
+
{ invitationId: string },
|
|
71
|
+
["invitationId"],
|
|
72
|
+
],
|
|
73
|
+
["teams_list", "List organization teams.", { orgId: string }, ["orgId"]],
|
|
74
|
+
[
|
|
75
|
+
"teams_create",
|
|
76
|
+
"Create an organization team. Organization owner only.",
|
|
77
|
+
{ orgId: string, name: string },
|
|
78
|
+
["orgId", "name"],
|
|
79
|
+
],
|
|
80
|
+
[
|
|
81
|
+
"teams_update",
|
|
82
|
+
"Rename a team. Organization owner only.",
|
|
83
|
+
{ teamId: string, name: string },
|
|
84
|
+
["teamId", "name"],
|
|
85
|
+
],
|
|
86
|
+
[
|
|
87
|
+
"teams_delete",
|
|
88
|
+
"Delete an empty team. Organization owner only.",
|
|
89
|
+
{ teamId: string },
|
|
90
|
+
["teamId"],
|
|
91
|
+
],
|
|
92
|
+
["team_members_list", "List team members.", { teamId: string }, ["teamId"]],
|
|
93
|
+
[
|
|
94
|
+
"team_members_add",
|
|
95
|
+
"Add an organization member to a team.",
|
|
96
|
+
{ teamId: string, userId: string },
|
|
97
|
+
["teamId", "userId"],
|
|
98
|
+
],
|
|
99
|
+
[
|
|
100
|
+
"team_members_remove",
|
|
101
|
+
"Remove a team member.",
|
|
102
|
+
{ teamId: string, userId: string },
|
|
103
|
+
["teamId", "userId"],
|
|
104
|
+
],
|
|
105
|
+
[
|
|
106
|
+
"documents_list",
|
|
107
|
+
"List readable documents. Super admins can list all users' documents.",
|
|
108
|
+
{
|
|
109
|
+
orgId: string,
|
|
110
|
+
search: string,
|
|
111
|
+
limit: { type: "integer", minimum: 1, maximum: 1000 },
|
|
112
|
+
offset: { type: "integer", minimum: 0 },
|
|
113
|
+
},
|
|
114
|
+
[],
|
|
115
|
+
],
|
|
116
|
+
[
|
|
117
|
+
"documents_create",
|
|
118
|
+
"Create a private Markdown document owned by you.",
|
|
119
|
+
{
|
|
120
|
+
orgId: string,
|
|
121
|
+
title: string,
|
|
122
|
+
source: string,
|
|
123
|
+
teamId: string,
|
|
124
|
+
access: { type: "string", enum: ["private", "view", "edit"] },
|
|
125
|
+
},
|
|
126
|
+
["orgId", "title", "source"],
|
|
127
|
+
],
|
|
128
|
+
[
|
|
129
|
+
"documents_get",
|
|
130
|
+
"Read a document and its current version. Reading is the default.",
|
|
131
|
+
{ documentId: string },
|
|
132
|
+
["documentId"],
|
|
133
|
+
],
|
|
134
|
+
[
|
|
135
|
+
"documents_update",
|
|
136
|
+
"Save a new immutable Markdown version. Requires edit access and the current baseVersion; stale saves are rejected.",
|
|
137
|
+
{
|
|
138
|
+
documentId: string,
|
|
139
|
+
source: string,
|
|
140
|
+
title: string,
|
|
141
|
+
baseVersion: string,
|
|
142
|
+
teamId: { type: ["string", "null"] },
|
|
143
|
+
access: { type: "string", enum: ["private", "view", "edit"] },
|
|
144
|
+
},
|
|
145
|
+
["documentId", "baseVersion"],
|
|
146
|
+
],
|
|
147
|
+
[
|
|
148
|
+
"documents_delete",
|
|
149
|
+
"Permanently delete a document, its versions, and all links. File owner or super admin only.",
|
|
150
|
+
{ documentId: string },
|
|
151
|
+
["documentId"],
|
|
152
|
+
],
|
|
153
|
+
[
|
|
154
|
+
"documents_transfer",
|
|
155
|
+
"Transfer document ownership to another username. Owner or super admin only.",
|
|
156
|
+
{ documentId: string, username: string },
|
|
157
|
+
["documentId", "username"],
|
|
158
|
+
],
|
|
159
|
+
[
|
|
160
|
+
"versions_list",
|
|
161
|
+
"List version IDs, authors, dates, and SHA-256 checksums. Owner or super admin only.",
|
|
162
|
+
{ documentId: string },
|
|
163
|
+
["documentId"],
|
|
164
|
+
],
|
|
165
|
+
[
|
|
166
|
+
"versions_get",
|
|
167
|
+
"Read an immutable version. Owner or super admin only.",
|
|
168
|
+
{ documentId: string, versionId: string },
|
|
169
|
+
["documentId", "versionId"],
|
|
170
|
+
],
|
|
171
|
+
[
|
|
172
|
+
"versions_restore",
|
|
173
|
+
"Restore a prior version as a new save. Owner or super admin only.",
|
|
174
|
+
{ documentId: string, versionId: string, baseVersion: string },
|
|
175
|
+
["documentId", "versionId", "baseVersion"],
|
|
176
|
+
],
|
|
177
|
+
[
|
|
178
|
+
"shares_create",
|
|
179
|
+
"Create a bearer link granting view (default) or edit access. Owners only. Pinned versions are view-only.",
|
|
180
|
+
{
|
|
181
|
+
documentId: string,
|
|
182
|
+
role,
|
|
183
|
+
versionId: string,
|
|
184
|
+
label: string,
|
|
185
|
+
expiresAt: string,
|
|
186
|
+
},
|
|
187
|
+
["documentId"],
|
|
188
|
+
],
|
|
189
|
+
[
|
|
190
|
+
"shares_list",
|
|
191
|
+
"List link metadata without revealing secret tokens. Owners only.",
|
|
192
|
+
{ documentId: string },
|
|
193
|
+
["documentId"],
|
|
194
|
+
],
|
|
195
|
+
[
|
|
196
|
+
"shares_revoke",
|
|
197
|
+
"Revoke a share link immediately. Owners only.",
|
|
198
|
+
{ documentId: string, shareId: string },
|
|
199
|
+
["documentId", "shareId"],
|
|
200
|
+
],
|
|
201
|
+
[
|
|
202
|
+
"permissions_list",
|
|
203
|
+
"List named collaborators. Owners only.",
|
|
204
|
+
{ documentId: string },
|
|
205
|
+
["documentId"],
|
|
206
|
+
],
|
|
207
|
+
[
|
|
208
|
+
"permissions_set",
|
|
209
|
+
"Grant or change a named user's view/edit access. Owners only.",
|
|
210
|
+
{ documentId: string, username: string, role },
|
|
211
|
+
["documentId", "username", "role"],
|
|
212
|
+
],
|
|
213
|
+
[
|
|
214
|
+
"permissions_remove",
|
|
215
|
+
"Remove a named collaborator. Owners only.",
|
|
216
|
+
{ documentId: string, userId: string },
|
|
217
|
+
["documentId", "userId"],
|
|
218
|
+
],
|
|
219
|
+
[
|
|
220
|
+
"tokens_list",
|
|
221
|
+
"List your personal API tokens (secrets are never returned).",
|
|
222
|
+
{},
|
|
223
|
+
[],
|
|
224
|
+
],
|
|
225
|
+
[
|
|
226
|
+
"tokens_create",
|
|
227
|
+
"Create a personal API token with your account's permissions, valid for 90 days. Returned once; keep secret.",
|
|
228
|
+
{ label: string },
|
|
229
|
+
[],
|
|
230
|
+
],
|
|
231
|
+
[
|
|
232
|
+
"tokens_revoke",
|
|
233
|
+
"Revoke one of your personal API tokens.",
|
|
234
|
+
{ tokenId: string },
|
|
235
|
+
["tokenId"],
|
|
236
|
+
],
|
|
237
|
+
["admin_users", "List all users. Super administrator only.", {}, []],
|
|
238
|
+
[
|
|
239
|
+
"shared_get",
|
|
240
|
+
"Read a Markdown document from a readm3 capability URL.",
|
|
241
|
+
{ url: string },
|
|
242
|
+
["url"],
|
|
243
|
+
],
|
|
244
|
+
[
|
|
245
|
+
"shared_update",
|
|
246
|
+
"Save through an edit link. View links cannot write. Requires current baseVersion.",
|
|
247
|
+
{ url: string, source: string, baseVersion: string },
|
|
248
|
+
["url", "source", "baseVersion"],
|
|
249
|
+
],
|
|
250
|
+
];
|
|
251
|
+
export async function runMcp() {
|
|
252
|
+
const server = new Server({ name: "readm3", version: "0.4.0" }, { capabilities: { tools: {} } });
|
|
253
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
254
|
+
tools: definitions.map(([name, description, properties, required]) => ({
|
|
255
|
+
name,
|
|
256
|
+
description,
|
|
257
|
+
inputSchema: {
|
|
258
|
+
type: "object",
|
|
259
|
+
properties,
|
|
260
|
+
required,
|
|
261
|
+
additionalProperties: false,
|
|
262
|
+
},
|
|
263
|
+
annotations: {
|
|
264
|
+
readOnlyHint: /_(list|get|me|users)$/.test(name),
|
|
265
|
+
destructiveHint: /_(delete|remove|revoke|transfer)$/.test(name),
|
|
266
|
+
openWorldHint: true,
|
|
267
|
+
},
|
|
268
|
+
})),
|
|
269
|
+
}));
|
|
270
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
271
|
+
const name = request.params.name;
|
|
272
|
+
const args = request.params.arguments ?? {};
|
|
273
|
+
try {
|
|
274
|
+
if (!definitions.some(([operation]) => operation === name))
|
|
275
|
+
throw new Error("Unknown tool.");
|
|
276
|
+
let result;
|
|
277
|
+
if (name.startsWith("shared_")) {
|
|
278
|
+
const { token, config } = sharedLocation(String(args.url));
|
|
279
|
+
result = await cloudRequest(`shared/${token}`, name === "shared_update" ? "PATCH" : "GET", name === "shared_update"
|
|
280
|
+
? { source: args.source, baseVersion: args.baseVersion }
|
|
281
|
+
: undefined, config);
|
|
282
|
+
}
|
|
283
|
+
else
|
|
284
|
+
result = await cloudAction(name, args);
|
|
285
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
286
|
+
}
|
|
287
|
+
catch (error) {
|
|
288
|
+
return {
|
|
289
|
+
isError: true,
|
|
290
|
+
content: [
|
|
291
|
+
{
|
|
292
|
+
type: "text",
|
|
293
|
+
text: error instanceof Error ? error.message : "Request failed.",
|
|
294
|
+
},
|
|
295
|
+
],
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
await server.connect(new StdioServerTransport());
|
|
300
|
+
}
|
|
301
|
+
//# sourceMappingURL=mcp.js.map
|
package/dist/mcp.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC9E,MAAM,MAAM,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AAClC,MAAM,IAAI,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;AACxD,MAAM,WAAW,GAA0D;IACzE,CAAC,YAAY,EAAE,qCAAqC,EAAE,EAAE,EAAE,EAAE,CAAC;IAC7D,CAAC,oBAAoB,EAAE,mCAAmC,EAAE,EAAE,EAAE,EAAE,CAAC;IACnE;QACE,sBAAsB;QACtB,sCAAsC;QACtC,EAAE,IAAI,EAAE,MAAM,EAAE;QAChB,CAAC,MAAM,CAAC;KACT;IACD;QACE,sBAAsB;QACtB,kDAAkD;QAClD,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE;QAC/B,CAAC,OAAO,EAAE,MAAM,CAAC;KAClB;IACD;QACE,sBAAsB;QACtB,wDAAwD;QACxD,EAAE,KAAK,EAAE,MAAM,EAAE;QACjB,CAAC,OAAO,CAAC;KACV;IACD,CAAC,cAAc,EAAE,4BAA4B,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC;IAC5E;QACE,gBAAgB;QAChB,kDAAkD;QAClD;YACE,KAAK,EAAE,MAAM;YAC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AI,KAAK,eAAe;oBACtB,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE;oBACxD,CAAC,CAAC,SAAS,EACb,MAAM,CACP,CAAC;YACJ,CAAC;;gBAAM,MAAM,GAAG,MAAM,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAC9C,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;QACvE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,iBAAiB;qBACjE;iBACF;aACF,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;IACH,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAC;AACnD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@profullstack/readm3",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "Markdown editing and sharing for people and teams. Web/PWA, CLI, API and MCP with version history, view/edit links, and a terminal reader.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Profullstack, Inc.",
|
|
@@ -33,16 +33,22 @@
|
|
|
33
33
|
"site:build": "bun site/build.ts",
|
|
34
34
|
"site:start": "bun site/server.ts",
|
|
35
35
|
"build": "tsc -p tsconfig.build.json",
|
|
36
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
36
|
+
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p site/tsconfig.json --noEmit",
|
|
37
37
|
"test": "node --experimental-strip-types --test test/*.test.ts",
|
|
38
|
-
"test:bun": "bun test test
|
|
39
|
-
"prepublishOnly": "npm run build"
|
|
38
|
+
"test:bun": "bun test ./test",
|
|
39
|
+
"prepublishOnly": "npm run build",
|
|
40
|
+
"test:site": "playwright test -c site/playwright.config.ts",
|
|
41
|
+
"test:server": "bun test ./server/test",
|
|
42
|
+
"test:accounts": "bun test ./server/test && playwright test -c site/accounts.playwright.config.ts"
|
|
40
43
|
},
|
|
41
44
|
"dependencies": {
|
|
42
|
-
"@
|
|
45
|
+
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
46
|
+
"@profullstack/hqtui": "^0.5.0",
|
|
43
47
|
"marked": "^18.0.11"
|
|
44
48
|
},
|
|
45
49
|
"devDependencies": {
|
|
50
|
+
"@playwright/test": "^1.63.0",
|
|
51
|
+
"@types/bun": "^1.4.2",
|
|
46
52
|
"@types/node": "^22",
|
|
47
53
|
"typescript": "^5.7.2"
|
|
48
54
|
},
|