@layervai/qurl-mcp 0.5.0 → 0.7.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 +209 -48
- package/dist/client.d.ts +65 -10
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +103 -5
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/dist/prompts/audit-links.js +1 -1
- package/dist/prompts/audit-links.js.map +1 -1
- package/dist/qurl-cli.d.ts +96 -0
- package/dist/qurl-cli.d.ts.map +1 -0
- package/dist/qurl-cli.js +331 -0
- package/dist/qurl-cli.js.map +1 -0
- package/dist/server.d.ts +14 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +39 -0
- package/dist/server.js.map +1 -1
- package/dist/tools/_shared.d.ts +1 -0
- package/dist/tools/_shared.d.ts.map +1 -1
- package/dist/tools/_shared.js +6 -1
- package/dist/tools/_shared.js.map +1 -1
- package/dist/tools/consumer-access.d.ts +235 -0
- package/dist/tools/consumer-access.d.ts.map +1 -0
- package/dist/tools/consumer-access.js +231 -0
- package/dist/tools/consumer-access.js.map +1 -0
- package/dist/tools/create-qurl.d.ts.map +1 -1
- package/dist/tools/create-qurl.js +6 -2
- package/dist/tools/create-qurl.js.map +1 -1
- package/dist/tools/delete-qurl.d.ts.map +1 -1
- package/dist/tools/delete-qurl.js +6 -3
- package/dist/tools/delete-qurl.js.map +1 -1
- package/dist/tools/duration.d.ts +13 -0
- package/dist/tools/duration.d.ts.map +1 -0
- package/dist/tools/duration.js +71 -0
- package/dist/tools/duration.js.map +1 -0
- package/dist/tools/email-delivery.d.ts +0 -1
- package/dist/tools/email-delivery.d.ts.map +1 -1
- package/dist/tools/email-delivery.js +0 -1
- package/dist/tools/email-delivery.js.map +1 -1
- package/dist/tools/extend-qurl.d.ts +14 -1
- package/dist/tools/extend-qurl.d.ts.map +1 -1
- package/dist/tools/extend-qurl.js +179 -18
- package/dist/tools/extend-qurl.js.map +1 -1
- package/dist/tools/get-qurl.d.ts +7 -0
- package/dist/tools/get-qurl.d.ts.map +1 -1
- package/dist/tools/list-qurls.d.ts +7 -0
- package/dist/tools/list-qurls.d.ts.map +1 -1
- package/dist/tools/local-cli.d.ts +44 -0
- package/dist/tools/local-cli.d.ts.map +1 -0
- package/dist/tools/local-cli.js +855 -0
- package/dist/tools/local-cli.js.map +1 -0
- package/dist/tools/mint-link.d.ts.map +1 -1
- package/dist/tools/mint-link.js +2 -1
- package/dist/tools/mint-link.js.map +1 -1
- package/dist/tools/output-schemas.d.ts +56 -4
- package/dist/tools/output-schemas.d.ts.map +1 -1
- package/dist/tools/output-schemas.js +62 -11
- package/dist/tools/output-schemas.js.map +1 -1
- package/dist/tools/share-by-crid.d.ts +52 -0
- package/dist/tools/share-by-crid.d.ts.map +1 -0
- package/dist/tools/share-by-crid.js +114 -0
- package/dist/tools/share-by-crid.js.map +1 -0
- package/dist/tools/update-qurl-token.d.ts.map +1 -1
- package/dist/tools/update-qurl-token.js +6 -7
- package/dist/tools/update-qurl-token.js.map +1 -1
- package/dist/tools/update-qurl.d.ts +7 -0
- package/dist/tools/update-qurl.d.ts.map +1 -1
- package/dist/tools/update-qurl.js +6 -7
- package/dist/tools/update-qurl.js.map +1 -1
- package/dist/tools/upload-file-data-qurl.d.ts +17 -61
- package/dist/tools/upload-file-data-qurl.d.ts.map +1 -1
- package/dist/tools/upload-file-data-qurl.js +16 -9
- package/dist/tools/upload-file-data-qurl.js.map +1 -1
- package/dist/tools/upload-file-qurl.d.ts +27 -55
- package/dist/tools/upload-file-qurl.d.ts.map +1 -1
- package/dist/tools/upload-file-qurl.js +19 -12
- package/dist/tools/upload-file-qurl.js.map +1 -1
- package/dist/tools/upload-file-shared.d.ts +27 -10
- package/dist/tools/upload-file-shared.d.ts.map +1 -1
- package/dist/tools/upload-file-shared.js +313 -43
- package/dist/tools/upload-file-shared.js.map +1 -1
- package/dist/tools/upload-mint-options.d.ts +14 -14
- package/dist/tools/upload-mint-options.d.ts.map +1 -1
- package/dist/tools/upload-mint-options.js +33 -15
- package/dist/tools/upload-mint-options.js.map +1 -1
- package/dist/tools/upload-text-qurl.d.ts +15 -47
- package/dist/tools/upload-text-qurl.d.ts.map +1 -1
- package/dist/tools/upload-text-qurl.js +11 -7
- package/dist/tools/upload-text-qurl.js.map +1 -1
- package/package.json +7 -7
|
@@ -33,6 +33,13 @@ export declare function updateQurlTool(client: IQURLClient, _runtime?: ToolRunti
|
|
|
33
33
|
preserve_host: z.ZodOptional<z.ZodBoolean>;
|
|
34
34
|
}, z.core.$strip>;
|
|
35
35
|
outputSchema: z.ZodObject<{
|
|
36
|
+
crid: z.ZodOptional<z.ZodString>;
|
|
37
|
+
private: z.ZodOptional<z.ZodBoolean>;
|
|
38
|
+
consumer_access: z.ZodOptional<z.ZodObject<{
|
|
39
|
+
mode: z.ZodString;
|
|
40
|
+
version: z.ZodOptional<z.ZodNumber>;
|
|
41
|
+
contract_id: z.ZodOptional<z.ZodString>;
|
|
42
|
+
}, z.core.$strip>>;
|
|
36
43
|
resource_id: z.ZodString;
|
|
37
44
|
qurl_site: z.ZodOptional<z.ZodString>;
|
|
38
45
|
target_url: z.ZodOptional<z.ZodString>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-qurl.d.ts","sourceRoot":"","sources":["../../src/tools/update-qurl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAwC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"update-qurl.d.ts","sourceRoot":"","sources":["../../src/tools/update-qurl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAwC,MAAM,cAAc,CAAC;AAEtF,OAAO,EAKL,KAAK,kBAAkB,EACxB,MAAM,cAAc,CAAC;AAetB,eAAO,MAAM,oBAAoB;;;;;;;;iBAqC/B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;iBA6B1B,CAAC;AAEJ,wBAAgB,cAAc,CAC5B,MAAM,EAAE,WAAW,EACnB,QAAQ,GAAE,kBAAsC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6CjD"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { durationSchema, MAX_EXPIRY_MS, MIN_EXPIRY_MS } from "./duration.js";
|
|
2
3
|
import { resourceIdSchema, toStructuredContent, withMissingApiKeyHandler, zodErrorToToolResult, } from "./_shared.js";
|
|
3
4
|
import { updateQurlOutputSchema } from "./output-schemas.js";
|
|
4
5
|
// Tags must match the API constraints: 1-50 chars, start with alphanumeric,
|
|
@@ -11,11 +12,9 @@ const tagSchema = z
|
|
|
11
12
|
.regex(/^[a-zA-Z0-9][a-zA-Z0-9 _-]*$/, "Tag must start with alphanumeric and contain only letters, numbers, spaces, underscores, or hyphens");
|
|
12
13
|
export const updateQurlBaseSchema = z.object({
|
|
13
14
|
resource_id: resourceIdSchema("update"),
|
|
14
|
-
extend_by:
|
|
15
|
-
.string()
|
|
16
|
-
.min(1)
|
|
15
|
+
extend_by: durationSchema(MIN_EXPIRY_MS, MAX_EXPIRY_MS, "1m to 30d")
|
|
17
16
|
.optional()
|
|
18
|
-
.describe('Duration to extend by (e.g., "24h", "7d"). Mutually exclusive with expires_at.'),
|
|
17
|
+
.describe('Duration to extend by (e.g., "24h", "7d"; 1m to 30d per call; use expires_at for longer). Mutually exclusive with expires_at.'),
|
|
19
18
|
expires_at: z
|
|
20
19
|
.string()
|
|
21
20
|
.datetime({ offset: true })
|
|
@@ -71,13 +70,13 @@ export function updateQurlTool(client, _runtime = { mode: "stdio" }) {
|
|
|
71
70
|
return {
|
|
72
71
|
name: "update_qurl",
|
|
73
72
|
title: "Update qURL",
|
|
74
|
-
description: "Update a qURL's expiration, tags, description, custom domain, or proxy host-header behavior.
|
|
73
|
+
description: "Update a qURL resource's expiration ceiling, tags, description, custom domain, or proxy host-header behavior. " +
|
|
74
|
+
"`extend_by`/`expires_at` here move the resource's own expiry, which does not keep an individual link open longer; use `extend_qurl` or `update_qurl_token` to change a link's expiry. " +
|
|
75
75
|
"Accepts resource public keys, CRIDs, legacy `r_` IDs, and `q_` display IDs for expiration, tags, and description updates (q_ is auto-resolved); custom domain and preserve_host updates require a resource identifier (public key, CRID, or legacy `r_` ID) because the qURL API now serves them from `PATCH /v1/resources/{id}`. " +
|
|
76
76
|
"**Constraints:** `extend_by` and `expires_at` are mutually exclusive; `custom_domain`/`preserve_host` cannot be combined with expiration changes in one call; at least one update field (`extend_by`, `expires_at`, `tags`, `description`, `custom_domain`, `preserve_host`) must be set. " +
|
|
77
77
|
'**Clearing fields:** pass `description: ""`, `tags: []`, or `custom_domain: ""` to clear those fields explicitly. ' +
|
|
78
|
-
"Use `extend_qurl` when the only change is a relative time push. " +
|
|
79
78
|
"Use `delete_qurl` when you want to revoke entirely. " +
|
|
80
|
-
"**Errors:** if the input fails schema refinements (both extend_by + expires_at, or no fields set), the handler returns an `isError: true` content block before any API call. Other API errors throw with the API's `code`/`statusCode`. " +
|
|
79
|
+
"**Errors:** a malformed or out-of-range `extend_by` is rejected by input validation; if the input fails schema refinements (both extend_by + expires_at, or no fields set), the handler returns an `isError: true` content block. Both happen before any API call. Other API errors throw with the API's `code`/`statusCode`. " +
|
|
81
80
|
"Returns the updated resource (same shape as `get_qurl`).",
|
|
82
81
|
// Base shape for MCP tool registration; refinements run in the handler
|
|
83
82
|
inputSchema: updateQurlBaseSchema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-qurl.js","sourceRoot":"","sources":["../../src/tools/update-qurl.ts"],"names":[],"mappings":"AAAA,OAAO,EAA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AW,GAAG,IAAI,CAAC,WAAW,CAAC;IACxE,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,uBAAuB,CAAC,IAAsB;IACrD,MAAM,IAAI,GAAwB,EAAE,CAAC;IACrC,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS;QAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;IACnD,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS;QAAE,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;IACxE,IAAI,IAAI,CAAC,aAAa,KAAK,SAAS;QAAE,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;IAC9E,IAAI,IAAI,CAAC,aAAa,KAAK,SAAS;QAAE,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;IAC9E,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -21,21 +21,9 @@ export declare function createUploadFileDataQurlSchema(maxBase64Characters?: num
|
|
|
21
21
|
label: z.ZodOptional<z.ZodString>;
|
|
22
22
|
expires_in: z.ZodOptional<z.ZodString>;
|
|
23
23
|
one_time_use: z.ZodOptional<z.ZodBoolean>;
|
|
24
|
-
max_sessions: z.ZodOptional<z.ZodNumber>;
|
|
25
24
|
session_duration: z.ZodOptional<z.ZodString>;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
ip_denylist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
29
|
-
geo_allowlist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
30
|
-
geo_denylist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
31
|
-
user_agent_allow_regex: z.ZodOptional<z.ZodString>;
|
|
32
|
-
user_agent_deny_regex: z.ZodOptional<z.ZodString>;
|
|
33
|
-
ai_agent_policy: z.ZodOptional<z.ZodObject<{
|
|
34
|
-
block_all: z.ZodOptional<z.ZodBoolean>;
|
|
35
|
-
deny_categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
36
|
-
allow_categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
37
|
-
}, z.core.$strip>>;
|
|
38
|
-
}, z.core.$strip>>;
|
|
25
|
+
max_sessions: z.ZodOptional<z.ZodNull>;
|
|
26
|
+
access_policy: z.ZodOptional<z.ZodNull>;
|
|
39
27
|
}, z.core.$strip>;
|
|
40
28
|
export declare const uploadFileDataQurlSchema: z.ZodObject<{
|
|
41
29
|
file_base64: z.ZodString;
|
|
@@ -55,23 +43,11 @@ export declare const uploadFileDataQurlSchema: z.ZodObject<{
|
|
|
55
43
|
label: z.ZodOptional<z.ZodString>;
|
|
56
44
|
expires_in: z.ZodOptional<z.ZodString>;
|
|
57
45
|
one_time_use: z.ZodOptional<z.ZodBoolean>;
|
|
58
|
-
max_sessions: z.ZodOptional<z.ZodNumber>;
|
|
59
46
|
session_duration: z.ZodOptional<z.ZodString>;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
ip_denylist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
63
|
-
geo_allowlist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
64
|
-
geo_denylist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
65
|
-
user_agent_allow_regex: z.ZodOptional<z.ZodString>;
|
|
66
|
-
user_agent_deny_regex: z.ZodOptional<z.ZodString>;
|
|
67
|
-
ai_agent_policy: z.ZodOptional<z.ZodObject<{
|
|
68
|
-
block_all: z.ZodOptional<z.ZodBoolean>;
|
|
69
|
-
deny_categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
70
|
-
allow_categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
71
|
-
}, z.core.$strip>>;
|
|
72
|
-
}, z.core.$strip>>;
|
|
47
|
+
max_sessions: z.ZodOptional<z.ZodNull>;
|
|
48
|
+
access_policy: z.ZodOptional<z.ZodNull>;
|
|
73
49
|
}, z.core.$strip>;
|
|
74
|
-
export declare function uploadFileDataQurlTool(
|
|
50
|
+
export declare function uploadFileDataQurlTool(_client: IQURLClient, runtime: ToolRuntimeOptions): {
|
|
75
51
|
name: string;
|
|
76
52
|
title: string;
|
|
77
53
|
description: string;
|
|
@@ -93,33 +69,25 @@ export declare function uploadFileDataQurlTool(client: IQURLClient, runtime: Too
|
|
|
93
69
|
label: z.ZodOptional<z.ZodString>;
|
|
94
70
|
expires_in: z.ZodOptional<z.ZodString>;
|
|
95
71
|
one_time_use: z.ZodOptional<z.ZodBoolean>;
|
|
96
|
-
max_sessions: z.ZodOptional<z.ZodNumber>;
|
|
97
72
|
session_duration: z.ZodOptional<z.ZodString>;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
ip_denylist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
101
|
-
geo_allowlist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
102
|
-
geo_denylist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
103
|
-
user_agent_allow_regex: z.ZodOptional<z.ZodString>;
|
|
104
|
-
user_agent_deny_regex: z.ZodOptional<z.ZodString>;
|
|
105
|
-
ai_agent_policy: z.ZodOptional<z.ZodObject<{
|
|
106
|
-
block_all: z.ZodOptional<z.ZodBoolean>;
|
|
107
|
-
deny_categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
108
|
-
allow_categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
109
|
-
}, z.core.$strip>>;
|
|
110
|
-
}, z.core.$strip>>;
|
|
73
|
+
max_sessions: z.ZodOptional<z.ZodNull>;
|
|
74
|
+
access_policy: z.ZodOptional<z.ZodNull>;
|
|
111
75
|
}, z.core.$strip>;
|
|
112
76
|
outputSchema: z.ZodObject<{
|
|
113
77
|
resource_id: z.ZodString;
|
|
114
|
-
qurl_id: z.ZodString
|
|
78
|
+
qurl_id: z.ZodOptional<z.ZodString>;
|
|
115
79
|
qurl_link: z.ZodString;
|
|
116
|
-
qurl_site: z.ZodOptional<z.ZodString>;
|
|
117
80
|
expires_at: z.ZodOptional<z.ZodString>;
|
|
81
|
+
requested_expires_at: z.ZodOptional<z.ZodString>;
|
|
82
|
+
expires_at_differs_from_request: z.ZodOptional<z.ZodBoolean>;
|
|
83
|
+
expires_at_later_than_requested: z.ZodOptional<z.ZodBoolean>;
|
|
84
|
+
expires_at_already_past: z.ZodOptional<z.ZodBoolean>;
|
|
85
|
+
expires_at_unconfirmed: z.ZodOptional<z.ZodBoolean>;
|
|
86
|
+
unexpected_extra_link_count: z.ZodOptional<z.ZodNumber>;
|
|
87
|
+
unexpected_extra_qurl_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
118
88
|
file_name: z.ZodString;
|
|
119
89
|
content_type: z.ZodString;
|
|
120
90
|
size_bytes: z.ZodNumber;
|
|
121
|
-
branded_domain: z.ZodOptional<z.ZodString>;
|
|
122
|
-
type: z.ZodOptional<z.ZodString>;
|
|
123
91
|
email_delivery: z.ZodOptional<z.ZodObject<{
|
|
124
92
|
attempted: z.ZodBoolean;
|
|
125
93
|
enabled: z.ZodBoolean;
|
|
@@ -155,21 +123,9 @@ export declare function uploadFileDataQurlTool(client: IQURLClient, runtime: Too
|
|
|
155
123
|
label?: string | undefined;
|
|
156
124
|
expires_in?: string | undefined;
|
|
157
125
|
one_time_use?: boolean | undefined;
|
|
158
|
-
max_sessions?: number | undefined;
|
|
159
126
|
session_duration?: string | undefined;
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
ip_denylist?: string[] | undefined;
|
|
163
|
-
geo_allowlist?: string[] | undefined;
|
|
164
|
-
geo_denylist?: string[] | undefined;
|
|
165
|
-
user_agent_allow_regex?: string | undefined;
|
|
166
|
-
user_agent_deny_regex?: string | undefined;
|
|
167
|
-
ai_agent_policy?: {
|
|
168
|
-
block_all?: boolean | undefined;
|
|
169
|
-
deny_categories?: string[] | undefined;
|
|
170
|
-
allow_categories?: string[] | undefined;
|
|
171
|
-
} | undefined;
|
|
172
|
-
} | undefined;
|
|
127
|
+
max_sessions?: null | undefined;
|
|
128
|
+
access_policy?: null | undefined;
|
|
173
129
|
}) => Promise<{
|
|
174
130
|
content: Array<{
|
|
175
131
|
type: "text";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-file-data-qurl.d.ts","sourceRoot":"","sources":["../../src/tools/upload-file-data-qurl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"upload-file-data-qurl.d.ts","sourceRoot":"","sources":["../../src/tools/upload-file-data-qurl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,cAAc,CAAC;AAkCtB,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED,eAAO,MAAM,iCAAiC,QAE7C,CAAC;AAEF,wBAAgB,8BAA8B,CAC5C,mBAAmB,SAAoC;;;;;;;;;;;;;;;;;;;;;kBA8BxD;AAED,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;iBAAmC,CAAC;AA2HzE,wBAAgB,sBAAsB,CAEpC,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoF5B"}
|
|
@@ -5,7 +5,7 @@ import { allowsServerApiKeyFallback, withMissingApiKeyHandler, } from "./_shared
|
|
|
5
5
|
import { emailDeliveryInputSchema, maybeDeliverToolEmail, toEmailAugmentedResult, uploadEmailDetailLines, } from "./email-delivery.js";
|
|
6
6
|
import { getConnectorConfig, getMaxUploadFileBytes, mintUploadedFile, normalizeFileName, supportedMimeTypes, uploadToConnector, validateFileNameContentType, validateFileSignature, } from "./upload-file-shared.js";
|
|
7
7
|
import { uploadFileQurlOutputSchema } from "./output-schemas.js";
|
|
8
|
-
import { uploadMintOptionsShape } from "./upload-mint-options.js";
|
|
8
|
+
import { uploadMintOptionsShape, uploadMintOptionsSchema, UPLOAD_LINK_DESCRIPTION, UPLOAD_RETURNS_DESCRIPTION, } from "./upload-mint-options.js";
|
|
9
9
|
// Uploads pass three deliberate bounds: a runtime-derived raw-string schema
|
|
10
10
|
// ceiling, the HTTP JSON-body limit before tool dispatch, and
|
|
11
11
|
// getMaxUploadFileBytes on the normalized decoded payload. The exported schema
|
|
@@ -139,7 +139,9 @@ function decodeBase64File(input, maxBytes, contentType) {
|
|
|
139
139
|
validateFileSignature(fileData, contentType);
|
|
140
140
|
return fileData;
|
|
141
141
|
}
|
|
142
|
-
export function uploadFileDataQurlTool(
|
|
142
|
+
export function uploadFileDataQurlTool(
|
|
143
|
+
// Unused since links are minted by the connector; kept for the shared tool factory signature.
|
|
144
|
+
_client, runtime) {
|
|
143
145
|
const inputSchema = createUploadFileDataQurlSchema(runtime.maxUploadFileDataBytes === undefined
|
|
144
146
|
? MAX_UPLOAD_FILE_BASE64_CHARACTERS
|
|
145
147
|
: maxBase64CharactersForBytes(runtime.maxUploadFileDataBytes));
|
|
@@ -149,14 +151,15 @@ export function uploadFileDataQurlTool(client, runtime) {
|
|
|
149
151
|
description: "Upload base64-encoded PDF or raster image content to a qURL connector, then mint an access link for it. " +
|
|
150
152
|
"This is the correct tool for a single in-chat image, PDF, or file attachment in either MCP transport, especially when the user wants 'the qURL of this image/file' or wants the generated link emailed. " +
|
|
151
153
|
"Use this when you have the file data available but cannot provide a server-local file path. " +
|
|
152
|
-
"Use `upload_file_qurl` when the file already exists on the MCP server host, use `create_qurl` when you already have a URL
|
|
154
|
+
"Use `upload_file_qurl` when the file already exists on the MCP server host, use `create_qurl` when you already have a URL. Each call uploads the file again and returns one new link; `mint_link` cannot re-link an uploaded file. " +
|
|
153
155
|
"For compressible images, compress them before converting to base64 so the request is smaller and more reliable. " +
|
|
154
|
-
"When the server upload limit is configured above 10 MB, a fresh HTTP session must complete a smaller qURL API call before its first larger upload. " +
|
|
155
|
-
"The tool decodes `file_base64`, uploads the file to `${QURL_CONNECTOR_URL}/api/upload`, then mints
|
|
156
|
+
"When the server upload limit is configured above 10 MB, a fresh HTTP session must complete a smaller qURL API call (e.g. `list_qurls`) before its first larger upload; a smaller completed upload also counts. " +
|
|
157
|
+
"The tool decodes `file_base64`, uploads the file to `${QURL_CONNECTOR_URL}/api/upload`, then mints the link through `${QURL_CONNECTOR_URL}/api/mint_link/:resource_id`. " +
|
|
158
|
+
UPLOAD_LINK_DESCRIPTION +
|
|
156
159
|
"Supported MIME types are application/pdf, image/png, image/jpeg, image/webp, and image/gif. " +
|
|
157
160
|
"If `one_time_use` is omitted, the tool defaults it to `true` for safer file distribution. " +
|
|
158
161
|
"Requires `QURL_CONNECTOR_URL`; stdio reads `QURL_API_KEY` from server config, while HTTP uses the caller's bearer credential. " +
|
|
159
|
-
|
|
162
|
+
UPLOAD_RETURNS_DESCRIPTION,
|
|
160
163
|
inputSchema,
|
|
161
164
|
outputSchema: uploadFileQurlOutputSchema,
|
|
162
165
|
annotations: {
|
|
@@ -167,6 +170,7 @@ export function uploadFileDataQurlTool(client, runtime) {
|
|
|
167
170
|
openWorldHint: true,
|
|
168
171
|
},
|
|
169
172
|
handler: withMissingApiKeyHandler(async (input) => {
|
|
173
|
+
uploadMintOptionsSchema.parse(input);
|
|
170
174
|
const allowServerApiKeyFallback = allowsServerApiKeyFallback(runtime);
|
|
171
175
|
// Preflight connector config before decoding payloads so auth/config errors fail fast.
|
|
172
176
|
const connectorConfig = getConnectorConfig(allowServerApiKeyFallback);
|
|
@@ -174,11 +178,15 @@ export function uploadFileDataQurlTool(client, runtime) {
|
|
|
174
178
|
validateFileNameContentType(fileName, input.content_type);
|
|
175
179
|
const fileData = decodeBase64File(input.file_base64, getMaxUploadFileBytes(), input.content_type);
|
|
176
180
|
const upload = await uploadToConnector(fileData, fileName, input.content_type, connectorConfig);
|
|
177
|
-
const result = await mintUploadedFile(
|
|
181
|
+
const result = await mintUploadedFile(connectorConfig, upload.resource_id, {
|
|
178
182
|
name: fileName,
|
|
179
183
|
contentType: input.content_type,
|
|
180
184
|
sizeBytes: fileData.byteLength,
|
|
181
|
-
},
|
|
185
|
+
}, {
|
|
186
|
+
expires_in: input.expires_in,
|
|
187
|
+
one_time_use: input.one_time_use,
|
|
188
|
+
session_duration: input.session_duration,
|
|
189
|
+
});
|
|
182
190
|
const emailResult = await maybeDeliverToolEmail({
|
|
183
191
|
allowServerApiKeyFallback,
|
|
184
192
|
delivery: input.email_delivery,
|
|
@@ -189,7 +197,6 @@ export function uploadFileDataQurlTool(client, runtime) {
|
|
|
189
197
|
contentType: input.content_type,
|
|
190
198
|
qurlLink: result.qurl_link,
|
|
191
199
|
expiresAt: result.expires_at,
|
|
192
|
-
qurlSite: result.qurl_site,
|
|
193
200
|
label: input.label,
|
|
194
201
|
}),
|
|
195
202
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-file-data-qurl.js","sourceRoot":"","sources":["../../src/tools/upload-file-data-qurl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,GAEzB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,2BAA2B,EAC3B,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,
|
|
1
|
+
{"version":3,"file":"upload-file-data-qurl.js","sourceRoot":"","sources":["../../src/tools/upload-file-data-qurl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,GAEzB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,2BAA2B,EAC3B,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,0BAA0B,CAAC;AAElC,4EAA4E;AAC5E,8DAA8D;AAC9D,+EAA+E;AAC/E,8EAA8E;AAC9E,gFAAgF;AAChF,gFAAgF;AAChF,+DAA+D;AAC/D,MAAM,8BAA8B,GAAG,IAAI,CAAC;AAE5C,MAAM,UAAU,2BAA2B,CAAC,QAAgB;IAC1D,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,8BAA8B,CAAC;AACxE,CAAC;AAED,MAAM,CAAC,MAAM,iCAAiC,GAAG,2BAA2B,CA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AQ;oBACR,WAAW,EAAE,KAAK,CAAC,YAAY;oBAC/B,QAAQ,EAAE,MAAM,CAAC,SAAS;oBAC1B,SAAS,EAAE,MAAM,CAAC,UAAU;oBAC5B,KAAK,EAAE,KAAK,CAAC,KAAK;iBACnB,CAAC;aACH,CAAC,CAAC;YACH,OAAO,sBAAsB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QACrD,CAAC,CAAC;KACH,CAAC;AACJ,CAAC"}
|
|
@@ -21,37 +21,29 @@ export declare const uploadFileQurlSchema: z.ZodObject<{
|
|
|
21
21
|
label: z.ZodOptional<z.ZodString>;
|
|
22
22
|
expires_in: z.ZodOptional<z.ZodString>;
|
|
23
23
|
one_time_use: z.ZodOptional<z.ZodBoolean>;
|
|
24
|
-
max_sessions: z.ZodOptional<z.ZodNumber>;
|
|
25
24
|
session_duration: z.ZodOptional<z.ZodString>;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
ip_denylist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
29
|
-
geo_allowlist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
30
|
-
geo_denylist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
31
|
-
user_agent_allow_regex: z.ZodOptional<z.ZodString>;
|
|
32
|
-
user_agent_deny_regex: z.ZodOptional<z.ZodString>;
|
|
33
|
-
ai_agent_policy: z.ZodOptional<z.ZodObject<{
|
|
34
|
-
block_all: z.ZodOptional<z.ZodBoolean>;
|
|
35
|
-
deny_categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
36
|
-
allow_categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
37
|
-
}, z.core.$strip>>;
|
|
38
|
-
}, z.core.$strip>>;
|
|
25
|
+
max_sessions: z.ZodOptional<z.ZodNull>;
|
|
26
|
+
access_policy: z.ZodOptional<z.ZodNull>;
|
|
39
27
|
}, z.core.$strip>;
|
|
40
28
|
export type UploadFileQurlInput = z.infer<typeof uploadFileQurlSchema>;
|
|
41
29
|
export declare function readFileWithinLimit(fileHandle: FileHandle, maxBytes: number, initialSize: number): Promise<Uint8Array>;
|
|
42
|
-
export declare function uploadGeneratedFileAndMint(
|
|
43
|
-
resource_id: string;
|
|
44
|
-
qurl_id: string;
|
|
45
|
-
qurl_link: string;
|
|
46
|
-
qurl_site: string | undefined;
|
|
47
|
-
expires_at: string;
|
|
30
|
+
export declare function uploadGeneratedFileAndMint(input: UploadFileQurlInput, connectorConfig: ConnectorConfig): Promise<{
|
|
48
31
|
file_name: string;
|
|
49
32
|
content_type: string;
|
|
50
33
|
size_bytes: number;
|
|
51
|
-
|
|
52
|
-
|
|
34
|
+
unexpected_extra_qurl_ids?: string[] | undefined;
|
|
35
|
+
unexpected_extra_link_count?: number | undefined;
|
|
36
|
+
expires_at_unconfirmed?: boolean | undefined;
|
|
37
|
+
expires_at_already_past?: boolean | undefined;
|
|
38
|
+
expires_at_later_than_requested?: boolean | undefined;
|
|
39
|
+
expires_at_differs_from_request?: boolean | undefined;
|
|
40
|
+
requested_expires_at: string;
|
|
41
|
+
expires_at?: string | undefined;
|
|
42
|
+
qurl_link: string;
|
|
43
|
+
qurl_id?: string | undefined;
|
|
44
|
+
resource_id: string;
|
|
53
45
|
}>;
|
|
54
|
-
export declare function uploadFileQurlTool(
|
|
46
|
+
export declare function uploadFileQurlTool(_client: IQURLClient, runtime: ToolRuntimeOptions): {
|
|
55
47
|
name: string;
|
|
56
48
|
title: string;
|
|
57
49
|
description: string;
|
|
@@ -73,33 +65,25 @@ export declare function uploadFileQurlTool(client: IQURLClient, runtime: ToolRun
|
|
|
73
65
|
label: z.ZodOptional<z.ZodString>;
|
|
74
66
|
expires_in: z.ZodOptional<z.ZodString>;
|
|
75
67
|
one_time_use: z.ZodOptional<z.ZodBoolean>;
|
|
76
|
-
max_sessions: z.ZodOptional<z.ZodNumber>;
|
|
77
68
|
session_duration: z.ZodOptional<z.ZodString>;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
ip_denylist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
81
|
-
geo_allowlist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
82
|
-
geo_denylist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
83
|
-
user_agent_allow_regex: z.ZodOptional<z.ZodString>;
|
|
84
|
-
user_agent_deny_regex: z.ZodOptional<z.ZodString>;
|
|
85
|
-
ai_agent_policy: z.ZodOptional<z.ZodObject<{
|
|
86
|
-
block_all: z.ZodOptional<z.ZodBoolean>;
|
|
87
|
-
deny_categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
88
|
-
allow_categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
89
|
-
}, z.core.$strip>>;
|
|
90
|
-
}, z.core.$strip>>;
|
|
69
|
+
max_sessions: z.ZodOptional<z.ZodNull>;
|
|
70
|
+
access_policy: z.ZodOptional<z.ZodNull>;
|
|
91
71
|
}, z.core.$strip>;
|
|
92
72
|
outputSchema: z.ZodObject<{
|
|
93
73
|
resource_id: z.ZodString;
|
|
94
|
-
qurl_id: z.ZodString
|
|
74
|
+
qurl_id: z.ZodOptional<z.ZodString>;
|
|
95
75
|
qurl_link: z.ZodString;
|
|
96
|
-
qurl_site: z.ZodOptional<z.ZodString>;
|
|
97
76
|
expires_at: z.ZodOptional<z.ZodString>;
|
|
77
|
+
requested_expires_at: z.ZodOptional<z.ZodString>;
|
|
78
|
+
expires_at_differs_from_request: z.ZodOptional<z.ZodBoolean>;
|
|
79
|
+
expires_at_later_than_requested: z.ZodOptional<z.ZodBoolean>;
|
|
80
|
+
expires_at_already_past: z.ZodOptional<z.ZodBoolean>;
|
|
81
|
+
expires_at_unconfirmed: z.ZodOptional<z.ZodBoolean>;
|
|
82
|
+
unexpected_extra_link_count: z.ZodOptional<z.ZodNumber>;
|
|
83
|
+
unexpected_extra_qurl_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
98
84
|
file_name: z.ZodString;
|
|
99
85
|
content_type: z.ZodString;
|
|
100
86
|
size_bytes: z.ZodNumber;
|
|
101
|
-
branded_domain: z.ZodOptional<z.ZodString>;
|
|
102
|
-
type: z.ZodOptional<z.ZodString>;
|
|
103
87
|
email_delivery: z.ZodOptional<z.ZodObject<{
|
|
104
88
|
attempted: z.ZodBoolean;
|
|
105
89
|
enabled: z.ZodBoolean;
|
|
@@ -135,21 +119,9 @@ export declare function uploadFileQurlTool(client: IQURLClient, runtime: ToolRun
|
|
|
135
119
|
label?: string | undefined;
|
|
136
120
|
expires_in?: string | undefined;
|
|
137
121
|
one_time_use?: boolean | undefined;
|
|
138
|
-
max_sessions?: number | undefined;
|
|
139
122
|
session_duration?: string | undefined;
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
ip_denylist?: string[] | undefined;
|
|
143
|
-
geo_allowlist?: string[] | undefined;
|
|
144
|
-
geo_denylist?: string[] | undefined;
|
|
145
|
-
user_agent_allow_regex?: string | undefined;
|
|
146
|
-
user_agent_deny_regex?: string | undefined;
|
|
147
|
-
ai_agent_policy?: {
|
|
148
|
-
block_all?: boolean | undefined;
|
|
149
|
-
deny_categories?: string[] | undefined;
|
|
150
|
-
allow_categories?: string[] | undefined;
|
|
151
|
-
} | undefined;
|
|
152
|
-
} | undefined;
|
|
123
|
+
max_sessions?: null | undefined;
|
|
124
|
+
access_policy?: null | undefined;
|
|
153
125
|
}) => Promise<{
|
|
154
126
|
content: Array<{
|
|
155
127
|
type: "text";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-file-qurl.d.ts","sourceRoot":"","sources":["../../src/tools/upload-file-qurl.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"upload-file-qurl.d.ts","sourceRoot":"","sources":["../../src/tools/upload-file-qurl.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,cAAc,CAAC;AAatB,OAAO,EAUL,KAAK,eAAe,EACrB,MAAM,yBAAyB,CAAC;AAGjC,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;iBAyBA,CAAC;AAElC,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEvE,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,UAAU,CAAC,CAkCrB;AA2DD,wBAAsB,0BAA0B,CAC9C,KAAK,EAAE,mBAAmB,EAC1B,eAAe,EAAE,eAAe;;;;;;;;;;;;;;;GAgBjC;AAED,wBAAgB,kBAAkB,CAEhC,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmD5B"}
|
|
@@ -6,7 +6,7 @@ import { isAbsolute, relative, resolve, sep } from "node:path";
|
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
import { allowsServerApiKeyFallback, withMissingApiKeyHandler, } from "./_shared.js";
|
|
8
8
|
import { emailDeliveryInputSchema, maybeDeliverToolEmail, toEmailAugmentedResult, uploadEmailDetailLines, } from "./email-delivery.js";
|
|
9
|
-
import { uploadMintOptionsShape } from "./upload-mint-options.js";
|
|
9
|
+
import { uploadMintOptionsShape, uploadMintOptionsSchema, UPLOAD_LINK_DESCRIPTION, UPLOAD_RETURNS_DESCRIPTION, } from "./upload-mint-options.js";
|
|
10
10
|
import { getConnectorConfig, getMaxUploadFileBytes, inferContentType, mintUploadedFile, normalizeFileName, supportedMimeTypes, uploadToConnector, validateFileNameContentType, validateFileSignature, } from "./upload-file-shared.js";
|
|
11
11
|
import { uploadFileQurlOutputSchema } from "./output-schemas.js";
|
|
12
12
|
export const uploadFileQurlSchema = z
|
|
@@ -58,8 +58,9 @@ export async function readFileWithinLimit(fileHandle, maxBytes, initialSize) {
|
|
|
58
58
|
}
|
|
59
59
|
return buffer.subarray(0, totalBytesRead);
|
|
60
60
|
}
|
|
61
|
-
async function uploadLocalFileAndMint(
|
|
62
|
-
//
|
|
61
|
+
async function uploadLocalFileAndMint(input, connectorConfig) {
|
|
62
|
+
// Direct generated-file callers also validate before reading or storing a file.
|
|
63
|
+
uploadMintOptionsSchema.parse(input);
|
|
63
64
|
const sourcePath = resolve(input.file_path);
|
|
64
65
|
// O_NOFOLLOW protects the final component. Intermediate directory symlinks
|
|
65
66
|
// still follow normal filesystem semantics; this tool is stdio-only and the
|
|
@@ -99,9 +100,13 @@ async function uploadLocalFileAndMint(client, input, connectorConfig) {
|
|
|
99
100
|
}
|
|
100
101
|
validateFileSignature(fileData, contentType);
|
|
101
102
|
const upload = await uploadToConnector(fileData, fileName, contentType, connectorConfig);
|
|
102
|
-
return mintUploadedFile(
|
|
103
|
+
return mintUploadedFile(connectorConfig, upload.resource_id, { name: fileName, contentType, sizeBytes: fileData.byteLength }, {
|
|
104
|
+
expires_in: input.expires_in,
|
|
105
|
+
one_time_use: input.one_time_use,
|
|
106
|
+
session_duration: input.session_duration,
|
|
107
|
+
});
|
|
103
108
|
}
|
|
104
|
-
export async function uploadGeneratedFileAndMint(
|
|
109
|
+
export async function uploadGeneratedFileAndMint(input, connectorConfig) {
|
|
105
110
|
const sourcePath = resolve(input.file_path);
|
|
106
111
|
const [canonicalTempPath, canonicalSourcePath] = await Promise.all([
|
|
107
112
|
realpath(tmpdir()),
|
|
@@ -113,9 +118,11 @@ export async function uploadGeneratedFileAndMint(client, input, connectorConfig)
|
|
|
113
118
|
relativeToTemp.startsWith(`..${sep}`)) {
|
|
114
119
|
throw new Error("Generated upload files must remain inside the server temporary directory.");
|
|
115
120
|
}
|
|
116
|
-
return uploadLocalFileAndMint(
|
|
121
|
+
return uploadLocalFileAndMint({ ...input, file_path: canonicalSourcePath }, connectorConfig);
|
|
117
122
|
}
|
|
118
|
-
export function uploadFileQurlTool(
|
|
123
|
+
export function uploadFileQurlTool(
|
|
124
|
+
// Unused since links are minted by the connector; kept for the shared tool factory signature.
|
|
125
|
+
_client, runtime) {
|
|
119
126
|
return {
|
|
120
127
|
name: "upload_file_qurl",
|
|
121
128
|
title: "Upload File qURL",
|
|
@@ -123,11 +130,12 @@ export function uploadFileQurlTool(client, runtime) {
|
|
|
123
130
|
"Use this when the content already exists on the MCP server host and you need a shareable file qURL rather than a proxy to an existing website URL. " +
|
|
124
131
|
"This stdio-only tool can read any supported file that the local MCP process user can access; invoke it only for a path the user explicitly chose to share. " +
|
|
125
132
|
"Deploy stdio under a restricted OS account or container whose readable files are limited to intended shareable content. " +
|
|
126
|
-
"Use `create_qurl` when you already have a URL
|
|
127
|
-
"The tool reads `file_path`, uploads the file to `${QURL_CONNECTOR_URL}/api/upload`, then mints
|
|
133
|
+
"Use `create_qurl` when you already have a URL. Each call uploads the file again and returns one new link; `mint_link` cannot re-link an uploaded file. " +
|
|
134
|
+
"The tool reads `file_path`, uploads the file to `${QURL_CONNECTOR_URL}/api/upload`, then mints the link through `${QURL_CONNECTOR_URL}/api/mint_link/:resource_id`. " +
|
|
135
|
+
UPLOAD_LINK_DESCRIPTION +
|
|
128
136
|
"If `one_time_use` is omitted, the tool defaults it to `true` for safer file distribution. " +
|
|
129
137
|
"Requires both `QURL_API_KEY` and `QURL_CONNECTOR_URL` in the server environment or runtime config. " +
|
|
130
|
-
|
|
138
|
+
UPLOAD_RETURNS_DESCRIPTION,
|
|
131
139
|
inputSchema: uploadFileQurlSchema,
|
|
132
140
|
outputSchema: uploadFileQurlOutputSchema,
|
|
133
141
|
annotations: {
|
|
@@ -145,7 +153,7 @@ export function uploadFileQurlTool(client, runtime) {
|
|
|
145
153
|
}
|
|
146
154
|
const allowServerApiKeyFallback = allowsServerApiKeyFallback(runtime);
|
|
147
155
|
const connectorConfig = getConnectorConfig(allowServerApiKeyFallback);
|
|
148
|
-
const result = await uploadLocalFileAndMint(
|
|
156
|
+
const result = await uploadLocalFileAndMint(input, connectorConfig);
|
|
149
157
|
const emailResult = await maybeDeliverToolEmail({
|
|
150
158
|
allowServerApiKeyFallback,
|
|
151
159
|
delivery: input.email_delivery,
|
|
@@ -156,7 +164,6 @@ export function uploadFileQurlTool(client, runtime) {
|
|
|
156
164
|
contentType: result.content_type,
|
|
157
165
|
qurlLink: result.qurl_link,
|
|
158
166
|
expiresAt: result.expires_at,
|
|
159
|
-
qurlSite: result.qurl_site,
|
|
160
167
|
label: input.label,
|
|
161
168
|
}),
|
|
162
169
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-file-qurl.js","sourceRoot":"","sources":["../../src/tools/upload-file-qurl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAmB,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,GAEzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAC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,KAAK,OAAO,EAAE,CAAC;gBAC7B,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;YACtE,CAAC;YACD,MAAM,yBAAyB,GAAG,0BAA0B,CAAC,OAAO,CAAC,CAAC;YACtE,MAAM,eAAe,GAAG,kBAAkB,CAAC,yBAAyB,CAAC,CAAC;YACtE,MAAM,MAAM,GAAG,MAAM,sBAAsB,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;YACpE,MAAM,WAAW,GAAG,MAAM,qBAAqB,CAAC;gBAC9C,yBAAyB;gBACzB,QAAQ,EAAE,KAAK,CAAC,cAAc;gBAC9B,cAAc,EAAE,uCAAuC;gBACvD,WAAW,EAAE,sBAAsB,CAAC;oBAClC,KAAK,EAAE,mDAAmD;oBAC1D,QAAQ,EAAE,MAAM,CAAC,SAAS;oBAC1B,WAAW,EAAE,MAAM,CAAC,YAAY;oBAChC,QAAQ,EAAE,MAAM,CAAC,SAAS;oBAC1B,SAAS,EAAE,MAAM,CAAC,UAAU;oBAC5B,KAAK,EAAE,KAAK,CAAC,KAAK;iBACnB,CAAC;aACH,CAAC,CAAC;YAEH,OAAO,sBAAsB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QACrD,CAAC,CAAC;KACH,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type UploadMintOptionsInput } from "./upload-mint-options.js";
|
|
2
|
+
export type UploadMintOptions = Pick<UploadMintOptionsInput, "expires_in" | "one_time_use" | "session_duration">;
|
|
2
3
|
export declare const supportedMimeTypes: readonly ["application/pdf", "image/gif", "image/jpeg", "image/png", "image/webp"];
|
|
3
4
|
export declare const mimeTypeByExtension: Map<string, "application/pdf" | "image/gif" | "image/jpeg" | "image/png" | "image/webp">;
|
|
4
5
|
type ConnectorUploadResponse = {
|
|
@@ -15,21 +16,37 @@ export declare function inferContentType(filePath: string): "application/pdf" |
|
|
|
15
16
|
export declare function getMaxUploadFileBytes(): number;
|
|
16
17
|
export declare function validateFileNameContentType(fileName: string, contentType: string): void;
|
|
17
18
|
export declare function validateFileSignature(fileData: Uint8Array, contentType: string): void;
|
|
18
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Contract: qurl-s3-connector internal/handler/handler.go MintLink (route in
|
|
21
|
+
* main.go's uploader mode) takes { n, one_time_use, expires_at, session_duration }
|
|
22
|
+
* and passes one_time_use and session_duration to qurl-service's mint in both
|
|
23
|
+
* legacy and render-at-mint modes. Drift is tracked with #282.
|
|
24
|
+
*
|
|
25
|
+
* Mint the recipient link through the connector's `/api/mint_link`, the only
|
|
26
|
+
* link the connector serves for an upload. The upload resource's own target is
|
|
27
|
+
* not a viewable page in the connector's tunnel mode (its per-upload qURL is
|
|
28
|
+
* never shared there), so minting on it with qurl-service yields a link that
|
|
29
|
+
* opens to a 404.
|
|
30
|
+
*/
|
|
31
|
+
export declare function mintUploadedFile(connectorConfig: ConnectorConfig, resourceId: string, file: {
|
|
19
32
|
name: string;
|
|
20
33
|
contentType: string;
|
|
21
34
|
sizeBytes: number;
|
|
22
|
-
}, input:
|
|
23
|
-
resource_id: string;
|
|
24
|
-
qurl_id: string;
|
|
25
|
-
qurl_link: string;
|
|
26
|
-
qurl_site: string | undefined;
|
|
27
|
-
expires_at: string;
|
|
35
|
+
}, input: UploadMintOptions): Promise<{
|
|
28
36
|
file_name: string;
|
|
29
37
|
content_type: string;
|
|
30
38
|
size_bytes: number;
|
|
31
|
-
|
|
32
|
-
|
|
39
|
+
unexpected_extra_qurl_ids?: string[] | undefined;
|
|
40
|
+
unexpected_extra_link_count?: number | undefined;
|
|
41
|
+
expires_at_unconfirmed?: boolean | undefined;
|
|
42
|
+
expires_at_already_past?: boolean | undefined;
|
|
43
|
+
expires_at_later_than_requested?: boolean | undefined;
|
|
44
|
+
expires_at_differs_from_request?: boolean | undefined;
|
|
45
|
+
requested_expires_at: string;
|
|
46
|
+
expires_at?: string | undefined;
|
|
47
|
+
qurl_link: string;
|
|
48
|
+
qurl_id?: string | undefined;
|
|
49
|
+
resource_id: string;
|
|
33
50
|
}>;
|
|
34
51
|
export declare function uploadToConnector(fileData: Uint8Array, fileName: string, contentType: string, connectorConfig: ConnectorConfig): Promise<ConnectorUploadResponse>;
|
|
35
52
|
export {};
|