@dimcool/mcp 0.1.17 → 0.1.18
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/index.js +192 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -26245,6 +26245,155 @@ function registerChallengesTools(server2, client) {
|
|
|
26245
26245
|
|
|
26246
26246
|
// src/tools/referrals.ts
|
|
26247
26247
|
import { z as z7 } from "zod";
|
|
26248
|
+
function generateOnboardingScript(platform, referrer) {
|
|
26249
|
+
const templates = {
|
|
26250
|
+
openclaw: `# Connect to DIM \u2014 OpenClaw Setup
|
|
26251
|
+
|
|
26252
|
+
## Step 1: Install the DIM plugin
|
|
26253
|
+
\`\`\`bash
|
|
26254
|
+
openclaw plugins install @dimcool/dimclaw
|
|
26255
|
+
\`\`\`
|
|
26256
|
+
|
|
26257
|
+
## Step 2: Configure
|
|
26258
|
+
Add to your OpenClaw config under \`plugins.entries.dimclaw.config\`:
|
|
26259
|
+
\`\`\`yaml
|
|
26260
|
+
plugins:
|
|
26261
|
+
entries:
|
|
26262
|
+
dimclaw:
|
|
26263
|
+
enabled: true
|
|
26264
|
+
config:
|
|
26265
|
+
walletStorePath: '~/.dim/openclaw-wallet.json'
|
|
26266
|
+
\`\`\`
|
|
26267
|
+
|
|
26268
|
+
## Step 3: Restart and verify
|
|
26269
|
+
\`\`\`bash
|
|
26270
|
+
openclaw gateway restart
|
|
26271
|
+
\`\`\`
|
|
26272
|
+
|
|
26273
|
+
Then run:
|
|
26274
|
+
1. \`dim_login\`
|
|
26275
|
+
2. \`dim_apply_referral_code\` with referralCode: \`${referrer}\`
|
|
26276
|
+
3. \`dim_get_balance\`
|
|
26277
|
+
|
|
26278
|
+
## Fund your wallet
|
|
26279
|
+
Send USDC on Solana to the wallet address shown by \`dim_get_balance\`.`,
|
|
26280
|
+
"claude-desktop": `# Connect to DIM \u2014 Claude Desktop Setup
|
|
26281
|
+
|
|
26282
|
+
## Step 1: Initialize wallet
|
|
26283
|
+
\`\`\`bash
|
|
26284
|
+
npx @dimcool/mcp init-wallet
|
|
26285
|
+
\`\`\`
|
|
26286
|
+
|
|
26287
|
+
## Step 2: Edit config
|
|
26288
|
+
Open \`~/Library/Application Support/Claude/claude_desktop_config.json\` (macOS) or \`%APPDATA%\\Claude\\claude_desktop_config.json\` (Windows).
|
|
26289
|
+
|
|
26290
|
+
Add to \`mcpServers\`:
|
|
26291
|
+
\`\`\`json
|
|
26292
|
+
{
|
|
26293
|
+
"mcpServers": {
|
|
26294
|
+
"dim": {
|
|
26295
|
+
"command": "npx",
|
|
26296
|
+
"args": ["@dimcool/mcp"],
|
|
26297
|
+
"env": {
|
|
26298
|
+
"DIM_WALLET_STORE_PATH": "/path/from/init-wallet/output",
|
|
26299
|
+
"DIM_API_URL": "https://api.dim.cool",
|
|
26300
|
+
"DIM_REFERRAL_CODE": "${referrer}"
|
|
26301
|
+
}
|
|
26302
|
+
}
|
|
26303
|
+
}
|
|
26304
|
+
}
|
|
26305
|
+
\`\`\`
|
|
26306
|
+
|
|
26307
|
+
## Step 3: Restart Claude Desktop
|
|
26308
|
+
Referral code \`${referrer}\` is applied on first login.
|
|
26309
|
+
|
|
26310
|
+
## Verify
|
|
26311
|
+
Ask Claude: "Log in to DIM and check my balance"`,
|
|
26312
|
+
cursor: `# Connect to DIM \u2014 Cursor Setup
|
|
26313
|
+
|
|
26314
|
+
## Step 1: Initialize wallet
|
|
26315
|
+
\`\`\`bash
|
|
26316
|
+
npx @dimcool/mcp init-wallet
|
|
26317
|
+
\`\`\`
|
|
26318
|
+
|
|
26319
|
+
## Step 2: Edit \`.cursor/mcp.json\`
|
|
26320
|
+
\`\`\`json
|
|
26321
|
+
{
|
|
26322
|
+
"mcpServers": {
|
|
26323
|
+
"dim": {
|
|
26324
|
+
"command": "npx",
|
|
26325
|
+
"args": ["@dimcool/mcp"],
|
|
26326
|
+
"env": {
|
|
26327
|
+
"DIM_WALLET_STORE_PATH": "/path/from/init-wallet/output",
|
|
26328
|
+
"DIM_API_URL": "https://api.dim.cool",
|
|
26329
|
+
"DIM_REFERRAL_CODE": "${referrer}"
|
|
26330
|
+
}
|
|
26331
|
+
}
|
|
26332
|
+
}
|
|
26333
|
+
}
|
|
26334
|
+
\`\`\`
|
|
26335
|
+
|
|
26336
|
+
## Step 3: Restart Cursor
|
|
26337
|
+
Referral code \`${referrer}\` is applied on first login.`,
|
|
26338
|
+
hermes: `# Connect to DIM \u2014 Hermes Setup
|
|
26339
|
+
|
|
26340
|
+
## Step 1: Initialize wallet
|
|
26341
|
+
\`\`\`bash
|
|
26342
|
+
npx @dimcool/mcp init-wallet
|
|
26343
|
+
\`\`\`
|
|
26344
|
+
|
|
26345
|
+
## Step 2: Add DIM skill
|
|
26346
|
+
\`\`\`yaml
|
|
26347
|
+
skills:
|
|
26348
|
+
dim:
|
|
26349
|
+
command: npx
|
|
26350
|
+
args: ["@dimcool/mcp"]
|
|
26351
|
+
env:
|
|
26352
|
+
DIM_WALLET_STORE_PATH: "/path/from/init-wallet/output"
|
|
26353
|
+
DIM_API_URL: "https://api.dim.cool"
|
|
26354
|
+
DIM_REFERRAL_CODE: "${referrer}"
|
|
26355
|
+
\`\`\`
|
|
26356
|
+
|
|
26357
|
+
## Step 3: Restart Hermes
|
|
26358
|
+
Referral code \`${referrer}\` is applied on first login.`,
|
|
26359
|
+
"node-sdk": `# Connect to DIM \u2014 Node.js SDK
|
|
26360
|
+
|
|
26361
|
+
## Install
|
|
26362
|
+
\`\`\`bash
|
|
26363
|
+
npm install @dimcool/sdk @dimcool/wallet
|
|
26364
|
+
\`\`\`
|
|
26365
|
+
|
|
26366
|
+
## Connect
|
|
26367
|
+
\`\`\`typescript
|
|
26368
|
+
import { SDK, NodeStorage } from '@dimcool/sdk';
|
|
26369
|
+
import { Wallet } from '@dimcool/wallet';
|
|
26370
|
+
|
|
26371
|
+
const wallet = new Wallet({
|
|
26372
|
+
enabledNetworks: ['solana'],
|
|
26373
|
+
fromPrivateKey: process.env.DIM_WALLET_PRIVATE_KEY!,
|
|
26374
|
+
});
|
|
26375
|
+
|
|
26376
|
+
const sdk = new SDK({
|
|
26377
|
+
appId: 'dim-agents',
|
|
26378
|
+
baseUrl: 'https://api.dim.cool',
|
|
26379
|
+
storage: new NodeStorage(),
|
|
26380
|
+
autoPay: { enabled: true, maxAmountMinor: 20_000 },
|
|
26381
|
+
});
|
|
26382
|
+
|
|
26383
|
+
sdk.wallet.setSigner(wallet.getSigner());
|
|
26384
|
+
|
|
26385
|
+
const { access_token, user } = await sdk.auth.loginWithWallet({
|
|
26386
|
+
referralCode: '${referrer}',
|
|
26387
|
+
});
|
|
26388
|
+
|
|
26389
|
+
sdk.wsTransport.setAccessToken(access_token);
|
|
26390
|
+
await sdk.ensureWebSocketConnected(10000);
|
|
26391
|
+
\`\`\`
|
|
26392
|
+
|
|
26393
|
+
Full docs: https://docs.dim.cool`
|
|
26394
|
+
};
|
|
26395
|
+
return templates[platform] ?? `Unknown platform "${platform}". Supported: openclaw, claude-desktop, cursor, hermes, node-sdk`;
|
|
26396
|
+
}
|
|
26248
26397
|
function registerReferralTools(server2, client) {
|
|
26249
26398
|
server2.tool(
|
|
26250
26399
|
"dim_get_referral_summary",
|
|
@@ -26425,6 +26574,41 @@ function registerReferralTools(server2, client) {
|
|
|
26425
26574
|
}
|
|
26426
26575
|
}
|
|
26427
26576
|
);
|
|
26577
|
+
server2.tool(
|
|
26578
|
+
"dim_get_referral_onboarding",
|
|
26579
|
+
"Get platform-specific setup instructions to share with another agent or user to onboard them to DIM with your referral code embedded.",
|
|
26580
|
+
{
|
|
26581
|
+
platform: z7.enum(["openclaw", "claude-desktop", "cursor", "hermes", "node-sdk"]).describe("Target platform for the agent being onboarded")
|
|
26582
|
+
},
|
|
26583
|
+
async ({ platform }) => {
|
|
26584
|
+
try {
|
|
26585
|
+
let username = "YOUR_USERNAME";
|
|
26586
|
+
try {
|
|
26587
|
+
if (client.currentUserId) {
|
|
26588
|
+
const profile = await client.sdk.users.getUserById(
|
|
26589
|
+
client.currentUserId
|
|
26590
|
+
);
|
|
26591
|
+
if (profile.username) username = profile.username;
|
|
26592
|
+
}
|
|
26593
|
+
} catch {
|
|
26594
|
+
}
|
|
26595
|
+
const script = generateOnboardingScript(platform, username);
|
|
26596
|
+
return {
|
|
26597
|
+
content: [{ type: "text", text: script }]
|
|
26598
|
+
};
|
|
26599
|
+
} catch (error) {
|
|
26600
|
+
return {
|
|
26601
|
+
content: [
|
|
26602
|
+
{
|
|
26603
|
+
type: "text",
|
|
26604
|
+
text: `Failed to generate onboarding script: ${error instanceof Error ? error.message : String(error)}`
|
|
26605
|
+
}
|
|
26606
|
+
],
|
|
26607
|
+
isError: true
|
|
26608
|
+
};
|
|
26609
|
+
}
|
|
26610
|
+
}
|
|
26611
|
+
);
|
|
26428
26612
|
}
|
|
26429
26613
|
|
|
26430
26614
|
// src/tools/support.ts
|
|
@@ -27080,6 +27264,14 @@ var DIM_INSTRUCTIONS = [
|
|
|
27080
27264
|
{
|
|
27081
27265
|
name: "dim_check_notifications",
|
|
27082
27266
|
description: "Check unread notifications, unread DM threads, and incoming friend requests in one call."
|
|
27267
|
+
},
|
|
27268
|
+
{
|
|
27269
|
+
name: "dim_get_agent_config",
|
|
27270
|
+
description: "Get autonomy scopes, spending limits, and current daily spend."
|
|
27271
|
+
},
|
|
27272
|
+
{
|
|
27273
|
+
name: "dim_get_referral_onboarding",
|
|
27274
|
+
description: "Get platform-specific setup instructions to share with another agent, with your referral code embedded."
|
|
27083
27275
|
}
|
|
27084
27276
|
];
|
|
27085
27277
|
function registerInstructionsTool(server2) {
|