mcp-crypto-price 5.0.2 → 5.0.3

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/http.js CHANGED
@@ -556,7 +556,7 @@ const serverCard = {
556
556
  },
557
557
  {
558
558
  name: 'analysis-candlestick',
559
- description: 'Get OHLCV candlestick data for a cryptocurrency from a specific exchange. Useful for charting and technical analysis.',
559
+ description: 'Get OHLCV candlestick data for a cryptocurrency. Useful for charting and technical analysis.',
560
560
  inputSchema: {
561
561
  type: 'object',
562
562
  properties: {
@@ -564,16 +564,6 @@ const serverCard = {
564
564
  type: 'string',
565
565
  description: 'Cryptocurrency symbol or name (e.g. BTC or Bitcoin)',
566
566
  },
567
- exchange: {
568
- type: 'string',
569
- default: 'poloniex',
570
- description: 'Exchange ID (e.g. "poloniex", "bittrex", "kraken", "binance")',
571
- },
572
- quote: {
573
- type: 'string',
574
- default: 'usd',
575
- description: 'Quote currency ID (e.g. "usd", "usdt", "btc")',
576
- },
577
567
  interval: {
578
568
  type: 'string',
579
569
  enum: ['m5', 'm15', 'm30', 'h1', 'h2', 'h6', 'h12', 'd1'],
@@ -595,7 +585,6 @@ const serverCard = {
595
585
  properties: {
596
586
  name: { type: 'string' },
597
587
  symbol: { type: 'string' },
598
- exchange: { type: 'string' },
599
588
  candles: {
600
589
  type: 'array',
601
590
  items: {
@@ -612,7 +601,7 @@ const serverCard = {
612
601
  },
613
602
  },
614
603
  },
615
- required: ['name', 'symbol', 'exchange', 'candles'],
604
+ required: ['name', 'symbol', 'candles'],
616
605
  },
617
606
  annotations: {
618
607
  title: 'Get Candlestick Data',
package/dist/index.js CHANGED
@@ -199,7 +199,7 @@ export function createServer({ config, }) {
199
199
  });
200
200
  server.registerTool('analysis-candlestick', {
201
201
  title: 'Get Candlestick Data',
202
- description: 'Get OHLCV candlestick data for a cryptocurrency from a specific exchange. Useful for charting and technical analysis.',
202
+ description: 'Get OHLCV candlestick data for a cryptocurrency. Useful for charting and technical analysis.',
203
203
  inputSchema: GetCandlestickDataSchema.shape,
204
204
  outputSchema: CandlestickOutputSchema.shape,
205
205
  annotations: {
Binary file
@@ -266,30 +266,15 @@ 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
- }
283
- export async function getCandles(exchange, baseId, quoteId, interval, start, end) {
284
- const normalizedQuoteId = normalizeQuoteId(quoteId);
269
+ export async function getCandles(assetId, interval, start, end) {
285
270
  try {
286
- return await makeCoinCapRequest(`/candles?exchange=${encodeURIComponent(exchange)}&baseId=${encodeURIComponent(baseId)}&quoteId=${encodeURIComponent(normalizedQuoteId)}&interval=${interval}&start=${start}&end=${end}`, CandlesResponseSchema);
271
+ return await makeCoinCapRequest(`/ta/${encodeURIComponent(assetId)}/candlesticks?interval=${interval}&start=${start}&end=${end}`, CandlesResponseSchema);
287
272
  }
288
273
  catch (error) {
289
274
  if (error instanceof MissingApiKeyError)
290
275
  throw error;
291
276
  const detail = error instanceof Error ? error.message : String(error);
292
- console.error(`Failed to get candles for ${exchange} ${baseId}/${normalizedQuoteId}:`, detail);
277
+ console.error(`Failed to get candlesticks for ${assetId}:`, detail);
293
278
  return null;
294
279
  }
295
280
  }
@@ -251,9 +251,9 @@ export function formatComparison(assets) {
251
251
  });
252
252
  return ['Cryptocurrency Comparison', '', header, separator, ...rows].join('\n');
253
253
  }
254
- export function formatCandlestickData(asset, candles, exchange) {
254
+ export function formatCandlestickData(asset, candles) {
255
255
  if (candles.length === 0) {
256
- return `No candlestick data available for ${asset.name} (${asset.symbol}) on ${exchange}.`;
256
+ return `No candlestick data available for ${asset.name} (${asset.symbol}).`;
257
257
  }
258
258
  const lines = candles.map((c) => {
259
259
  const date = new Date(c.period).toISOString().split('T')[0];
@@ -265,7 +265,7 @@ export function formatCandlestickData(asset, candles, exchange) {
265
265
  return `${date} | O: $${open} | H: $${high} | L: $${low} | C: $${close} | Vol: ${volume}M`;
266
266
  });
267
267
  return [
268
- `Candlestick Data for ${asset.name} (${asset.symbol}) — Exchange: ${exchange}`,
268
+ `Candlestick Data for ${asset.name} (${asset.symbol})`,
269
269
  '',
270
270
  ...lines,
271
271
  ].join('\n');
@@ -6,14 +6,6 @@ export const GetCandlestickDataSchema = z.object({
6
6
  .string()
7
7
  .min(1)
8
8
  .describe('Cryptocurrency symbol or name (e.g. BTC or Bitcoin)'),
9
- exchange: z
10
- .string()
11
- .default('poloniex')
12
- .describe('Exchange ID (e.g. "poloniex", "bittrex", "kraken", "binance")'),
13
- quote: z
14
- .string()
15
- .default('usd')
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
9
  interval: z
18
10
  .enum(['m5', 'm15', 'm30', 'h1', 'h2', 'h6', 'h12', 'd1'])
19
11
  .default('h1')
@@ -28,7 +20,6 @@ export const GetCandlestickDataSchema = z.object({
28
20
  export const CandlestickOutputSchema = z.object({
29
21
  name: z.string(),
30
22
  symbol: z.string(),
31
- exchange: z.string(),
32
23
  candles: z.array(z.object({
33
24
  open: z.string(),
34
25
  high: z.string(),
@@ -40,7 +31,7 @@ export const CandlestickOutputSchema = z.object({
40
31
  });
41
32
  export async function handleGetCandlestickData(args) {
42
33
  try {
43
- const { symbol, exchange, quote, interval, days } = GetCandlestickDataSchema.parse(args);
34
+ const { symbol, interval, days } = GetCandlestickDataSchema.parse(args);
44
35
  const upperSymbol = symbol.toUpperCase();
45
36
  const asset = await searchAsset(upperSymbol);
46
37
  if (!asset) {
@@ -54,7 +45,6 @@ export async function handleGetCandlestickData(args) {
54
45
  structuredContent: {
55
46
  name: '',
56
47
  symbol: upperSymbol,
57
- exchange,
58
48
  candles: [],
59
49
  },
60
50
  };
@@ -62,19 +52,18 @@ export async function handleGetCandlestickData(args) {
62
52
  const now = Date.now();
63
53
  const end = now - (now % 60000);
64
54
  const start = end - days * 24 * 60 * 60 * 1000;
65
- const candlesData = await getCandles(exchange, asset.id, quote, interval, start, end);
55
+ const candlesData = await getCandles(asset.id, interval, start, end);
66
56
  if (!candlesData) {
67
57
  return {
68
58
  content: [
69
59
  {
70
60
  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).`,
61
+ text: `Failed to retrieve candlestick data for ${asset.name} (${asset.symbol}).`,
72
62
  },
73
63
  ],
74
64
  structuredContent: {
75
65
  name: asset.name,
76
66
  symbol: asset.symbol,
77
- exchange,
78
67
  candles: [],
79
68
  },
80
69
  };
@@ -84,13 +73,12 @@ export async function handleGetCandlestickData(args) {
84
73
  content: [
85
74
  {
86
75
  type: 'text',
87
- text: `No candlestick data available for ${asset.name} (${asset.symbol}) on ${exchange} with quote ${quote.toUpperCase()}`,
76
+ text: `No candlestick data available for ${asset.name} (${asset.symbol})`,
88
77
  },
89
78
  ],
90
79
  structuredContent: {
91
80
  name: asset.name,
92
81
  symbol: asset.symbol,
93
- exchange,
94
82
  candles: [],
95
83
  },
96
84
  };
@@ -99,13 +87,12 @@ export async function handleGetCandlestickData(args) {
99
87
  content: [
100
88
  {
101
89
  type: 'text',
102
- text: formatCandlestickData(asset, candlesData.data, exchange),
90
+ text: formatCandlestickData(asset, candlesData.data),
103
91
  },
104
92
  ],
105
93
  structuredContent: {
106
94
  name: asset.name,
107
95
  symbol: asset.symbol,
108
- exchange,
109
96
  candles: candlesData.data.map((c) => ({
110
97
  open: c.open,
111
98
  high: c.high,
@@ -130,7 +117,6 @@ export async function handleGetCandlestickData(args) {
130
117
  structuredContent: {
131
118
  name: '',
132
119
  symbol: '',
133
- exchange: '',
134
120
  candles: [],
135
121
  },
136
122
  };
@@ -147,7 +133,6 @@ export async function handleGetCandlestickData(args) {
147
133
  structuredContent: {
148
134
  name: '',
149
135
  symbol: '',
150
- exchange: '',
151
136
  candles: [],
152
137
  },
153
138
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-crypto-price",
3
- "version": "5.0.2",
3
+ "version": "5.0.3",
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