@sendsafely/mcp-server-local 0.0.0-stage → 1.0.5
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/LICENSE +201 -0
- package/NOTICE +22 -0
- package/README.md +390 -2
- package/dist/context.d.ts +2 -0
- package/dist/context.js +21 -0
- package/dist/credentials.d.ts +7 -0
- package/dist/credentials.js +59 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +47 -0
- package/dist/setupCredentials.d.ts +2 -0
- package/dist/setupCredentials.js +151 -0
- package/dist/trustedDeviceKeyStore.d.ts +3 -0
- package/dist/trustedDeviceKeyStore.js +34 -0
- package/node_modules/@sendsafely/mcp-tools-core/LICENSE +201 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/approval.d.ts +51 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/approval.js +148 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/constants.d.ts +5 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/constants.js +8 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/context.d.ts +25 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/context.js +16 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/index.d.ts +18 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/index.js +17 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/instructions.d.ts +1 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/instructions.js +17 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/jsonResult.d.ts +3 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/jsonResult.js +15 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/recipientAddContext.d.ts +42 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/recipientAddContext.js +182 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/runTool.d.ts +2 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/runTool.js +22 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/safeHandler.d.ts +17 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/safeHandler.js +32 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/sdk/clientFactory.d.ts +17 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/sdk/clientFactory.js +29 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/sdk/oauthError.d.ts +9 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/sdk/oauthError.js +34 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/sdk/sdkPromise.d.ts +53 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/sdk/sdkPromise.js +462 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/sdk/signedFetch.d.ts +6 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/sdk/signedFetch.js +28 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/store/keyStore.d.ts +6 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/store/keyStore.js +1 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/store/packageSecretCache.d.ts +18 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/store/packageSecretCache.js +39 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/createDirectory.d.ts +9 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/createDirectory.js +53 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/deleteDirectory.d.ts +10 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/deleteDirectory.js +46 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/deleteFile.d.ts +11 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/deleteFile.js +53 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/getActivityLog.d.ts +8 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/getActivityLog.js +44 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/getDirectory.d.ts +12 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/getDirectory.js +51 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/getEnterpriseInfo.d.ts +5 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/getEnterpriseInfo.js +27 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/getFileInformation.d.ts +9 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/getFileInformation.js +34 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/getPackageInformation.d.ts +7 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/getPackageInformation.js +41 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/getReceivedPackages.d.ts +5 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/getReceivedPackages.js +54 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/getRecipient.d.ts +8 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/getRecipient.js +30 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/getSentPackages.d.ts +7 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/getSentPackages.js +84 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/getWorkspaces.d.ts +5 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/getWorkspaces.js +114 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/index.d.ts +46 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/index.js +92 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/moveDirectory.d.ts +9 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/moveDirectory.js +39 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/removeRecipient.d.ts +8 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/removeRecipient.js +34 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/renameDirectory.d.ts +9 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/renameDirectory.js +34 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/setRecipientPhoneNumber.d.ts +10 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/setRecipientPhoneNumber.js +40 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/addPackageMessage.d.ts +9 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/addPackageMessage.js +37 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/addRecipient.d.ts +9 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/addRecipient.js +109 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/addRecipientWithSms.d.ts +11 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/addRecipientWithSms.js +115 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/addRecipientsBulk.d.ts +9 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/addRecipientsBulk.js +110 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/createPackage.d.ts +6 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/createPackage.js +65 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/createWorkspace.d.ts +10 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/createWorkspace.js +107 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/deletePackage.d.ts +10 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/deletePackage.js +39 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/downloadFileFromDirectory.d.ts +12 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/downloadFileFromDirectory.js +91 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/downloadPackageFiles.d.ts +12 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/downloadPackageFiles.js +205 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/finalizePackage.d.ts +9 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/finalizePackage.js +111 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/finalizeUndisclosedPackage.d.ts +9 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/finalizeUndisclosedPackage.js +57 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/generateTrustedDeviceKeypair.d.ts +10 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/generateTrustedDeviceKeypair.js +75 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/getPackageInformationFromLink.d.ts +8 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/getPackageInformationFromLink.js +50 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/getPackageKeycode.d.ts +11 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/getPackageKeycode.js +120 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/getPackageMessage.d.ts +9 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/getPackageMessage.js +59 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/listDownloadedFiles.d.ts +5 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/listDownloadedFiles.js +71 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/readDownloadedFile.d.ts +8 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/readDownloadedFile.js +176 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/uploadFile.d.ts +12 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/uploadFile.js +69 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/updateFile.d.ts +9 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/updateFile.js +38 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/updatePackage.d.ts +14 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/updatePackage.js +122 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/updateRecipientRole.d.ts +9 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/updateRecipientRole.js +45 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/verifyCredentials.d.ts +5 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/tools/verifyCredentials.js +27 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/types/sendsafely.d.ts +432 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/utils/packageChecksum.d.ts +1 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/utils/packageChecksum.js +7 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/utils/packageDir.d.ts +8 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/utils/packageDir.js +50 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/utils/packageLink.d.ts +2 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/utils/packageLink.js +4 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/utils/sanitizeFilename.d.ts +4 -0
- package/node_modules/@sendsafely/mcp-tools-core/dist/utils/sanitizeFilename.js +8 -0
- package/node_modules/@sendsafely/mcp-tools-core/package.json +40 -0
- package/npm-shrinkwrap.json +1632 -0
- package/package.json +58 -4
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { approvalGateError, CONSENT_FALLBACK_INSTRUCTIONS, proceedWithoutPromptSchema, } from "../../approval.js";
|
|
4
|
+
import { jsonError, jsonResult } from "../../jsonResult.js";
|
|
5
|
+
import { MissingPackageSecretsError, } from "../../store/packageSecretCache.js";
|
|
6
|
+
import { runTool } from "../../runTool.js";
|
|
7
|
+
import { safeHandler } from "../../safeHandler.js";
|
|
8
|
+
import { assertSafePackageId, preparePackageDir } from "../../utils/packageDir.js";
|
|
9
|
+
import { sanitizeFilename } from "../../utils/sanitizeFilename.js";
|
|
10
|
+
import { downloadFileToPath, packageInformation, packageInformationFromLink, } from "../../sdk/sdkPromise.js";
|
|
11
|
+
export function extractKeyCode(link) {
|
|
12
|
+
const hashIdx = link.indexOf("#");
|
|
13
|
+
if (hashIdx === -1)
|
|
14
|
+
return null;
|
|
15
|
+
const params = new URLSearchParams(link.slice(hashIdx + 1));
|
|
16
|
+
for (const [key, value] of params) {
|
|
17
|
+
if (key.toLowerCase() === "keycode")
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
export async function handleDownloadPackageFiles(args, extra, ctx, cacheFor) {
|
|
23
|
+
return runTool("download_package_files", "Failed to download package", async () => {
|
|
24
|
+
const client = await ctx.getClient(extra);
|
|
25
|
+
let resolved;
|
|
26
|
+
if (args.link) {
|
|
27
|
+
const keyCode = extractKeyCode(args.link);
|
|
28
|
+
if (!keyCode) {
|
|
29
|
+
return jsonError("Invalid SendSafely link: missing #keyCode= fragment.");
|
|
30
|
+
}
|
|
31
|
+
const info = await packageInformationFromLink(client, args.link);
|
|
32
|
+
if (cacheFor && info.serverSecret) {
|
|
33
|
+
cacheFor(extra).set(String(info.packageId), {
|
|
34
|
+
keyCode,
|
|
35
|
+
serverSecret: info.serverSecret,
|
|
36
|
+
...(info.packageCode ? { packageCode: info.packageCode } : {}),
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
resolved = { packageInfo: info, keyCode };
|
|
40
|
+
}
|
|
41
|
+
else if (args.package_id) {
|
|
42
|
+
if (!cacheFor) {
|
|
43
|
+
return jsonError("Downloading by package_id requires a cached Keycode, which this " +
|
|
44
|
+
"transport does not provide. Supply the full secure link " +
|
|
45
|
+
"(including the #keyCode= fragment) instead.");
|
|
46
|
+
}
|
|
47
|
+
const secrets = cacheFor(extra).get(args.package_id);
|
|
48
|
+
if (!secrets)
|
|
49
|
+
throw new MissingPackageSecretsError(args.package_id);
|
|
50
|
+
const info = await packageInformation(client, args.package_id);
|
|
51
|
+
resolved = { packageInfo: info, keyCode: secrets.keyCode };
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
return jsonError("Provide either `link` (a full secure link including the #keyCode= " +
|
|
55
|
+
"fragment) or `package_id` (with the package's Keycode already " +
|
|
56
|
+
"cached via get_package_keycode or get_package_information_from_link).");
|
|
57
|
+
}
|
|
58
|
+
const { packageInfo, keyCode } = resolved;
|
|
59
|
+
const packageId = String(packageInfo.packageId);
|
|
60
|
+
const sender = String(packageInfo.packageSender ?? "");
|
|
61
|
+
const files = packageInfo.files ?? [];
|
|
62
|
+
const downloadDir = ctx.getDownloadDir(extra);
|
|
63
|
+
const packageDir = path.join(downloadDir, assertSafePackageId(packageId));
|
|
64
|
+
const approval = await ctx.requireUserApproval(`Download and decrypt ${files.length} file(s) from SendSafely package ` +
|
|
65
|
+
`${packageId}${sender ? ` (sent by ${sender})` : ""} to ${packageDir}?\n\n` +
|
|
66
|
+
"Decrypted copies will be written to the local download directory.");
|
|
67
|
+
const denied = approvalGateError(approval, "decrypt this package's files to the local download directory", {
|
|
68
|
+
proceedWithoutPrompt: args.proceed_without_prompt,
|
|
69
|
+
abortPrefix: "Download aborted",
|
|
70
|
+
});
|
|
71
|
+
if (denied)
|
|
72
|
+
return denied;
|
|
73
|
+
const realDir = await preparePackageDir(downloadDir, packageId);
|
|
74
|
+
const downloaded = [];
|
|
75
|
+
const rejected = [];
|
|
76
|
+
const failed = [];
|
|
77
|
+
for (const f of files) {
|
|
78
|
+
const fileId = f.fileId;
|
|
79
|
+
const rawName = String(f.fileName);
|
|
80
|
+
const safeName = sanitizeFilename(rawName);
|
|
81
|
+
const targetPath = path.resolve(realDir, safeName);
|
|
82
|
+
if (targetPath !== realDir && !targetPath.startsWith(realDir + path.sep)) {
|
|
83
|
+
process.stderr.write(`SECURITY: rejected file '${rawName}' (id=${fileId}) — ` +
|
|
84
|
+
`resolved path escapes package directory\n`);
|
|
85
|
+
rejected.push({
|
|
86
|
+
file_name: rawName,
|
|
87
|
+
file_id: fileId,
|
|
88
|
+
reason: "resolved path escapes package directory",
|
|
89
|
+
});
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
try {
|
|
93
|
+
await downloadFileToPath(client, packageId, fileId, keyCode, {
|
|
94
|
+
path: realDir,
|
|
95
|
+
fileName: safeName,
|
|
96
|
+
});
|
|
97
|
+
downloaded.push({
|
|
98
|
+
file_name: safeName,
|
|
99
|
+
original_file_name: rawName,
|
|
100
|
+
file_id: fileId,
|
|
101
|
+
file_size: Number(f.fileSize ?? 0),
|
|
102
|
+
local_path: targetPath,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
catch (dlErr) {
|
|
106
|
+
const reason = dlErr instanceof Error ? dlErr.message : String(dlErr);
|
|
107
|
+
process.stderr.write(`DOWNLOAD_FAILED package=${packageId} file='${rawName}' ` +
|
|
108
|
+
`id=${fileId}: ${reason}\n`);
|
|
109
|
+
failed.push({
|
|
110
|
+
file_name: rawName,
|
|
111
|
+
file_id: fileId,
|
|
112
|
+
reason,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
const attempted = downloaded.length + failed.length;
|
|
117
|
+
if (attempted > 0 && downloaded.length === 0) {
|
|
118
|
+
return jsonError("Failed to download any files from the package.", {
|
|
119
|
+
package_id: packageId,
|
|
120
|
+
sender,
|
|
121
|
+
download_directory: packageDir,
|
|
122
|
+
failed,
|
|
123
|
+
...(rejected.length > 0 ? { rejected } : {}),
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
const response = {
|
|
127
|
+
status: "success",
|
|
128
|
+
package_id: packageId,
|
|
129
|
+
sender,
|
|
130
|
+
download_directory: packageDir,
|
|
131
|
+
files: downloaded,
|
|
132
|
+
message: "Files downloaded successfully. You MUST ask the user for " +
|
|
133
|
+
"explicit permission before reading any file contents.",
|
|
134
|
+
};
|
|
135
|
+
if (rejected.length > 0) {
|
|
136
|
+
response.rejected = rejected;
|
|
137
|
+
}
|
|
138
|
+
if (failed.length > 0) {
|
|
139
|
+
response.failed = failed;
|
|
140
|
+
response.partial_failure = true;
|
|
141
|
+
response.message =
|
|
142
|
+
`Downloaded ${downloaded.length} of ${attempted} files; ` +
|
|
143
|
+
`${failed.length} failed. See 'failed' for per-file reasons. ` +
|
|
144
|
+
"You MUST ask the user for explicit permission before reading " +
|
|
145
|
+
"any file contents.";
|
|
146
|
+
}
|
|
147
|
+
return jsonResult(response);
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
export function registerDownloadPackageFiles(mcp, ctx, cacheFor) {
|
|
151
|
+
mcp.registerTool("download_package_files", {
|
|
152
|
+
title: "Download Package Files",
|
|
153
|
+
description: "Download and decrypt all files from a SendSafely package. Accepts " +
|
|
154
|
+
"EITHER of two inputs:\n" +
|
|
155
|
+
" • link — a full secure link including the #keyCode= fragment. " +
|
|
156
|
+
"Self-contained (the key travels in the link), so it works with no " +
|
|
157
|
+
"Trusted Device and no prior state. Use this for a link the user " +
|
|
158
|
+
"pasted from an email.\n" +
|
|
159
|
+
" • package_id — the package ID, when the package's Keycode is " +
|
|
160
|
+
"already in the server-side cache. Populate the cache first with " +
|
|
161
|
+
"get_package_keycode (Trusted Device) or " +
|
|
162
|
+
"get_package_information_from_link (keyed link). This is the same " +
|
|
163
|
+
"Keycode-from-cache flow download_file_from_directory uses for " +
|
|
164
|
+
"workspace files, and is the way to download a Transfer or Dropzone " +
|
|
165
|
+
"package by id after resolving its Keycode via a Trusted Device — " +
|
|
166
|
+
"without re-pasting the link.\n" +
|
|
167
|
+
"If both are supplied, the link is used. " +
|
|
168
|
+
"Files are saved to <download_dir>/<packageId>/<file_name>, where " +
|
|
169
|
+
'any of the characters <>:"/\\|?* in the original file name are ' +
|
|
170
|
+
"replaced with '_' (matching the SendSafely SDK's sanitization). " +
|
|
171
|
+
"If two files in the same package sanitize to the same name, the " +
|
|
172
|
+
"later download overwrites the earlier one. " +
|
|
173
|
+
"ACCESSING CONTENTS: the returned local_path is in the SERVER's " +
|
|
174
|
+
"managed download directory, which is very likely NOT reachable by " +
|
|
175
|
+
"your own file-reading tools when this server runs in a sandbox or " +
|
|
176
|
+
"on a different host. Do not open it directly and do not report the " +
|
|
177
|
+
"download as unreadable if your file tools cannot find it. " +
|
|
178
|
+
"read_downloaded_file is the ONLY reliable way to access the " +
|
|
179
|
+
"decrypted contents; always route reads through it using this " +
|
|
180
|
+
"local_path, and ask the user for explicit permission first. " +
|
|
181
|
+
"CONSENT: this tool writes decrypted files to local disk, so it " +
|
|
182
|
+
"requires user approval via MCP elicitation. " +
|
|
183
|
+
CONSENT_FALLBACK_INSTRUCTIONS,
|
|
184
|
+
inputSchema: {
|
|
185
|
+
link: z
|
|
186
|
+
.string()
|
|
187
|
+
.optional()
|
|
188
|
+
.describe("Full SendSafely secure link including the #keyCode= fragment. " +
|
|
189
|
+
"Provide this OR package_id."),
|
|
190
|
+
package_id: z
|
|
191
|
+
.string()
|
|
192
|
+
.optional()
|
|
193
|
+
.describe("The unique SendSafely package ID. Use instead of link when the " +
|
|
194
|
+
"package's Keycode is already cached (via get_package_keycode " +
|
|
195
|
+
"or get_package_information_from_link). Provide this OR link."),
|
|
196
|
+
proceed_without_prompt: proceedWithoutPromptSchema,
|
|
197
|
+
},
|
|
198
|
+
annotations: {
|
|
199
|
+
readOnlyHint: false,
|
|
200
|
+
destructiveHint: true,
|
|
201
|
+
idempotentHint: true,
|
|
202
|
+
openWorldHint: true,
|
|
203
|
+
},
|
|
204
|
+
}, safeHandler("download_package_files", (args, extra) => handleDownloadPackageFiles(args, extra, ctx, cacheFor)));
|
|
205
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import type { ToolContext, ToolExtra } from "../../context.js";
|
|
4
|
+
import { type CacheFor } from "../../store/packageSecretCache.js";
|
|
5
|
+
export declare function handleFinalizePackage(args: {
|
|
6
|
+
package_id: string;
|
|
7
|
+
auto_notify: boolean;
|
|
8
|
+
}, extra: ToolExtra, ctx: ToolContext, cacheFor: CacheFor): Promise<CallToolResult>;
|
|
9
|
+
export declare function registerFinalizePackage(mcp: McpServer, ctx: ToolContext, cacheFor: CacheFor): void;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { jsonError, jsonResult } from "../../jsonResult.js";
|
|
3
|
+
import { MissingPackageSecretsError, } from "../../store/packageSecretCache.js";
|
|
4
|
+
import { runTool } from "../../runTool.js";
|
|
5
|
+
import { safeHandler } from "../../safeHandler.js";
|
|
6
|
+
import { finalizePackage, notifyPackageRecipients } from "../../sdk/sdkPromise.js";
|
|
7
|
+
const SHARE_LINK_MESSAGE = "Package finalized. SendSafely did NOT email recipients — surface the " +
|
|
8
|
+
"secure_link from this response to the user and tell them they need to " +
|
|
9
|
+
"send the link to all recipients themselves.";
|
|
10
|
+
const NOTIFIED_MESSAGE = "Package finalized and recipient notification emails dispatched by " +
|
|
11
|
+
"SendSafely. The secure_link is also in the response — only show it to " +
|
|
12
|
+
"the user if they explicitly ask for it.";
|
|
13
|
+
export async function handleFinalizePackage(args, extra, ctx, cacheFor) {
|
|
14
|
+
return runTool("finalize_package", "Failed to finalize package", async () => {
|
|
15
|
+
const client = await ctx.getClient(extra);
|
|
16
|
+
const secrets = cacheFor(extra).get(args.package_id);
|
|
17
|
+
if (!secrets)
|
|
18
|
+
throw new MissingPackageSecretsError(args.package_id);
|
|
19
|
+
if (!secrets.packageCode) {
|
|
20
|
+
return jsonError(`Cached secrets for packageId '${args.package_id}' do not include a ` +
|
|
21
|
+
"packageCode; the cache entry was populated without one. " +
|
|
22
|
+
"Repopulate via create_package, get_package_information_from_link, " +
|
|
23
|
+
"or get_package_keycode (Trusted Device unlock) to get a full " +
|
|
24
|
+
"cache entry including packageCode.");
|
|
25
|
+
}
|
|
26
|
+
const result = await finalizePackage(client, args.package_id, secrets.packageCode, secrets.keyCode);
|
|
27
|
+
if (!args.auto_notify) {
|
|
28
|
+
return jsonResult({
|
|
29
|
+
status: "success",
|
|
30
|
+
package_id: args.package_id,
|
|
31
|
+
auto_notify: false,
|
|
32
|
+
notified: false,
|
|
33
|
+
result,
|
|
34
|
+
message: SHARE_LINK_MESSAGE,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
await notifyPackageRecipients(client, args.package_id, secrets.keyCode);
|
|
39
|
+
return jsonResult({
|
|
40
|
+
status: "success",
|
|
41
|
+
package_id: args.package_id,
|
|
42
|
+
auto_notify: true,
|
|
43
|
+
notified: true,
|
|
44
|
+
result,
|
|
45
|
+
message: NOTIFIED_MESSAGE,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
catch (notifyErr) {
|
|
49
|
+
const notifyError = notifyErr instanceof Error ? notifyErr.message : String(notifyErr);
|
|
50
|
+
return jsonResult({
|
|
51
|
+
status: "success",
|
|
52
|
+
package_id: args.package_id,
|
|
53
|
+
auto_notify: true,
|
|
54
|
+
notified: false,
|
|
55
|
+
notify_error: notifyError,
|
|
56
|
+
result,
|
|
57
|
+
message: "Package finalized, but the recipient-notification request " +
|
|
58
|
+
"failed. SendSafely did NOT email recipients — surface the " +
|
|
59
|
+
"secure_link to the user and tell them they need to share it " +
|
|
60
|
+
"with all recipients themselves to complete delivery.",
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
export function registerFinalizePackage(mcp, ctx, cacheFor) {
|
|
66
|
+
mcp.registerTool("finalize_package", {
|
|
67
|
+
title: "Finalize Package",
|
|
68
|
+
description: "Finalize a SendSafely package — publishes it so recipients can " +
|
|
69
|
+
"access it. The package's secret material must be in the " +
|
|
70
|
+
"server-side cache (populated by create_package, " +
|
|
71
|
+
"get_package_information_from_link, or get_package_keycode via a " +
|
|
72
|
+
"registered Trusted Device). " +
|
|
73
|
+
"REQUIRED PRE-CALL STEP: Before calling this tool, you MUST ask " +
|
|
74
|
+
"the user whether SendSafely should automatically email the secure " +
|
|
75
|
+
"link to recipients. Pass their answer as the `auto_notify` " +
|
|
76
|
+
"parameter (true = SendSafely sends notification emails; false = " +
|
|
77
|
+
"no email, the user will share the link themselves). Do NOT pick " +
|
|
78
|
+
"a default on the user's behalf — always ask first. " +
|
|
79
|
+
"Behavior: " +
|
|
80
|
+
"(auto_notify=true) the server invokes SendSafely's notify " +
|
|
81
|
+
"endpoint after finalize; response has `notified: true` and " +
|
|
82
|
+
"secure_link, which you should only show to the user if they " +
|
|
83
|
+
"explicitly ask. " +
|
|
84
|
+
"(auto_notify=false) no email is sent; response has " +
|
|
85
|
+
"`notified: false` and secure_link, which you MUST surface to the " +
|
|
86
|
+
"user along with instructions that they need to share it with " +
|
|
87
|
+
"every recipient themselves. " +
|
|
88
|
+
"If the notify request fails after finalize succeeds, the response " +
|
|
89
|
+
"degrades to the auto_notify=false shape (success + secure_link + " +
|
|
90
|
+
"`notify_error`) — package is still published; user must share the " +
|
|
91
|
+
"link manually.",
|
|
92
|
+
inputSchema: {
|
|
93
|
+
package_id: z.string().describe("The unique SendSafely package ID."),
|
|
94
|
+
auto_notify: z
|
|
95
|
+
.boolean()
|
|
96
|
+
.describe("REQUIRED. Whether SendSafely should automatically email the " +
|
|
97
|
+
"secure link to all recipients after the package is " +
|
|
98
|
+
"finalized. You MUST ask the user this question before " +
|
|
99
|
+
"calling — do not assume a default. Pass true to send " +
|
|
100
|
+
"notification emails; pass false to skip notifications, in " +
|
|
101
|
+
"which case the user will be responsible for sharing the " +
|
|
102
|
+
"returned secure_link with the recipients themselves."),
|
|
103
|
+
},
|
|
104
|
+
annotations: {
|
|
105
|
+
readOnlyHint: false,
|
|
106
|
+
destructiveHint: false,
|
|
107
|
+
idempotentHint: false,
|
|
108
|
+
openWorldHint: true,
|
|
109
|
+
},
|
|
110
|
+
}, safeHandler("finalize_package", (args, extra) => handleFinalizePackage(args, extra, ctx, cacheFor)));
|
|
111
|
+
}
|
package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/finalizeUndisclosedPackage.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import type { ToolContext, ToolExtra } from "../../context.js";
|
|
4
|
+
import { type CacheFor } from "../../store/packageSecretCache.js";
|
|
5
|
+
export declare function handleFinalizeUndisclosedPackage(args: {
|
|
6
|
+
package_id: string;
|
|
7
|
+
password: string;
|
|
8
|
+
}, extra: ToolExtra, ctx: ToolContext, cacheFor: CacheFor): Promise<CallToolResult>;
|
|
9
|
+
export declare function registerFinalizeUndisclosedPackage(mcp: McpServer, ctx: ToolContext, cacheFor: CacheFor): void;
|
package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/finalizeUndisclosedPackage.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { jsonError, jsonResult } from "../../jsonResult.js";
|
|
3
|
+
import { MissingPackageSecretsError, } from "../../store/packageSecretCache.js";
|
|
4
|
+
import { runTool } from "../../runTool.js";
|
|
5
|
+
import { safeHandler } from "../../safeHandler.js";
|
|
6
|
+
import { finalizeUndisclosedPackage } from "../../sdk/sdkPromise.js";
|
|
7
|
+
export async function handleFinalizeUndisclosedPackage(args, extra, ctx, cacheFor) {
|
|
8
|
+
return runTool("finalize_undisclosed_package", "Failed to finalize undisclosed package", async () => {
|
|
9
|
+
const client = await ctx.getClient(extra);
|
|
10
|
+
const secrets = cacheFor(extra).get(args.package_id);
|
|
11
|
+
if (!secrets)
|
|
12
|
+
throw new MissingPackageSecretsError(args.package_id);
|
|
13
|
+
if (!secrets.packageCode) {
|
|
14
|
+
return jsonError(`Cached secrets for packageId '${args.package_id}' do not include a ` +
|
|
15
|
+
"packageCode; the cache entry was populated without one. " +
|
|
16
|
+
"Repopulate via create_package, get_package_information_from_link, " +
|
|
17
|
+
"or get_package_keycode (Trusted Device unlock) to get a full " +
|
|
18
|
+
"cache entry including packageCode.");
|
|
19
|
+
}
|
|
20
|
+
const result = await finalizeUndisclosedPackage(client, args.package_id, secrets.packageCode, secrets.keyCode, args.password);
|
|
21
|
+
return jsonResult({
|
|
22
|
+
status: "success",
|
|
23
|
+
package_id: args.package_id,
|
|
24
|
+
result,
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export function registerFinalizeUndisclosedPackage(mcp, ctx, cacheFor) {
|
|
29
|
+
mcp.registerTool("finalize_undisclosed_package", {
|
|
30
|
+
title: "Finalize Undisclosed-Recipient Package",
|
|
31
|
+
description: "Finalize a SendSafely package in undisclosed-recipient mode: " +
|
|
32
|
+
"anyone with the resulting secure link plus the password can " +
|
|
33
|
+
"retrieve the package. The password is the only recipient " +
|
|
34
|
+
"authentication factor — do NOT also call add_recipient / " +
|
|
35
|
+
"add_recipient_with_sms on an undisclosed package; named " +
|
|
36
|
+
"recipients and the undisclosed flow are mutually exclusive. " +
|
|
37
|
+
"Use this finalize variant instead of finalize_package when the " +
|
|
38
|
+
"user wants \"anyone with the link and password\" access. The " +
|
|
39
|
+
"package's secret material must be in the server-side cache — " +
|
|
40
|
+
"typically because create_package was called to author it, or " +
|
|
41
|
+
"because get_package_keycode unlocked it via a registered Trusted " +
|
|
42
|
+
"Device.",
|
|
43
|
+
inputSchema: {
|
|
44
|
+
package_id: z.string().describe("The unique SendSafely package ID."),
|
|
45
|
+
password: z
|
|
46
|
+
.string()
|
|
47
|
+
.min(1)
|
|
48
|
+
.describe("Password recipients must enter to retrieve the package."),
|
|
49
|
+
},
|
|
50
|
+
annotations: {
|
|
51
|
+
readOnlyHint: false,
|
|
52
|
+
destructiveHint: false,
|
|
53
|
+
idempotentHint: false,
|
|
54
|
+
openWorldHint: true,
|
|
55
|
+
},
|
|
56
|
+
}, safeHandler("finalize_undisclosed_package", (args, extra) => handleFinalizeUndisclosedPackage(args, extra, ctx, cacheFor)));
|
|
57
|
+
}
|
package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/generateTrustedDeviceKeypair.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import type { ToolContext, ToolExtra } from "../../context.js";
|
|
4
|
+
import { type KeyStore } from "../../store/keyStore.js";
|
|
5
|
+
export interface GenerateTrustedDeviceKeypairArgs {
|
|
6
|
+
description: string;
|
|
7
|
+
proceed_without_prompt?: boolean | undefined;
|
|
8
|
+
}
|
|
9
|
+
export declare function handleGenerateTrustedDeviceKeypair(args: GenerateTrustedDeviceKeypairArgs, extra: ToolExtra, ctx: ToolContext, keyStore: KeyStore): Promise<CallToolResult>;
|
|
10
|
+
export declare function registerGenerateTrustedDeviceKeypair(mcp: McpServer, ctx: ToolContext, keyStore: KeyStore): void;
|
package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/generateTrustedDeviceKeypair.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { approvalGateError, CONSENT_FALLBACK_INSTRUCTIONS, proceedWithoutPromptSchema, } from "../../approval.js";
|
|
3
|
+
import { jsonResult } from "../../jsonResult.js";
|
|
4
|
+
import { ACTIVE_KEY_ID } from "../../store/keyStore.js";
|
|
5
|
+
import { runTool } from "../../runTool.js";
|
|
6
|
+
import { safeHandler } from "../../safeHandler.js";
|
|
7
|
+
import { generateRsaKeyPair } from "../../sdk/sdkPromise.js";
|
|
8
|
+
export async function handleGenerateTrustedDeviceKeypair(args, extra, ctx, keyStore) {
|
|
9
|
+
return runTool("generate_trusted_device_keypair", "Failed to generate trusted device key pair", async () => {
|
|
10
|
+
const client = await ctx.getClient(extra);
|
|
11
|
+
const approval = await ctx.requireUserApproval(`Generate a SendSafely Trusted Device key pair labeled '${args.description}'? ` +
|
|
12
|
+
"The public key will be uploaded to SendSafely (visible to your tenant " +
|
|
13
|
+
"admin until revoked) and the private key will be stored locally in the " +
|
|
14
|
+
"OS keychain.");
|
|
15
|
+
const denied = approvalGateError(approval, "register this machine as a Trusted Device for the user's SendSafely account", {
|
|
16
|
+
proceedWithoutPrompt: args.proceed_without_prompt,
|
|
17
|
+
});
|
|
18
|
+
if (denied)
|
|
19
|
+
return denied;
|
|
20
|
+
const { privateKey, publicKey } = await generateRsaKeyPair(client, args.description);
|
|
21
|
+
await keyStore.set(publicKey.id, privateKey);
|
|
22
|
+
await keyStore.set(ACTIVE_KEY_ID, publicKey.id);
|
|
23
|
+
return jsonResult({
|
|
24
|
+
status: "success",
|
|
25
|
+
public_key_id: publicKey.id,
|
|
26
|
+
description: publicKey.description,
|
|
27
|
+
date_str: publicKey.dateStr,
|
|
28
|
+
message: "Trusted Device key pair generated. Public key uploaded to " +
|
|
29
|
+
"SendSafely; private key stored locally in the OS keychain. The " +
|
|
30
|
+
"private key is not returned and must not be requested.\n\n" +
|
|
31
|
+
"EXPLAIN THIS TO THE USER (verbatim or close to it):\n" +
|
|
32
|
+
" \"Your new Trusted Device is registered. From now on, any " +
|
|
33
|
+
"NEW SendSafely items sent to you can be opened from here " +
|
|
34
|
+
"without pasting the secure link each time — SendSafely will " +
|
|
35
|
+
"encrypt the keycodes for those new items to this device's " +
|
|
36
|
+
"public key.\n\n" +
|
|
37
|
+
" Existing items that arrived BEFORE this device was registered " +
|
|
38
|
+
"are not yet readable from here. To grant the new device access " +
|
|
39
|
+
"to those older items, log into the SendSafely portal from " +
|
|
40
|
+
"another browser that's already a Trusted Browser for your " +
|
|
41
|
+
"account, then log back out. That login/logout step prompts " +
|
|
42
|
+
"SendSafely to sync your existing keycodes to the new device. " +
|
|
43
|
+
"After the sync, this MCP server will be able to open those " +
|
|
44
|
+
"older items too.\"",
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
export function registerGenerateTrustedDeviceKeypair(mcp, ctx, keyStore) {
|
|
49
|
+
mcp.registerTool("generate_trusted_device_keypair", {
|
|
50
|
+
title: "Generate Trusted Device Key Pair",
|
|
51
|
+
description: "Generate an RSA Trusted Device key pair. The public half is " +
|
|
52
|
+
"uploaded to SendSafely automatically; the private half is stored " +
|
|
53
|
+
"locally in the OS keychain under its public-key ID. Only the " +
|
|
54
|
+
"public-key ID and description are returned — the private key never " +
|
|
55
|
+
"appears in tool I/O. Available only on transports that provide a " +
|
|
56
|
+
"secure local key store (today: stdio). Requires user approval — " +
|
|
57
|
+
"generates Trusted Device key material (public key uploaded to " +
|
|
58
|
+
"SendSafely; private key stored in the OS keychain). " +
|
|
59
|
+
"Approval is collected via MCP elicitation. " +
|
|
60
|
+
CONSENT_FALLBACK_INSTRUCTIONS,
|
|
61
|
+
inputSchema: {
|
|
62
|
+
description: z
|
|
63
|
+
.string()
|
|
64
|
+
.min(1)
|
|
65
|
+
.describe("Human-readable label for the key pair (e.g. 'My MCP Trusted Device')."),
|
|
66
|
+
proceed_without_prompt: proceedWithoutPromptSchema,
|
|
67
|
+
},
|
|
68
|
+
annotations: {
|
|
69
|
+
readOnlyHint: false,
|
|
70
|
+
destructiveHint: false,
|
|
71
|
+
idempotentHint: false,
|
|
72
|
+
openWorldHint: true,
|
|
73
|
+
},
|
|
74
|
+
}, safeHandler("generate_trusted_device_keypair", (args, extra) => handleGenerateTrustedDeviceKeypair(args, extra, ctx, keyStore)));
|
|
75
|
+
}
|
package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/getPackageInformationFromLink.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import type { ToolContext, ToolExtra } from "../../context.js";
|
|
4
|
+
import { type CacheFor } from "../../store/packageSecretCache.js";
|
|
5
|
+
export declare function handleGetPackageInformationFromLink(args: {
|
|
6
|
+
link: string;
|
|
7
|
+
}, extra: ToolExtra, ctx: ToolContext, cacheFor: CacheFor): Promise<CallToolResult>;
|
|
8
|
+
export declare function registerGetPackageInformationFromLink(mcp: McpServer, ctx: ToolContext, cacheFor: CacheFor): void;
|
package/node_modules/@sendsafely/mcp-tools-core/dist/tools/stdio/getPackageInformationFromLink.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { jsonResult } from "../../jsonResult.js";
|
|
3
|
+
import { stripPackageSecrets } from "../../store/packageSecretCache.js";
|
|
4
|
+
import { runTool } from "../../runTool.js";
|
|
5
|
+
import { safeHandler } from "../../safeHandler.js";
|
|
6
|
+
import { packageInformationFromLink } from "../../sdk/sdkPromise.js";
|
|
7
|
+
export async function handleGetPackageInformationFromLink(args, extra, ctx, cacheFor) {
|
|
8
|
+
return runTool("get_package_information_from_link", "Failed to retrieve package information", async () => {
|
|
9
|
+
const client = await ctx.getClient(extra);
|
|
10
|
+
const info = await packageInformationFromLink(client, args.link);
|
|
11
|
+
if (info.keyCode && info.serverSecret) {
|
|
12
|
+
cacheFor(extra).set(String(info.packageId), {
|
|
13
|
+
keyCode: info.keyCode,
|
|
14
|
+
serverSecret: info.serverSecret,
|
|
15
|
+
...(info.packageCode ? { packageCode: info.packageCode } : {}),
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return jsonResult({
|
|
19
|
+
status: "success",
|
|
20
|
+
package_info: stripPackageSecrets(info),
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
export function registerGetPackageInformationFromLink(mcp, ctx, cacheFor) {
|
|
25
|
+
mcp.registerTool("get_package_information_from_link", {
|
|
26
|
+
title: "Get Package Information From Link",
|
|
27
|
+
description: "Resolve a SendSafely secure link (including the #keyCode= " +
|
|
28
|
+
"Keycode fragment) to package metadata. Caches the package's " +
|
|
29
|
+
"secret material server-side so subsequent receive-flow tools " +
|
|
30
|
+
"(get_package_message, download_file_from_directory) can operate " +
|
|
31
|
+
"by package ID without re-supplying the link. Secrets are " +
|
|
32
|
+
"stripped from the response. For TRANSFER and DROPZONE packages, " +
|
|
33
|
+
"per-recipient download and view history is returned under " +
|
|
34
|
+
"`recipients[].confirmations` (same shape as get_package_information; " +
|
|
35
|
+
"surfaced to senders in the UI as the recipient's \"Recipient " +
|
|
36
|
+
"History\"). For WORKSPACE packages, use get_activity_log for the " +
|
|
37
|
+
"full Activity Log — `confirmations` is not populated there.",
|
|
38
|
+
inputSchema: {
|
|
39
|
+
link: z
|
|
40
|
+
.string()
|
|
41
|
+
.describe("Full SendSafely secure link including the #keyCode= fragment."),
|
|
42
|
+
},
|
|
43
|
+
annotations: {
|
|
44
|
+
readOnlyHint: true,
|
|
45
|
+
destructiveHint: false,
|
|
46
|
+
idempotentHint: true,
|
|
47
|
+
openWorldHint: true,
|
|
48
|
+
},
|
|
49
|
+
}, safeHandler("get_package_information_from_link", (args, extra) => handleGetPackageInformationFromLink(args, extra, ctx, cacheFor)));
|
|
50
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import type { ToolContext, ToolExtra } from "../../context.js";
|
|
4
|
+
import { type KeyStore } from "../../store/keyStore.js";
|
|
5
|
+
import { type CacheFor } from "../../store/packageSecretCache.js";
|
|
6
|
+
export declare function handleGetPackageKeycode(args: {
|
|
7
|
+
package_id: string;
|
|
8
|
+
public_key_id?: string | undefined;
|
|
9
|
+
proceed_without_prompt?: boolean | undefined;
|
|
10
|
+
}, extra: ToolExtra, ctx: ToolContext, cacheFor: CacheFor, keyStore: KeyStore): Promise<CallToolResult>;
|
|
11
|
+
export declare function registerGetPackageKeycode(mcp: McpServer, ctx: ToolContext, cacheFor: CacheFor, keyStore: KeyStore): void;
|