ofw-mcp 2.26.1 → 2.27.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.
@@ -0,0 +1,234 @@
1
+ // Getting a file's bytes to OurFamilyWizard from a caller that shares no
2
+ // filesystem with this server.
3
+ //
4
+ // `ofw_upload_attachment` used to accept only a `path` on the SERVER's disk.
5
+ // On mcp-host the caller is a claude.ai session somewhere else entirely, so no
6
+ // path it can name exists here, and every upload failed — first as a raw
7
+ // ENOENT on an upload directory nobody had created, and even with that
8
+ // directory there was no way for the caller to put a file in it.
9
+ //
10
+ // Two ways in, by size:
11
+ //
12
+ // - **Blob upload slots** (hosted, the main path). The server mints a signed
13
+ // PUT URL on mcp-host's per-registration blob store (`uploadSlots`); the
14
+ // caller `curl`s the file to it; the server reads the object back
15
+ // (`blobKeys`) and DELETES it once OFW has the file (`BlobStore.consume`).
16
+ // No base64 in the tool call, so no request-size ceiling, and no photo
17
+ // left sitting in the bucket until the 30-day retention prune.
18
+ // - **Inline base64** (`inline`). Works on any deployment, but every byte
19
+ // rides inside one JSON-RPC request — mcp-host caps that at ~9.9 MiB — and
20
+ // a model must emit the base64 as tool-call text. Fine for a small file or
21
+ // a client with no shell; wrong for a batch of phone photos.
22
+ //
23
+ // Both converge on a {@link ResolvedUpload}, the same shape a disk `path`
24
+ // resolves to, so everything after this point — the My Files POST, the
25
+ // SHARED confirmation, the attachment cache — is one code path.
26
+ import { createHash } from 'node:crypto';
27
+ import { z } from 'zod';
28
+ import { parseLenient } from '@chrischall/mcp-utils';
29
+ import { checkUploadSize as sharedCheckUploadSize, decodeBase64Strict, inlineFileSchema, MAX_UPLOAD_FILES, mintUploadSlot as sharedMintUploadSlot, resolveUploadMime, sanitizeUploadFilename, UPLOAD_KEY_PREFIX, UPLOAD_SLOT_DEFAULT_TTL_MS, uploadFileNameFromKey, uploadSlotRequestSchema, } from '@chrischall/mcp-utils/export';
30
+ import { MAX_UPLOAD_BYTES, mimeFromName, normalizeMimeType } from './attachments.js';
31
+ import { formatInstant } from '../timestamps.js';
32
+ // The filename / MIME / base64 / slot rules are the fleet's, from
33
+ // @chrischall/mcp-utils/export (3.6), which was lifted out of this file. The
34
+ // names below keep this module's API so callers and tests did not move; the
35
+ // only local policy is the 25 MiB cap and the offset-bearing expiresAt.
36
+ /** Most files one call may upload (inline array, blobKeys, uploadSlots). */
37
+ export const MAX_FILES_PER_CALL = MAX_UPLOAD_FILES;
38
+ /** How long an upload slot's PUT URL works. */
39
+ export const UPLOAD_SLOT_TTL_MS = UPLOAD_SLOT_DEFAULT_TTL_MS;
40
+ /** Object-key prefix for caller uploads — the only keys `blobKeys` accepts. */
41
+ export const UPLOAD_BLOB_PREFIX = UPLOAD_KEY_PREFIX;
42
+ export { inlineFileSchema, resolveUploadMime, sanitizeUploadFilename, uploadSlotRequestSchema };
43
+ /** Refuse an empty file or one over the 25 MiB upload cap, naming the limit. */
44
+ export function checkUploadSize(fileName, size) {
45
+ sharedCheckUploadSize(fileName, size, MAX_UPLOAD_BYTES);
46
+ }
47
+ /** Strict base64 → bytes, capped at the upload limit (see `decodeBase64Strict`). */
48
+ export function decodeBase64Content(content, fileName) {
49
+ const bytes = decodeBase64Strict(content, { fileName, maxBytes: MAX_UPLOAD_BYTES });
50
+ return Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
51
+ }
52
+ /** An `inline` entry → the upload it describes, validated end to end. */
53
+ export function resolveInlineUpload(file) {
54
+ const fileName = sanitizeUploadFilename(file.filename);
55
+ const mimeType = resolveUploadMime(fileName, file.mimeType);
56
+ const bytes = decodeBase64Content(file.contentBase64, fileName);
57
+ return { blob: new Blob([new Uint8Array(bytes)], { type: mimeType }), fileName, mimeType, sizeBytes: bytes.length };
58
+ }
59
+ /**
60
+ * The filename an upload key was minted for. Only the exact
61
+ * `uploads/<uuid>/<base64url(name)>` shape is accepted, so `blobKeys` can
62
+ * never be pointed at another object in this registration's store (a
63
+ * calendar export, an export zip) and pass it off as an upload.
64
+ */
65
+ export function fileNameFromBlobKey(key) {
66
+ try {
67
+ return uploadFileNameFromKey(key, { prefix: UPLOAD_BLOB_PREFIX });
68
+ }
69
+ catch (e) {
70
+ // The shared message is tool-agnostic; name the tool that mints keys here.
71
+ const message = e.message;
72
+ if (!message.includes('is not an upload key'))
73
+ throw e;
74
+ throw new Error(`blobKey ${JSON.stringify(key)} is not an upload key. Pass the blobKey exactly as ofw_upload_attachment's uploadSlots returned it.`);
75
+ }
76
+ }
77
+ /** Mint one signed PUT slot for a caller upload. */
78
+ export function mintUploadSlot(store, req) {
79
+ const { expiresAtMs, ...slot } = sharedMintUploadSlot(store, req, { prefix: UPLOAD_BLOB_PREFIX, ttlMs: UPLOAD_SLOT_TTL_MS });
80
+ return { ...slot, expiresAt: formatInstant(new Date(expiresAtMs)).iso };
81
+ }
82
+ /** A consumed blob object → the upload it holds. */
83
+ export function blobObjectToUpload(key, object) {
84
+ const fileName = fileNameFromBlobKey(key);
85
+ checkUploadSize(fileName, object.bytes.length);
86
+ // The stored type is the one the PUT signature committed to, i.e. the one
87
+ // this server minted the slot for.
88
+ const mimeType = normalizeMimeType(object.contentType ?? mimeFromName(fileName));
89
+ return {
90
+ blob: new Blob([object.bytes], { type: mimeType }),
91
+ fileName,
92
+ mimeType,
93
+ sizeBytes: object.bytes.length,
94
+ };
95
+ }
96
+ // ── The My Files upload ──────────────────────────────────────────────────
97
+ export const UploadedFileSchema = z.looseObject({
98
+ fileId: z.number(),
99
+ fileName: z.string().optional(),
100
+ label: z.string().optional(),
101
+ fileType: z.string().optional(),
102
+ sizeInBytes: z.number().optional(),
103
+ shareClass: z.string().optional(),
104
+ });
105
+ /**
106
+ * POST one resolved upload to OFW's My Files, the multipart shape of the OFW
107
+ * web UI's own request, and cache its metadata under the not-yet-linked
108
+ * `messageId: 0` sentinel so a later download or send can name it. The
109
+ * response is parsed STRICTLY: an unusable fileId cached here would be
110
+ * attached to a message later.
111
+ */
112
+ export async function uploadToMyFiles(client, cache, upload, opts) {
113
+ const { blob, fileName, mimeType, sizeBytes } = upload;
114
+ const form = new FormData();
115
+ form.append('file', blob, fileName);
116
+ form.append('source', 'message');
117
+ form.append('description', opts.description ?? fileName);
118
+ form.append('label', opts.label ?? fileName);
119
+ form.append('fileName', fileName);
120
+ form.append('shareClass', opts.shareClass);
121
+ const meta = parseLenient(UploadedFileSchema, await client.request('POST', '/pub/v3/myfiles/multipart', form), { label: 'ofw-mcp', context: 'POST /pub/v3/myfiles/multipart (ofw_upload_attachment)', mode: 'strict' });
122
+ const stored = {
123
+ fileName: meta.fileName ?? fileName,
124
+ mimeType: meta.fileType ?? mimeType,
125
+ sizeBytes: typeof meta.sizeInBytes === 'number' ? meta.sizeInBytes : sizeBytes,
126
+ };
127
+ await cache.upsertAttachmentForMessage({
128
+ fileId: meta.fileId,
129
+ fileName: stored.fileName,
130
+ label: meta.label ?? opts.label ?? fileName,
131
+ mimeType: stored.mimeType,
132
+ sizeBytes: stored.sizeBytes,
133
+ metadata: meta,
134
+ messageId: 0,
135
+ });
136
+ return { fileId: meta.fileId, ...stored, bytes: sizeBytes, shareClass: meta.shareClass ?? opts.shareClass };
137
+ }
138
+ /** SHA-256 of an upload's bytes, hex — what a confirmation binds. */
139
+ export async function sha256Hex(blob) {
140
+ return createHash('sha256').update(new Uint8Array(await blob.arrayBuffer())).digest('hex');
141
+ }
142
+ /** Refuse a call naming more than {@link MAX_FILES_PER_CALL} files. */
143
+ export function checkFileCount(count, what) {
144
+ if (count > MAX_FILES_PER_CALL) {
145
+ throw new Error(`${what}: at most ${MAX_FILES_PER_CALL} files per call (got ${count}). Split them across calls.`);
146
+ }
147
+ }
148
+ /** The blob store, or a refusal that says what to use instead. */
149
+ export function requireBlobStore(store, what) {
150
+ if (store)
151
+ return store;
152
+ throw new Error(`${what} needs the blob store an mcp-host deployment provides, and this server has no blob store (it is a local install). Pass a \`path\` inside the upload directory, or the bytes with \`inline\`.`);
153
+ }
154
+ // ── Attaching in one step (ofw_save_draft / ofw_send_message) ────────────
155
+ export const inlineAttachmentsParam = z.array(inlineFileSchema).max(MAX_FILES_PER_CALL).describe('Files to attach, supplied as base64 BYTES ({filename, contentBase64, mimeType?}). Each is uploaded to My Files '
156
+ + '(PRIVATE when a draft holds it; SHARED when sent, as the web app attaches files) and attached alongside any myFileIDs. Use for small files; on a hosted deployment, larger files (phone photos) go faster '
157
+ + 'through ofw_upload_attachment uploadSlots + blobKeys here. Every entry is validated before anything is uploaded.').optional();
158
+ export const blobKeysParam = z.array(z.string()).max(MAX_FILES_PER_CALL).describe('Hosted deployments: blobKeys from ofw_upload_attachment uploadSlots whose files you have already PUT. Each is uploaded to '
159
+ + 'My Files (PRIVATE when a draft holds it; SHARED when sent), attached alongside any myFileIDs, and deleted from the upload store.').optional();
160
+ /**
161
+ * Validate every new attachment BEFORE anything is uploaded, so a bad entry
162
+ * fails the call with nothing half-done. With `readBlobs`, blob objects are
163
+ * read (not consumed) so a confirmation can bind their exact bytes.
164
+ */
165
+ export async function planAttachments(input, opts) {
166
+ const inline = input.inline ?? [];
167
+ const keys = input.blobKeys ?? [];
168
+ checkFileCount(inline.length + keys.length, 'inlineAttachments + blobKeys');
169
+ const pending = [];
170
+ for (const file of inline) {
171
+ const upload = resolveInlineUpload(file);
172
+ pending.push({ fileName: upload.fileName, mimeType: upload.mimeType, sizeBytes: upload.sizeBytes, sha256: await sha256Hex(upload.blob), inline: upload });
173
+ }
174
+ if (keys.length > 0) {
175
+ const store = requireBlobStore(opts.store, 'blobKeys');
176
+ for (const blobKey of keys) {
177
+ const fileName = fileNameFromBlobKey(blobKey);
178
+ if (!opts.readBlobs) {
179
+ pending.push({ fileName, mimeType: null, sizeBytes: null, sha256: null, blobKey });
180
+ continue;
181
+ }
182
+ const upload = blobObjectToUpload(blobKey, await store.get(blobKey, { maxBytes: MAX_UPLOAD_BYTES }));
183
+ pending.push({ fileName, mimeType: upload.mimeType, sizeBytes: upload.sizeBytes, sha256: await sha256Hex(upload.blob), blobKey });
184
+ }
185
+ }
186
+ return pending;
187
+ }
188
+ /** What a preview shows of the new attachments. */
189
+ export function describePending(pending) {
190
+ return pending.map((p) => ({ fileName: p.fileName, mimeType: p.mimeType, sizeBytes: p.sizeBytes, sha256: p.sha256, upload: 'PRIVATE, on approval' }));
191
+ }
192
+ /**
193
+ * Upload the planned attachments, in order, under `ctx.shareClass` (PRIVATE
194
+ * when a draft holds them; SHARED at send, as the web app attaches files). A blob is consumed —
195
+ * deleted once OFW has it; a failed delete is a warning, never a failure. Any
196
+ * upload failure stops the batch and throws, naming what DID upload, so the
197
+ * caller can retry with those fileIds instead of uploading them twice.
198
+ */
199
+ export async function uploadPending(pending, ctx) {
200
+ const uploaded = [];
201
+ const warnings = [];
202
+ for (const p of pending) {
203
+ try {
204
+ if (p.inline) {
205
+ uploaded.push(await uploadToMyFiles(ctx.client, ctx.cache, p.inline, { shareClass: ctx.shareClass }));
206
+ continue;
207
+ }
208
+ const out = await ctx.store.consume(p.blobKey, async (object) => {
209
+ const upload = blobObjectToUpload(p.blobKey, object);
210
+ if (p.sha256 !== null && (await sha256Hex(upload.blob)) !== p.sha256) {
211
+ throw new Error(`${p.fileName} changed in the upload store after it was previewed`);
212
+ }
213
+ return uploadToMyFiles(ctx.client, ctx.cache, upload, { shareClass: ctx.shareClass });
214
+ }, { maxBytes: MAX_UPLOAD_BYTES });
215
+ uploaded.push(out.result);
216
+ if (!out.deleted) {
217
+ warnings.push(`${p.fileName} was uploaded (fileId ${out.result.fileId}) but its copy in the upload store could not be deleted (${out.deleteError}); it expires with the store's retention.`);
218
+ }
219
+ }
220
+ catch (e) {
221
+ const done = uploaded.map((u) => `${u.fileName} (fileId ${u.fileId})`);
222
+ throw new Error(`Attachment ${p.fileName} could not be uploaded: ${e.message}. Nothing was ${ctx.nothingWas}.`
223
+ + (done.length > 0
224
+ ? ` Already uploaded to My Files (${ctx.shareClass}): ${done.join(', ')} — pass those fileIds in myFileIDs when you retry instead of uploading them again.`
225
+ : ''));
226
+ }
227
+ }
228
+ return { uploaded, warnings };
229
+ }
230
+ // ── Hosted detection ─────────────────────────────────────────────────────
231
+ // Defined beside the code that needs them without importing this module
232
+ // (config.ts, attachments.ts), re-exported here as part of the upload surface.
233
+ export { hasBlobStoreEnv, isHostedDeployment } from '../config.js';
234
+ export { hostedPathRefusal } from './attachments.js';
package/dist/version.js CHANGED
@@ -4,4 +4,4 @@
4
4
  // package.json drift. Importing these instead of package.json keeps the whole
5
5
  // manifest — npm scripts included — out of dist/bundle.js.
6
6
  export const SERVER_NAME = 'ofw-mcp';
7
- export const VERSION = '2.26.1'; // x-release-please-version
7
+ export const VERSION = '2.27.1'; // x-release-please-version
package/mint.yaml CHANGED
@@ -207,3 +207,8 @@ egress:
207
207
  # file URL (no OFW credential is sent there; every redirect hop is
208
208
  # re-checked against this suffix in src/tools/expenses.ts).
209
209
  - "*.oaiusercontent.com"
210
+ # Not listed: mcp-host's own blob store (MCP_BLOB_BASE_URL, the gateway
211
+ # serving this connector — its host differs per deployment). The server
212
+ # PUTs .ics exports and download links there, and GETs + DELETEs files the
213
+ # caller uploaded through ofw_upload_attachment uploadSlots. Signed
214
+ # requests only; no OFW credential is ever sent.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ofw-mcp",
3
- "version": "2.26.1",
3
+ "version": "2.27.1",
4
4
  "license": "MIT",
5
5
  "mcpName": "io.github.chrischall/ofw-mcp",
6
6
  "description": "OurFamilyWizard MCP server for Claude — developed and maintained by AI (Claude Code)",
@@ -34,7 +34,7 @@
34
34
  "typecheck": "tsc -p tsconfig.json --noEmit"
35
35
  },
36
36
  "dependencies": {
37
- "@chrischall/mcp-utils": "^3.1.0",
37
+ "@chrischall/mcp-utils": "^3.6.0",
38
38
  "@fetchproxy/bootstrap": "^3.6.2",
39
39
  "@modelcontextprotocol/server": "^2.3.0",
40
40
  "dotenv": "^18.0.0",
package/server.json CHANGED
@@ -6,12 +6,12 @@
6
6
  "url": "https://github.com/chrischall/ofw-mcp",
7
7
  "source": "github"
8
8
  },
9
- "version": "2.26.1",
9
+ "version": "2.27.1",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "ofw-mcp",
14
- "version": "2.26.1",
14
+ "version": "2.27.1",
15
15
  "transport": {
16
16
  "type": "stdio"
17
17
  },
@@ -94,13 +94,13 @@ Always pass `--config ~/.mcporter/mcporter.json` unless a local `config/mcporter
94
94
  | `ofw_list_message_folders` | List OFW folders with unread counts. Most reads use the cache; this is mainly for folder IDs and live unread counts. |
95
95
  | `ofw_list_messages(folderId?, since?, until?, q?, sort?, page?, size?, autoRefresh?, view?)` | Cache-backed list. Supports folder ("inbox"/"sent"/"both"), date range, and substring search. `sort:"oldest"` starts at the old end of a range instead of paging to it (default `"newest"`). Returns `complete` for the RESULT SET plus **`nextPage`** (null when done) — and the paging keys come FIRST in the JSON, before `messages`. `returned` carries the record count as a scalar, beside `total`. An **empty** result from a non-fresh cache is refused (`UNVERIFIED_EMPTY`) — pass `autoRefresh:true` to sync and answer instead. |
96
96
  | `ofw_get_message(messageId, allowMarkRead?, view?)` | Read a message OR draft body. Cache-first. Ids in the drafts cache return `folder: "drafts"`. ⚠️ Falls through to OFW for unread inbox messages, which marks them read AND stamps a "First Viewed" time the co-parent can see — irreversible. Pass `allowMarkRead:false` to refuse that fetch instead; cached, sent and already-read messages are unaffected. If the server runs with `OFW_CONFIRM_MARK_READ`, the first call returns a preview (subject, sender, sent time) instead of the body: show it to the user and repeat the call with its `confirmToken` only after they say yes. On a server-configured no-read day (`readingBlocked` / `READING_BLOCKED` in the response) the body is withheld (`bodyWithheld: true`) — report the sender, date and subject, say when `nextReadableDay` is, and do not try to work around it. |
97
- | `ofw_send_message(draftId?, subject?, body?, recipientIds?, replyToId?, expectedRevision?, deleteDraftOnSuccess?, myFileIDs?, force?)` | Send a message — **the one irreversible operation**. Preferred path: pass `draftId` (+ `expectedRevision`) to send an existing draft **as it exists on the server** — the tool re-reads it from OFW first and refuses if it changed since you read it (or was already sent/deleted); `subject`/`body` become optional overrides. `recipientIds` is usually still required: OFW does not store recipients on drafts. After a **confirmed** send the draft is auto-deleted (`deleteDraftOnSuccess:false` to keep it); on any failure or ambiguity it is retained and the response says why (`draftRetained`). Response leads with `sentMessageId`, `draftKey`, `threaded`, `draftDeleted`. Compose from scratch by passing `subject`/`body`/`recipientIds` with no `draftId`. |
97
+ | `ofw_send_message(draftId?, subject?, body?, recipientIds?, replyToId?, expectedRevision?, deleteDraftOnSuccess?, myFileIDs?, inlineAttachments?, blobKeys?, force?)` | Send a message — **the one irreversible operation**. Preferred path: pass `draftId` (+ `expectedRevision`) to send an existing draft **as it exists on the server** — the tool re-reads it from OFW first and refuses if it changed since you read it (or was already sent/deleted); `subject`/`body` become optional overrides. `recipientIds` is usually still required: OFW does not store recipients on drafts. After a **confirmed** send the draft is auto-deleted (`deleteDraftOnSuccess:false` to keep it); on any failure or ambiguity it is retained and the response says why (`draftRetained`). Response leads with `sentMessageId`, `draftKey`, `threaded`, `draftDeleted`. Compose from scratch by passing `subject`/`body`/`recipientIds` with no `draftId`. Sending a draft attaches its held files. Everything goes out SHARED (new files uploaded SHARED, PRIVATE ones re-shared), only after approval, and the response's `attachments.verified`/`missing` says what OFW actually attached. |
98
98
  | `ofw_get_unread_sent(page?, size?, autoRefresh?)` | Sent messages your co-parent hasn't read yet (from cache). Leads with `complete`/`hasMore`/`nextPage`, then `scanned`/`total`, then `unread`; an empty sent cache that is not fresh is refused rather than reported as "nothing sent". |
99
99
  | `ofw_list_drafts(page?, size?, verify?, autoRefresh?, view?)` | Leads with `complete`/`hasMore`/`nextPage`; `drafts` comes last. List saved drafts, **auto-verified**: when the cache is not verified-fresh a cheap drafts sync runs first (default `verify:true`), so one call answers server-confirmed. `verify:false` serves straight from cache. Each draft carries `serverConfirmed`, `revision` and `draftKey`. Returns `complete` — **check it before saying "you have N drafts"**. See [Freshness](#freshness). |
100
- | `ofw_save_draft(subject, body, recipientIds?, messageId?, replyToId?, myFileIDs?, expectedRevision?, force?)` | Create a new draft. Pass `messageId` to **replace** an existing draft: the tool creates a fresh draft and deletes the old one (OFW's update-in-place endpoint silently no-ops). The returned `id` is the NEW id; the response leads with `draftKey`, which stays the same across every edit — **track that, not the id**. Note: OFW does **not** store recipients on drafts — `recipientIds` are accepted but come back empty (a one-line NOTE says so; supply them at send time instead). Threading warnings fire only on genuine drops — a draft echoing `inReplyTo`/`showContext` IS threaded. |
100
+ | `ofw_save_draft(subject, body, recipientIds?, messageId?, replyToId?, myFileIDs?, removeFileIDs?, inlineAttachments?, blobKeys?, expectedRevision?, force?)` | Create a new draft. Pass `messageId` to **replace** an existing draft: the tool creates a fresh draft and deletes the old one (OFW's update-in-place endpoint silently no-ops). The returned `id` is the NEW id; the response leads with `draftKey`, which stays the same across every edit — **track that, not the id**. Note: OFW does **not** store recipients on drafts — `recipientIds` are accepted but come back empty (a one-line NOTE says so; supply them at send time instead). Threading warnings fire only on genuine drops — a draft echoing `inReplyTo`/`showContext` IS threaded. **OFW drafts can't hold files**: attachments are HELD by the server (`attachments.held`), kept across edits (`removeFileIDs` drops one), and attached when the draft is sent. They don't appear on the draft in the OFW web app; that's expected. `inlineAttachments`/`blobKeys` upload and add new files in the same call. |
101
101
  | `ofw_delete_draft(messageId)` | Delete a draft. |
102
- | `ofw_upload_attachment(path, shareClass?, label?, description?)` | Upload a local file to My Files; returns a fileId to pass into `myFileIDs`. Only files inside the upload directory (`OFW_UPLOAD_DIR`, default `~/Downloads/ofw-mcp`) can be uploaded; hidden files are refused. `shareClass:"SHARED"` needs write mode `all`. |
103
- | `ofw_download_attachment(fileId, inline?, saveTo?, force?, extract?, maxChars?, parts?)` | Download an attachment. Inline delivery returns the first rung that works: image → `ImageContent`; .xlsx/.csv/.pdf/.docx/.pptx/text → **extracted content** under `extracted` (per-sheet CSV, per-page/slide text); anything else → raw bytes. Default writes to `~/Downloads/ofw-mcp/` (add `extract:true` for content too). Use `parts:"1-2"` / a sheet name and `maxChars` on large files. Images and raw bytes over 10 MiB are not returned inline (tool error) — use disk mode or open the file in OFW. |
102
+ | `ofw_upload_attachment(path \| inline \| uploadSlots \| blobKeys, shareClass?, label?, description?)` | Upload to My Files; returns fileIds for `myFileIDs`. Exactly one source. **Hosted connector (claude.ai): `path` cannot work.** For real files (photos), call `uploadSlots:[{filename}]`, run each slot's `curl` with the file, then call again with `blobKeys`; for a small file pass `inline:{filename, contentBase64}`. Local installs: `path` inside the upload directory (`OFW_UPLOAD_DIR`). Up to 10 files per call, 25 MiB each; a batch reports per-file `results`. `shareClass:"SHARED"` is one file, confirm-gated, mode `all`. |
103
+ | `ofw_download_attachment(fileId, inline?, saveTo?, force?, extract?, maxChars?, parts?, link?, linkMinutes?)` | Download an attachment. Inline delivery returns the first rung that works: image → `ImageContent`; .xlsx/.csv/.pdf/.docx/.pptx/text → **extracted content** under `extracted` (per-sheet CSV, per-page/slide text); anything else → raw bytes. Default writes to `~/Downloads/ofw-mcp/` (add `extract:true` for content too). Use `parts:"1-2"` / a sheet name and `maxChars` on large files. Images and raw bytes over 10 MiB are not returned inline (tool error) — use disk mode or open the file in OFW. On a hosted connector, `inline:false`/`link:true` returns a private expiring download link instead, and an over-10-MiB inline image falls back to one. |
104
104
  | `ofw_check_freshness(folders?, messageIds?, allowMarkRead?)` | Cheap live check that the cache still matches OFW — one request for folder counts plus one per id, no bodies, no sync. Each id gets a live `state` (`draft`/`sent`/`received`/`deleted`/`unknown`) plus `folder` and `sentAt`. Probes ids cached as drafts, as sent, or as already-read inbox messages freely; anything else needs `allowMarkRead:true` (it would mark an inbox message read). |
105
105
  | `ofw_status(ids?, draftKeys?, includeDraftInventory?, allowMarkRead?)` | **The status call.** One live round trip. With no arguments: the full, server-verified draft inventory. With `ids`/`draftKeys`: each one's live lifecycle state. Top-level `complete` is true only when every part was verified live. |
106
106