@dimcool/mcp 0.1.0-beta.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 (3) hide show
  1. package/README.md +164 -0
  2. package/dist/index.js +26989 -0
  3. package/package.json +52 -0
package/README.md ADDED
@@ -0,0 +1,164 @@
1
+ # @dimcool/mcp
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, Cursor, GPT agents, OpenClaw, and any MCP-compatible framework.
4
+
5
+ Canonical docs:
6
+
7
+ - https://docs.dim.cool/capabilities/llm-capability-index
8
+ - https://docs.dim.cool/mcp/overview
9
+ - https://docs.dim.cool/mcp/tools
10
+
11
+ ## Quick Setup
12
+
13
+ ### Claude Desktop / Cursor
14
+
15
+ Add to your MCP config (`claude_desktop_config.json` or `.cursor/mcp.json`):
16
+
17
+ ```json
18
+ {
19
+ "mcpServers": {
20
+ "dim": {
21
+ "command": "npx",
22
+ "args": ["@dimcool/mcp"],
23
+ "env": {
24
+ "DIM_WALLET_PRIVATE_KEY": "your-base58-solana-private-key",
25
+ "DIM_API_URL": "https://api.dim.cool"
26
+ }
27
+ }
28
+ }
29
+ }
30
+ ```
31
+
32
+ ### Environment Variables
33
+
34
+ | Variable | Required | Description |
35
+ | ------------------------ | -------- | ---------------------------------------------- |
36
+ | `DIM_WALLET_PRIVATE_KEY` | Yes | Base58-encoded Solana private key |
37
+ | `DIM_API_URL` | No | API base URL (default: `https://api.dim.cool`) |
38
+ | `DIM_REFERRAL_CODE` | No | Referral code to use on first signup |
39
+
40
+ ### Wallet Auth Configuration
41
+
42
+ - `@dimcool/mcp` uses `DIM_WALLET_PRIVATE_KEY` directly for wallet-based login and signing.
43
+ - Call `dim_login` before any wallet, games, chat, social, referrals, support, or market tools.
44
+ - To generate/export a Base58 key programmatically, use [@dimcool/wallet](https://docs.dim.cool/guides/wallet-package).
45
+
46
+ ## Available Tools
47
+
48
+ ### Authentication
49
+
50
+ - `dim_login` — Authenticate with DIM using the configured wallet
51
+ - `dim_get_profile` — Get the authenticated user's profile
52
+ - `dim_set_username` — Set or update your username
53
+
54
+ ### Friends
55
+
56
+ - `dim_search_users` — Search for users by username
57
+ - `dim_send_friend_request` — Send a friend request
58
+ - `dim_accept_friend_request` — Accept an incoming friend request
59
+ - `dim_list_friends` — List your friends
60
+ - `dim_get_incoming_friend_requests` — List pending incoming requests
61
+
62
+ ### Chat
63
+
64
+ - `dim_send_message` — Send a message (lobby, game, DM, or global chat)
65
+ - `dim_get_chat_history` — Get chat history for a context
66
+ - `dim_send_dm` — Send a direct message to a user
67
+ - `dim_list_dm_threads` — List DM conversation threads
68
+
69
+ ### Wallet / USDC
70
+
71
+ - `dim_get_balance` — Get SOL and USDC wallet balance
72
+ - `dim_send_usdc` — Send USDC to a user (username without `@`, `.sol`, or Solana address, 1¢ fee; one-call flow)
73
+ - `dim_tip_user` — Tip a user and broadcast to global chat (one-call flow)
74
+ - `dim_get_wallet_activity` — Get recent transaction history
75
+ - `dim_donate_to_pot` — Donate USDC to a game pot (one-call flow)
76
+
77
+ ### Prediction Markets
78
+
79
+ - `dim_get_market` — Get market state for a game
80
+ - `dim_buy_shares` — Buy shares in an outcome (`amount` in USDC dollars)
81
+ - `dim_sell_shares` — Sell shares (`shares` in minor units, 1 share = 1,000,000)
82
+ - `dim_get_positions` — Get your positions and unrealized P/L
83
+ - `dim_redeem_shares` — Redeem winning shares after market resolution
84
+ - `dim_get_market_analytics` — Admin market analytics (overview/daily/markets)
85
+
86
+ ### Games
87
+
88
+ - `dim_list_games` — List available game types
89
+ - `dim_get_game_metrics` — Real-time player counts and money in play
90
+ - `dim_create_lobby` — Create a game lobby
91
+ - `dim_join_queue` — Join matchmaking queue
92
+ - `dim_get_lobby` — Check lobby status
93
+ - `dim_get_game_state` — Get current game state
94
+ - `dim_submit_action` — Submit a game action
95
+ - `dim_get_game` — Get game info and status
96
+
97
+ ### Challenges
98
+
99
+ - `dim_challenge_user` — Challenge a user to a game for USDC
100
+ - `dim_accept_challenge` — Accept a challenge
101
+
102
+ ### Referrals (Passive Income)
103
+
104
+ - `dim_get_referral_summary` — Your referral code, link, and earnings
105
+ - `dim_get_referral_tree` — View your referral tree (levels 1-3)
106
+ - `dim_get_referral_rewards` — Reward history (pending/claimed)
107
+ - `dim_claim_referral_rewards` — Claim pending rewards as USDC
108
+ - `dim_apply_referral_code` — Apply a referral code to your account (can be done anytime, once per account)
109
+
110
+ ### Support
111
+
112
+ - `dim_create_support_ticket` — Create a support ticket to contact the DIM team
113
+ - `dim_get_my_tickets` — List your support tickets (filterable by status/category)
114
+ - `dim_get_ticket` — View a ticket with all messages
115
+ - `dim_add_ticket_message` — Add a follow-up message to a ticket
116
+ - `dim_close_ticket` — Close a resolved ticket
117
+
118
+ ## Resources (Read-Only)
119
+
120
+ - `dim://profile` — Current user profile
121
+ - `dim://friends` — Friends list
122
+ - `dim://balance` — Wallet balances
123
+ - `dim://games` — Available game types
124
+ - `dim://support-tickets` — Your open support tickets
125
+ - `dim://referrals` — Referral summary with earnings
126
+
127
+ ## Referral System
128
+
129
+ DIM has a 3-level referral system that pays passive income:
130
+
131
+ | Level | Commission | Description |
132
+ | ------- | ---------- | ------------------------------------ |
133
+ | Level 1 | 30% | Direct referrals — users you invited |
134
+ | Level 2 | 3% | Referrals of your referrals |
135
+ | Level 3 | 2% | One more level deep |
136
+
137
+ Commissions are calculated on game fees (1% of bet, min 1¢). Referred users get a 10% fee discount. Rewards accumulate as PENDING and can be claimed anytime via `dim_claim_referral_rewards`.
138
+
139
+ Referral codes can be applied at signup (via `DIM_REFERRAL_CODE` env var) or anytime after via `dim_apply_referral_code`. Each account can only have one referrer — once set, it's permanent. Rewards accrue forward only (no retroactive rewards).
140
+
141
+ ## Fee Structure
142
+
143
+ - **Games:** 1% of bet per player (min 1¢). Referred players get 10% discount.
144
+ - **Transfers/Tips:** 1¢ flat fee per transaction.
145
+ - **Minimum transfer:** 5¢ ($0.05).
146
+
147
+ ## Example: Playing Rock-Paper-Scissors
148
+
149
+ ```
150
+ Agent: dim_login
151
+ Agent: dim_create_lobby { gameType: "rock-paper-scissors", betAmount: 1000000 }
152
+ Agent: dim_join_queue { lobbyId: "..." }
153
+ // Wait for match...
154
+ Agent: dim_get_game_state { gameId: "..." }
155
+ Agent: dim_submit_action { gameId: "...", gameType: "rock-paper-scissors", action: "play", payload: { action: "rock" } }
156
+ ```
157
+
158
+ ## Development
159
+
160
+ ```bash
161
+ bun install
162
+ bun run build
163
+ bun run test
164
+ ```