rubien-mcp-server 0.1.0 → 0.3.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 CHANGED
@@ -1,179 +1,177 @@
1
1
  # rubien-mcp-server
2
2
 
3
- A Model Context Protocol server that wraps `rubien-cli`, making the Rubien reference library available to Claude Code, Claude Desktop, and claude.ai chat as a callable tool catalog.
3
+ A Model Context Protocol server that wraps `rubien-cli`, exposing your Rubien library to Claude Code, Claude Desktop, and claude.ai (web) as a tool catalog. It spawns `rubien-cli` under the hood and speaks MCP over two transports:
4
4
 
5
- The server is a thin Node/TypeScript process. It spawns `rubien-cli` under the hood and speaks MCP over one of two transports:
5
+ - **stdio** Claude Code and Claude Desktop. The client spawns the server locally. No network, no auth. What most people want; see [Install](#install).
6
+ - **Streamable HTTP + bearer token** — claude.ai (web) connects as a *remote MCP server* (it can't spawn a local process), so it needs a tunnel. See [claude.ai web](#claudeai-web-remote-mcp-server).
6
7
 
7
- - **stdio** used by **Claude Code** and **Claude Desktop**. The client launches the server as a child process and talks to it over the pipe. No network, no auth.
8
- - **Streamable HTTP with bearer-token auth** — used by **claude.ai (web)** via a custom MCP connector. Requires a tunnel (e.g. Cloudflare Tunnel) because your library lives on your Mac.
8
+ ## Requirement: `rubien-cli` on the host
9
9
 
10
- Pick the section below that matches your client. Most users want one of the two stdio paths.
10
+ The server is only a wrapper. It needs **Node.js 20** and the `rubien-cli` binary:
11
11
 
12
- ## Install (Claude Code)
12
+ - **Mac:** install **Rubien.app** (the DMG). The entitled `rubien-cli` ships inside it and is found automatically.
13
+ - **Linux:** install the runtime libs and extract the CLI tarball, keeping `rubien-cli` and its `*.resources` folders together (the CLI loads citation styles from beside the binary):
14
+ ```bash
15
+ sudo apt install libsqlite3-0 libcurl4 libxml2 libpoppler-glib8 libcairo2 libgdk-pixbuf-2.0-0 libglib2.0-0 ca-certificates
16
+ # download rubien-cli-*-linux-x86_64.tar.gz, extract, then:
17
+ export RUBIEN_CLI=/path/to/extracted/rubien-cli
18
+ ```
19
+ Tarball: <https://github.com/devzhk/Rubien-releases/releases>. Don't put the bare binary on `PATH` alone — it loses its resource bundles.
13
20
 
14
- ```bash
15
- claude mcp add rubien -- npx -y rubien-mcp-server
16
- ```
17
-
18
- This needs `rubien-cli` on the host:
19
- - **Mac:** install Rubien.app (DMG) — the entitled `rubien-cli` ships inside it; nothing else to do.
20
- - **Linux:** `sudo apt install libsqlite3-0 libcurl4 libxml2 libpoppler-glib8 libcairo2 libgdk-pixbuf-2.0-0 libglib2.0-0 ca-certificates`, then download `rubien-cli-*-linux-x86_64.tar.gz` from
21
- https://github.com/devzhk/Rubien-releases/releases and **extract it to a directory, keeping `rubien-cli` and the `*.resources` folders together** (the CLI loads citation styles from beside the binary). Point the server at it: `export RUBIEN_CLI=/path/to/extracted/rubien-cli`. Do **not** copy the bare binary onto `PATH` alone — it would lose its resource bundles.
22
-
23
- The server checks the CLI's build at startup; if it's too old it prints an update
24
- instruction and exits (rather than failing mid-call). On **Mac**, update Rubien.app
25
- (Sparkle). On **Linux**, run `rubien-cli self-update` (signature-verified, replaces in
26
- place) — or re-download the tarball.
27
-
28
- ## Prerequisites
21
+ At startup the server checks the CLI's build and exits with an update instruction if it's too old. Update via Rubien.app / Sparkle on Mac, or `rubien-cli self-update` on Linux.
29
22
 
30
- - Node.js ≥ 20
31
- - `rubien-cli` reachable on the host. The server looks for it in this order:
32
- 1. `$RUBIEN_CLI` env var (explicit path)
33
- 2. `/Applications/Rubien.app/Contents/Helpers/rubien-cli` (installed app bundle, Mac)
34
- 3. `~/Applications/Rubien.app/Contents/Helpers/rubien-cli` (Mac)
35
- 4. `./build/Rubien.app/Contents/Helpers/rubien-cli` (dev build output, Mac)
36
- 5. `rubien-cli` on `PATH` (Linux installs land here — see the **Install** section above)
23
+ ## Install
37
24
 
38
- **On Mac, prefer the bundled helper.** It's signed with the App Group entitlement and reads the same `library.sqlite` the Rubien app uses. A bare `rubien-cli` on PATH is typically an SPM dev build without the entitlement, which hits a *different* database see "Database location" in `Docs/CLI-Reference.md`.
25
+ Both stdio clients use the published npm package via `npx -y` — no global install.
39
26
 
40
- **On Linux**, the server runs against a `rubien-cli` installed per the **Install** section above (prebuilt Linux tarball, or built from source). Everything works except `rubien_sync_status`, which always errors (`sync` subcommand isn't registered on Linux builds — CloudKit doesn't exist there).
41
-
42
- To pin the spawned CLI to a specific library directory regardless of which binary resolves, set `RUBIEN_LIBRARY_ROOT` in the MCP server's `env` block (Claude Code: `claude mcp add rubien --env RUBIEN_LIBRARY_ROOT=...`; Claude Desktop: under `mcpServers.rubien.env` in `claude_desktop_config.json`). The path is used verbatim — point it at the directory that contains `library.sqlite`:
43
-
44
- - Mac sandboxed: `~/Library/Group Containers/9TXK4V3SS8.com.rubien.shared/Rubien`
45
- - Mac unsandboxed: `~/Library/Application Support/Rubien`
46
- - Linux: `~/.local/share/rubien` (or wherever `$XDG_DATA_HOME/rubien` resolved to)
47
-
48
- ## Claude Code (stdio)
49
-
50
- The npx command above is the recommended path. To run a local checkout instead (see [Development](#development) for the build):
27
+ ### Claude Code
51
28
 
52
29
  ```bash
53
- claude mcp add rubien node $(pwd)/dist/index.js
30
+ claude mcp add rubien -- npx -y rubien-mcp-server
54
31
  ```
55
32
 
56
- Try it:
57
-
58
- > List my 5 most recently added references.
59
- > Cite reference 42 in Nature style.
33
+ ### Claude Desktop
60
34
 
61
- Claude Code's permission UI prompts for the destructive tools (`rubien_delete`, `rubien_update`, `rubien_import`, and the property write tools) on first use.
62
-
63
- ## Claude Desktop (stdio)
64
-
65
- Claude Desktop spawns MCP servers itself — no tunnel, no bearer token. Add Rubien to `claude_desktop_config.json` via either route:
66
-
67
- - **Edit the file directly** at `~/Library/Application Support/Claude/claude_desktop_config.json`.
68
- - **Settings → Developer → Edit Config** in Claude Desktop, which opens the same file in your editor.
69
-
70
- Add Rubien under `mcpServers`:
35
+ **Settings Developer Edit Config** (or edit `~/Library/Application Support/Claude/claude_desktop_config.json`), then restart Claude Desktop:
71
36
 
72
37
  ```json
73
38
  {
74
39
  "mcpServers": {
75
40
  "rubien": {
76
- "command": "node",
77
- "args": ["/absolute/path/to/Rubien/mcp-server/dist/index.js"]
41
+ "command": "npx",
42
+ "args": ["-y", "rubien-mcp-server"]
78
43
  }
79
44
  }
80
45
  }
81
46
  ```
82
47
 
83
- Restart Claude Desktop and Rubien appears in the tool picker. To pin the spawned CLI to a specific library (see *Prerequisites* above for paths), add an `env` block:
48
+ **macOS PATH gotcha:** Claude Desktop launches servers with launchd's minimal `PATH`, not your shell's. If `npx` isn't found, set `"command"` to its absolute path (`which npx` e.g. `/opt/homebrew/bin/npx`). Affects every npx-based server; Claude Code is unaffected. No `.dxt` one-click package yet.
84
49
 
85
- ```json
86
- "rubien": {
87
- "command": "node",
88
- "args": ["/absolute/path/to/Rubien/mcp-server/dist/index.js"],
89
- "env": {
90
- "RUBIEN_LIBRARY_ROOT": "/Users/you/Library/Group Containers/9TXK4V3SS8.com.rubien.shared/Rubien"
91
- }
92
- }
93
- ```
50
+ ### Upgrading
51
+
52
+ The `npx -y rubien-mcp-server` install is **unpinned**, so there is nothing to reinstall — `npx` resolves the latest published version each time the client spawns the server. Upgrade in this order:
94
53
 
95
- > **Future workDesktop Extension (`.dxt`).** Claude Desktop also supports one-click MCP installs via `.dxt` packages (a zip containing a `manifest.json` + bundled server). Rubien doesn't ship one yet; packaging it would replace the config-file edit above with a double-click install from a GitHub Release asset.
54
+ 1. **Update Rubien first** Sparkle on Mac (Rubien Settings Check Now), `rubien-cli self-update` on Linux. The server needs the new `rubien-cli`.
55
+ 2. **Restart your MCP client** — quit/reopen Claude Desktop, or start a new Claude Code session. The respawned server is the latest release.
96
56
 
97
- ## claude.ai web (Streamable HTTP + Cloudflare Tunnel)
57
+ The pairing is guarded in one direction: a new server against a too-old Rubien **exits at startup with an update instruction** (`MIN_CLI_BUILD`), so a half-upgrade fails fast instead of half-working. The other direction is why upgrading matters — an old server against a new Rubien breaks at tool-call time when it shells subcommands that no longer exist (server < 0.3.0 vs Rubien ≥ 0.4.0: the 0.4.0 CLI cutover removed `import`, `add --identifier`, `views --query`, and the legacy `properties` write flags that 0.1.x/0.2.x servers shell out to; those server versions are deprecated on npm for this reason).
98
58
 
99
- claude.ai (the web app at https://claude.ai) can't spawn a local process, so it talks to the server over HTTPS via a custom MCP connector. Since your library lives on your Mac, you'll need a tunnel to expose the local server, and bearer-token auth to keep strangers out.
59
+ If a stale `npx` cache ever keeps serving an old version after a restart, clear it (`rm -rf ~/.npm/_npx`) or pin `rubien-mcp-server@latest` in the config. HTTP mode (below) runs as a long-lived process you started yourself it does not auto-upgrade; restart it after updating Rubien.
60
+
61
+ ## claude.ai web (remote MCP server)
62
+
63
+ claude.ai connects to rubien as a **remote MCP server** over Streamable HTTP — it can't spawn a local process. It's the *same npm package* in HTTP mode: the server still runs on your Mac (where the library and `rubien-cli` live), and claude.ai reaches it through a Cloudflare Tunnel, with a bearer token to keep strangers out.
100
64
 
101
65
  ```bash
102
- # 1. Start the server with a bearer token
66
+ # 1. Start the server in HTTP mode with a bearer token
103
67
  RUBIEN_MCP_BEARER=$(openssl rand -hex 32) \
104
- node dist/index.js --http --port 4000 --bearer-token "$RUBIEN_MCP_BEARER"
68
+ npx -y rubien-mcp-server --http --port 4000 --bearer-token "$RUBIEN_MCP_BEARER"
105
69
 
106
70
  # 2. Open a tunnel
107
71
  cloudflared tunnel --url http://localhost:4000
108
72
  # → copy the https://*.trycloudflare.com URL
109
73
 
110
- # 3. In claude.ai: Settings → Connectors → Add custom MCP connector
111
- # URL: https://<your-tunnel>.trycloudflare.com
112
- # Token: $RUBIEN_MCP_BEARER (from step 1)
74
+ # 3. claude.ai Settings → Connectors → Add custom MCP connector
75
+ # URL: the tunnel URL; Token: $RUBIEN_MCP_BEARER
113
76
  ```
114
77
 
115
- Save the bearer token — you'll need it to reconnect after restarts.
78
+ Save the token — you need it to reconnect after restarts.
79
+
80
+ ### Security model
116
81
 
117
- ## Security model
82
+ The remote path is **single-user personal use only.**
118
83
 
119
- This server is designed for **single-user personal use** only.
84
+ - The bearer token is a long-lived static secret — no rotation, revocation, rate limiting, or replay protection. Treat it like an SSH key; regenerate if leaked.
85
+ - Cloudflare Tunnel terminates TLS, so the token travels over HTTPS. A plaintext tunnel (e.g. raw ngrok HTTP) exposes it to sniffing.
86
+ - A leaked URL without the token is safe (every request gets a 401) — but rotate both if in doubt.
120
87
 
121
- - The bearer token is a long-lived static secret. There's no rotation, revocation, rate limiting, or replay protection.
122
- - The server will happily accept any request with the correct token. Don't paste the token into anything you don't trust, and treat a leaked token like an SSH key — regenerate immediately.
123
- - Cloudflare Tunnel provides TLS termination; the token travels over HTTPS. If you use a plaintext tunnel (e.g. raw ngrok HTTP) the token can be sniffed.
124
- - A leaked URL without the token is safe — every request gets a 401 — but rotate both if in doubt.
88
+ Multi-user would need a real auth story: OAuth, short-lived tokens, per-client revocation.
125
89
 
126
- If this setup ever becomes multi-user, the auth layer needs a real story: OAuth, short-lived tokens, and per-client revocation.
90
+ ## Optional configuration
91
+
92
+ ### Pin the library directory
93
+
94
+ By default the CLI resolves its own library location. To force one, set `RUBIEN_LIBRARY_ROOT` to the directory containing `library.sqlite`:
95
+
96
+ - Claude Code: `claude mcp add rubien --env RUBIEN_LIBRARY_ROOT=<dir> -- npx -y rubien-mcp-server`
97
+ - Claude Desktop: add `"env": { "RUBIEN_LIBRARY_ROOT": "<dir>" }` beside `command`/`args`.
98
+
99
+ | Host | Directory |
100
+ |---|---|
101
+ | Mac (sandboxed app) | `~/Library/Group Containers/9TXK4V3SS8.com.rubien.shared/Rubien` |
102
+ | Mac (unsandboxed dev) | `~/Library/Application Support/Rubien` |
103
+ | Linux | `~/.local/share/rubien` (or `$XDG_DATA_HOME/rubien`) |
104
+
105
+ ### How the server finds `rubien-cli`
106
+
107
+ First hit wins:
108
+
109
+ 1. `$RUBIEN_CLI` (explicit path)
110
+ 2. `/Applications/Rubien.app/Contents/Helpers/rubien-cli` (Mac)
111
+ 3. `~/Applications/Rubien.app/Contents/Helpers/rubien-cli` (Mac)
112
+ 4. `./build/Rubien.app/Contents/Helpers/rubien-cli` (dev build, Mac)
113
+ 5. `rubien-cli` on `PATH` (Linux installs land here)
114
+
115
+ **On Mac, prefer the bundled helper** (2–4): it's signed with the App Group entitlement and reads the same `library.sqlite` as the app. A bare `rubien-cli` on PATH is usually an unentitled dev build hitting a *different* database (see "Database location" in `Docs/CLI-Reference.md`).
116
+
117
+ **On Linux**, everything works except `rubien_get_sync_status` (no CloudKit — the `sync` subcommand isn't built).
118
+
119
+ ### Run a local checkout
120
+
121
+ For development, point the client at a built `dist/` (see [Development](#development)):
122
+
123
+ ```bash
124
+ claude mcp add rubien -- node $(pwd)/dist/index.js # Claude Code
125
+ ```
126
+ ```json
127
+ { "mcpServers": { "rubien": { "command": "node", "args": ["/abs/path/to/mcp-server/dist/index.js"] } } }
128
+ ```
127
129
 
128
130
  ## Tool catalog
129
131
 
130
- Roughly 36 tools covering every `rubien-cli` subcommand mode. Names are `rubien_<subject>_<action>` so Claude can pick the right tool from a single-word hint:
132
+ 27 tools on the `{op}_{target}` grid CRUD operations always carry the target suffix (`create_reference`, `update_property`); a bare verb appears only when the operation is unique and unambiguous (`cite`, `export`):
131
133
 
132
134
  | Surface | Tools |
133
135
  |---|---|
134
- | References | `rubien_search`, `rubien_list`, `rubien_get`, `rubien_add`, `rubien_update`, `rubien_delete` |
135
- | Citations | `rubien_cite`, `rubien_styles_list` |
136
- | Import/Export | `rubien_import`, `rubien_export` |
137
- | PDFs | `rubien_pdf_info`, `rubien_pdf_text`, `rubien_pdf_page_image`, `rubien_pdf_download`, `rubien_annotations_list` |
138
- | Web clips | `rubien_web_get`, `rubien_web_annotations` |
139
- | Properties (incl. Tags) | `rubien_properties_list`, `rubien_properties_create`, `rubien_properties_delete`, `rubien_properties_rename`, `rubien_properties_show`, `rubien_properties_hide`, `rubien_properties_add_option`, `rubien_properties_rename_option`, `rubien_properties_delete_option`, `rubien_properties_set`, `rubien_properties_add_values`, `rubien_properties_remove_values`, `rubien_properties_clear` |
140
- | Saved views | `rubien_views_list`, `rubien_views_create`, `rubien_views_delete`, `rubien_views_rename`, `rubien_views_query` |
141
- | Sync | `rubien_sync_status` (Mac-only — errors on Linux hosts) |
136
+ | References | `rubien_search_references`, `rubien_list_references`, `rubien_get_reference`, `rubien_create_reference`, `rubien_update_reference`, `rubien_delete_reference` |
137
+ | Citations | `rubien_cite`, `rubien_list_styles` |
138
+ | Export | `rubien_export` |
139
+ | Reading | `rubien_read_text`, `rubien_read_annotations`, `rubien_grep_text` |
140
+ | PDFs | `rubien_get_pdf_info`, `rubien_render_pdf_page`, `rubien_download_pdf` |
141
+ | Properties (columns + options, incl. Tags) | `rubien_list_properties`, `rubien_create_property`, `rubien_update_property`, `rubien_delete_property`, `rubien_create_option`, `rubien_update_option`, `rubien_delete_option` |
142
+ | Saved views | `rubien_list_views`, `rubien_create_view`, `rubien_update_view`, `rubien_delete_view` |
143
+ | Sync | `rubien_get_sync_status` (Mac-only — errors on Linux) |
144
+
145
+ `rubien_create_reference` is the **one door in**: pass exactly one of `source` (any locator — DOI / arXiv / PMID / PMCID / ISBN, paper URL, PDF/Markdown file URL, absolute file path, or folder path; the CLI routes it), `bibtex`, or `title`. It may return multiple items (multi-entry BibTeX, folders) and `status: "existing"` when dedup matched, in the unified `{items, summary, diagnostics}` envelope. Stdin (`"-"`) is intentionally unavailable through MCP.
142
146
 
143
- The PDF tools cover inspection and acquisition `rubien_pdf_info` returns page count plus a flattened outline, `rubien_pdf_text` extracts text by page range or section title, `rubien_pdf_page_image` renders a page to PNG for figure inspection, and `rubien_pdf_download` fetches an open-access PDF for an existing reference and attaches it to the library. `rubien_annotations_list` returns the user's highlights/underlines/anchored-notes on the attached PDF.
147
+ Per-reference property values (cells) are edited through `rubien_update_reference`'s `properties` payload `{"Status": "Reading", "Tags": {"add": ["12"]}, "7": ["ml", "nlp"], "Themes": null}` atomically alongside metadata fields. The option tools (`create_option` / `update_option` / `delete_option`) manage the *choices themselves* (including Tag rows for the built-in Tags property).
144
148
 
145
- The web-clip tools are the counterpart for clipped web pages — `rubien_web_get` returns the extracted body (markdown or HTML, paginated by character offset) along with `siteName` and `annotationCount`, and `rubien_web_annotations` returns highlights with a W3C TextQuoteSelector triple (`prefixText` / `anchorText` / `suffixText`) so the highlight can be located inside the body. Library-only — neither tool fetches from the network.
149
+ Reading tools operate on any reference without your knowing whether it holds a PDF or a clipped web page. `rubien_read_text` returns the readable body text — the attached PDF or the clipped web pagerouted automatically: omit `source` and `pages`/`sections` imply the PDF, `start` implies the web body, else PDF wins when both exist. Every response reports `source` (what was read) and `available` (which sources are readable now). PDF results are page-keyed (`pages[]` items with `text` + `sectionPath`, selected by a `pages` range or `sections` title-substrings); web results are one paginated body window (`content` + `contentLength`, `start`/`maxChars`; `contentFormat` markdown or HTML). `rubien_read_annotations` merges the user's highlights/underlines/anchored notes across both kinds into one array, each item tagged `source`; web items carry a W3C TextQuoteSelector triple (`prefixText`/`anchorText`/`suffixText`) that locates them inside the `rubien_read_text` body. `rubien_grep_text` is the lookup half of the same workflow: it finds *where* a reference's body mentions a phrase or regex — PDF hits grouped by page (`sectionPath` breadcrumbs), web hits as exact character offsets — so you can then pull just those spots with `rubien_read_text` (`pages` for PDF, `start` for web). All three are library-only — none hit the network.
146
150
 
147
- Destructive tools are tagged with `destructiveHint: true` so Claude Code's permission UI flags them. `rubien_delete` always passes `--force` the confirmation happens in the MCP client permission UI, not in the CLI's TTY prompt. See the comment in `src/tools/references.ts` for rationale.
151
+ PDF tools: `rubien_get_pdf_info` (page count, `hasTextLayer`, outline sections call it before selecting `rubien_read_text` by `sections`), `rubien_render_pdf_page` (render a page to an image, for tables/figures/equations), `rubien_download_pdf` (fetch an open-access PDF and attach it to an existing reference).
152
+
153
+ Destructive tools carry `destructiveHint: true` so Claude Code's permission UI flags them. `rubien_delete_reference` passes `--force`; confirmation happens in the client UI, not a CLI prompt (see `src/tools/references.ts`).
148
154
 
149
155
  ## Contract pinning
150
156
 
151
- Every tool's argument shape is defined in zod in the tool file; the expected *response* shape is in `src/schemas.ts`, mirroring the Swift DTOs in `Sources/RubienCLI/RubienCLI.swift` (search for `*DTO`). Crucial convention (see tests in `test/schemas.test.ts`):
157
+ Argument shapes are zod schemas in each tool file; response shapes are in `src/schemas.ts`, mirroring the Swift `*DTO` types in `Sources/RubienCLI/RubienCLI.swift`. Convention (tested in `test/schemas.test.ts`):
152
158
 
153
- - `.optional()` in zod for Swift `Optional` fields — Swift's `JSONEncoder` **omits** nil optionals from output.
154
- - `.nullable()` only for `AlwaysEncodedOptional<T>` wrappers (currently just `DatabaseViewDTO.groupBy`).
159
+ - `.optional()` for Swift `Optional` fields — `JSONEncoder` omits nil optionals.
160
+ - `.nullable()` only for `AlwaysEncodedOptional<T>` (currently just `DatabaseViewDTO.groupBy`).
155
161
 
156
- If a Swift DTO changes, update both the Swift side and `src/schemas.ts` in the same commit, per the CLAUDE.md rule about keeping the CLI and data layer in lockstep.
162
+ Change a Swift DTO update `src/schemas.ts` in the same commit (CLAUDE.md CLI/data-layer lockstep rule).
157
163
 
158
164
  ## Development
159
165
 
160
- Build from a local checkout (instead of `npx`):
161
-
162
166
  ```bash
163
167
  cd mcp-server
164
168
  npm install
165
169
  npm run build # → dist/
166
- npm test # vitest unit tests
167
- ```
168
-
169
- Watch mode:
170
-
171
- ```bash
172
- npm run dev # tsc --watch
173
- npm run test:watch
170
+ npm test # vitest
171
+ npm run dev # tsc --watch
174
172
  ```
175
173
 
176
- MCP Inspector is the fastest way to poke at tool schemas by hand:
174
+ Poke at tool schemas by hand with MCP Inspector:
177
175
 
178
176
  ```bash
179
177
  npx @modelcontextprotocol/inspector node dist/index.js
package/dist/cli.js CHANGED
@@ -52,9 +52,12 @@ export function resolveCliPath() {
52
52
  * Invoke rubien-cli with the given argv and return the parsed result.
53
53
  *
54
54
  * Contract: on exit 0, stdout is JSON (default) or plain text (`textMode`).
55
- * On non-zero exit, stderr is `{"error": "..."}` per the contract pinned in
56
- * Tests/RubienCLITests/SwiftLibCLITests.swift:189; this function throws a
57
- * CliError with that message.
55
+ * On non-zero exit, stderr carries a structured JSON error envelope either
56
+ * plain `{"error": "..."}` or a richer shape like the `unresolved-selectors`
57
+ * envelope (`{"error", "ids", "names"}`) or the all-failed create-reference
58
+ * envelope (`{"items", "summary"}`). Per spec §4.6 the envelope must reach
59
+ * the agent VERBATIM — no field extraction — so CliError.message is the raw
60
+ * stderr text.
58
61
  */
59
62
  export async function invokeCli(args, options = {}) {
60
63
  const cliPath = resolveCliPath();
@@ -66,7 +69,7 @@ export async function invokeCli(args, options = {}) {
66
69
  });
67
70
  // Close stdin unconditionally. Even when we have nothing to pipe, leaving
68
71
  // it open causes subcommands that call `readDataToEndOfFile()` (like
69
- // `import -`) to block until the timeout fires.
72
+ // `add --source -`) to block until the timeout fires.
70
73
  if (child.child.stdin) {
71
74
  if (options.stdin !== undefined) {
72
75
  child.child.stdin.write(options.stdin);
@@ -86,20 +89,10 @@ export async function invokeCli(args, options = {}) {
86
89
  // execFile error shape: { code, signal, stdout, stderr, message }
87
90
  const e = err;
88
91
  const stderr = (e.stderr ?? "").trim();
89
- let parsedError;
90
- if (stderr.length > 0) {
91
- try {
92
- const parsed = JSON.parse(stderr);
93
- if (parsed && typeof parsed === "object" && "error" in parsed) {
94
- parsedError = String(parsed.error);
95
- }
96
- }
97
- catch {
98
- // stderr wasn't JSON; fall through and use raw text.
99
- }
100
- }
101
- const message = parsedError ??
102
- (stderr.length > 0 ? stderr : (e.message ?? "rubien-cli invocation failed"));
92
+ // Raw pass-through (§4.6): structured envelopes (unresolved-selectors,
93
+ // all-failed create envelopes) must survive to the agent unmodified —
94
+ // extracting `.error` here would silently drop `ids`/`names`/`items`.
95
+ const message = stderr.length > 0 ? stderr : (e.message ?? "rubien-cli invocation failed");
103
96
  throw new CliError(message, typeof e.code === "number" ? e.code : null, stderr);
104
97
  }
105
98
  }
package/dist/cli.js.map CHANGED
@@ -1 +1 @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,EAC7D,CAAC;YACD,OAAO,MAA+B,CAAC;QACzC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
package/dist/index.js CHANGED
@@ -21,11 +21,11 @@ Options:
21
21
 
22
22
  Examples:
23
23
  # Claude Code
24
- claude mcp add rubien node /path/to/mcp-server/dist/index.js
24
+ claude mcp add rubien -- npx -y rubien-mcp-server
25
25
 
26
- # claude.ai (remote MCP)
26
+ # claude.ai (remote MCP) — same package, HTTP mode
27
27
  RUBIEN_MCP_BEARER=$(openssl rand -hex 32) \\
28
- node dist/index.js --http --port 4000 --bearer-token "$RUBIEN_MCP_BEARER"
28
+ npx -y rubien-mcp-server --http --port 4000 --bearer-token "$RUBIEN_MCP_BEARER"
29
29
  # then: cloudflared tunnel --url http://localhost:4000
30
30
  `;
31
31
  function parseCliArgs(argv) {
package/dist/schemas.js CHANGED
@@ -13,7 +13,7 @@ const isoDateString = z
13
13
  .string()
14
14
  .describe("ISO-8601 timestamp with millisecond precision, e.g. 2026-04-24T12:00:00.000Z");
15
15
  export const CustomPropertyValueDTO = z.object({
16
- propertyId: z.string(),
16
+ propertyId: z.number().int(),
17
17
  name: z.string(),
18
18
  type: z.string(),
19
19
  value: z.string(),
@@ -60,7 +60,7 @@ export const PropertyOptionDTO = z.object({
60
60
  color: z.string(),
61
61
  });
62
62
  export const PropertyDefinitionDTO = z.object({
63
- id: z.string(),
63
+ id: z.number().int(),
64
64
  name: z.string(),
65
65
  type: z.string(),
66
66
  options: z.array(PropertyOptionDTO),
@@ -69,25 +69,48 @@ export const PropertyDefinitionDTO = z.object({
69
69
  defaultFieldKey: z.string().optional(),
70
70
  isVisible: z.boolean(),
71
71
  });
72
- // PDF-download status DTO emitted by `add --identifier --download-pdf` and by
73
- // `pdf download <id>`. Mirrors PDFDownloadStatusDTO in RubienCLI.swift.
74
- // `action` is the raw value of PDFDownloadAction (downloaded | already-attached
75
- // | already-pending | skipped). All fields except `ok` use plain `Optional` in
76
- // Swift → key omitted when nil → `.optional()` here.
72
+ // PDF-download status DTO emitted by the create-reference resolver route's
73
+ // PDF fetch and by `pdf download <id>`. Mirrors PDFDownloadStatusDTO in
74
+ // RubienCLI.swift. `action` is the raw value of PDFDownloadAction (downloaded
75
+ // | replaced | already-attached | already-pending | skipped). All fields
76
+ // except `ok` use plain `Optional` in Swift → key omitted when nil →
77
+ // `.optional()` here.
77
78
  export const PDFDownloadStatusDTO = z.object({
78
79
  ok: z.boolean(),
79
80
  action: z.string().optional(),
80
81
  filename: z.string().optional(),
81
82
  error: z.string().optional(),
82
83
  });
83
- // Envelope returned by `add` (single object) or `add --bibtex` (array of these).
84
- // `status` mirrors AppDatabase.ReferenceSaveResult.
85
- // `pdfDownload` is an AlwaysEncodedOptional in Swift, so it's always present
86
- // in the JSON — explicit `null` when --download-pdf wasn't set.
87
- export const AddStatusOutput = z.object({
88
- reference: ReferenceDTO,
89
- status: z.enum(["created", "existing"]),
90
- pdfDownload: PDFDownloadStatusDTO.nullable(),
84
+ // Unified create-reference envelope (spec §5.4) one shape for every route
85
+ // (`add --source` / `--bibtex` / `--title`). Swift-Optional contract as
86
+ // everywhere: absent keys, never null. `diagnostics` appears only when the
87
+ // route produces it; `pdfDownload` only when a fetch was attempted.
88
+ export const CreateReferenceItem = z.object({
89
+ reference: ReferenceDTO.optional(),
90
+ status: z.enum(["created", "existing", "queued", "failed"]),
91
+ intakeId: z.number().int().optional(),
92
+ input: z.string(),
93
+ pdfDownload: PDFDownloadStatusDTO.optional(),
94
+ error: z.string().optional(),
95
+ });
96
+ export const CreateReferenceEnvelope = z.object({
97
+ items: z.array(CreateReferenceItem),
98
+ summary: z.object({
99
+ created: z.number().int(),
100
+ existing: z.number().int(),
101
+ queued: z.number().int(),
102
+ failed: z.number().int(),
103
+ }),
104
+ diagnostics: z
105
+ .object({
106
+ file: z.string().optional(),
107
+ property: z.string().optional(),
108
+ value: z.string().optional(),
109
+ attached: z.number().int().optional(),
110
+ duplicatesSkipped: z.number().int().optional(),
111
+ missingPDFs: z.array(z.string()).optional(),
112
+ })
113
+ .optional(),
91
114
  });
92
115
  // TagDTO retired alongside the rubien_tags_* MCP tool family. Tag rows now
93
116
  // surface as inline options on the built-in Tags PropertyDefinition (see
@@ -130,13 +153,93 @@ export const DatabaseViewDTO = z.object({
130
153
  dateCreated: isoDateString,
131
154
  dateModified: isoDateString,
132
155
  });
133
- export const AnnotationDTO = z.object({
156
+ // Unified read-tool output mirrors (RubienCLI `read text` / `read annotations`).
157
+ // Superseded the permissive AnnotationDTO, which was retired alongside the
158
+ // kind-specific rubien_web_* / rubien_annotations_list tools.
159
+ export const ReadTextPdfOutput = z.object({
160
+ id: z.number().int(),
161
+ source: z.literal("pdf"),
162
+ available: z.array(z.enum(["pdf", "web"])),
163
+ pageCount: z.number().int(),
164
+ selection: z.object({
165
+ mode: z.string(),
166
+ pages: z.string().optional(),
167
+ requested: z.array(z.string()).optional(),
168
+ matchedSections: z.array(z.string()).optional(),
169
+ unmatched: z.array(z.string()).optional(),
170
+ }),
171
+ pages: z.array(z.object({
172
+ index: z.number().int(),
173
+ text: z.string(),
174
+ sectionPath: z.array(z.string()),
175
+ })),
176
+ truncated: z.boolean(),
177
+ hasTextLayer: z.boolean(),
178
+ });
179
+ export const ReadTextWebOutput = z.object({
180
+ id: z.number().int(),
181
+ source: z.literal("web"),
182
+ available: z.array(z.enum(["pdf", "web"])),
183
+ url: z.string().optional(),
184
+ siteName: z.string().optional(),
185
+ contentFormat: z.enum(["markdown", "html"]),
186
+ content: z.string(),
187
+ contentLength: z.number().int(),
188
+ start: z.number().int(),
189
+ returnedChars: z.number().int(),
190
+ truncated: z.boolean(),
191
+ annotationCount: z.number().int(),
192
+ });
193
+ export const ReadAnnotationItem = z.object({
194
+ source: z.enum(["pdf", "web"]),
134
195
  id: z.number().int(),
135
196
  type: z.string(),
136
- color: z.string().optional(),
197
+ color: z.string(),
198
+ noteText: z.string().optional(),
199
+ dateCreated: isoDateString,
200
+ dateModified: isoDateString,
137
201
  pageIndex: z.number().int().optional(),
138
202
  selectedText: z.string().optional(),
139
- noteText: z.string().optional(),
203
+ anchorText: z.string().optional(),
204
+ prefixText: z.string().optional(),
205
+ suffixText: z.string().optional(),
206
+ });
207
+ // Unified grep-tool output mirrors (RubienCLI `grep <id> <query>`). PDF hits are
208
+ // page-grouped (PageSearchHit); web hits carry character offsets (GrepWebMatch).
209
+ export const GrepTextPdfOutput = z.object({
210
+ id: z.number().int(),
211
+ source: z.literal("pdf"),
212
+ available: z.array(z.enum(["pdf", "web"])),
213
+ query: z.string(),
214
+ isRegex: z.boolean(),
215
+ pageCount: z.number().int(),
216
+ hasTextLayer: z.boolean(),
217
+ totalMatches: z.number().int(),
218
+ totalMatchingPages: z.number().int(),
219
+ truncated: z.boolean(),
220
+ pages: z.array(z.object({
221
+ page: z.number().int(),
222
+ sectionPath: z.array(z.string()),
223
+ matchCount: z.number().int(),
224
+ snippetsTruncated: z.boolean(),
225
+ snippets: z.array(z.string()),
226
+ })),
227
+ });
228
+ export const GrepTextWebOutput = z.object({
229
+ id: z.number().int(),
230
+ source: z.literal("web"),
231
+ available: z.array(z.enum(["pdf", "web"])),
232
+ query: z.string(),
233
+ isRegex: z.boolean(),
234
+ contentLength: z.number().int(),
235
+ totalMatches: z.number().int(),
236
+ totalEntries: z.number().int(),
237
+ truncated: z.boolean(),
238
+ matches: z.array(z.object({
239
+ start: z.number().int().nonnegative(),
240
+ matchCount: z.number().int(),
241
+ snippet: z.string(),
242
+ })),
140
243
  });
141
244
  export const StyleDTO = z.object({
142
245
  id: z.string(),
@@ -159,8 +262,8 @@ export const SyncStatusDTO = z
159
262
  })
160
263
  .passthrough(); // sync status is relatively fluid; keep forward-compat
161
264
  export const DeleteResultDTO = z.object({ deleted: z.string() });
162
- export const ImportResultDTO = z
163
- .object({ imported: z.number().int(), file: z.string() })
164
- .passthrough();
165
- export const CliErrorDTO = z.object({ error: z.string() });
265
+ // (ImportResultDTO removed with the `import` subcommand; CliErrorDTO removed
266
+ // with the verbatim-stderr change — errors are now raw envelope text, which
267
+ // may be a structured `{error, ids, names}` / `{items, summary}` shape, not a
268
+ // plain `{error}` object.)
166
269
  //# sourceMappingURL=schemas.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,gFAAgF;AAChF,8EAA8E;AAC9E,EAAE;AACF,yEAAyE;AACzE,mEAAmE;AACnE,6EAA6E;AAC7E,4DAA4D;AAC5D,iFAAiF;AACjF,gEAAgE;AAChE,gFAAgF;AAEhF,MAAM,aAAa,GAAG,CAAC;KACpB,MAAM,EAAE;KACR,QAAQ,CAAC,8EAA8E,CAAC,CAAC;AAE5F,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;CAClB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAC/B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACjC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,KAAK,EAAE,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