@openclawcash/mcp-server 0.1.4 → 0.1.6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # OpenClawCash MCP Server
2
2
 
3
- This folder contains the public OpenClawCash stdio MCP server package that exposes OpenClawCash agent wallet operations as MCP tools.
3
+ This folder contains the public OpenClawCash stdio MCP server package, which exposes OpenClawCash agent operations as MCP tools.
4
4
 
5
5
  It is a thin adapter over the existing OpenClawCash agent API at `https://openclawcash.com/api/agent/*`.
6
6
 
@@ -8,17 +8,60 @@ Canonical docs page: `https://openclawcash.com/mcp`
8
8
 
9
9
  ## What It Exposes
10
10
 
11
+ Wallet and profile tools:
12
+
11
13
  - `wallets_list`
12
14
  - `wallet_get`
13
15
  - `transactions_list`
14
16
  - `balances_get`
15
17
  - `supported_tokens_list`
18
+ - `user_tag_get`
19
+ - `user_tag_set`
20
+ - `wallet_create`
21
+ - `wallet_import`
22
+
23
+ Trading and transfer tools:
24
+
16
25
  - `transfer_send`
17
26
  - `swap_quote`
18
27
  - `swap_execute`
19
28
  - `approve_token`
20
- - `wallet_create`
21
- - `wallet_import`
29
+
30
+ Get Paid checkout tools:
31
+
32
+ - `checkout_payreq_create`
33
+ - `checkout_payreq_get`
34
+ - `checkout_escrow_get`
35
+ - `checkout_funding_confirm`
36
+ - `checkout_accept`
37
+ - `checkout_proof_submit`
38
+ - `checkout_dispute_open`
39
+ - `checkout_quick_pay`
40
+ - `checkout_swap_and_pay`
41
+ - `checkout_fund` (quick-pay first, swap fallback)
42
+ - `checkout_release`
43
+ - `checkout_refund`
44
+ - `checkout_cancel`
45
+ - `checkout_webhooks_list`
46
+ - `checkout_webhook_create`
47
+ - `checkout_webhook_update`
48
+ - `checkout_webhook_delete`
49
+
50
+ Polymarket tools:
51
+
52
+ - `polymarket_market_resolve`
53
+ - `polymarket_order_limit`
54
+ - `polymarket_order_market`
55
+ - `polymarket_account`
56
+ - `polymarket_orders`
57
+ - `polymarket_cancel_order`
58
+ - `polymarket_clear_integration`
59
+ - `polymarket_activity`
60
+ - `polymarket_positions`
61
+
62
+ Utility tool:
63
+
64
+ - `openclawcash-self-test`
22
65
 
23
66
  It also exposes two lightweight MCP resources:
24
67
 
@@ -222,6 +265,10 @@ The MCP server itself does not hold approval memory. The MCP client or agent run
222
265
  - `swap_quote` is read-only, but still requires an agent key.
223
266
  - `supported_tokens_list` is read-only, but still requires an agent key.
224
267
  - `transfer_send`, `swap_execute`, `approve_token`, `wallet_create`, and `wallet_import` are write tools.
268
+ - `transfer_send` is for normal wallet transfers. For checkout escrow funding, use checkout tools:
269
+ - `checkout_quick_pay` for direct settlement funding
270
+ - `checkout_swap_and_pay` for asset mismatch funding
271
+ - `checkout_funding_confirm` to confirm external/manual funding transactions
225
272
  - For `wallet_get`, `transactions_list`, `supported_tokens_list`, and `swap_quote`, pass at most one wallet selector when using `walletId`, `walletLabel`, or `walletAddress`.
226
273
  - The server uses stdio transport and is intended for MCP-compatible desktop or agent clients.
227
274
 
@@ -7,7 +7,7 @@ import { fileURLToPath } from "node:url";
7
7
  import { z } from "zod";
8
8
 
9
9
  const SERVER_NAME = "openclawcash";
10
- const SERVER_VERSION = "0.1.6";
10
+ const SERVER_VERSION = "0.1.9";
11
11
  const PROTOCOL_VERSION = "2024-11-05";
12
12
  const DEFAULT_BASE_URL = "https://openclawcash.com";
13
13
 
@@ -250,6 +250,25 @@ const polymarketCancelArgsSchema = z
250
250
  message: "Provide exactly one of walletId or walletAddress.",
251
251
  });
252
252
 
253
+ const polymarketUnlinkArgsSchema = z
254
+ .object({
255
+ walletId: z.union([z.number().int().positive(), z.string().min(1)]).optional(),
256
+ walletAddress: z.string().min(1).optional(),
257
+ })
258
+ .refine((data) => [data.walletId, data.walletAddress].filter((v) => v !== undefined).length === 1, {
259
+ message: "Provide exactly one of walletId or walletAddress.",
260
+ });
261
+
262
+ const polymarketMarketResolveArgsSchema = z
263
+ .object({
264
+ marketUrl: z.string().url().optional(),
265
+ slug: z.string().min(1).optional(),
266
+ outcome: z.string().min(1),
267
+ })
268
+ .refine((data) => [data.marketUrl, data.slug].filter((v) => v !== undefined).length === 1, {
269
+ message: "Provide exactly one of marketUrl or slug.",
270
+ });
271
+
253
272
  const checkoutEscrowIdArgsSchema = z.object({
254
273
  id: z.string().min(1),
255
274
  });
@@ -316,6 +335,18 @@ const checkoutSwapAndPayArgsSchema = z
316
335
  message: "Provide exactly one of walletId or walletAddress.",
317
336
  });
318
337
 
338
+ const checkoutFundArgsSchema = z
339
+ .object({
340
+ id: z.string().min(1),
341
+ walletId: z.union([z.number().int().positive(), z.string().min(1)]).optional(),
342
+ walletAddress: z.string().min(1).optional(),
343
+ slippage: z.number().positive().max(5).optional(),
344
+ allowSwapFallback: z.boolean().optional(),
345
+ })
346
+ .refine((data) => [data.walletId, data.walletAddress].filter((v) => v !== undefined).length === 1, {
347
+ message: "Provide exactly one of walletId or walletAddress.",
348
+ });
349
+
319
350
  const checkoutWebhookCreateArgsSchema = z.object({
320
351
  url: z.string().url(),
321
352
  eventTypes: z.array(z.string().min(1)).optional(),
@@ -523,7 +554,9 @@ const tools = [
523
554
  },
524
555
  {
525
556
  name: "transfer_send",
526
- description: withWriteSafety("Send a native asset or token transfer from a managed wallet."),
557
+ description: withWriteSafety(
558
+ "Send a native asset or token transfer from a managed wallet. Do not use for checkout escrow funding; use checkout_quick_pay or checkout_swap_and_pay.",
559
+ ),
527
560
  inputSchema: {
528
561
  type: "object",
529
562
  properties: {
@@ -541,12 +574,37 @@ const tools = [
541
574
  additionalProperties: false,
542
575
  },
543
576
  parse: (args) => transferArgsSchema.parse(args ?? {}),
544
- execute: async (args) =>
545
- callAgentApi({
546
- method: "POST",
547
- pathName: "/api/agent/transfer",
548
- body: args,
549
- }),
577
+ execute: async (args) => {
578
+ try {
579
+ return await callAgentApi({
580
+ method: "POST",
581
+ pathName: "/api/agent/transfer",
582
+ body: args,
583
+ });
584
+ } catch (error) {
585
+ const payload = error?.payload;
586
+ const code = typeof payload?.code === "string" ? payload.code : "";
587
+ if (code === "unsupported_funding_asset" || code === "unsupported_funding_network") {
588
+ const enriched = new Error(
589
+ [
590
+ "Checkout escrow funding is restricted to checkout funding endpoints.",
591
+ "Use `checkout_quick_pay` (direct settlement) or `checkout_swap_and_pay` (asset mismatch), then `checkout_funding_confirm` if needed.",
592
+ ].join(" "),
593
+ );
594
+ enriched.status = error?.status;
595
+ enriched.payload = {
596
+ ...(payload && typeof payload === "object" ? payload : {}),
597
+ mcpHints: {
598
+ quickPayTool: "checkout_quick_pay",
599
+ swapAndPayTool: "checkout_swap_and_pay",
600
+ fundingConfirmTool: "checkout_funding_confirm",
601
+ },
602
+ };
603
+ throw enriched;
604
+ }
605
+ throw error;
606
+ }
607
+ },
550
608
  },
551
609
  {
552
610
  name: "swap_quote",
@@ -919,6 +977,78 @@ const tools = [
919
977
  });
920
978
  },
921
979
  },
980
+ {
981
+ name: "checkout_fund",
982
+ description: withWriteSafety(
983
+ "Default escrow funding flow: try direct quick-pay first, then automatically fallback to swap-and-pay when required.",
984
+ ),
985
+ inputSchema: {
986
+ type: "object",
987
+ properties: {
988
+ id: { type: "string" },
989
+ walletId: { oneOf: [{ type: "integer" }, { type: "string" }] },
990
+ walletAddress: { type: "string" },
991
+ slippage: { type: "number" },
992
+ allowSwapFallback: { type: "boolean", description: "Defaults to true." },
993
+ },
994
+ required: ["id"],
995
+ additionalProperties: false,
996
+ },
997
+ parse: (args) => checkoutFundArgsSchema.parse(args ?? {}),
998
+ execute: async (args) => {
999
+ const { id, walletId, walletAddress, slippage, allowSwapFallback = true } = args;
1000
+ const selector = {
1001
+ ...(walletId !== undefined ? { walletId } : {}),
1002
+ ...(walletAddress !== undefined ? { walletAddress } : {}),
1003
+ };
1004
+
1005
+ try {
1006
+ const quickPay = await callAgentApi({
1007
+ method: "POST",
1008
+ pathName: `/api/agent/checkout/escrows/${encodeURIComponent(id)}/quick-pay`,
1009
+ body: selector,
1010
+ });
1011
+ return {
1012
+ strategy: "quick-pay",
1013
+ fallbackUsed: false,
1014
+ quickPay,
1015
+ };
1016
+ } catch (error) {
1017
+ const code = typeof error?.payload?.code === "string" ? error.payload.code : "";
1018
+ if (code !== "quick_pay_requires_swap" || !allowSwapFallback) {
1019
+ throw error;
1020
+ }
1021
+
1022
+ const quotePreview = await callAgentApi({
1023
+ method: "POST",
1024
+ pathName: `/api/agent/checkout/escrows/${encodeURIComponent(id)}/swap-and-pay`,
1025
+ body: {
1026
+ ...selector,
1027
+ ...(slippage !== undefined ? { slippage } : {}),
1028
+ confirm: false,
1029
+ },
1030
+ });
1031
+
1032
+ const swapAndPay = await callAgentApi({
1033
+ method: "POST",
1034
+ pathName: `/api/agent/checkout/escrows/${encodeURIComponent(id)}/swap-and-pay`,
1035
+ body: {
1036
+ ...selector,
1037
+ ...(slippage !== undefined ? { slippage } : {}),
1038
+ confirm: true,
1039
+ },
1040
+ });
1041
+
1042
+ return {
1043
+ strategy: "swap-and-pay",
1044
+ fallbackUsed: true,
1045
+ fallbackReason: code,
1046
+ quote: quotePreview?.quote || null,
1047
+ swapAndPay,
1048
+ };
1049
+ }
1050
+ },
1051
+ },
922
1052
  {
923
1053
  name: "checkout_release",
924
1054
  description: withWriteSafety("Release checkout escrow to seller."),
@@ -1056,9 +1186,30 @@ const tools = [
1056
1186
  pathName: `/api/agent/checkout/webhooks/${encodeURIComponent(String(args.id))}`,
1057
1187
  }),
1058
1188
  },
1189
+ {
1190
+ name: "polymarket_market_resolve",
1191
+ description: "Resolve a Polymarket market URL/slug and human-readable outcome label to the exact CLOB tokenId required by order tools.",
1192
+ inputSchema: {
1193
+ type: "object",
1194
+ properties: {
1195
+ marketUrl: { type: "string", description: "Polymarket market or event URL." },
1196
+ slug: { type: "string", description: "Polymarket market slug (alternative to marketUrl)." },
1197
+ outcome: { type: "string", description: "Outcome label, e.g. Yes, No, Trump, Harris." },
1198
+ },
1199
+ required: ["outcome"],
1200
+ additionalProperties: false,
1201
+ },
1202
+ parse: (args) => polymarketMarketResolveArgsSchema.parse(args ?? {}),
1203
+ execute: async (args) =>
1204
+ callAgentApi({
1205
+ method: "GET",
1206
+ pathName: "/api/agent/venues/polymarket/market/resolve",
1207
+ query: args,
1208
+ }),
1209
+ },
1059
1210
  {
1060
1211
  name: "polymarket_order_limit",
1061
- description: withWriteSafety("Place a Polymarket limit order from a configured polygon-mainnet wallet."),
1212
+ description: withWriteSafety("Place a Polymarket limit order from a configured polygon-mainnet wallet. Use this for explicit target-price orders; for close-position intent, prefer market SELL unless a limit price is explicitly requested."),
1062
1213
  inputSchema: {
1063
1214
  type: "object",
1064
1215
  properties: {
@@ -1082,7 +1233,7 @@ const tools = [
1082
1233
  },
1083
1234
  {
1084
1235
  name: "polymarket_order_market",
1085
- description: withWriteSafety("Place a Polymarket market order from a configured polygon-mainnet wallet."),
1236
+ description: withWriteSafety("Place a Polymarket market order from a configured polygon-mainnet wallet. For close-position intent on open markets, default to side=SELL (SELL amount is shares); use limit SELL only for explicit target-price requests."),
1086
1237
  inputSchema: {
1087
1238
  type: "object",
1088
1239
  properties: {
@@ -1167,6 +1318,25 @@ const tools = [
1167
1318
  body: args,
1168
1319
  }),
1169
1320
  },
1321
+ {
1322
+ name: "polymarket_clear_integration",
1323
+ description: withWriteSafety("Clear Polymarket integration for a configured polygon-mainnet wallet."),
1324
+ inputSchema: {
1325
+ type: "object",
1326
+ properties: {
1327
+ walletId: { oneOf: [{ type: "integer" }, { type: "string" }] },
1328
+ walletAddress: { type: "string" },
1329
+ },
1330
+ additionalProperties: false,
1331
+ },
1332
+ parse: (args) => polymarketUnlinkArgsSchema.parse(args ?? {}),
1333
+ execute: async (args) =>
1334
+ callAgentApi({
1335
+ method: "POST",
1336
+ pathName: "/api/agent/venues/polymarket/unlink",
1337
+ body: args,
1338
+ }),
1339
+ },
1170
1340
  {
1171
1341
  name: "polymarket_activity",
1172
1342
  description: "List Polymarket trade activity for a configured polygon-mainnet wallet.",
@@ -1235,8 +1405,9 @@ const resources = [
1235
1405
  "2. Use `wallets_list` first to discover managed wallets.",
1236
1406
  "3. Use `wallet_get` or `balances_get` before write actions.",
1237
1407
  "4. For writes, establish approval mode once per session.",
1238
- "5. Use `swap_quote` before `swap_execute`.",
1239
- "6. For Polymarket: ask your human to complete setup in dashboard (/venues/polymarket), then place/cancel orders and inspect account/activity/positions via polymarket tools.",
1408
+ "5. For checkout escrow funding, use `checkout_fund` (quick-pay first, swap fallback when needed).",
1409
+ "6. Use `swap_quote` before `swap_execute` for non-checkout swaps.",
1410
+ "7. For Polymarket: ask your human to complete setup in dashboard (/venues/polymarket), then place/cancel orders and inspect account/activity/positions via polymarket tools.",
1240
1411
  ].join("\n"),
1241
1412
  },
1242
1413
  ];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@openclawcash/mcp-server",
3
- "version": "0.1.4",
4
- "description": "OpenClawCash MCP server for managed agent wallets, balances, transfers, swaps, and approvals.",
3
+ "version": "0.1.6",
4
+ "description": "OpenClawCash MCP server for managed agent wallets, balances, transfers, swaps, approvals, Get Paid checkout escrow flows, and Polymarket market resolution/order tools.",
5
5
  "type": "module",
6
6
  "license": "Proprietary",
7
7
  "homepage": "https://openclawcash.com/mcp",