@buildinternet/uploads 0.42.0 → 0.42.2

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/dist/mcp/tools.js CHANGED
@@ -10,7 +10,7 @@ import { validateMetaMap } from "../metadata.js";
10
10
  import { mergeDerivedMeta } from "../metadata-vocab.js";
11
11
  import { execRunner, ghMetadataFromTargetWithTitle, resolveCurrentBranch, resolveCurrentPullRequest, resolveRepo, } from "../github-gh.js";
12
12
  import { appProp, canonicalMetaFromArgs, METADATA_DESCRIPTION, metadataArgWithCanonical, metadataProp, optBool, optPosInt, optString, optStringArray, optStringRecord, stateProp, usage, } from "./args.js";
13
- import { batchFailureMessage, ToolBatchError } from "./server.js";
13
+ import { batchFailureMessage, mcpDestroyPublic, mcpNoAuth, mcpOAuthAny, mcpOAuthDelete, mcpOAuthRead, mcpOAuthWrite, mcpRead, mcpWriteInternal, mcpWritePublic, stdioOutputSchemas, withOutputSchemas, ToolBatchError, } from "./server.js";
14
14
  import { attachmentFromText, buildReportPayload, parseReportType, REPORT_TYPES, submitReport, validateReportMessage, } from "../report.js";
15
15
  import { resolveApiUrl } from "../config.js";
16
16
  function mcpOptimizeOptions(args, defaults) {
@@ -130,9 +130,12 @@ export function createUploadsMcpTools(opts) {
130
130
  }
131
131
  return { comment, commentError };
132
132
  };
133
- return [
133
+ const tools = [
134
134
  {
135
135
  name: "gallery_create",
136
+ title: "Create gallery",
137
+ annotations: mcpWritePublic,
138
+ securitySchemes: mcpOAuthWrite,
136
139
  description: "Create a public ordered media gallery in the workspace. The returned canonical URL is safe to give users, but anyone who knows it can view the gallery and its media.",
137
140
  inputSchema: {
138
141
  type: "object",
@@ -154,6 +157,9 @@ export function createUploadsMcpTools(opts) {
154
157
  },
155
158
  {
156
159
  name: "gallery_get",
160
+ title: "Get gallery",
161
+ annotations: mcpRead,
162
+ securitySchemes: mcpOAuthRead,
157
163
  description: "Get a workspace-owned gallery, including ordered media and its canonical public URL. Gallery media is public to anyone with the URL.",
158
164
  inputSchema: {
159
165
  type: "object",
@@ -171,6 +177,9 @@ export function createUploadsMcpTools(opts) {
171
177
  },
172
178
  {
173
179
  name: "gallery_add",
180
+ title: "Add gallery item",
181
+ annotations: mcpWritePublic,
182
+ securitySchemes: mcpOAuthWrite,
174
183
  description: "Add one existing, publicly served workspace object to a gallery. Reads the latest gallery version before writing, so the optimistic API version is handled safely. Does not upload or delete the object.",
175
184
  inputSchema: {
176
185
  type: "object",
@@ -200,6 +209,9 @@ export function createUploadsMcpTools(opts) {
200
209
  },
201
210
  {
202
211
  name: "gallery_link",
212
+ title: "Link gallery",
213
+ annotations: mcpWritePublic,
214
+ securitySchemes: mcpOAuthWrite,
203
215
  description: "Link a gallery to an external reference. References use provider-neutral fields; github currently accepts owner/repo#number or a strict GitHub issue/PR URL. No GitHub credentials or API calls are used.",
204
216
  inputSchema: {
205
217
  type: "object",
@@ -227,6 +239,9 @@ export function createUploadsMcpTools(opts) {
227
239
  },
228
240
  {
229
241
  name: "gallery_find_by_reference",
242
+ title: "Find galleries",
243
+ annotations: mcpRead,
244
+ securitySchemes: mcpOAuthRead,
230
245
  description: "Find workspace galleries linked to an external reference. Returns gallery summaries and canonical public URLs without contacting the provider.",
231
246
  inputSchema: {
232
247
  type: "object",
@@ -254,6 +269,9 @@ export function createUploadsMcpTools(opts) {
254
269
  },
255
270
  {
256
271
  name: "put",
272
+ title: "Upload file",
273
+ annotations: mcpDestroyPublic,
274
+ securitySchemes: mcpOAuthWrite,
257
275
  description: "Upload one or more files to uploads.sh and get public URL(s) plus GitHub-ready embed markdown. Single-file: pass `file` or `contentBase64`+`filename` (flat result with `url`/`embedUrl`/`markdown`). Multi-file: pass `files` (paths; parallel; returns `uploads`+`failures`). Prefer `embedUrl` in PR/issue markdown. With `pr`/`issue` keys are stable and `comment` syncs the managed attachments comment. All uploads are public; pr/issue keys are predictable — upload only non-sensitive media.",
258
276
  inputSchema: {
259
277
  type: "object",
@@ -558,6 +576,9 @@ export function createUploadsMcpTools(opts) {
558
576
  },
559
577
  {
560
578
  name: "screenshot",
579
+ title: "Capture screenshot",
580
+ annotations: mcpDestroyPublic,
581
+ securitySchemes: mcpOAuthWrite,
561
582
  description: "Capture a URL or a local .html file and host it — a hosted, PR-embeddable image in one call. Backend `local` drives an already-installed Chrome/Chromium (dynamically loaded; unavailable in some runtimes); `remote` renders server-side via the workspace's render endpoint and counts against the monthly upload budget. Default via=auto prefers local when found, else remote. localhost/private-network URLs and .html files are local-only — via=remote (or auto falling back to remote) fails fast instead of a doomed request. Shares the put upload pipeline: optional frame, optimize-by-default, pr/issue attachment + comment, gallery, metadata. Uploads are public.",
562
583
  inputSchema: {
563
584
  type: "object",
@@ -891,6 +912,9 @@ export function createUploadsMcpTools(opts) {
891
912
  },
892
913
  {
893
914
  name: "attach",
915
+ title: "Attach to GitHub",
916
+ annotations: mcpDestroyPublic,
917
+ securitySchemes: mcpOAuthWrite,
894
918
  description: "Upload one or more files as stable PR/issue attachments (in parallel) and maintain a managed GitHub comment. Returns `uploads` and `failures` (one bad file does not abort the batch). Each success has `url`, `embedUrl`, and `markdown` (prefer embedUrl for GitHub). With no pr/issue, targets the current branch PR. Attachments are public and keys are predictable; upload only non-sensitive media.",
895
919
  inputSchema: {
896
920
  type: "object",
@@ -989,6 +1013,9 @@ export function createUploadsMcpTools(opts) {
989
1013
  },
990
1014
  {
991
1015
  name: "list",
1016
+ title: "List files",
1017
+ annotations: mcpRead,
1018
+ securitySchemes: mcpOAuthRead,
992
1019
  description: "List uploaded objects in the workspace, filtered by key prefix or by a PR/issue's attachments. Paginate with cursor, or set all to fetch every page.",
993
1020
  inputSchema: {
994
1021
  type: "object",
@@ -1046,6 +1073,9 @@ export function createUploadsMcpTools(opts) {
1046
1073
  },
1047
1074
  {
1048
1075
  name: "staged",
1076
+ title: "List staged files",
1077
+ annotations: mcpRead,
1078
+ securitySchemes: mcpOAuthRead,
1049
1079
  description: "Read-only view of what's staged for a git branch (attach --branch / bare put on a non-default branch) and whether it will auto-attach once a PR opens. One list call against the branch staging prefix plus a repo-binding check (files:read only). Returns { repo, branch, files, binding }; binding.state is self/other/none/unknown and binding.autoAttach is true only for self.",
1050
1080
  inputSchema: {
1051
1081
  type: "object",
@@ -1071,6 +1101,9 @@ export function createUploadsMcpTools(opts) {
1071
1101
  },
1072
1102
  {
1073
1103
  name: "delete",
1104
+ title: "Delete file",
1105
+ annotations: mcpDestroyPublic,
1106
+ securitySchemes: mcpOAuthDelete,
1074
1107
  description: "Delete an uploaded object by key. Set dryRun to preview without deleting.",
1075
1108
  inputSchema: {
1076
1109
  type: "object",
@@ -1097,6 +1130,9 @@ export function createUploadsMcpTools(opts) {
1097
1130
  },
1098
1131
  {
1099
1132
  name: "get_metadata",
1133
+ title: "Get metadata",
1134
+ annotations: mcpRead,
1135
+ securitySchemes: mcpOAuthRead,
1100
1136
  description: "Read an object's queryable custom metadata (D1 key-value pairs, not R2 provenance). Returns `{ metadata }` (empty when none). Object must exist. Same as `uploads meta get`.",
1101
1137
  inputSchema: {
1102
1138
  type: "object",
@@ -1116,6 +1152,9 @@ export function createUploadsMcpTools(opts) {
1116
1152
  },
1117
1153
  {
1118
1154
  name: "set_metadata",
1155
+ title: "Set metadata",
1156
+ annotations: mcpWritePublic,
1157
+ securitySchemes: mcpOAuthWrite,
1119
1158
  description: "Merge-set and/or delete an object's queryable custom metadata (D1 key-value pairs, not R2 provenance). `set` wins over `delete` for the same key. " +
1120
1159
  METADATA_DESCRIPTION +
1121
1160
  " Requires at least one of `set` or `delete`. Same as `uploads meta set`.",
@@ -1151,6 +1190,9 @@ export function createUploadsMcpTools(opts) {
1151
1190
  },
1152
1191
  {
1153
1192
  name: "find_files",
1193
+ title: "Find files",
1194
+ annotations: mcpRead,
1195
+ securitySchemes: mcpOAuthRead,
1154
1196
  description: "Find objects whose queryable custom metadata matches ALL of `filters` (ANDed equality) and/or whose key contains `name` (case-insensitive substring). At least one of `filters` or `name` is required. Returns each match's key, public URL, full metadata map, and optional `truncated`. Same as `uploads find k=v...` / `uploads find --name <term>`.",
1155
1197
  inputSchema: {
1156
1198
  type: "object",
@@ -1191,6 +1233,9 @@ export function createUploadsMcpTools(opts) {
1191
1233
  },
1192
1234
  {
1193
1235
  name: "list_metadata_keys",
1236
+ title: "List metadata keys",
1237
+ annotations: mcpRead,
1238
+ securitySchemes: mcpOAuthRead,
1194
1239
  description: "List the distinct queryable metadata keys present in the workspace, with file counts and distinct-value counts. Use this to discover what is filterable before calling find_files — keys are user/agent-defined, not a fixed schema. Same as `uploads meta keys`. Pass optional `key` to list that key's values instead (`uploads meta values <key>`).",
1195
1240
  inputSchema: {
1196
1241
  type: "object",
@@ -1211,6 +1256,9 @@ export function createUploadsMcpTools(opts) {
1211
1256
  },
1212
1257
  {
1213
1258
  name: "usage",
1259
+ title: "Show usage",
1260
+ annotations: mcpRead,
1261
+ securitySchemes: mcpOAuthRead,
1214
1262
  description: "Workspace storage and monthly upload counters (and remaining headroom when budgets are configured). Same as `uploads usage`.",
1215
1263
  inputSchema: {
1216
1264
  type: "object",
@@ -1224,6 +1272,9 @@ export function createUploadsMcpTools(opts) {
1224
1272
  },
1225
1273
  {
1226
1274
  name: "reconcile",
1275
+ title: "Reconcile usage",
1276
+ annotations: mcpWriteInternal,
1277
+ securitySchemes: mcpOAuthWrite,
1227
1278
  description: "Rebuild usage ledger bytes/objects from storage (source of truth). Preserves the monthly upload counter. Requires files:write. Same as `uploads reconcile`.",
1228
1279
  inputSchema: {
1229
1280
  type: "object",
@@ -1237,6 +1288,9 @@ export function createUploadsMcpTools(opts) {
1237
1288
  },
1238
1289
  {
1239
1290
  name: "purge_expired",
1291
+ title: "Purge expired files",
1292
+ annotations: mcpDestroyPublic,
1293
+ securitySchemes: mcpOAuthDelete,
1240
1294
  description: "Delete objects older than the workspace retentionDays setting, then reconcile. Skips if retention is unset. Requires files:delete. Same as `uploads purge-expired`.",
1241
1295
  inputSchema: {
1242
1296
  type: "object",
@@ -1250,6 +1304,9 @@ export function createUploadsMcpTools(opts) {
1250
1304
  },
1251
1305
  {
1252
1306
  name: "comment",
1307
+ title: "Sync attachments comment",
1308
+ annotations: mcpDestroyPublic,
1309
+ securitySchemes: mcpOAuthWrite,
1253
1310
  description: "Create or update the managed attachments comment on a GitHub PR or issue, listing everything uploaded for it. Posts as uploads-sh[bot] when the GitHub App is installed on the repo; otherwise via local gh auth. Edits its own prior comment in place and never touches other comments.",
1254
1311
  inputSchema: {
1255
1312
  type: "object",
@@ -1273,6 +1330,9 @@ export function createUploadsMcpTools(opts) {
1273
1330
  },
1274
1331
  {
1275
1332
  name: "health",
1333
+ title: "Check health",
1334
+ annotations: mcpRead,
1335
+ securitySchemes: mcpNoAuth,
1276
1336
  description: "Check uploads.sh API liveness. No auth or arguments required.",
1277
1337
  inputSchema: { type: "object", properties: {}, additionalProperties: false },
1278
1338
  async handler(args) {
@@ -1283,6 +1343,9 @@ export function createUploadsMcpTools(opts) {
1283
1343
  },
1284
1344
  {
1285
1345
  name: "doctor",
1346
+ title: "Diagnose setup",
1347
+ annotations: mcpRead,
1348
+ securitySchemes: mcpOAuthAny,
1286
1349
  description: "Diagnose the configuration: API health, token auth, and workspace/token alignment. Returns the same report as `uploads doctor --json`, including hints.",
1287
1350
  inputSchema: {
1288
1351
  type: "object",
@@ -1296,6 +1359,9 @@ export function createUploadsMcpTools(opts) {
1296
1359
  },
1297
1360
  {
1298
1361
  name: "report",
1362
+ title: "Send diagnostic report",
1363
+ annotations: mcpWriteInternal,
1364
+ securitySchemes: mcpOAuthWrite,
1299
1365
  description: "Send an explicit diagnostic report to the uploads team (message + optional text log). " +
1300
1366
  "Only call this when the user asked to submit feedback, a bug report, or error logs — " +
1301
1367
  "never automatically. Do not include tokens, secrets, or private file contents. " +
@@ -1377,4 +1443,5 @@ export function createUploadsMcpTools(opts) {
1377
1443
  },
1378
1444
  },
1379
1445
  ];
1446
+ return withOutputSchemas(tools, stdioOutputSchemas, { required: false });
1380
1447
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buildinternet/uploads",
3
- "version": "0.42.0",
3
+ "version": "0.42.2",
4
4
  "description": "CLI and client for uploads.sh — workspace-scoped image hosting for GitHub embeds",
5
5
  "type": "module",
6
6
  "sideEffects": false,