mcp-crypto-price 5.0.1 → 5.0.2

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.
Binary file
@@ -266,14 +266,30 @@ export async function getExchange(exchangeId) {
266
266
  return null;
267
267
  }
268
268
  }
269
+ const QUOTE_ID_MAP = {
270
+ usd: 'us-dollar',
271
+ eur: 'euro',
272
+ gbp: 'british-pound',
273
+ jpy: 'japanese-yen',
274
+ usdt: 'tether',
275
+ usdc: 'usd-coin',
276
+ btc: 'bitcoin',
277
+ eth: 'ethereum',
278
+ };
279
+ function normalizeQuoteId(quote) {
280
+ const lower = quote.toLowerCase();
281
+ return QUOTE_ID_MAP[lower] ?? lower;
282
+ }
269
283
  export async function getCandles(exchange, baseId, quoteId, interval, start, end) {
284
+ const normalizedQuoteId = normalizeQuoteId(quoteId);
270
285
  try {
271
- return await makeCoinCapRequest(`/candles?exchange=${encodeURIComponent(exchange)}&baseId=${encodeURIComponent(baseId)}&quoteId=${encodeURIComponent(quoteId)}&interval=${interval}&start=${start}&end=${end}`, CandlesResponseSchema);
286
+ return await makeCoinCapRequest(`/candles?exchange=${encodeURIComponent(exchange)}&baseId=${encodeURIComponent(baseId)}&quoteId=${encodeURIComponent(normalizedQuoteId)}&interval=${interval}&start=${start}&end=${end}`, CandlesResponseSchema);
272
287
  }
273
288
  catch (error) {
274
289
  if (error instanceof MissingApiKeyError)
275
290
  throw error;
276
- console.error('Failed to get candles:', error);
291
+ const detail = error instanceof Error ? error.message : String(error);
292
+ console.error(`Failed to get candles for ${exchange} ${baseId}/${normalizedQuoteId}:`, detail);
277
293
  return null;
278
294
  }
279
295
  }
@@ -13,7 +13,7 @@ export const GetCandlestickDataSchema = z.object({
13
13
  quote: z
14
14
  .string()
15
15
  .default('usd')
16
- .describe('Quote currency ID (e.g. "usd", "usdt", "btc")'),
16
+ .describe('Quote currency code (e.g. "usd", "usdt", "btc", "eur"). Common mappings: usd→us-dollar, usdt→tether, usdc→usd-coin. Not all exchanges support all quote currencies — e.g. Binance uses "usdt" not "usd".'),
17
17
  interval: z
18
18
  .enum(['m5', 'm15', 'm30', 'h1', 'h2', 'h6', 'h12', 'd1'])
19
19
  .default('h1')
@@ -66,7 +66,10 @@ export async function handleGetCandlestickData(args) {
66
66
  if (!candlesData) {
67
67
  return {
68
68
  content: [
69
- { type: 'text', text: 'Failed to retrieve candlestick data' },
69
+ {
70
+ type: 'text',
71
+ text: `Failed to retrieve candlestick data for ${asset.name} (${asset.symbol}) on ${exchange} with quote "${quote}". This usually means the exchange does not support this trading pair. Try a different quote currency (e.g. "usdt" for Binance) or a different exchange (e.g. "kraken" supports USD pairs).`,
72
+ },
70
73
  ],
71
74
  structuredContent: {
72
75
  name: asset.name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-crypto-price",
3
- "version": "5.0.1",
3
+ "version": "5.0.2",
4
4
  "description": "A Model Context Protocol (MCP) server that provides real-time cryptocurrency data and analysis through CoinCap's API. Features include price tracking, market analysis, and historical trends.",
5
5
  "license": "MIT",
6
6
  "author": {
Binary file