hushdrop-mcp 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -0
- package/SETUP.md +83 -0
- package/SKILL.md +93 -0
- package/brand/badge.html +15 -0
- package/brand/brand.json +13 -0
- package/brand/download-page.html +111 -0
- package/brand/favicon.png +0 -0
- package/brand/gate.html +337 -0
- package/brand/logo-black.png +0 -0
- package/brand/logo-white.png +0 -0
- package/brand/meta.html +13 -0
- package/drop.mjs +1020 -0
- package/install.mjs +96 -0
- package/mcp.mjs +192 -0
- package/package.json +59 -0
package/install.mjs
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* hushdrop-install — wire the hushdrop MCP server (and `drop` CLI) into your agents.
|
|
4
|
+
*
|
|
5
|
+
* Open-source one-command installer. Unlike hosted installers there's NO sign-in step
|
|
6
|
+
* (the managed tier is anonymous), so it's fewer steps. It:
|
|
7
|
+
* - registers the 'hushdrop' MCP in CLI agents (Claude Code, Codex, OpenCode, Amp)
|
|
8
|
+
* - writes/merges MCP config for GUI clients (Cursor, Claude Desktop, Windsurf)
|
|
9
|
+
* - symlinks `drop` onto your PATH and installs the skill for Claude/OpenClaw
|
|
10
|
+
*
|
|
11
|
+
* npx hushdrop-install # configure everything detected
|
|
12
|
+
* npx hushdrop-install --print # show what it would do, change nothing
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { spawnSync } from "node:child_process";
|
|
16
|
+
import { existsSync, symlinkSync, mkdirSync, rmSync, readFileSync, writeFileSync } from "node:fs";
|
|
17
|
+
import { homedir, platform } from "node:os";
|
|
18
|
+
import { join, dirname } from "node:path";
|
|
19
|
+
import { fileURLToPath } from "node:url";
|
|
20
|
+
|
|
21
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
22
|
+
const SKILL_DIR = __dirname;
|
|
23
|
+
const MCP = join(__dirname, "mcp.mjs");
|
|
24
|
+
const DROP = join(__dirname, "drop.mjs");
|
|
25
|
+
const PRINT = process.argv.includes("--print");
|
|
26
|
+
const HOME = homedir();
|
|
27
|
+
const PLAT = platform();
|
|
28
|
+
const SEP = PLAT === "win32" ? "\\" : "/";
|
|
29
|
+
|
|
30
|
+
// When installed from npm, wire agents to the published runner; from a clone, the local file.
|
|
31
|
+
const PUBLISHED = __dirname.includes(`${SEP}node_modules${SEP}`);
|
|
32
|
+
const MCP_CMD = PUBLISHED ? ["npx", "-y", "hushdrop-mcp"] : [process.execPath, MCP];
|
|
33
|
+
|
|
34
|
+
const ok = (m) => console.log(`\x1b[32m✓\x1b[0m ${m}`);
|
|
35
|
+
const dim = (m) => console.log(`\x1b[2m${m}\x1b[0m`);
|
|
36
|
+
const has = (cmd) => spawnSync(PLAT === "win32" ? "where" : "which", [cmd], { stdio: "ignore", shell: PLAT === "win32" }).status === 0;
|
|
37
|
+
|
|
38
|
+
console.log("hushdrop-install — wiring the hushdrop MCP into your agents\n");
|
|
39
|
+
let wired = 0;
|
|
40
|
+
|
|
41
|
+
// 1. CLI agents via `<cli> mcp add`
|
|
42
|
+
for (const cli of ["claude", "codex", "opencode", "amp"]) {
|
|
43
|
+
if (!has(cli)) continue;
|
|
44
|
+
const args = ["mcp", "add", "hushdrop", "--", ...MCP_CMD];
|
|
45
|
+
if (PRINT) { dim(`${cli} ${args.join(" ")}`); wired++; continue; }
|
|
46
|
+
const r = spawnSync(cli, args, { stdio: ["ignore", "ignore", "ignore"], shell: PLAT === "win32" });
|
|
47
|
+
if (r.status === 0) { ok(`registered hushdrop MCP in ${cli}`); wired++; }
|
|
48
|
+
else dim(`skipped ${cli} (already configured?)`);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// 2. GUI MCP clients via their config files (only if the app's dir exists → app installed)
|
|
52
|
+
const appSupport = PLAT === "darwin" ? join(HOME, "Library", "Application Support")
|
|
53
|
+
: PLAT === "win32" ? (process.env.APPDATA || join(HOME, "AppData", "Roaming"))
|
|
54
|
+
: join(HOME, ".config");
|
|
55
|
+
const GUI = [
|
|
56
|
+
{ name: "Cursor", dir: join(HOME, ".cursor"), file: join(HOME, ".cursor", "mcp.json"), key: "mcpServers" },
|
|
57
|
+
{ name: "Claude Desktop", dir: join(appSupport, "Claude"), file: join(appSupport, "Claude", "claude_desktop_config.json"), key: "mcpServers" },
|
|
58
|
+
{ name: "Windsurf", dir: join(HOME, ".codeium", "windsurf"), file: join(HOME, ".codeium", "windsurf", "mcp_config.json"), key: "mcpServers" },
|
|
59
|
+
];
|
|
60
|
+
function mergeMcp(file, key) {
|
|
61
|
+
let cfg = {};
|
|
62
|
+
if (existsSync(file)) { try { cfg = JSON.parse(readFileSync(file, "utf8")); } catch { return false; } }
|
|
63
|
+
cfg[key] = cfg[key] || {};
|
|
64
|
+
cfg[key].hushdrop = { command: MCP_CMD[0], args: MCP_CMD.slice(1) };
|
|
65
|
+
writeFileSync(file, JSON.stringify(cfg, null, 2) + "\n");
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
for (const g of GUI) {
|
|
69
|
+
if (!existsSync(g.dir)) continue;
|
|
70
|
+
if (PRINT) { dim(`write ${g.file} → ${g.key}.hushdrop`); wired++; continue; }
|
|
71
|
+
try { mkdirSync(dirname(g.file), { recursive: true }); if (mergeMcp(g.file, g.key)) { ok(`configured ${g.name} (${g.file})`); wired++; } }
|
|
72
|
+
catch (e) { dim(`skipped ${g.name}: ${e.message}`); }
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (!wired) dim("no agents detected — add the MCP config below by hand");
|
|
76
|
+
|
|
77
|
+
// 3. `drop` on PATH
|
|
78
|
+
const bin = join(HOME, ".local", "bin");
|
|
79
|
+
const link = join(bin, "hush");
|
|
80
|
+
if (PRINT) { dim(`ln -s ${DROP} ${link}`); }
|
|
81
|
+
else {
|
|
82
|
+
try { mkdirSync(bin, { recursive: true }); if (existsSync(link)) rmSync(link); symlinkSync(DROP, link); ok(`linked 'hush' → ${link}`); }
|
|
83
|
+
catch (e) { dim(`could not symlink drop: ${e.message}`); }
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// 4. skill auto-discovery for Claude Code / OpenClaw
|
|
87
|
+
const skillsDir = join(HOME, ".claude", "skills");
|
|
88
|
+
if (existsSync(skillsDir) && !PUBLISHED) {
|
|
89
|
+
const dest = join(skillsDir, "hushdrop");
|
|
90
|
+
if (PRINT) { dim(`ln -s ${SKILL_DIR} ${dest}`); }
|
|
91
|
+
else { try { if (existsSync(dest)) rmSync(dest, { recursive: true, force: true }); symlinkSync(SKILL_DIR, dest); ok(`installed skill → ${dest}`); } catch {} }
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
console.log("\nGUI clients not auto-detected? Add this to your MCP config:");
|
|
95
|
+
console.log(JSON.stringify({ mcpServers: { hushdrop: { command: MCP_CMD[0], args: MCP_CMD.slice(1) } } }, null, 2));
|
|
96
|
+
console.log("\nReady. Try: hush report.html --managed (zero setup) · docs: https://hushdrop.maxtechera.dev/docs");
|
package/mcp.mjs
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* hushdrop MCP server — the MCP-native publish primitive for HTML/artifacts your agents make.
|
|
4
|
+
*
|
|
5
|
+
* Open-source, self-hosted MCP publish primitive: an agent calls `publish_html` and gets
|
|
6
|
+
* back a branded, password-protected, zero-knowledge link on YOUR own domain. Every tool
|
|
7
|
+
* shells out to the `drop` CLI (drop.mjs --json) so the MCP and CLI share one pipeline.
|
|
8
|
+
* Nothing is hosted by a third party — it's your Vercel Blob.
|
|
9
|
+
*
|
|
10
|
+
* Wire it into an agent (stdio):
|
|
11
|
+
* claude mcp add hushdrop -- npx -y hushdrop-mcp
|
|
12
|
+
* # or, from a checkout:
|
|
13
|
+
* claude mcp add hushdrop -- node <repo>/skill/mcp.mjs
|
|
14
|
+
*
|
|
15
|
+
* Requires `hush setup` to have run (BLOB_READ_WRITE_TOKEN in ~/.hushdrop/.env).
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
19
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
20
|
+
import { z } from "zod";
|
|
21
|
+
import { spawn } from "node:child_process";
|
|
22
|
+
import { writeFile, mkdtemp, rm } from "node:fs/promises";
|
|
23
|
+
import { tmpdir } from "node:os";
|
|
24
|
+
import { join, dirname } from "node:path";
|
|
25
|
+
import { fileURLToPath } from "node:url";
|
|
26
|
+
|
|
27
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
28
|
+
const DROP = join(__dirname, "drop.mjs");
|
|
29
|
+
|
|
30
|
+
// Run the drop CLI with --json and return the parsed result.
|
|
31
|
+
function runDrop(args) {
|
|
32
|
+
return new Promise((resolve, reject) => {
|
|
33
|
+
const p = spawn(process.execPath, [DROP, ...args, "--json"], { stdio: ["ignore", "pipe", "pipe"] });
|
|
34
|
+
let out = "", err = "";
|
|
35
|
+
p.stdout.on("data", (d) => (out += d));
|
|
36
|
+
p.stderr.on("data", (d) => (err += d));
|
|
37
|
+
p.on("error", reject);
|
|
38
|
+
p.on("close", (code) => {
|
|
39
|
+
if (code !== 0) return reject(new Error(err.trim() || `hush exited ${code}`));
|
|
40
|
+
const line = out.trim().split("\n").filter(Boolean).pop() || "{}";
|
|
41
|
+
try { resolve(JSON.parse(line)); } catch { resolve({ raw: out.trim() }); }
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async function withTempFile(name, content, fn) {
|
|
47
|
+
const dir = await mkdtemp(join(tmpdir(), "hushdrop-mcp-"));
|
|
48
|
+
const path = join(dir, name);
|
|
49
|
+
await writeFile(path, content);
|
|
50
|
+
try { return await fn(path); }
|
|
51
|
+
finally { await rm(dir, { recursive: true, force: true }); }
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const textResult = (obj) => ({ content: [{ type: "text", text: JSON.stringify(obj, null, 2) }] });
|
|
55
|
+
const errResult = (e) => ({ isError: true, content: [{ type: "text", text: `Error: ${e.message || e}` }] });
|
|
56
|
+
|
|
57
|
+
const server = new McpServer({ name: "hushdrop", version: "1.0.0" });
|
|
58
|
+
|
|
59
|
+
server.tool(
|
|
60
|
+
"publish_html",
|
|
61
|
+
"Publish raw HTML as a branded, password-protected (zero-knowledge AES-256) link on your own domain. Returns the URL and (if locked) the password. Locked by default.",
|
|
62
|
+
{
|
|
63
|
+
html: z.string().describe("The full HTML document to publish."),
|
|
64
|
+
slug: z.string().optional().describe("Force the URL slug (e.g. 'q3-report'). Otherwise auto-generated."),
|
|
65
|
+
password: z.string().optional().describe("Set a specific password. Otherwise an unguessable one is generated when locked."),
|
|
66
|
+
lock: z.boolean().optional().describe("Encrypt + password-protect (default true). Set false for a public branded page."),
|
|
67
|
+
expire: z.string().optional().describe("Auto-expire after this long: '7d', '24h', '2w', or a date. Enforce deletion with the host's `hush gc` cron."),
|
|
68
|
+
},
|
|
69
|
+
async ({ html, slug, password, lock, expire }) => {
|
|
70
|
+
try {
|
|
71
|
+
const args = [];
|
|
72
|
+
if (slug) args.push("-s", slug);
|
|
73
|
+
if (lock === false) args.push("--no-lock");
|
|
74
|
+
else if (password) args.push("-p", password);
|
|
75
|
+
if (expire) args.push("--expire", expire);
|
|
76
|
+
const res = await withTempFile((slug || "page") + ".html", html, (p) => runDrop([p, ...args]));
|
|
77
|
+
return textResult(res);
|
|
78
|
+
} catch (e) { return errResult(e); }
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
server.tool(
|
|
83
|
+
"publish_file",
|
|
84
|
+
"Publish a file from a local path. Non-HTML files get an unguessable URL; pass page=true to wrap any file in a branded download page (optionally password-protected).",
|
|
85
|
+
{
|
|
86
|
+
path: z.string().describe("Absolute path to the local file to publish."),
|
|
87
|
+
slug: z.string().optional(),
|
|
88
|
+
page: z.boolean().optional().describe("Wrap the file in a branded download page."),
|
|
89
|
+
password: z.string().optional().describe("Password-protect the download page (requires page=true)."),
|
|
90
|
+
},
|
|
91
|
+
async ({ path, slug, page, password }) => {
|
|
92
|
+
try {
|
|
93
|
+
const args = [path];
|
|
94
|
+
if (slug) args.push("-s", slug);
|
|
95
|
+
if (page) args.push("--page");
|
|
96
|
+
if (password) args.push("-p", password);
|
|
97
|
+
return textResult(await runDrop(args));
|
|
98
|
+
} catch (e) { return errResult(e); }
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
server.tool(
|
|
103
|
+
"update_site",
|
|
104
|
+
"Replace the content of an existing drop in place — same URL/slug, new HTML. (Set a password to re-lock; zero-knowledge means content can't be re-keyed without re-supplying it.)",
|
|
105
|
+
{
|
|
106
|
+
slug: z.string().describe("The slug to overwrite."),
|
|
107
|
+
html: z.string().describe("The new HTML document."),
|
|
108
|
+
password: z.string().optional(),
|
|
109
|
+
lock: z.boolean().optional(),
|
|
110
|
+
expire: z.string().optional().describe("Auto-expire: '7d', '24h', '2w', or a date."),
|
|
111
|
+
},
|
|
112
|
+
async ({ slug, html, password, lock, expire }) => {
|
|
113
|
+
try {
|
|
114
|
+
const args = ["-s", slug];
|
|
115
|
+
if (lock === false) args.push("--no-lock");
|
|
116
|
+
else if (password) args.push("-p", password);
|
|
117
|
+
if (expire) args.push("--expire", expire);
|
|
118
|
+
const res = await withTempFile(slug + ".html", html, (p) => runDrop([p, ...args]));
|
|
119
|
+
return textResult(res);
|
|
120
|
+
} catch (e) { return errResult(e); }
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
server.tool(
|
|
125
|
+
"list_sites",
|
|
126
|
+
"List the drops currently live in your store (slug, URL, size, password if known locally, upload date).",
|
|
127
|
+
{},
|
|
128
|
+
async () => {
|
|
129
|
+
try { return textResult(await runDrop(["list"])); }
|
|
130
|
+
catch (e) { return errResult(e); }
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
server.tool(
|
|
135
|
+
"delete_site",
|
|
136
|
+
"Delete a drop (and any sibling file) by slug. Burns the artifact immediately.",
|
|
137
|
+
{ slug: z.string().describe("The slug to delete.") },
|
|
138
|
+
async ({ slug }) => {
|
|
139
|
+
try { return textResult(await runDrop(["rm", slug])); }
|
|
140
|
+
catch (e) { return errResult(e); }
|
|
141
|
+
}
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
server.tool(
|
|
145
|
+
"set_password",
|
|
146
|
+
"Change the password gate on a hosted drop. Zero-knowledge means re-keying re-encrypts, so re-supply the HTML; returns the new URL + password.",
|
|
147
|
+
{
|
|
148
|
+
slug: z.string().describe("The slug to re-key."),
|
|
149
|
+
html: z.string().describe("The drop's HTML (required — content is re-encrypted under the new password)."),
|
|
150
|
+
password: z.string().optional().describe("New password (auto-generated if omitted)."),
|
|
151
|
+
},
|
|
152
|
+
async ({ slug, html, password }) => {
|
|
153
|
+
try {
|
|
154
|
+
const args = ["-s", slug];
|
|
155
|
+
if (password) args.push("-p", password);
|
|
156
|
+
return textResult(await withTempFile(slug + ".html", html, (p) => runDrop([p, ...args])));
|
|
157
|
+
} catch (e) { return errResult(e); }
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
server.tool(
|
|
162
|
+
"set_expiry",
|
|
163
|
+
"Set (or clear) the auto-expiry on a hosted drop. The host's gc cron deletes it after the deadline.",
|
|
164
|
+
{ slug: z.string(), expire: z.string().describe("'7d' | '24h' | '2w' | a date | 'off' to clear.") },
|
|
165
|
+
async ({ slug, expire }) => {
|
|
166
|
+
try { return textResult(await runDrop(["set-expiry", slug, expire])); }
|
|
167
|
+
catch (e) { return errResult(e); }
|
|
168
|
+
}
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
server.tool(
|
|
172
|
+
"set_email_gate",
|
|
173
|
+
"Restrict a hosted drop so only viewers with a given email domain can open it (e.g. 'acme.com'); pass 'off' to remove.",
|
|
174
|
+
{ slug: z.string(), domain: z.string().describe("Allowed email domain, or 'off'.") },
|
|
175
|
+
async ({ slug, domain }) => {
|
|
176
|
+
try { return textResult(await runDrop(["set-email-gate", slug, domain])); }
|
|
177
|
+
catch (e) { return errResult(e); }
|
|
178
|
+
}
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
server.tool(
|
|
182
|
+
"set_feedback",
|
|
183
|
+
"Toggle the viewer feedback widget on a hosted drop (collect reactions/comments from recipients).",
|
|
184
|
+
{ slug: z.string(), enabled: z.boolean().optional().describe("true to enable (default), false to disable.") },
|
|
185
|
+
async ({ slug, enabled }) => {
|
|
186
|
+
try { return textResult(await runDrop(["set-feedback", slug, enabled === false ? "off" : "on"])); }
|
|
187
|
+
catch (e) { return errResult(e); }
|
|
188
|
+
}
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
const transport = new StdioServerTransport();
|
|
192
|
+
await server.connect(transport);
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "hushdrop-mcp",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Open-source artifact sharing \u2014 publish HTML/Markdown/files as branded, password-protected, zero-knowledge links on your own domain, from any AI agent. CLI + MCP server. The open-source, self-hosted Stacktree alternative.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"hush": "./drop.mjs",
|
|
8
|
+
"hushdrop": "./drop.mjs",
|
|
9
|
+
"hushdrop-mcp": "./mcp.mjs",
|
|
10
|
+
"hushdrop-install": "./install.mjs"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"drop.mjs",
|
|
14
|
+
"mcp.mjs",
|
|
15
|
+
"install.mjs",
|
|
16
|
+
"brand/",
|
|
17
|
+
"SKILL.md",
|
|
18
|
+
"SETUP.md"
|
|
19
|
+
],
|
|
20
|
+
"keywords": [
|
|
21
|
+
"mcp",
|
|
22
|
+
"ai-agents",
|
|
23
|
+
"claude",
|
|
24
|
+
"claude-code",
|
|
25
|
+
"artifacts",
|
|
26
|
+
"file-sharing",
|
|
27
|
+
"zero-knowledge",
|
|
28
|
+
"cli",
|
|
29
|
+
"self-hosted",
|
|
30
|
+
"staticrypt",
|
|
31
|
+
"vercel-blob",
|
|
32
|
+
"password-protection",
|
|
33
|
+
"stacktree-alternative",
|
|
34
|
+
"publish-html",
|
|
35
|
+
"mcp-server",
|
|
36
|
+
"cursor",
|
|
37
|
+
"anthropic",
|
|
38
|
+
"artifact-sharing",
|
|
39
|
+
"send-co-alternative"
|
|
40
|
+
],
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "https://github.com/maxtechera/hushdrop"
|
|
44
|
+
},
|
|
45
|
+
"homepage": "https://hushdrop.maxtechera.dev",
|
|
46
|
+
"bugs": "https://github.com/maxtechera/hushdrop/issues",
|
|
47
|
+
"author": "Max Techera (https://maxtechera.dev)",
|
|
48
|
+
"license": "MIT",
|
|
49
|
+
"engines": {
|
|
50
|
+
"node": ">=18"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
54
|
+
"@vercel/blob": "^0.27.0",
|
|
55
|
+
"adm-zip": "^0.5.17",
|
|
56
|
+
"marked": "^18.0.5",
|
|
57
|
+
"zod": "^3.23.0"
|
|
58
|
+
}
|
|
59
|
+
}
|