@champz-llc/legends-mcp-server 1.3.4 → 1.3.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.
Files changed (2) hide show
  1. package/index.js +34 -33
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -11,14 +11,22 @@ import fetch from 'node-fetch';
11
11
  // Helper function to fetch image and convert to base64
12
12
  async function fetchImageAsBase64(imageUrl) {
13
13
  try {
14
+ console.error(`[MCP] Fetching image: ${imageUrl}`);
14
15
  const response = await fetch(imageUrl);
15
16
  if (!response.ok) {
17
+ console.error(`[MCP] Image fetch failed: ${response.status} ${response.statusText}`);
16
18
  throw new Error(`Failed to fetch image: ${response.status}`);
17
19
  }
20
+
21
+ const contentType = response.headers.get('content-type');
22
+ console.error(`[MCP] Image content-type: ${contentType}`);
23
+
18
24
  const buffer = await response.buffer();
19
- return buffer.toString('base64');
25
+ const base64 = buffer.toString('base64');
26
+ console.error(`[MCP] Image converted to base64, size: ${base64.length} chars`);
27
+ return base64;
20
28
  } catch (error) {
21
- console.error(`Error fetching image ${imageUrl}:`, error.message);
29
+ console.error(`[MCP] Error fetching image ${imageUrl}:`, error.message);
22
30
  return null;
23
31
  }
24
32
  }
@@ -679,30 +687,21 @@ You can still ask about:
679
687
  },
680
688
  ];
681
689
 
682
- // Add throne images (show all thrones)
690
+ // Show throne collection (text only - use show_throne tool for images)
683
691
  if (data.thrones && data.thrones.length > 0) {
684
692
  const throneText = `\nšŸ† Throne Collection (${data.thrones.length}):\n`;
685
693
  let throneList = '';
686
694
 
687
- for (const [i, throne] of data.thrones.entries()) {
688
- throneList += `${i + 1}. ${throne.name} (${throne.rarity.toUpperCase()}) - Cycle ${throne.cycle_id}\n`;
689
-
690
- // Add throne image
691
- const imageUrl = `https://img.champz.world${throne.image_path}`;
692
- const base64Data = await fetchImageAsBase64(imageUrl);
693
- if (base64Data) {
694
- content.push({
695
- type: 'image',
696
- data: base64Data,
697
- mimeType: 'image/png',
698
- });
699
- }
700
- }
695
+ data.thrones.forEach((throne, i) => {
696
+ throneList += `${i + 1}. Throne #${throne.throne_id} - ${throne.name} (${throne.rarity.toUpperCase()}) - Cycle ${throne.cycle_id}\n`;
697
+ });
698
+
699
+ throneList += `\nTo view a throne image, ask: "Show me throne #<ID>"\n`;
701
700
 
702
701
  content[0].text += throneText + throneList + '\n';
703
702
  }
704
703
 
705
- // Show legend summary (don't show all images by default - too many)
704
+ // Show legend summary with IDs
706
705
  if (data.all_legends && data.all_legends.length > 0) {
707
706
  const legendText = `\nšŸ„ All Legends Owned (${data.all_legends.length}):\n`;
708
707
  let legendSummary = '';
@@ -720,39 +719,41 @@ You can still ask about:
720
719
  byRarity[legend.rarity]?.push(legend);
721
720
  });
722
721
 
722
+ // Show each rarity group with IDs
723
723
  Object.entries(byRarity).forEach(([rarity, legends]) => {
724
724
  if (legends.length > 0) {
725
- legendSummary += ` ${rarity.toUpperCase()}: ${legends.length} legends\n`;
725
+ legendSummary += `\n${rarity.toUpperCase()} (${legends.length}):\n`;
726
+
727
+ // List legend IDs (limit to first 20 per rarity to avoid huge output)
728
+ const displayLegends = legends.slice(0, 20);
729
+ const legendIds = displayLegends.map(l => `#${l.legend_id} (${l.name})`).join(', ');
730
+ legendSummary += ` ${legendIds}`;
731
+
732
+ if (legends.length > 20) {
733
+ legendSummary += `... and ${legends.length - 20} more`;
734
+ }
735
+ legendSummary += '\n';
726
736
  }
727
737
  });
728
738
 
729
- legendSummary += `\nTo view a specific legend, ask: "Show me legend #<ID>"\n`;
739
+ legendSummary += `\nTo view a legend image, ask: "Show me legend #<ID>"\n`;
730
740
  legendSummary += `Example: "Show me legend #1010"\n\n`;
731
741
 
732
742
  content[0].text += legendText + legendSummary;
733
743
  }
734
744
 
735
- // Add saved trainer images (premium collection)
745
+ // Show saved trainers (text only - use show_legend tool for images)
736
746
  if (data.saved_trainers && data.saved_trainers.length > 0) {
737
747
  const trainerText = `⭐ Saved Trainers (${data.saved_trainers.length}):\n`;
738
748
  let trainerList = '';
739
749
 
740
- for (const [i, trainer] of data.saved_trainers.entries()) {
750
+ data.saved_trainers.forEach((trainer, i) => {
741
751
  trainerList += `${i + 1}. ${trainer.rarity.toUpperCase()} Legend #${trainer.legend_id} - Power: ${trainer.total_power}\n`;
742
752
  trainerList += ` ATK: ${trainer.attack} | DEF: ${trainer.defense} | SPD: ${trainer.speed}\n`;
743
753
  trainerList += ` Elements: ${trainer.elements.join(', ')}\n\n`;
754
+ });
744
755
 
745
- // Add trainer image
746
- const imageUrl = `https://img.champz.world${trainer.image_path}`;
747
- const base64Data = await fetchImageAsBase64(imageUrl);
748
- if (base64Data) {
749
- content.push({
750
- type: 'image',
751
- data: base64Data,
752
- mimeType: 'image/png',
753
- });
754
- }
755
- }
756
+ trainerList += `To view a legend image, ask: "Show me legend #<ID>"\n`;
756
757
 
757
758
  content[0].text += trainerText + trainerList;
758
759
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@champz-llc/legends-mcp-server",
3
- "version": "1.3.4",
3
+ "version": "1.3.6",
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",