@champz-llc/legends-mcp-server 1.5.0 ā 1.6.0
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/index.js +153 -49
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -51,10 +51,14 @@ const SIGNATURE = process.env.SIGNATURE;
|
|
|
51
51
|
const SIGNED_AT = process.env.SIGNED_AT;
|
|
52
52
|
const hasWalletAuth = WALLET && SIGNATURE && SIGNED_AT;
|
|
53
53
|
|
|
54
|
-
//
|
|
54
|
+
// ============================================================
|
|
55
|
+
// LEGACY: Hardcoded rewards data for BuildOnBase contest demo
|
|
56
|
+
// NOTE: This is no longer used! Real claims now fetched from API
|
|
57
|
+
// with mode=claims parameter. Kept for reference only.
|
|
58
|
+
// ============================================================
|
|
55
59
|
const DEMO_WALLET = '0xfbc159e35f56580d5d297af18a8c19f83d66088a';
|
|
56
60
|
|
|
57
|
-
const
|
|
61
|
+
const REWARDS_DATA_LEGACY = {
|
|
58
62
|
wallet: DEMO_WALLET,
|
|
59
63
|
champz_claims: [
|
|
60
64
|
{
|
|
@@ -155,7 +159,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
155
159
|
},
|
|
156
160
|
{
|
|
157
161
|
name: 'check_legends_rewards',
|
|
158
|
-
description: 'Check claimable rewards in Legends of Champz
|
|
162
|
+
description: 'Check YOUR pending claimable rewards in Legends of Champz. Returns CHAMPZ tokens and USDC claims with amounts and expiration dates. Requires wallet authentication.',
|
|
159
163
|
inputSchema: {
|
|
160
164
|
type: 'object',
|
|
161
165
|
properties: {},
|
|
@@ -164,7 +168,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
164
168
|
},
|
|
165
169
|
{
|
|
166
170
|
name: 'get_champz_claim_data',
|
|
167
|
-
description: 'Get complete contract call data for claiming CHAMPZ
|
|
171
|
+
description: 'Get complete contract call data for claiming YOUR CHAMPZ token rewards. Returns contract address, ABI, function parameters, and signature ready for Base MCP execution. Requires wallet authentication.',
|
|
168
172
|
inputSchema: {
|
|
169
173
|
type: 'object',
|
|
170
174
|
properties: {},
|
|
@@ -173,7 +177,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
173
177
|
},
|
|
174
178
|
{
|
|
175
179
|
name: 'get_usdc_claim_data',
|
|
176
|
-
description: 'Get complete contract call data for claiming USDC rewards
|
|
180
|
+
description: 'Get complete contract call data for claiming YOUR USDC rewards. Returns contract address, ABI, function parameters, and signature ready for Base MCP execution. Requires wallet authentication.',
|
|
177
181
|
inputSchema: {
|
|
178
182
|
type: 'object',
|
|
179
183
|
properties: {},
|
|
@@ -351,54 +355,154 @@ Last updated: ${new Date(stats.cached_at * 1000).toLocaleString()}`;
|
|
|
351
355
|
}
|
|
352
356
|
|
|
353
357
|
case 'check_legends_rewards':
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
{
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
358
|
+
if (!hasWalletAuth) {
|
|
359
|
+
return {
|
|
360
|
+
content: [{ type: 'text', text: 'Authentication required. Visit https://legends.champz.world/mcp-setup' }],
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
try {
|
|
365
|
+
// Fetch pending claims
|
|
366
|
+
const url = `https://api.champz.world/game/spore-trainer/player-data?wallet=${encodeURIComponent(WALLET)}&signature=${encodeURIComponent(SIGNATURE)}×tamp=${encodeURIComponent(SIGNED_AT)}&mode=claims`;
|
|
367
|
+
const response = await fetch(url);
|
|
368
|
+
const data = await response.json();
|
|
369
|
+
|
|
370
|
+
if (!data.success) {
|
|
371
|
+
throw new Error('Failed to fetch claims data');
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
if (data.champz_claims.length === 0 && data.usdc_claims.length === 0) {
|
|
375
|
+
return {
|
|
376
|
+
content: [
|
|
377
|
+
{
|
|
378
|
+
type: 'text',
|
|
379
|
+
text: 'š Legends of Champz - Claimable Rewards\n\nNo pending claims available at the moment.\n\nKeep battling and holding thrones to earn rewards! āļøš',
|
|
380
|
+
},
|
|
381
|
+
],
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
let output = 'š Legends of Champz - Claimable Rewards\n\n';
|
|
386
|
+
output += `${data.message}\n\n`;
|
|
387
|
+
output += `š° **Total Claimable:**\n`;
|
|
388
|
+
if (data.total_champz !== '0.00 CHAMPZ') output += ` š ${data.total_champz}\n`;
|
|
389
|
+
if (data.total_usdc !== '0.00 USDC') output += ` šµ ${data.total_usdc}\n`;
|
|
390
|
+
output += `\nš Ready to execute on Base L2 (Chain ID: ${data.chain_id})\n`;
|
|
391
|
+
|
|
392
|
+
return {
|
|
393
|
+
content: [{ type: 'text', text: output }],
|
|
394
|
+
};
|
|
395
|
+
} catch (error) {
|
|
396
|
+
return {
|
|
397
|
+
content: [{ type: 'text', text: `Error fetching claims: ${error.message}` }],
|
|
398
|
+
};
|
|
399
|
+
}
|
|
362
400
|
|
|
363
401
|
case 'get_champz_claim_data':
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
{
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
402
|
+
if (!hasWalletAuth) {
|
|
403
|
+
return {
|
|
404
|
+
content: [{ type: 'text', text: 'Authentication required. Visit https://legends.champz.world/mcp-setup' }],
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
try {
|
|
409
|
+
// Fetch pending claims
|
|
410
|
+
const url = `https://api.champz.world/game/spore-trainer/player-data?wallet=${encodeURIComponent(WALLET)}&signature=${encodeURIComponent(SIGNATURE)}×tamp=${encodeURIComponent(SIGNED_AT)}&mode=claims`;
|
|
411
|
+
const response = await fetch(url);
|
|
412
|
+
const data = await response.json();
|
|
413
|
+
|
|
414
|
+
if (!data.success) {
|
|
415
|
+
throw new Error('Failed to fetch claims data');
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
if (data.champz_claims.length === 0) {
|
|
419
|
+
return {
|
|
420
|
+
content: [{ type: 'text', text: 'No pending CHAMPZ claims available' }],
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// Return all CHAMPZ claims with contract data
|
|
425
|
+
const claimsOutput = data.champz_claims.map(claim => ({
|
|
426
|
+
claim_id: claim.claim_id,
|
|
427
|
+
claim_type: claim.claim_type_name,
|
|
428
|
+
amount: claim.amount_human,
|
|
429
|
+
contract_address: claim.contract,
|
|
430
|
+
chain: 'Base (8453)',
|
|
431
|
+
expires_at: claim.expires_at,
|
|
432
|
+
contract_call: {
|
|
433
|
+
function: claim.function_name,
|
|
434
|
+
parameters: claim.parameters,
|
|
435
|
+
abi_function: claim.abi_function,
|
|
436
|
+
abi: CHAMPZ_REWARDS_ABI
|
|
437
|
+
}
|
|
438
|
+
}));
|
|
439
|
+
|
|
440
|
+
return {
|
|
441
|
+
content: [
|
|
442
|
+
{
|
|
443
|
+
type: 'text',
|
|
444
|
+
text: JSON.stringify(claimsOutput, null, 2),
|
|
445
|
+
},
|
|
446
|
+
],
|
|
447
|
+
};
|
|
448
|
+
} catch (error) {
|
|
449
|
+
return {
|
|
450
|
+
content: [{ type: 'text', text: `Error fetching CHAMPZ claims: ${error.message}` }],
|
|
451
|
+
};
|
|
452
|
+
}
|
|
382
453
|
|
|
383
454
|
case 'get_usdc_claim_data':
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
{
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
455
|
+
if (!hasWalletAuth) {
|
|
456
|
+
return {
|
|
457
|
+
content: [{ type: 'text', text: 'Authentication required. Visit https://legends.champz.world/mcp-setup' }],
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
try {
|
|
462
|
+
// Fetch pending claims
|
|
463
|
+
const url = `https://api.champz.world/game/spore-trainer/player-data?wallet=${encodeURIComponent(WALLET)}&signature=${encodeURIComponent(SIGNATURE)}×tamp=${encodeURIComponent(SIGNED_AT)}&mode=claims`;
|
|
464
|
+
const response = await fetch(url);
|
|
465
|
+
const data = await response.json();
|
|
466
|
+
|
|
467
|
+
if (!data.success) {
|
|
468
|
+
throw new Error('Failed to fetch claims data');
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
if (data.usdc_claims.length === 0) {
|
|
472
|
+
return {
|
|
473
|
+
content: [{ type: 'text', text: 'No pending USDC claims available' }],
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
// Return all USDC claims with contract data
|
|
478
|
+
const claimsOutput = data.usdc_claims.map(claim => ({
|
|
479
|
+
claim_id: claim.claim_id,
|
|
480
|
+
claim_type: claim.claim_type_name,
|
|
481
|
+
amount: claim.amount_human,
|
|
482
|
+
contract_address: claim.contract,
|
|
483
|
+
chain: 'Base (8453)',
|
|
484
|
+
expires_at: claim.expires_at,
|
|
485
|
+
contract_call: {
|
|
486
|
+
function: claim.function_name,
|
|
487
|
+
parameters: claim.parameters,
|
|
488
|
+
abi_function: claim.abi_function,
|
|
489
|
+
abi: USDC_REWARDS_ABI
|
|
490
|
+
}
|
|
491
|
+
}));
|
|
492
|
+
|
|
493
|
+
return {
|
|
494
|
+
content: [
|
|
495
|
+
{
|
|
496
|
+
type: 'text',
|
|
497
|
+
text: JSON.stringify(claimsOutput, null, 2),
|
|
498
|
+
},
|
|
499
|
+
],
|
|
500
|
+
};
|
|
501
|
+
} catch (error) {
|
|
502
|
+
return {
|
|
503
|
+
content: [{ type: 'text', text: `Error fetching USDC claims: ${error.message}` }],
|
|
504
|
+
};
|
|
505
|
+
}
|
|
402
506
|
|
|
403
507
|
case 'legends_leaderboard_current':
|
|
404
508
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@champz-llc/legends-mcp-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "MCP server for Legends of Champz - Query game stats, access personal data with signature auth, and claim rewards through Claude Desktop",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|