@champz-llc/legends-mcp-server 1.3.4 → 1.3.5

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 +20 -30
  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,25 +687,16 @@ 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
  }
@@ -732,27 +731,18 @@ You can still ask about:
732
731
  content[0].text += legendText + legendSummary;
733
732
  }
734
733
 
735
- // Add saved trainer images (premium collection)
734
+ // Show saved trainers (text only - use show_legend tool for images)
736
735
  if (data.saved_trainers && data.saved_trainers.length > 0) {
737
736
  const trainerText = `⭐ Saved Trainers (${data.saved_trainers.length}):\n`;
738
737
  let trainerList = '';
739
738
 
740
- for (const [i, trainer] of data.saved_trainers.entries()) {
739
+ data.saved_trainers.forEach((trainer, i) => {
741
740
  trainerList += `${i + 1}. ${trainer.rarity.toUpperCase()} Legend #${trainer.legend_id} - Power: ${trainer.total_power}\n`;
742
741
  trainerList += ` ATK: ${trainer.attack} | DEF: ${trainer.defense} | SPD: ${trainer.speed}\n`;
743
742
  trainerList += ` Elements: ${trainer.elements.join(', ')}\n\n`;
743
+ });
744
744
 
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
- }
745
+ trainerList += `To view a legend image, ask: "Show me legend #<ID>"\n`;
756
746
 
757
747
  content[0].text += trainerText + trainerList;
758
748
  }
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.5",
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",