run402-mcp 1.33.0 → 1.33.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.zh-CN.md +1 -1
- package/core/dist/wallet-auth.d.ts +15 -0
- package/core/dist/wallet-auth.d.ts.map +1 -0
- package/core/dist/wallet-auth.js +62 -0
- package/core/dist/wallet-auth.js.map +1 -0
- package/core/dist/wallet.d.ts +10 -0
- package/core/dist/wallet.d.ts.map +1 -0
- package/core/dist/wallet.js +25 -0
- package/core/dist/wallet.js.map +1 -0
- package/dist/tools/archive-project.d.ts.map +1 -1
- package/dist/tools/archive-project.js +5 -3
- package/dist/tools/archive-project.js.map +1 -1
- package/dist/tools/renew.d.ts +16 -0
- package/dist/tools/renew.d.ts.map +1 -0
- package/dist/tools/renew.js +64 -0
- package/dist/tools/renew.js.map +1 -0
- package/dist/tools/wallet-create.d.ts +9 -0
- package/dist/tools/wallet-create.d.ts.map +1 -0
- package/dist/tools/wallet-create.js +52 -0
- package/dist/tools/wallet-create.js.map +1 -0
- package/dist/tools/wallet-export.d.ts +9 -0
- package/dist/tools/wallet-export.d.ts.map +1 -0
- package/dist/tools/wallet-export.js +20 -0
- package/dist/tools/wallet-export.js.map +1 -0
- package/dist/tools/wallet-status.d.ts +9 -0
- package/dist/tools/wallet-status.d.ts.map +1 -0
- package/dist/tools/wallet-status.js +28 -0
- package/dist/tools/wallet-status.js.map +1 -0
- package/dist/wallet-auth.d.ts +21 -0
- package/dist/wallet-auth.d.ts.map +1 -0
- package/dist/wallet-auth.js +26 -0
- package/dist/wallet-auth.js.map +1 -0
- package/dist/wallet.d.ts +3 -0
- package/dist/wallet.d.ts.map +1 -0
- package/dist/wallet.js +2 -0
- package/dist/wallet.js.map +1 -0
- package/package.json +3 -3
package/README.zh-CN.md
CHANGED
|
@@ -156,7 +156,7 @@ Run402 上的公开应用可以一键复制(Fork),每个副本拥有独立
|
|
|
156
156
|
- **应用市场**:[run402.com/apps](https://run402.com/apps)
|
|
157
157
|
- **API 状态**:[api.run402.com/health](https://api.run402.com/health)
|
|
158
158
|
- **npm**:[npmjs.com/package/run402-mcp](https://www.npmjs.com/package/run402-mcp)
|
|
159
|
-
- **GitHub**:[github.com/kychee-com/run402
|
|
159
|
+
- **GitHub**:[github.com/kychee-com/run402](https://github.com/kychee-com/run402)
|
|
160
160
|
|
|
161
161
|
## 开发
|
|
162
162
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wallet auth helper — generates EIP-191 signature headers for Run402 API.
|
|
3
|
+
* Uses @noble/curves (lighter than viem) for signing.
|
|
4
|
+
*/
|
|
5
|
+
export interface WalletAuthHeaders {
|
|
6
|
+
"X-Run402-Wallet": string;
|
|
7
|
+
"X-Run402-Signature": string;
|
|
8
|
+
"X-Run402-Timestamp": string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Get wallet auth headers for the Run402 API.
|
|
12
|
+
* Returns null if no wallet is configured.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getWalletAuthHeaders(walletPath?: string): WalletAuthHeaders | null;
|
|
15
|
+
//# sourceMappingURL=wallet-auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet-auth.d.ts","sourceRoot":"","sources":["../src/wallet-auth.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,MAAM,WAAW,iBAAiB;IAChC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,oBAAoB,EAAE,MAAM,CAAC;CAC9B;AA4CD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,CAYlF"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wallet auth helper — generates EIP-191 signature headers for Run402 API.
|
|
3
|
+
* Uses @noble/curves (lighter than viem) for signing.
|
|
4
|
+
*/
|
|
5
|
+
import { secp256k1 } from "@noble/curves/secp256k1.js";
|
|
6
|
+
import { keccak_256 } from "@noble/hashes/sha3.js";
|
|
7
|
+
import { bytesToHex } from "@noble/hashes/utils.js";
|
|
8
|
+
import { readWallet } from "./wallet.js";
|
|
9
|
+
/**
|
|
10
|
+
* EIP-191 personal_sign: sign a message with the wallet's private key.
|
|
11
|
+
*/
|
|
12
|
+
function personalSign(privateKeyHex, address, message) {
|
|
13
|
+
const msgBytes = new TextEncoder().encode(message);
|
|
14
|
+
const prefix = new TextEncoder().encode(`\x19Ethereum Signed Message:\n${msgBytes.length}`);
|
|
15
|
+
const prefixed = new Uint8Array(prefix.length + msgBytes.length);
|
|
16
|
+
prefixed.set(prefix);
|
|
17
|
+
prefixed.set(msgBytes, prefix.length);
|
|
18
|
+
const hash = keccak_256(prefixed);
|
|
19
|
+
const pkHex = privateKeyHex.startsWith("0x")
|
|
20
|
+
? privateKeyHex.slice(2)
|
|
21
|
+
: privateKeyHex;
|
|
22
|
+
const pkBytes = Uint8Array.from(Buffer.from(pkHex, "hex"));
|
|
23
|
+
const rawSig = secp256k1.sign(hash, pkBytes);
|
|
24
|
+
const sig = secp256k1.Signature.fromBytes(rawSig);
|
|
25
|
+
// Determine recovery bit by trying both and matching the address
|
|
26
|
+
let recovery = 0;
|
|
27
|
+
for (const v of [0, 1]) {
|
|
28
|
+
try {
|
|
29
|
+
const recovered = sig.addRecoveryBit(v).recoverPublicKey(hash);
|
|
30
|
+
const pubBytes = recovered.toBytes(false).slice(1); // uncompressed, drop 04 prefix
|
|
31
|
+
const addrBytes = keccak_256(pubBytes).slice(-20);
|
|
32
|
+
if ("0x" + bytesToHex(addrBytes) === address.toLowerCase()) {
|
|
33
|
+
recovery = v;
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const r = sig.r.toString(16).padStart(64, "0");
|
|
42
|
+
const s = sig.s.toString(16).padStart(64, "0");
|
|
43
|
+
const vHex = (recovery + 27).toString(16).padStart(2, "0");
|
|
44
|
+
return "0x" + r + s + vHex;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Get wallet auth headers for the Run402 API.
|
|
48
|
+
* Returns null if no wallet is configured.
|
|
49
|
+
*/
|
|
50
|
+
export function getWalletAuthHeaders(walletPath) {
|
|
51
|
+
const wallet = readWallet(walletPath);
|
|
52
|
+
if (!wallet || !wallet.address || !wallet.privateKey)
|
|
53
|
+
return null;
|
|
54
|
+
const timestamp = Math.floor(Date.now() / 1000).toString();
|
|
55
|
+
const signature = personalSign(wallet.privateKey, wallet.address, `run402:${timestamp}`);
|
|
56
|
+
return {
|
|
57
|
+
"X-Run402-Wallet": wallet.address,
|
|
58
|
+
"X-Run402-Signature": signature,
|
|
59
|
+
"X-Run402-Timestamp": timestamp,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=wallet-auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet-auth.js","sourceRoot":"","sources":["../src/wallet-auth.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAQzC;;GAEG;AACH,SAAS,YAAY,CAAC,aAAqB,EAAE,OAAe,EAAE,OAAe;IAC3E,MAAM,QAAQ,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACnD,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CACrC,iCAAiC,QAAQ,CAAC,MAAM,EAAE,CACnD,CAAC;IACF,MAAM,QAAQ,GAA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
|
5
|
+
funded?: boolean;
|
|
6
|
+
lastFaucet?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function readWallet(path?: string): WalletData | null;
|
|
9
|
+
export declare function saveWallet(data: WalletData, path?: string): void;
|
|
10
|
+
//# sourceMappingURL=wallet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../src/wallet.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAQ3D;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAQhE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync, mkdirSync, existsSync, chmodSync, renameSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { randomBytes } from "node:crypto";
|
|
4
|
+
import { getWalletPath } from "./config.js";
|
|
5
|
+
export function readWallet(path) {
|
|
6
|
+
const p = path ?? getWalletPath();
|
|
7
|
+
if (!existsSync(p))
|
|
8
|
+
return null;
|
|
9
|
+
try {
|
|
10
|
+
return JSON.parse(readFileSync(p, "utf-8"));
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export function saveWallet(data, path) {
|
|
17
|
+
const p = path ?? getWalletPath();
|
|
18
|
+
const dir = dirname(p);
|
|
19
|
+
mkdirSync(dir, { recursive: true });
|
|
20
|
+
const tmp = join(dir, `.wallet.${randomBytes(4).toString("hex")}.tmp`);
|
|
21
|
+
writeFileSync(tmp, JSON.stringify(data, null, 2), { mode: 0o600 });
|
|
22
|
+
renameSync(tmp, p);
|
|
23
|
+
chmodSync(p, 0o600);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=wallet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet.js","sourceRoot":"","sources":["../src/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACpG,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAU5C,MAAM,UAAU,UAAU,CAAC,IAAa;IACtC,MAAM,CAAC,GAAG,IAAI,IAAI,aAAa,EAAE,CAAC;IAClC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IAChC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;IAC9C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,IAAgB,EAAE,IAAa;IACxD,MAAM,CAAC,GAAG,IAAI,IAAI,aAAa,EAAE,CAAC;IAClC,MAAM,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACvB,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACpC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,WAAW,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACvE,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACnE,UAAU,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACnB,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AACtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"archive-project.d.ts","sourceRoot":"","sources":["../../src/tools/archive-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,oBAAoB;;
|
|
1
|
+
{"version":3,"file":"archive-project.d.ts","sourceRoot":"","sources":["../../src/tools/archive-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,oBAAoB;;CAIhC,CAAC;AAEF,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CA0BjF"}
|
|
@@ -3,7 +3,9 @@ import { apiRequest } from "../client.js";
|
|
|
3
3
|
import { getProject, loadKeyStore, saveKeyStore } from "../keystore.js";
|
|
4
4
|
import { formatApiError, projectNotFound } from "../errors.js";
|
|
5
5
|
export const archiveProjectSchema = {
|
|
6
|
-
project_id: z
|
|
6
|
+
project_id: z
|
|
7
|
+
.string()
|
|
8
|
+
.describe("The project ID to soft-delete (enter the grace window)"),
|
|
7
9
|
};
|
|
8
10
|
export async function handleArchiveProject(args) {
|
|
9
11
|
const project = getProject(args.project_id);
|
|
@@ -16,7 +18,7 @@ export async function handleArchiveProject(args) {
|
|
|
16
18
|
},
|
|
17
19
|
});
|
|
18
20
|
if (!res.ok)
|
|
19
|
-
return formatApiError(res, "
|
|
21
|
+
return formatApiError(res, "deleting project");
|
|
20
22
|
// Remove from local key store
|
|
21
23
|
const store = loadKeyStore();
|
|
22
24
|
delete store.projects[args.project_id];
|
|
@@ -25,7 +27,7 @@ export async function handleArchiveProject(args) {
|
|
|
25
27
|
content: [
|
|
26
28
|
{
|
|
27
29
|
type: "text",
|
|
28
|
-
text: `Project \`${args.project_id}\`
|
|
30
|
+
text: `Project \`${args.project_id}\` entered the soft-delete state (status: purged) and was removed from the local key store. Renewing the tier during the grace window would have reactivated it.`,
|
|
29
31
|
},
|
|
30
32
|
],
|
|
31
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"archive-project.js","sourceRoot":"","sources":["../../src/tools/archive-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/D,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,UAAU,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"archive-project.js","sourceRoot":"","sources":["../../src/tools/archive-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/D,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,QAAQ,CAAC,wDAAwD,CAAC;CACtE,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,IAE1C;IACC,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC5C,IAAI,CAAC,OAAO;QAAE,OAAO,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAEtD,MAAM,GAAG,GAAG,MAAM,UAAU,CAAC,gBAAgB,IAAI,CAAC,UAAU,EAAE,EAAE;QAC9D,MAAM,EAAE,QAAQ;QAChB,OAAO,EAAE;YACP,aAAa,EAAE,UAAU,OAAO,CAAC,WAAW,EAAE;SAC/C;KACF,CAAC,CAAC;IAEH,IAAI,CAAC,GAAG,CAAC,EAAE;QAAE,OAAO,cAAc,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC;IAE5D,8BAA8B;IAC9B,MAAM,KAAK,GAAG,YAAY,EAAE,CAAC;IAC7B,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACvC,YAAY,CAAC,KAAK,CAAC,CAAC;IAEpB,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,aAAa,IAAI,CAAC,UAAU,kKAAkK;aACrM;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const renewSchema: {
|
|
3
|
+
project_id: z.ZodString;
|
|
4
|
+
tier: z.ZodOptional<z.ZodEnum<["prototype", "hobby", "team"]>>;
|
|
5
|
+
};
|
|
6
|
+
export declare function handleRenew(args: {
|
|
7
|
+
project_id: string;
|
|
8
|
+
tier?: string;
|
|
9
|
+
}): Promise<{
|
|
10
|
+
content: Array<{
|
|
11
|
+
type: "text";
|
|
12
|
+
text: string;
|
|
13
|
+
}>;
|
|
14
|
+
isError?: boolean;
|
|
15
|
+
}>;
|
|
16
|
+
//# sourceMappingURL=renew.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renew.d.ts","sourceRoot":"","sources":["../../src/tools/renew.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,WAAW;;;CAMvB,CAAC;AAEF,wBAAsB,WAAW,CAAC,IAAI,EAAE;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CA6DjF"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { apiRequest } from "../client.js";
|
|
3
|
+
import { getProject, saveProject } from "../keystore.js";
|
|
4
|
+
import { formatApiError, projectNotFound } from "../errors.js";
|
|
5
|
+
export const renewSchema = {
|
|
6
|
+
project_id: z.string().describe("The project ID to renew"),
|
|
7
|
+
tier: z
|
|
8
|
+
.enum(["prototype", "hobby", "team"])
|
|
9
|
+
.optional()
|
|
10
|
+
.describe("Tier for renewal (defaults to current tier)"),
|
|
11
|
+
};
|
|
12
|
+
export async function handleRenew(args) {
|
|
13
|
+
const project = getProject(args.project_id);
|
|
14
|
+
if (!project)
|
|
15
|
+
return projectNotFound(args.project_id);
|
|
16
|
+
const tier = args.tier || project.tier;
|
|
17
|
+
const res = await apiRequest(`/tiers/v1/renew/${tier}`, {
|
|
18
|
+
method: "POST",
|
|
19
|
+
body: {},
|
|
20
|
+
});
|
|
21
|
+
if (res.is402) {
|
|
22
|
+
const body = res.body;
|
|
23
|
+
const lines = [
|
|
24
|
+
`## Payment Required`,
|
|
25
|
+
``,
|
|
26
|
+
`To renew project \`${args.project_id}\` (tier: **${tier}**), an x402 payment is needed.`,
|
|
27
|
+
``,
|
|
28
|
+
];
|
|
29
|
+
if (body.x402) {
|
|
30
|
+
lines.push(`**Payment details:**`);
|
|
31
|
+
lines.push("```json");
|
|
32
|
+
lines.push(JSON.stringify(body.x402, null, 2));
|
|
33
|
+
lines.push("```");
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
lines.push(`**Server response:**`);
|
|
37
|
+
lines.push("```json");
|
|
38
|
+
lines.push(JSON.stringify(body, null, 2));
|
|
39
|
+
lines.push("```");
|
|
40
|
+
}
|
|
41
|
+
lines.push(``);
|
|
42
|
+
lines.push(`The user's wallet or payment agent must send the required amount. ` +
|
|
43
|
+
`Once payment is confirmed, retry this tool call.`);
|
|
44
|
+
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
45
|
+
}
|
|
46
|
+
if (!res.ok)
|
|
47
|
+
return formatApiError(res, "renewing project");
|
|
48
|
+
const body = res.body;
|
|
49
|
+
// Update key store with new expiry
|
|
50
|
+
saveProject(args.project_id, {
|
|
51
|
+
...project,
|
|
52
|
+
tier: body.tier,
|
|
53
|
+
expires_at: body.lease_expires_at,
|
|
54
|
+
});
|
|
55
|
+
return {
|
|
56
|
+
content: [
|
|
57
|
+
{
|
|
58
|
+
type: "text",
|
|
59
|
+
text: `Project \`${body.project_id}\` renewed. New expiry: **${body.lease_expires_at}**`,
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=renew.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renew.js","sourceRoot":"","sources":["../../src/tools/renew.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MA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tC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAC3B,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CAoDhF"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { getWalletPath } from "../config.js";
|
|
2
|
+
import { readWallet, saveWallet } from "../wallet.js";
|
|
3
|
+
import { randomBytes, createECDH } from "node:crypto";
|
|
4
|
+
import { keccak_256 } from "@noble/hashes/sha3.js";
|
|
5
|
+
export const walletCreateSchema = {};
|
|
6
|
+
export async function handleWalletCreate(_args) {
|
|
7
|
+
const walletPath = getWalletPath();
|
|
8
|
+
const existing = readWallet();
|
|
9
|
+
if (existing) {
|
|
10
|
+
return {
|
|
11
|
+
content: [
|
|
12
|
+
{
|
|
13
|
+
type: "text",
|
|
14
|
+
text: `Wallet already exists at \`${walletPath}\`.\n\nAddress: \`${existing.address}\`\n\nUse \`wallet_status\` to check details.`,
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
isError: true,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
// Generate private key
|
|
21
|
+
const privateKeyBytes = randomBytes(32);
|
|
22
|
+
const privateKey = `0x${privateKeyBytes.toString("hex")}`;
|
|
23
|
+
// Derive public key using secp256k1
|
|
24
|
+
const ecdh = createECDH("secp256k1");
|
|
25
|
+
ecdh.setPrivateKey(privateKeyBytes);
|
|
26
|
+
const uncompressedPubKey = ecdh.getPublicKey();
|
|
27
|
+
// Remove the 04 prefix (uncompressed point marker)
|
|
28
|
+
const pubKeyBody = uncompressedPubKey.subarray(1);
|
|
29
|
+
// Ethereum address = last 20 bytes of keccak256(publicKey)
|
|
30
|
+
const hash = keccak_256(pubKeyBody);
|
|
31
|
+
const addressBytes = hash.slice(-20);
|
|
32
|
+
const address = `0x${Buffer.from(addressBytes).toString("hex")}`;
|
|
33
|
+
// Save wallet using core's atomic write
|
|
34
|
+
saveWallet({
|
|
35
|
+
address,
|
|
36
|
+
privateKey,
|
|
37
|
+
created: new Date().toISOString(),
|
|
38
|
+
funded: false,
|
|
39
|
+
});
|
|
40
|
+
const lines = [
|
|
41
|
+
`## Wallet Created`,
|
|
42
|
+
``,
|
|
43
|
+
`| Field | Value |`,
|
|
44
|
+
`|-------|-------|`,
|
|
45
|
+
`| address | \`${address}\` |`,
|
|
46
|
+
`| saved to | \`${walletPath}\` |`,
|
|
47
|
+
``,
|
|
48
|
+
`Use \`request_faucet\` to fund it with testnet USDC, or send USDC on any supported chain.`,
|
|
49
|
+
];
|
|
50
|
+
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=wallet-create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet-create.js","sourceRoot":"","sources":["../../src/tools/wallet-create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAErC,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,KAA4B;IAE5B,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IAEnC,MAAM,QAAQ,GAAG,UAAU,EAAE,CAAC;IAC9B,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,8BAA8B,UAAU,qBAAqB,QAAQ,CAAC,OAAO,+CAA+C;iBACnI;aACF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.d.ts","sourceRoot":"","sources":["../../src/tools/wallet-export.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB,IAAK,CAAC;AAErC,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAC3B,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CAkBhF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { readWallet } from "../wallet.js";
|
|
2
|
+
export const walletExportSchema = {};
|
|
3
|
+
export async function handleWalletExport(_args) {
|
|
4
|
+
const wallet = readWallet();
|
|
5
|
+
if (!wallet) {
|
|
6
|
+
return {
|
|
7
|
+
content: [
|
|
8
|
+
{
|
|
9
|
+
type: "text",
|
|
10
|
+
text: "No wallet found. Use `wallet_create` to create one.",
|
|
11
|
+
},
|
|
12
|
+
],
|
|
13
|
+
isError: true,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
content: [{ type: "text", text: wallet.address }],
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=wallet-export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet-export.js","sourceRoot":"","sources":["../../src/tools/wallet-export.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAErC,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,KAA4B;IAE5B,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAE5B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,qDAAqD;iBAC5D;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;KAClD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet-status.d.ts","sourceRoot":"","sources":["../../src/tools/wallet-status.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB,IAAK,CAAC;AAErC,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAC3B,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CA0BhF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { getWalletPath } from "../config.js";
|
|
2
|
+
import { readWallet } from "../wallet.js";
|
|
3
|
+
export const walletStatusSchema = {};
|
|
4
|
+
export async function handleWalletStatus(_args) {
|
|
5
|
+
const walletPath = getWalletPath();
|
|
6
|
+
const wallet = readWallet();
|
|
7
|
+
if (!wallet) {
|
|
8
|
+
return {
|
|
9
|
+
content: [
|
|
10
|
+
{
|
|
11
|
+
type: "text",
|
|
12
|
+
text: "No wallet found. Use `wallet_create` to create one.",
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
const lines = [
|
|
18
|
+
`## Wallet Status`,
|
|
19
|
+
``,
|
|
20
|
+
`| Field | Value |`,
|
|
21
|
+
`|-------|-------|`,
|
|
22
|
+
`| address | \`${wallet.address}\` |`,
|
|
23
|
+
`| created | ${wallet.created || "unknown"} |`,
|
|
24
|
+
`| funded | ${wallet.funded ? "yes" : "no"} |`,
|
|
25
|
+
];
|
|
26
|
+
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=wallet-status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet-status.js","sourceRoot":"","sources":["../../src/tools/wallet-status.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAErC,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,KAA4B;IAE5B,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IACnC,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAE5B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,qDAAqD;iBAC5D;aACF;SACF,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,GAAG;QACZ,kBAAkB;QAClB,EAAE;QACF,mBAAmB;QACnB,mBAAmB;QACnB,iBAAiB,MAAM,CAAC,OAAO,MAAM;QACrC,eAAe,MAAM,CAAC,OAAO,IAAI,SAAS,IAAI;QAC9C,cAAc,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI;KAC/C,CAAC;IAEF,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wallet auth helper — re-exports core signing + adds MCP-specific error wrapper.
|
|
3
|
+
*/
|
|
4
|
+
import { getWalletAuthHeaders as _getWalletAuthHeaders, type WalletAuthHeaders } from "../core/dist/wallet-auth.js";
|
|
5
|
+
export type { WalletAuthHeaders };
|
|
6
|
+
export declare const getWalletAuthHeaders: typeof _getWalletAuthHeaders;
|
|
7
|
+
/**
|
|
8
|
+
* Get wallet auth headers or return an MCP error result.
|
|
9
|
+
*/
|
|
10
|
+
export declare function requireWalletAuth(): {
|
|
11
|
+
headers: WalletAuthHeaders;
|
|
12
|
+
} | {
|
|
13
|
+
error: {
|
|
14
|
+
content: Array<{
|
|
15
|
+
type: "text";
|
|
16
|
+
text: string;
|
|
17
|
+
}>;
|
|
18
|
+
isError: true;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=wallet-auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet-auth.d.ts","sourceRoot":"","sources":["../src/wallet-auth.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,oBAAoB,IAAI,qBAAqB,EAAE,KAAK,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEpH,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAElC,eAAO,MAAM,oBAAoB,8BAAwB,CAAC;AAE1D;;GAEG;AACH,wBAAgB,iBAAiB,IAAI;IACnC,OAAO,EAAE,iBAAiB,CAAC;CAC5B,GAAG;IACF,KAAK,EAAE;QAAE,OAAO,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QAAC,OAAO,EAAE,IAAI,CAAA;KAAE,CAAC;CAC1E,CAgBA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wallet auth helper — re-exports core signing + adds MCP-specific error wrapper.
|
|
3
|
+
*/
|
|
4
|
+
import { getWalletAuthHeaders as _getWalletAuthHeaders } from "../core/dist/wallet-auth.js";
|
|
5
|
+
export const getWalletAuthHeaders = _getWalletAuthHeaders;
|
|
6
|
+
/**
|
|
7
|
+
* Get wallet auth headers or return an MCP error result.
|
|
8
|
+
*/
|
|
9
|
+
export function requireWalletAuth() {
|
|
10
|
+
const headers = getWalletAuthHeaders();
|
|
11
|
+
if (!headers) {
|
|
12
|
+
return {
|
|
13
|
+
error: {
|
|
14
|
+
content: [
|
|
15
|
+
{
|
|
16
|
+
type: "text",
|
|
17
|
+
text: "Error: No wallet configured. Use `wallet_create` to create a wallet first, then `request_faucet` to fund it.",
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
isError: true,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
return { headers };
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=wallet-auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet-auth.js","sourceRoot":"","sources":["../src/wallet-auth.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,oBAAoB,IAAI,qBAAqB,EAA0B,MAAM,6BAA6B,CAAC;AAIpH,MAAM,CAAC,MAAM,oBAAoB,GAAG,qBAAqB,CAAC;AAE1D;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAK/B,MAAM,OAAO,GAAG,oBAAoB,EAAE,CAAC;IACvC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO;YACL,KAAK,EAAE;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,8GAA8G;qBACrH;iBACF;gBACD,OAAO,EAAE,IAAI;aACd;SACF,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,CAAC;AACrB,CAAC"}
|
package/dist/wallet.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../src/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAChE,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC"}
|
package/dist/wallet.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet.js","sourceRoot":"","sources":["../src/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "run402-mcp",
|
|
3
|
-
"version": "1.33.
|
|
3
|
+
"version": "1.33.2",
|
|
4
4
|
"description": "MCP server for Run402 — AI-native Postgres databases with REST API, auth, storage, and row-level security. Pay with x402 USDC micropayments.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
],
|
|
40
40
|
"repository": {
|
|
41
41
|
"type": "git",
|
|
42
|
-
"url": "git+https://github.com/kychee-com/run402
|
|
42
|
+
"url": "git+https://github.com/kychee-com/run402.git"
|
|
43
43
|
},
|
|
44
44
|
"homepage": "https://run402.com",
|
|
45
|
-
"bugs": "https://github.com/kychee-com/run402
|
|
45
|
+
"bugs": "https://github.com/kychee-com/run402/issues",
|
|
46
46
|
"author": "Kychee Technologies",
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|