@chainship/mcp 0.0.0-stage → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +58 -2
  3. package/dist/index.js +111 -0
  4. package/package.json +53 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Martin Dehlan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,59 @@
1
- # Temporary Holding Version
1
+ # @chainship/mcp
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A [Model Context Protocol](https://modelcontextprotocol.io) server that lets AI agents deploy
4
+ permanent, censorship-resistant frontends with chainship.
5
+
6
+ > `chainship_deploy` deploys are permanent and get tamper-checked delivery: from the second
7
+ > visit the browser checks each file against its hash and refuses a changed one. The first
8
+ > visit is unchecked, and a swap of the whole bundle is not caught yet. x402 deploys are not
9
+ > tamper-checked yet (#516). Full guide: https://chainship.org/docs/mcp
10
+
11
+ ## Tools
12
+
13
+ | Tool | What it does |
14
+ |---|---|
15
+ | `chainship_plan` | The account's plan + capabilities |
16
+ | `chainship_balance` | Credit balance + ledger |
17
+ | `chainship_list` | Recent deployments |
18
+ | `chainship_deploy` | Deploy a static site (no key needed, paid from account credits) → permanent URL |
19
+ | `chainship_deploy_x402` | Deploy without an account, paid per deploy in USDC on Base (x402) |
20
+
21
+ ## Config
22
+
23
+ Environment:
24
+ - `CHAINSHIP_API_URL` — control plane (default: `https://chainship.org`)
25
+ - `CHAINSHIP_TOKEN` — account session token (from `chainship login`, or the web app)
26
+
27
+ ## Use with Claude Desktop / Cursor / Claude Code
28
+
29
+ Node 20 or newer. Claude Code:
30
+
31
+ ```sh
32
+ claude mcp add chainship -e CHAINSHIP_TOKEN=<your account token> -- npx -y @chainship/mcp
33
+ ```
34
+
35
+ Claude Desktop (`claude_desktop_config.json`) and Cursor (`~/.cursor/mcp.json`):
36
+
37
+ ```json
38
+ {
39
+ "mcpServers": {
40
+ "chainship": {
41
+ "command": "npx",
42
+ "args": ["-y", "@chainship/mcp"],
43
+ "env": { "CHAINSHIP_TOKEN": "<your account token>" }
44
+ }
45
+ }
46
+ }
47
+ ```
48
+
49
+ Then ask your agent: *"deploy this folder with chainship"* — it calls `chainship_deploy` and
50
+ returns a permanent URL.
51
+
52
+ ## Develop
53
+
54
+ ```sh
55
+ npm run build -w @chainship/mcp
56
+ CHAINSHIP_TOKEN=… node packages/mcp/dist/index.js # stdio server
57
+ npm run smoke -w @chainship/mcp # clean install of the packed tarball, lists the tools
58
+ npm run release -w @chainship/mcp # publish (owner, own terminal, 2FA); -- --check stops before it
59
+ ```
package/dist/index.js ADDED
@@ -0,0 +1,111 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/index.ts
4
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
5
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
6
+ import { z } from "zod";
7
+ import { createRequire } from "module";
8
+
9
+ // src/api.ts
10
+ var BASE = (process.env.CHAINSHIP_API_URL || "https://chainship.org").replace(/\/$/, "");
11
+ var TOKEN = process.env.CHAINSHIP_TOKEN || "";
12
+ function authedHeaders(extra = {}) {
13
+ return { "content-type": "application/json", authorization: `Bearer ${TOKEN}`, ...extra };
14
+ }
15
+ async function me() {
16
+ return (await fetch(`${BASE}/api/me`, { headers: authedHeaders() })).json();
17
+ }
18
+ async function balance() {
19
+ return (await fetch(`${BASE}/api/credits`, { headers: authedHeaders() })).json();
20
+ }
21
+ async function list() {
22
+ return (await fetch(`${BASE}/api/deployments`, { headers: authedHeaders() })).json();
23
+ }
24
+ async function deploy(files) {
25
+ const res = await fetch(`${BASE}/api/deploy`, {
26
+ method: "POST",
27
+ headers: authedHeaders(),
28
+ body: JSON.stringify({ files })
29
+ });
30
+ return { status: res.status, body: await res.json().catch(() => ({})) };
31
+ }
32
+ async function deployX402(files, payment, signature) {
33
+ const headers = { "content-type": "application/json" };
34
+ if (payment) headers["x-payment"] = payment;
35
+ if (signature) headers["x-payment-signature"] = signature;
36
+ const res = await fetch(`${BASE}/api/x402/deploy`, {
37
+ method: "POST",
38
+ headers,
39
+ body: JSON.stringify({ files })
40
+ });
41
+ return { status: res.status, body: await res.json().catch(() => ({})) };
42
+ }
43
+
44
+ // src/index.ts
45
+ var { version } = createRequire(import.meta.url)("../package.json");
46
+ var server = new McpServer({ name: "chainship", version });
47
+ var text = (o) => ({
48
+ content: [{ type: "text", text: typeof o === "string" ? o : JSON.stringify(o, null, 2) }]
49
+ });
50
+ server.registerTool(
51
+ "chainship_plan",
52
+ { description: "Show the authenticated chainship account's plan and capabilities.", inputSchema: {} },
53
+ async () => text(await me())
54
+ );
55
+ server.registerTool(
56
+ "chainship_balance",
57
+ { description: "Show the account's credit balance and ledger.", inputSchema: {} },
58
+ async () => text(await balance())
59
+ );
60
+ server.registerTool(
61
+ "chainship_list",
62
+ { description: "List recent deployments.", inputSchema: {} },
63
+ async () => text(await list())
64
+ );
65
+ server.registerTool(
66
+ "chainship_deploy",
67
+ {
68
+ description: "Deploy a static site to Arweave, permanently. Costs account credits at any size and cannot be refunded, so ask before spending. Provide files as path + UTF-8 text content. Returns a permanent URL. Tamper-checked delivery: from the second load the browser checks each file against its hash; the first visit is unchecked.",
69
+ inputSchema: {
70
+ files: z.array(z.object({ path: z.string(), content: z.string() })).describe("Files to deploy, e.g. [{path:'index.html', content:'<!doctype html>\u2026'}]")
71
+ }
72
+ },
73
+ async ({ files }) => {
74
+ const payload = files.map((f) => ({
75
+ path: f.path,
76
+ contentBase64: Buffer.from(f.content, "utf8").toString("base64")
77
+ }));
78
+ const r = await deploy(payload);
79
+ if (r.status === 402) return text({ paymentRequired: true, detail: r.body });
80
+ if (r.status >= 400) return text({ error: r.body?.error ?? `deploy failed (${r.status})` });
81
+ return text({ url: r.body.url, txId: r.body.txId, debitedUsd: r.body.debitedUsd, balanceUsd: r.body.balanceUsd });
82
+ }
83
+ );
84
+ server.registerTool(
85
+ "chainship_deploy_x402",
86
+ {
87
+ description: "Account-less pay-per-deploy via x402. Call with files; if payment is required you get a 402 challenge (USDC on Base \u2192 an address). Pay it, sign `signMessage` (EIP-191, your tx hash in lowercase) with the paying wallet, then call again with `payment` and `paymentSignature`. Good for autonomous agents without an account.",
88
+ inputSchema: {
89
+ files: z.array(z.object({ path: z.string(), content: z.string() })),
90
+ payment: z.string().optional().describe("Base USDC tx hash, to satisfy a prior 402 challenge"),
91
+ paymentSignature: z.string().optional().describe("the paying wallet's signature over accepts[0].signMessage")
92
+ }
93
+ },
94
+ async ({ files, payment, paymentSignature }) => {
95
+ const payload = files.map((f) => ({
96
+ path: f.path,
97
+ contentBase64: Buffer.from(f.content, "utf8").toString("base64")
98
+ }));
99
+ const r = await deployX402(payload, payment, paymentSignature);
100
+ if (r.status === 402) {
101
+ return text({
102
+ paymentRequired: true,
103
+ accepts: r.body.accepts,
104
+ instructions: "Pay USDC per accepts[0], sign accepts[0].signMessage with the paying wallet (put your tx hash, lowercase, in place of <tx hash>), then call this tool again with the same files, payment=<tx hash> and paymentSignature=<signature>."
105
+ });
106
+ }
107
+ if (r.status >= 400) return text({ error: r.body?.error ?? `failed (${r.status})`, payer: r.body?.payer, signMessage: r.body?.signMessage });
108
+ return text({ url: r.body.url, txId: r.body.txId, paidUsd: r.body.paidUsd });
109
+ }
110
+ );
111
+ await server.connect(new StdioServerTransport());
package/package.json CHANGED
@@ -1,6 +1,55 @@
1
1
  {
2
2
  "name": "@chainship/mcp",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.0.1",
4
+ "description": "MCP server: let an AI agent deploy a static site to Arweave with chainship (tamper-checked delivery).",
5
+ "type": "module",
6
+ "bin": {
7
+ "chainship-mcp": "dist/index.js"
8
+ },
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "engines": {
13
+ "node": ">=20"
14
+ },
15
+ "keywords": [
16
+ "mcp",
17
+ "model-context-protocol",
18
+ "arweave",
19
+ "deploy",
20
+ "static-site",
21
+ "chainship"
22
+ ],
23
+ "homepage": "https://chainship.org/docs/mcp",
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/martin-dehlan/chainship.git",
27
+ "directory": "packages/mcp"
28
+ },
29
+ "bugs": {
30
+ "url": "https://github.com/martin-dehlan/chainship/issues"
31
+ },
32
+ "license": "MIT",
33
+ "publishConfig": {
34
+ "access": "public"
35
+ },
36
+ "scripts": {
37
+ "build": "tsup src/index.ts --format esm --platform node --target node20 --clean",
38
+ "typecheck": "tsc --noEmit",
39
+ "test": "vitest run",
40
+ "prepublishOnly": "npm run build && npm run test",
41
+ "smoke": "node scripts/smoke.mjs",
42
+ "release": "node scripts/release.mjs",
43
+ "prepack": "npm run build"
44
+ },
45
+ "dependencies": {
46
+ "@modelcontextprotocol/sdk": "^1.32.2",
47
+ "zod": "^4.6.7"
48
+ },
49
+ "devDependencies": {
50
+ "@types/node": "^26.6.11",
51
+ "tsup": "^8.2.4",
52
+ "typescript": "^5.5.4",
53
+ "vitest": "^4.1.12"
54
+ }
55
+ }