@dimcool/mcp 0.1.31 → 0.1.32

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
  # @dimcool/mcp
2
2
 
3
- MCP (Model Context Protocol) server for the **DIM Gaming Platform**. Lets AI agents play games, chat, send USDC, challenge users, and earn referral income — all through a standardized protocol that works with Claude Desktop, Cursor, Claude.ai, OpenAI Agents SDK, and any MCP-compatible framework.
3
+ MCP (Model Context Protocol) server for the **DIM Gaming Platform**. Lets AI agents play games, chat, send USDC, and earn referral income — all through a standardized protocol that works with Claude Desktop, Cursor, Claude.ai, OpenAI Agents SDK, and any MCP-compatible framework.
4
4
 
5
5
  Canonical docs:
6
6
 
@@ -65,7 +65,7 @@ In modes 1–3 call `dim_login` to authenticate. In external signer mode use `di
65
65
 
66
66
  <!-- TOOLS_START -->
67
67
 
68
- **72 tools available.**
68
+ **71 tools available.**
69
69
 
70
70
  ### Authentication
71
71
 
@@ -124,13 +124,6 @@ In modes 1–3 call `dim_login` to authenticate. In external signer mode use `di
124
124
  - `dim_invite_to_lobby` — Invite a friend to your waiting lobby.
125
125
  _`lobbyId` (string, required) · `userId` (string, required)_
126
126
 
127
- ### Challenges
128
-
129
- - `dim_challenge_user` — Challenge a specific user to a game.
130
- _`gameType` (string, required) · `amount` (number, required) · `targetUsername` (string) · `targetUserId` (string)_
131
- - `dim_accept_challenge` — Accept a challenge that was sent to you.
132
- _`challengeId` (string, required)_
133
-
134
127
  ### Wallet
135
128
 
136
129
  - `dim_get_wallet_address` — Get the Solana wallet address DIM uses for this account.
@@ -187,6 +180,8 @@ In modes 1–3 call `dim_login` to authenticate. In external signer mode use `di
187
180
  - `dim_send_dm` — Send a direct message to another user by their user ID.
188
181
  _`userId` (string, required) · `message` (string, required)_
189
182
  - `dim_list_dm_threads` — List all DM conversation threads with last message info and unread counts.
183
+ - `dim_report_user` — Report a user for cheating, harassment, or other violations.
184
+ _`userId` (string, required) · `reason` (string, required)_
190
185
 
191
186
  ### Referrals
192
187
 
@@ -216,7 +211,7 @@ In modes 1–3 call `dim_login` to authenticate. In external signer mode use `di
216
211
 
217
212
  ### System
218
213
 
219
- - `dim_get_pending_events` — Drain buffered real-time events (DMs, challenges, game turns, match notifications).
214
+ - `dim_get_pending_events` — Drain buffered real-time events (DMs, game turns, match notifications).
220
215
  - `dim_check_notifications` — Check unread notifications, unread DM threads, and incoming friend requests in one call.
221
216
  - `dim_get_agent_config` — Get autonomy scopes, spending limits, and current daily spend.
222
217
 
package/dist/index.js CHANGED
@@ -10964,7 +10964,7 @@ var require_money = __commonJS2({
10964
10964
  "../utils/dist/money.js"(exports) {
10965
10965
  "use strict";
10966
10966
  Object.defineProperty(exports, "__esModule", { value: true });
10967
- exports.SOL_LAMPORTS = exports.MICRO_UNITS = void 0;
10967
+ exports.SOL_MINT = exports.SOL_LAMPORTS = exports.MICRO_UNITS = void 0;
10968
10968
  exports.isSolMint = isSolMint;
10969
10969
  exports.formatMoneyMinor = formatMoneyMinor2;
10970
10970
  exports.toMajor = toMajor2;
@@ -10977,12 +10977,12 @@ var require_money = __commonJS2({
10977
10977
  exports.formatMoneyMinorCompact = formatMoneyMinorCompact;
10978
10978
  exports.MICRO_UNITS = 1e6;
10979
10979
  exports.SOL_LAMPORTS = 1e9;
10980
- var SOL_MINT_LABEL = "SOL";
10980
+ exports.SOL_MINT = "SOL";
10981
10981
  var SOL_SYSTEM_PROGRAM = "11111111111111111111111111111111";
10982
10982
  function isSolMint(mint) {
10983
10983
  if (!mint)
10984
10984
  return false;
10985
- return mint === SOL_MINT_LABEL || mint === SOL_SYSTEM_PROGRAM;
10985
+ return mint === exports.SOL_MINT || mint === SOL_SYSTEM_PROGRAM;
10986
10986
  }
10987
10987
  function formatMoneyMinor2(amountMinor, fractionDigits = 2) {
10988
10988
  return (amountMinor / exports.MICRO_UNITS).toFixed(fractionDigits);
@@ -11086,7 +11086,7 @@ var require_dist = __commonJS2({
11086
11086
  "../utils/dist/index.js"(exports) {
11087
11087
  "use strict";
11088
11088
  Object.defineProperty(exports, "__esModule", { value: true });
11089
- exports.formatMoneyMinorCompact = exports.formatCurrencyPartsForToken = exports.formatCurrencyParts = exports.kformatMoney = exports.kformat = exports.formatSolMinor = exports.toSolMajor = exports.toMajor = exports.formatMoneyMinor = exports.isSolMint = exports.SOL_LAMPORTS = exports.MICRO_UNITS = void 0;
11089
+ exports.formatMoneyMinorCompact = exports.formatCurrencyPartsForToken = exports.formatCurrencyParts = exports.kformatMoney = exports.kformat = exports.formatSolMinor = exports.toSolMajor = exports.toMajor = exports.formatMoneyMinor = exports.isSolMint = exports.SOL_MINT = exports.SOL_LAMPORTS = exports.MICRO_UNITS = void 0;
11090
11090
  var money_1 = require_money();
11091
11091
  Object.defineProperty(exports, "MICRO_UNITS", { enumerable: true, get: function() {
11092
11092
  return money_1.MICRO_UNITS;
@@ -11094,6 +11094,9 @@ var require_dist = __commonJS2({
11094
11094
  Object.defineProperty(exports, "SOL_LAMPORTS", { enumerable: true, get: function() {
11095
11095
  return money_1.SOL_LAMPORTS;
11096
11096
  } });
11097
+ Object.defineProperty(exports, "SOL_MINT", { enumerable: true, get: function() {
11098
+ return money_1.SOL_MINT;
11099
+ } });
11097
11100
  Object.defineProperty(exports, "isSolMint", { enumerable: true, get: function() {
11098
11101
  return money_1.isSolMint;
11099
11102
  } });
@@ -11984,6 +11987,13 @@ var Lobbies = class {
11984
11987
  setLobbyStore(store) {
11985
11988
  this.lobbyStore = store;
11986
11989
  }
11990
+ /**
11991
+ * Create a new game lobby.
11992
+ *
11993
+ * **Important:** Creating a lobby automatically closes and refunds any
11994
+ * existing open or queued lobby for this user. You do not need to manually
11995
+ * leave or cancel a previous lobby before calling this.
11996
+ */
11987
11997
  async createLobby(gameType, betAmount) {
11988
11998
  return this.http.post("/lobbies", { gameType, betAmount });
11989
11999
  }
@@ -12047,21 +12057,6 @@ var Lobbies = class {
12047
12057
  async deleteLobby(lobbyId) {
12048
12058
  return this.http.delete(`/lobbies/admin/${lobbyId}`);
12049
12059
  }
12050
- /**
12051
- * Play again: Create a new lobby and prepare deposit in one flow.
12052
- * Returns the lobby and unsigned transaction that needs to be signed.
12053
- * @param gameType - The game type to play again
12054
- * @param betAmount - The bet amount (same as previous game)
12055
- * @param escrow - The escrow service instance (from sdk.escrow)
12056
- */
12057
- async playAgain(gameType, betAmount, escrow) {
12058
- const lobby = await this.createLobby(gameType, betAmount);
12059
- const { transaction } = await escrow.prepareAndStartDeposit(lobby.id);
12060
- return {
12061
- lobby,
12062
- unsignedTransaction: transaction
12063
- };
12064
- }
12065
12060
  };
12066
12061
  var Games = class {
12067
12062
  constructor(http, wallet, logger2) {
@@ -12581,6 +12576,7 @@ var Achievements = class {
12581
12576
  return this.http.get(`/achievements/users/${userId}`);
12582
12577
  }
12583
12578
  };
12579
+ var import_utils = __toESM2(require_dist(), 1);
12584
12580
  var MIN_TRANSFER_AMOUNT = 5e4;
12585
12581
  var MIN_SOL_TRANSFER_AMOUNT = 1e6;
12586
12582
  var Wallet = class {
@@ -15540,10 +15536,11 @@ var SDK = class {
15540
15536
  return { ...result, lobby };
15541
15537
  }
15542
15538
  };
15543
- var import_utils = __toESM2(require_dist(), 1);
15544
- var export_MICRO_UNITS = import_utils.MICRO_UNITS;
15545
- var export_formatMoneyMinor = import_utils.formatMoneyMinor;
15546
- var export_toMajor = import_utils.toMajor;
15539
+ var import_utils2 = __toESM2(require_dist(), 1);
15540
+ var export_MICRO_UNITS = import_utils2.MICRO_UNITS;
15541
+ var export_SOL_MINT = import_utils.SOL_MINT;
15542
+ var export_formatMoneyMinor = import_utils2.formatMoneyMinor;
15543
+ var export_toMajor = import_utils2.toMajor;
15547
15544
 
15548
15545
  // ../dim-agent-core/src/client.ts
15549
15546
  var import_tweetnacl = __toESM(require_nacl_fast(), 1);
@@ -17116,58 +17113,6 @@ function raceTimeout(promise, ms) {
17116
17113
  });
17117
17114
  }
17118
17115
 
17119
- // ../dim-agent-core/src/tools/challenges.ts
17120
- async function challengeUser(client, args) {
17121
- try {
17122
- if (!args.targetUsername && !args.targetUserId) {
17123
- return {
17124
- error: "Must provide either targetUsername or targetUserId.",
17125
- isError: true
17126
- };
17127
- }
17128
- const spendErr = client.checkSpendLimit(args.amount, true);
17129
- if (spendErr) return { error: spendErr, isError: true };
17130
- const amountMinor = Math.round(args.amount * 1e6);
17131
- const result = await client.sdk.challenges.create({
17132
- gameType: args.gameType,
17133
- amount: amountMinor,
17134
- targetUsername: args.targetUsername,
17135
- targetUserId: args.targetUserId
17136
- });
17137
- client.recordSpend(amountMinor);
17138
- return {
17139
- data: {
17140
- ...result,
17141
- amountFormatted: `$${args.amount.toFixed(2)}`,
17142
- hint: "The challenged user will receive a notification. When they accept, a lobby is created automatically."
17143
- }
17144
- };
17145
- } catch (error) {
17146
- return {
17147
- error: `Failed to create challenge: ${error instanceof Error ? error.message : String(error)}`,
17148
- isError: true
17149
- };
17150
- }
17151
- }
17152
- async function acceptChallenge(client, args) {
17153
- try {
17154
- const result = await client.sdk.challenges.accept(args.challengeId);
17155
- const spectateUrl = result.gameId ? await getSpectateUrl(client) : null;
17156
- return {
17157
- data: {
17158
- ...result,
17159
- ...spectateUrl && { spectateUrl },
17160
- hint: result.gameId ? `Game started! Call dim_game_loop with gameId "${result.gameId}".${spectateUrl ? ` Tell the user they can spectate at ${spectateUrl}` : ""}` : `Lobby created: ${result.lobbyId}. Use dim_join_queue to start matchmaking.`
17161
- }
17162
- };
17163
- } catch (error) {
17164
- return {
17165
- error: `Failed to accept challenge: ${error instanceof Error ? error.message : String(error)}`,
17166
- isError: true
17167
- };
17168
- }
17169
- }
17170
-
17171
17116
  // ../dim-agent-core/src/tools/referrals.ts
17172
17117
  async function getReferralSummary(client) {
17173
17118
  try {
@@ -18577,7 +18522,7 @@ var TOOL_DEFINITIONS = [
18577
18522
  },
18578
18523
  {
18579
18524
  name: "dim_create_lobby",
18580
- description: "Create a new game lobby. Bet amount is in USDC dollars (e.g., 1.00 for $1.00). A 1% fee (min 1 cent) is charged per player.",
18525
+ description: "Create a new game lobby. Bet amount is in USDC dollars (e.g., 1.00 for $1.00). A 1% fee (min 1 cent) is charged per player. NOTE: Creating a lobby automatically closes and refunds any previous open or queued lobby for this user \u2014 you do not need to clean up manually.",
18581
18526
  params: {
18582
18527
  gameType: {
18583
18528
  type: "string",
@@ -18791,45 +18736,6 @@ var TOOL_DEFINITIONS = [
18791
18736
  },
18792
18737
  execute: (c, a) => inviteToLobby(c, a)
18793
18738
  },
18794
- // ── Challenges ───────────────────────────────────────────────────────
18795
- {
18796
- name: "dim_challenge_user",
18797
- description: "Challenge a specific user to a game. This is the best way to invite someone you are chatting with \u2014 they get a notification and can accept directly. Prefer this over creating a lobby when you know who you want to play. Amount must be between $1 and $1000.",
18798
- params: {
18799
- gameType: { type: "string", description: "Game type", required: true },
18800
- amount: {
18801
- type: "number",
18802
- description: "Challenge amount in USDC dollars",
18803
- required: true,
18804
- min: 1,
18805
- max: 1e3
18806
- },
18807
- targetUsername: {
18808
- type: "string",
18809
- description: "Username of the user to challenge"
18810
- },
18811
- targetUserId: {
18812
- type: "string",
18813
- description: "User ID of the user to challenge"
18814
- }
18815
- },
18816
- execute: (c, a) => challengeUser(
18817
- c,
18818
- a
18819
- )
18820
- },
18821
- {
18822
- name: "dim_accept_challenge",
18823
- description: "Accept a challenge that was sent to you.",
18824
- params: {
18825
- challengeId: {
18826
- type: "string",
18827
- description: "The challenge ID to accept",
18828
- required: true
18829
- }
18830
- },
18831
- execute: (c, a) => acceptChallenge(c, a)
18832
- },
18833
18739
  // ── Referrals ────────────────────────────────────────────────────────
18834
18740
  {
18835
18741
  name: "dim_get_referral_summary",
@@ -19102,7 +19008,7 @@ var TOOL_DEFINITIONS = [
19102
19008
  // ── Notifications & Events ───────────────────────────────────────────
19103
19009
  {
19104
19010
  name: "dim_get_pending_events",
19105
- description: "Drain buffered real-time events (DMs, challenges, game turns, match notifications). Call regularly to stay aware.",
19011
+ description: "Drain buffered real-time events (DMs, game turns, match notifications). Call regularly to stay aware.",
19106
19012
  params: {},
19107
19013
  execute: (c) => getPendingEvents(c)
19108
19014
  },
@@ -19381,7 +19287,7 @@ function buildMcpServer(client, mode) {
19381
19287
  const server2 = new McpServer({
19382
19288
  name: "dim",
19383
19289
  version: "1.0.0",
19384
- description: "DIM Gaming Platform \u2014 Play games, chat, send USDC, challenge users, and earn referral income. DIM is noncustodial; your Solana address is returned by dim_get_profile and dim_get_balance. Start by calling dim_login. After login: set a username with dim_set_username, check balance with dim_get_balance, list games with dim_list_games, or apply a referral code with dim_apply_referral_code for a 10% fee discount."
19290
+ description: "DIM Gaming Platform \u2014 Play games, chat, send USDC, and earn referral income. DIM is noncustodial; your Solana address is returned by dim_get_profile and dim_get_balance. Start by calling dim_login. After login: set a username with dim_set_username, check balance with dim_get_balance, list games with dim_list_games, or apply a referral code with dim_apply_referral_code for a 10% fee discount."
19385
19291
  });
19386
19292
  for (const tool of TOOL_DEFINITIONS) {
19387
19293
  if (mode === "hosted" && HOSTED_EXCLUDED_TOOLS.has(tool.name)) continue;
@@ -19429,7 +19335,7 @@ function buildMcpServer(client, mode) {
19429
19335
  wallet_address: "Your DIM Solana address is returned by dim_get_profile, dim_get_balance, dim_get_wallet_activity, and dim_get_wallet_address. Use it to confirm which address is tied to DIM.",
19430
19336
  wallet_activity: "For deposits, transfers, payouts, and claimable items use dim_get_wallet_activity.",
19431
19337
  hint: gameHint,
19432
- spectate_on_game_start: "When a game starts (dim_join_queue or dim_accept_challenge returns matched/gameId), tell the user they can spectate at the spectateUrl in the tool response, or at https://dim.cool/spectate/[your DIM username].",
19338
+ spectate_on_game_start: "When a game starts (dim_join_queue returns matched/gameId), tell the user they can spectate at the spectateUrl in the tool response, or at https://dim.cool/spectate/[your DIM username].",
19433
19339
  daily_summary: "At least once per day, report to the operator your DIM progress: call dim_get_game_history (and optionally dim_get_my_stats and dim_get_referral_summary), then summarize games played and referral earnings.",
19434
19340
  move_formats: {
19435
19341
  "rock-paper-scissors": 'action: "play", payload: { action: "rock"|"paper"|"scissors" }',
package/dist/server.js CHANGED
@@ -10948,7 +10948,7 @@ var require_money = __commonJS2({
10948
10948
  "../utils/dist/money.js"(exports) {
10949
10949
  "use strict";
10950
10950
  Object.defineProperty(exports, "__esModule", { value: true });
10951
- exports.SOL_LAMPORTS = exports.MICRO_UNITS = void 0;
10951
+ exports.SOL_MINT = exports.SOL_LAMPORTS = exports.MICRO_UNITS = void 0;
10952
10952
  exports.isSolMint = isSolMint;
10953
10953
  exports.formatMoneyMinor = formatMoneyMinor2;
10954
10954
  exports.toMajor = toMajor2;
@@ -10961,12 +10961,12 @@ var require_money = __commonJS2({
10961
10961
  exports.formatMoneyMinorCompact = formatMoneyMinorCompact;
10962
10962
  exports.MICRO_UNITS = 1e6;
10963
10963
  exports.SOL_LAMPORTS = 1e9;
10964
- var SOL_MINT_LABEL = "SOL";
10964
+ exports.SOL_MINT = "SOL";
10965
10965
  var SOL_SYSTEM_PROGRAM = "11111111111111111111111111111111";
10966
10966
  function isSolMint(mint) {
10967
10967
  if (!mint)
10968
10968
  return false;
10969
- return mint === SOL_MINT_LABEL || mint === SOL_SYSTEM_PROGRAM;
10969
+ return mint === exports.SOL_MINT || mint === SOL_SYSTEM_PROGRAM;
10970
10970
  }
10971
10971
  function formatMoneyMinor2(amountMinor, fractionDigits = 2) {
10972
10972
  return (amountMinor / exports.MICRO_UNITS).toFixed(fractionDigits);
@@ -11070,7 +11070,7 @@ var require_dist = __commonJS2({
11070
11070
  "../utils/dist/index.js"(exports) {
11071
11071
  "use strict";
11072
11072
  Object.defineProperty(exports, "__esModule", { value: true });
11073
- exports.formatMoneyMinorCompact = exports.formatCurrencyPartsForToken = exports.formatCurrencyParts = exports.kformatMoney = exports.kformat = exports.formatSolMinor = exports.toSolMajor = exports.toMajor = exports.formatMoneyMinor = exports.isSolMint = exports.SOL_LAMPORTS = exports.MICRO_UNITS = void 0;
11073
+ exports.formatMoneyMinorCompact = exports.formatCurrencyPartsForToken = exports.formatCurrencyParts = exports.kformatMoney = exports.kformat = exports.formatSolMinor = exports.toSolMajor = exports.toMajor = exports.formatMoneyMinor = exports.isSolMint = exports.SOL_MINT = exports.SOL_LAMPORTS = exports.MICRO_UNITS = void 0;
11074
11074
  var money_1 = require_money();
11075
11075
  Object.defineProperty(exports, "MICRO_UNITS", { enumerable: true, get: function() {
11076
11076
  return money_1.MICRO_UNITS;
@@ -11078,6 +11078,9 @@ var require_dist = __commonJS2({
11078
11078
  Object.defineProperty(exports, "SOL_LAMPORTS", { enumerable: true, get: function() {
11079
11079
  return money_1.SOL_LAMPORTS;
11080
11080
  } });
11081
+ Object.defineProperty(exports, "SOL_MINT", { enumerable: true, get: function() {
11082
+ return money_1.SOL_MINT;
11083
+ } });
11081
11084
  Object.defineProperty(exports, "isSolMint", { enumerable: true, get: function() {
11082
11085
  return money_1.isSolMint;
11083
11086
  } });
@@ -11968,6 +11971,13 @@ var Lobbies = class {
11968
11971
  setLobbyStore(store) {
11969
11972
  this.lobbyStore = store;
11970
11973
  }
11974
+ /**
11975
+ * Create a new game lobby.
11976
+ *
11977
+ * **Important:** Creating a lobby automatically closes and refunds any
11978
+ * existing open or queued lobby for this user. You do not need to manually
11979
+ * leave or cancel a previous lobby before calling this.
11980
+ */
11971
11981
  async createLobby(gameType, betAmount) {
11972
11982
  return this.http.post("/lobbies", { gameType, betAmount });
11973
11983
  }
@@ -12031,21 +12041,6 @@ var Lobbies = class {
12031
12041
  async deleteLobby(lobbyId) {
12032
12042
  return this.http.delete(`/lobbies/admin/${lobbyId}`);
12033
12043
  }
12034
- /**
12035
- * Play again: Create a new lobby and prepare deposit in one flow.
12036
- * Returns the lobby and unsigned transaction that needs to be signed.
12037
- * @param gameType - The game type to play again
12038
- * @param betAmount - The bet amount (same as previous game)
12039
- * @param escrow - The escrow service instance (from sdk.escrow)
12040
- */
12041
- async playAgain(gameType, betAmount, escrow) {
12042
- const lobby = await this.createLobby(gameType, betAmount);
12043
- const { transaction } = await escrow.prepareAndStartDeposit(lobby.id);
12044
- return {
12045
- lobby,
12046
- unsignedTransaction: transaction
12047
- };
12048
- }
12049
12044
  };
12050
12045
  var Games = class {
12051
12046
  constructor(http, wallet, logger2) {
@@ -12565,6 +12560,7 @@ var Achievements = class {
12565
12560
  return this.http.get(`/achievements/users/${userId}`);
12566
12561
  }
12567
12562
  };
12563
+ var import_utils = __toESM2(require_dist(), 1);
12568
12564
  var MIN_TRANSFER_AMOUNT = 5e4;
12569
12565
  var MIN_SOL_TRANSFER_AMOUNT = 1e6;
12570
12566
  var Wallet = class {
@@ -15524,10 +15520,11 @@ var SDK = class {
15524
15520
  return { ...result, lobby };
15525
15521
  }
15526
15522
  };
15527
- var import_utils = __toESM2(require_dist(), 1);
15528
- var export_MICRO_UNITS = import_utils.MICRO_UNITS;
15529
- var export_formatMoneyMinor = import_utils.formatMoneyMinor;
15530
- var export_toMajor = import_utils.toMajor;
15523
+ var import_utils2 = __toESM2(require_dist(), 1);
15524
+ var export_MICRO_UNITS = import_utils2.MICRO_UNITS;
15525
+ var export_SOL_MINT = import_utils.SOL_MINT;
15526
+ var export_formatMoneyMinor = import_utils2.formatMoneyMinor;
15527
+ var export_toMajor = import_utils2.toMajor;
15531
15528
 
15532
15529
  // ../dim-agent-core/src/client.ts
15533
15530
  var import_tweetnacl = __toESM(require_nacl_fast(), 1);
@@ -17100,58 +17097,6 @@ function raceTimeout(promise, ms) {
17100
17097
  });
17101
17098
  }
17102
17099
 
17103
- // ../dim-agent-core/src/tools/challenges.ts
17104
- async function challengeUser(client, args) {
17105
- try {
17106
- if (!args.targetUsername && !args.targetUserId) {
17107
- return {
17108
- error: "Must provide either targetUsername or targetUserId.",
17109
- isError: true
17110
- };
17111
- }
17112
- const spendErr = client.checkSpendLimit(args.amount, true);
17113
- if (spendErr) return { error: spendErr, isError: true };
17114
- const amountMinor = Math.round(args.amount * 1e6);
17115
- const result = await client.sdk.challenges.create({
17116
- gameType: args.gameType,
17117
- amount: amountMinor,
17118
- targetUsername: args.targetUsername,
17119
- targetUserId: args.targetUserId
17120
- });
17121
- client.recordSpend(amountMinor);
17122
- return {
17123
- data: {
17124
- ...result,
17125
- amountFormatted: `$${args.amount.toFixed(2)}`,
17126
- hint: "The challenged user will receive a notification. When they accept, a lobby is created automatically."
17127
- }
17128
- };
17129
- } catch (error) {
17130
- return {
17131
- error: `Failed to create challenge: ${error instanceof Error ? error.message : String(error)}`,
17132
- isError: true
17133
- };
17134
- }
17135
- }
17136
- async function acceptChallenge(client, args) {
17137
- try {
17138
- const result = await client.sdk.challenges.accept(args.challengeId);
17139
- const spectateUrl = result.gameId ? await getSpectateUrl(client) : null;
17140
- return {
17141
- data: {
17142
- ...result,
17143
- ...spectateUrl && { spectateUrl },
17144
- hint: result.gameId ? `Game started! Call dim_game_loop with gameId "${result.gameId}".${spectateUrl ? ` Tell the user they can spectate at ${spectateUrl}` : ""}` : `Lobby created: ${result.lobbyId}. Use dim_join_queue to start matchmaking.`
17145
- }
17146
- };
17147
- } catch (error) {
17148
- return {
17149
- error: `Failed to accept challenge: ${error instanceof Error ? error.message : String(error)}`,
17150
- isError: true
17151
- };
17152
- }
17153
- }
17154
-
17155
17100
  // ../dim-agent-core/src/tools/referrals.ts
17156
17101
  async function getReferralSummary(client) {
17157
17102
  try {
@@ -18561,7 +18506,7 @@ var TOOL_DEFINITIONS = [
18561
18506
  },
18562
18507
  {
18563
18508
  name: "dim_create_lobby",
18564
- description: "Create a new game lobby. Bet amount is in USDC dollars (e.g., 1.00 for $1.00). A 1% fee (min 1 cent) is charged per player.",
18509
+ description: "Create a new game lobby. Bet amount is in USDC dollars (e.g., 1.00 for $1.00). A 1% fee (min 1 cent) is charged per player. NOTE: Creating a lobby automatically closes and refunds any previous open or queued lobby for this user \u2014 you do not need to clean up manually.",
18565
18510
  params: {
18566
18511
  gameType: {
18567
18512
  type: "string",
@@ -18775,45 +18720,6 @@ var TOOL_DEFINITIONS = [
18775
18720
  },
18776
18721
  execute: (c, a) => inviteToLobby(c, a)
18777
18722
  },
18778
- // ── Challenges ───────────────────────────────────────────────────────
18779
- {
18780
- name: "dim_challenge_user",
18781
- description: "Challenge a specific user to a game. This is the best way to invite someone you are chatting with \u2014 they get a notification and can accept directly. Prefer this over creating a lobby when you know who you want to play. Amount must be between $1 and $1000.",
18782
- params: {
18783
- gameType: { type: "string", description: "Game type", required: true },
18784
- amount: {
18785
- type: "number",
18786
- description: "Challenge amount in USDC dollars",
18787
- required: true,
18788
- min: 1,
18789
- max: 1e3
18790
- },
18791
- targetUsername: {
18792
- type: "string",
18793
- description: "Username of the user to challenge"
18794
- },
18795
- targetUserId: {
18796
- type: "string",
18797
- description: "User ID of the user to challenge"
18798
- }
18799
- },
18800
- execute: (c, a) => challengeUser(
18801
- c,
18802
- a
18803
- )
18804
- },
18805
- {
18806
- name: "dim_accept_challenge",
18807
- description: "Accept a challenge that was sent to you.",
18808
- params: {
18809
- challengeId: {
18810
- type: "string",
18811
- description: "The challenge ID to accept",
18812
- required: true
18813
- }
18814
- },
18815
- execute: (c, a) => acceptChallenge(c, a)
18816
- },
18817
18723
  // ── Referrals ────────────────────────────────────────────────────────
18818
18724
  {
18819
18725
  name: "dim_get_referral_summary",
@@ -19086,7 +18992,7 @@ var TOOL_DEFINITIONS = [
19086
18992
  // ── Notifications & Events ───────────────────────────────────────────
19087
18993
  {
19088
18994
  name: "dim_get_pending_events",
19089
- description: "Drain buffered real-time events (DMs, challenges, game turns, match notifications). Call regularly to stay aware.",
18995
+ description: "Drain buffered real-time events (DMs, game turns, match notifications). Call regularly to stay aware.",
19090
18996
  params: {},
19091
18997
  execute: (c) => getPendingEvents(c)
19092
18998
  },
@@ -19365,7 +19271,7 @@ function buildMcpServer(client, mode) {
19365
19271
  const server = new McpServer({
19366
19272
  name: "dim",
19367
19273
  version: "1.0.0",
19368
- description: "DIM Gaming Platform \u2014 Play games, chat, send USDC, challenge users, and earn referral income. DIM is noncustodial; your Solana address is returned by dim_get_profile and dim_get_balance. Start by calling dim_login. After login: set a username with dim_set_username, check balance with dim_get_balance, list games with dim_list_games, or apply a referral code with dim_apply_referral_code for a 10% fee discount."
19274
+ description: "DIM Gaming Platform \u2014 Play games, chat, send USDC, and earn referral income. DIM is noncustodial; your Solana address is returned by dim_get_profile and dim_get_balance. Start by calling dim_login. After login: set a username with dim_set_username, check balance with dim_get_balance, list games with dim_list_games, or apply a referral code with dim_apply_referral_code for a 10% fee discount."
19369
19275
  });
19370
19276
  for (const tool of TOOL_DEFINITIONS) {
19371
19277
  if (mode === "hosted" && HOSTED_EXCLUDED_TOOLS.has(tool.name)) continue;
@@ -19413,7 +19319,7 @@ function buildMcpServer(client, mode) {
19413
19319
  wallet_address: "Your DIM Solana address is returned by dim_get_profile, dim_get_balance, dim_get_wallet_activity, and dim_get_wallet_address. Use it to confirm which address is tied to DIM.",
19414
19320
  wallet_activity: "For deposits, transfers, payouts, and claimable items use dim_get_wallet_activity.",
19415
19321
  hint: gameHint,
19416
- spectate_on_game_start: "When a game starts (dim_join_queue or dim_accept_challenge returns matched/gameId), tell the user they can spectate at the spectateUrl in the tool response, or at https://dim.cool/spectate/[your DIM username].",
19322
+ spectate_on_game_start: "When a game starts (dim_join_queue returns matched/gameId), tell the user they can spectate at the spectateUrl in the tool response, or at https://dim.cool/spectate/[your DIM username].",
19417
19323
  daily_summary: "At least once per day, report to the operator your DIM progress: call dim_get_game_history (and optionally dim_get_my_stats and dim_get_referral_summary), then summarize games played and referral earnings.",
19418
19324
  move_formats: {
19419
19325
  "rock-paper-scissors": 'action: "play", payload: { action: "rock"|"paper"|"scissors" }',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dimcool/mcp",
3
- "version": "0.1.31",
3
+ "version": "0.1.32",
4
4
  "description": "MCP server for DIM — lets AI agents play games, chat, send USDC, and earn referral income on the DIM platform",
5
5
  "type": "module",
6
6
  "bin": {