@moonpay/cli 0.6.15 → 0.6.17
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/dist/chunk-77AT5BZQ.js +25 -0
- package/dist/chunk-WLQU5BOQ.js +3 -0
- package/dist/index.js +15 -405
- package/dist/mcp-L2RILWER.js +2 -0
- package/dist/store-XV77WYWO.js +2 -0
- package/package.json +1 -1
- package/skills/moonpay-buy-crypto/SKILL.md +4 -3
- package/dist/chunk-7KJP7F5Q.js +0 -7866
- package/dist/chunk-7KJP7F5Q.js.map +0 -1
- package/dist/chunk-ZYYH3VNA.js +0 -511
- package/dist/chunk-ZYYH3VNA.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/mcp-7EFPAPL5.js +0 -128
- package/dist/mcp-7EFPAPL5.js.map +0 -1
- package/dist/store-6OIOBMHW.js +0 -22
- package/dist/store-6OIOBMHW.js.map +0 -1
package/dist/mcp-7EFPAPL5.js
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
LOCAL_TOOLS,
|
|
4
|
-
callTool,
|
|
5
|
-
resolveBaseUrl,
|
|
6
|
-
schemas_default
|
|
7
|
-
} from "./chunk-7KJP7F5Q.js";
|
|
8
|
-
import "./chunk-ZYYH3VNA.js";
|
|
9
|
-
|
|
10
|
-
// src/mcp.ts
|
|
11
|
-
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
12
|
-
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
13
|
-
import {
|
|
14
|
-
CallToolRequestSchema,
|
|
15
|
-
ListToolsRequestSchema
|
|
16
|
-
} from "@modelcontextprotocol/sdk/types.js";
|
|
17
|
-
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
18
|
-
var localToolMap = new Map(LOCAL_TOOLS.map((t) => [t.schema.name, t]));
|
|
19
|
-
function resolveRemoteSchema(schema) {
|
|
20
|
-
const input = schema.inputSchema;
|
|
21
|
-
if (input.$ref && input.definitions) {
|
|
22
|
-
const defName = input.$ref.replace("#/definitions/", "");
|
|
23
|
-
return input.definitions[defName] ?? input;
|
|
24
|
-
}
|
|
25
|
-
return input;
|
|
26
|
-
}
|
|
27
|
-
async function startMcpServer() {
|
|
28
|
-
const server = new Server(
|
|
29
|
-
{ name: "moonpay", version: "1.0.0" },
|
|
30
|
-
{ capabilities: { tools: { listChanged: true } } }
|
|
31
|
-
);
|
|
32
|
-
const toolDefs = LOCAL_TOOLS.map((tool) => ({
|
|
33
|
-
name: tool.schema.name,
|
|
34
|
-
description: tool.schema.description,
|
|
35
|
-
inputSchema: zodToJsonSchema(tool.schema.input)
|
|
36
|
-
}));
|
|
37
|
-
const remotePropsMap = /* @__PURE__ */ new Map();
|
|
38
|
-
for (const schema of schemas_default) {
|
|
39
|
-
if (localToolMap.has(schema.name)) continue;
|
|
40
|
-
const resolved = resolveRemoteSchema(schema);
|
|
41
|
-
remotePropsMap.set(
|
|
42
|
-
schema.name,
|
|
43
|
-
resolved.properties ?? {}
|
|
44
|
-
);
|
|
45
|
-
toolDefs.push({
|
|
46
|
-
name: schema.name,
|
|
47
|
-
description: schema.description,
|
|
48
|
-
inputSchema: {
|
|
49
|
-
type: "object",
|
|
50
|
-
properties: resolved.properties ?? {},
|
|
51
|
-
...resolved.required ? { required: resolved.required } : {},
|
|
52
|
-
...resolved.additionalProperties !== void 0 ? { additionalProperties: resolved.additionalProperties } : {}
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
const toolDefMap = new Map(toolDefs.map((t) => [t.name, t]));
|
|
57
|
-
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
58
|
-
tools: toolDefs.map((t) => ({
|
|
59
|
-
name: t.name,
|
|
60
|
-
description: t.description,
|
|
61
|
-
inputSchema: t.inputSchema
|
|
62
|
-
}))
|
|
63
|
-
}));
|
|
64
|
-
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
65
|
-
const { name, arguments: params = {} } = request.params;
|
|
66
|
-
if (!toolDefMap.has(name)) {
|
|
67
|
-
return {
|
|
68
|
-
content: [{ type: "text", text: `Unknown tool: ${name}` }],
|
|
69
|
-
isError: true
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
try {
|
|
73
|
-
const localTool = localToolMap.get(name);
|
|
74
|
-
if (localTool) {
|
|
75
|
-
const shape = localTool.schema.input.shape ?? {};
|
|
76
|
-
for (const [key, field] of Object.entries(shape)) {
|
|
77
|
-
if (params[key] === void 0 && field._def.typeName === "ZodNullable") {
|
|
78
|
-
params[key] = null;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
const result2 = await localTool.handler(params);
|
|
82
|
-
return {
|
|
83
|
-
content: [
|
|
84
|
-
{ type: "text", text: JSON.stringify(result2, null, 2) }
|
|
85
|
-
]
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
const props = remotePropsMap.get(name) ?? {};
|
|
89
|
-
for (const [key, prop] of Object.entries(props)) {
|
|
90
|
-
if (params[key] === void 0) {
|
|
91
|
-
const nullable = Array.isArray(prop.type) ? prop.type.includes("null") : prop.anyOf?.some((t) => t.type === "null");
|
|
92
|
-
if (nullable) params[key] = null;
|
|
93
|
-
}
|
|
94
|
-
const isNum = prop.type === "number" || prop.type === "integer" || Array.isArray(prop.type) && prop.type.some(
|
|
95
|
-
(t) => t === "number" || t === "integer"
|
|
96
|
-
) || prop.anyOf?.some(
|
|
97
|
-
(t) => t.type === "number" || t.type === "integer"
|
|
98
|
-
);
|
|
99
|
-
if (isNum && typeof params[key] === "string") {
|
|
100
|
-
params[key] = Number(params[key]);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
const baseUrl = resolveBaseUrl();
|
|
104
|
-
const result = await callTool(baseUrl, name, params);
|
|
105
|
-
return {
|
|
106
|
-
content: [
|
|
107
|
-
{ type: "text", text: JSON.stringify(result, null, 2) }
|
|
108
|
-
]
|
|
109
|
-
};
|
|
110
|
-
} catch (error) {
|
|
111
|
-
return {
|
|
112
|
-
content: [
|
|
113
|
-
{
|
|
114
|
-
type: "text",
|
|
115
|
-
text: error instanceof Error ? error.message : String(error)
|
|
116
|
-
}
|
|
117
|
-
],
|
|
118
|
-
isError: true
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
const transport = new StdioServerTransport();
|
|
123
|
-
await server.connect(transport);
|
|
124
|
-
}
|
|
125
|
-
export {
|
|
126
|
-
startMcpServer
|
|
127
|
-
};
|
|
128
|
-
//# sourceMappingURL=mcp-7EFPAPL5.js.map
|
package/dist/mcp-7EFPAPL5.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/mcp.ts"],"sourcesContent":["import { Server } from \"@modelcontextprotocol/sdk/server/index.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport {\n CallToolRequestSchema,\n ListToolsRequestSchema,\n} from \"@modelcontextprotocol/sdk/types.js\";\nimport { z } from \"zod\";\nimport { zodToJsonSchema } from \"zod-to-json-schema\";\nimport { callTool } from \"./client\";\nimport { resolveBaseUrl } from \"./auth\";\nimport { LOCAL_TOOLS } from \"./local-tools\";\nimport schemas from \"./generated/schemas.json\";\n\nconst localToolMap = new Map(LOCAL_TOOLS.map((t) => [t.schema.name, t]));\n\n/**\n * Resolve a remote schema's $ref to the actual properties object.\n */\nfunction resolveRemoteSchema(schema: (typeof schemas)[number]) {\n const input = schema.inputSchema as any;\n if (input.$ref && input.definitions) {\n const defName = input.$ref.replace(\"#/definitions/\", \"\");\n return input.definitions[defName] ?? input;\n }\n return input;\n}\n\nexport async function startMcpServer() {\n const server = new Server(\n { name: \"moonpay\", version: \"1.0.0\" },\n { capabilities: { tools: { listChanged: true } } },\n );\n\n // Build tool definitions — local tools use Zod→JSON, remote use JSON directly\n const toolDefs: Array<{\n name: string;\n description: string;\n inputSchema: Record<string, unknown>;\n }> = LOCAL_TOOLS.map((tool) => ({\n name: tool.schema.name,\n description: tool.schema.description,\n inputSchema: zodToJsonSchema(tool.schema.input) as Record<string, unknown>,\n }));\n\n const remotePropsMap = new Map<string, Record<string, any>>();\n for (const schema of schemas) {\n if (localToolMap.has(schema.name)) continue;\n const resolved = resolveRemoteSchema(schema);\n remotePropsMap.set(\n schema.name,\n (resolved.properties ?? {}) as Record<string, any>,\n );\n toolDefs.push({\n name: schema.name,\n description: schema.description,\n inputSchema: {\n type: \"object\",\n properties: resolved.properties ?? {},\n ...(resolved.required ? { required: resolved.required } : {}),\n ...(resolved.additionalProperties !== undefined\n ? { additionalProperties: resolved.additionalProperties }\n : {}),\n },\n });\n }\n\n const toolDefMap = new Map(toolDefs.map((t) => [t.name, t]));\n\n // tools/list — return raw JSON schemas directly\n server.setRequestHandler(ListToolsRequestSchema, async () => ({\n tools: toolDefs.map((t) => ({\n name: t.name,\n description: t.description,\n inputSchema: t.inputSchema,\n })),\n }));\n\n // tools/call\n server.setRequestHandler(CallToolRequestSchema, async (request) => {\n const { name, arguments: params = {} } = request.params;\n\n if (!toolDefMap.has(name)) {\n return {\n content: [{ type: \"text\" as const, text: `Unknown tool: ${name}` }],\n isError: true,\n };\n }\n\n try {\n // Local tool — coerce nullable fields then run handler\n const localTool = localToolMap.get(name);\n if (localTool) {\n // Fill missing nullable fields with null (MCP clients may omit them)\n const shape = (localTool.schema.input as z.ZodObject<z.ZodRawShape>).shape ?? {};\n for (const [key, field] of Object.entries(shape)) {\n if (\n params[key] === undefined &&\n (field as z.ZodTypeAny)._def.typeName === \"ZodNullable\"\n ) {\n params[key] = null;\n }\n }\n\n const result = await localTool.handler(params);\n return {\n content: [\n { type: \"text\" as const, text: JSON.stringify(result, null, 2) },\n ],\n };\n }\n\n // Remote tool — coerce types then call API\n const props = remotePropsMap.get(name) ?? {};\n for (const [key, prop] of Object.entries(props)) {\n if (params[key] === undefined) {\n const nullable = Array.isArray(prop.type)\n ? prop.type.includes(\"null\")\n : prop.anyOf?.some((t: any) => t.type === \"null\");\n if (nullable) params[key] = null;\n }\n const isNum =\n prop.type === \"number\" ||\n prop.type === \"integer\" ||\n (Array.isArray(prop.type) &&\n prop.type.some(\n (t: string) => t === \"number\" || t === \"integer\",\n )) ||\n prop.anyOf?.some(\n (t: any) => t.type === \"number\" || t.type === \"integer\",\n );\n if (isNum && typeof params[key] === \"string\") {\n params[key] = Number(params[key]);\n }\n }\n\n const baseUrl = resolveBaseUrl();\n const result = await callTool(baseUrl, name, params);\n return {\n content: [\n { type: \"text\" as const, text: JSON.stringify(result, null, 2) },\n ],\n };\n } catch (error) {\n return {\n content: [\n {\n type: \"text\" as const,\n text: error instanceof Error ? error.message : String(error),\n },\n ],\n isError: true,\n };\n }\n });\n\n const transport = new StdioServerTransport();\n await server.connect(transport);\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAS,cAAc;AACvB,SAAS,4BAA4B;AACrC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEP,SAAS,uBAAuB;AAMhC,IAAM,eAAe,IAAI,IAAI,YAAY,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,MAAM,CAAC,CAAC,CAAC;AAKvE,SAAS,oBAAoB,QAAkC;AAC7D,QAAM,QAAQ,OAAO;AACrB,MAAI,MAAM,QAAQ,MAAM,aAAa;AACnC,UAAM,UAAU,MAAM,KAAK,QAAQ,kBAAkB,EAAE;AACvD,WAAO,MAAM,YAAY,OAAO,KAAK;AAAA,EACvC;AACA,SAAO;AACT;AAEA,eAAsB,iBAAiB;AACrC,QAAM,SAAS,IAAI;AAAA,IACjB,EAAE,MAAM,WAAW,SAAS,QAAQ;AAAA,IACpC,EAAE,cAAc,EAAE,OAAO,EAAE,aAAa,KAAK,EAAE,EAAE;AAAA,EACnD;AAGA,QAAM,WAID,YAAY,IAAI,CAAC,UAAU;AAAA,IAC9B,MAAM,KAAK,OAAO;AAAA,IAClB,aAAa,KAAK,OAAO;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AAAA,QACjE;AAAA,MACF;AAAA,IACF,SAAS,OAAO;AACd,aAAO;AAAA,QACL,SAAS;AAAA,UACP;AAAA,YACE,MAAM;AAAA,YACN,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAAA,UAC7D;AAAA,QACF;AAAA,QACA,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF,CAAC;AAED,QAAM,YAAY,IAAI,qBAAqB;AAC3C,QAAM,OAAO,QAAQ,SAAS;AAChC;","names":["result"]}
|
package/dist/store-6OIOBMHW.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
addWallet,
|
|
4
|
-
findWallet,
|
|
5
|
-
findWalletOrThrow,
|
|
6
|
-
loadWallets,
|
|
7
|
-
mutateWallets,
|
|
8
|
-
removeWallet,
|
|
9
|
-
resolveSigningKey,
|
|
10
|
-
saveWallets
|
|
11
|
-
} from "./chunk-ZYYH3VNA.js";
|
|
12
|
-
export {
|
|
13
|
-
addWallet,
|
|
14
|
-
findWallet,
|
|
15
|
-
findWalletOrThrow,
|
|
16
|
-
loadWallets,
|
|
17
|
-
mutateWallets,
|
|
18
|
-
removeWallet,
|
|
19
|
-
resolveSigningKey,
|
|
20
|
-
saveWallets
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=store-6OIOBMHW.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|