mcp-crypto-price 5.0.1 → 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
|
|
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', '
|
|
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
|
|
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
|
package/dist/services/coincap.js
CHANGED
|
@@ -266,14 +266,15 @@ export async function getExchange(exchangeId) {
|
|
|
266
266
|
return null;
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
|
-
export async function getCandles(
|
|
269
|
+
export async function getCandles(assetId, interval, start, end) {
|
|
270
270
|
try {
|
|
271
|
-
return await makeCoinCapRequest(`/
|
|
271
|
+
return await makeCoinCapRequest(`/ta/${encodeURIComponent(assetId)}/candlesticks?interval=${interval}&start=${start}&end=${end}`, CandlesResponseSchema);
|
|
272
272
|
}
|
|
273
273
|
catch (error) {
|
|
274
274
|
if (error instanceof MissingApiKeyError)
|
|
275
275
|
throw error;
|
|
276
|
-
|
|
276
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
277
|
+
console.error(`Failed to get candlesticks for ${assetId}:`, detail);
|
|
277
278
|
return null;
|
|
278
279
|
}
|
|
279
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
|
|
254
|
+
export function formatCandlestickData(asset, candles) {
|
|
255
255
|
if (candles.length === 0) {
|
|
256
|
-
return `No candlestick data available for ${asset.name} (${asset.symbol})
|
|
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})
|
|
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 ID (e.g. "usd", "usdt", "btc")'),
|
|
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,
|
|
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,16 +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(
|
|
55
|
+
const candlesData = await getCandles(asset.id, interval, start, end);
|
|
66
56
|
if (!candlesData) {
|
|
67
57
|
return {
|
|
68
58
|
content: [
|
|
69
|
-
{
|
|
59
|
+
{
|
|
60
|
+
type: 'text',
|
|
61
|
+
text: `Failed to retrieve candlestick data for ${asset.name} (${asset.symbol}).`,
|
|
62
|
+
},
|
|
70
63
|
],
|
|
71
64
|
structuredContent: {
|
|
72
65
|
name: asset.name,
|
|
73
66
|
symbol: asset.symbol,
|
|
74
|
-
exchange,
|
|
75
67
|
candles: [],
|
|
76
68
|
},
|
|
77
69
|
};
|
|
@@ -81,13 +73,12 @@ export async function handleGetCandlestickData(args) {
|
|
|
81
73
|
content: [
|
|
82
74
|
{
|
|
83
75
|
type: 'text',
|
|
84
|
-
text: `No candlestick data available for ${asset.name} (${asset.symbol})
|
|
76
|
+
text: `No candlestick data available for ${asset.name} (${asset.symbol})`,
|
|
85
77
|
},
|
|
86
78
|
],
|
|
87
79
|
structuredContent: {
|
|
88
80
|
name: asset.name,
|
|
89
81
|
symbol: asset.symbol,
|
|
90
|
-
exchange,
|
|
91
82
|
candles: [],
|
|
92
83
|
},
|
|
93
84
|
};
|
|
@@ -96,13 +87,12 @@ export async function handleGetCandlestickData(args) {
|
|
|
96
87
|
content: [
|
|
97
88
|
{
|
|
98
89
|
type: 'text',
|
|
99
|
-
text: formatCandlestickData(asset, candlesData.data
|
|
90
|
+
text: formatCandlestickData(asset, candlesData.data),
|
|
100
91
|
},
|
|
101
92
|
],
|
|
102
93
|
structuredContent: {
|
|
103
94
|
name: asset.name,
|
|
104
95
|
symbol: asset.symbol,
|
|
105
|
-
exchange,
|
|
106
96
|
candles: candlesData.data.map((c) => ({
|
|
107
97
|
open: c.open,
|
|
108
98
|
high: c.high,
|
|
@@ -127,7 +117,6 @@ export async function handleGetCandlestickData(args) {
|
|
|
127
117
|
structuredContent: {
|
|
128
118
|
name: '',
|
|
129
119
|
symbol: '',
|
|
130
|
-
exchange: '',
|
|
131
120
|
candles: [],
|
|
132
121
|
},
|
|
133
122
|
};
|
|
@@ -144,7 +133,6 @@ export async function handleGetCandlestickData(args) {
|
|
|
144
133
|
structuredContent: {
|
|
145
134
|
name: '',
|
|
146
135
|
symbol: '',
|
|
147
|
-
exchange: '',
|
|
148
136
|
candles: [],
|
|
149
137
|
},
|
|
150
138
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-crypto-price",
|
|
3
|
-
"version": "5.0.
|
|
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
|