@pipeworx/mcp-coingecko 0.1.0
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/LICENSE +21 -0
- package/README.md +55 -0
- package/package.json +20 -0
- package/server.json +18 -0
- package/src/index.ts +250 -0
- package/tsconfig.json +14 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Pipeworx
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# mcp-coingecko
|
|
2
|
+
|
|
3
|
+
CoinGecko MCP — wraps CoinGecko free API (no auth required)
|
|
4
|
+
|
|
5
|
+
Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 965+ live data sources.
|
|
6
|
+
|
|
7
|
+
## Tools
|
|
8
|
+
|
|
9
|
+
| Tool | Description |
|
|
10
|
+
|------|-------------|
|
|
11
|
+
|
|
12
|
+
## Quick Start
|
|
13
|
+
|
|
14
|
+
Add to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):
|
|
15
|
+
|
|
16
|
+
```json
|
|
17
|
+
{
|
|
18
|
+
"mcpServers": {
|
|
19
|
+
"coingecko": {
|
|
20
|
+
"url": "https://gateway.pipeworx.io/coingecko/mcp"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Or connect to the full Pipeworx gateway for access to all 965+ data sources:
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"mcpServers": {
|
|
31
|
+
"pipeworx": {
|
|
32
|
+
"url": "https://gateway.pipeworx.io/mcp"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Using with ask_pipeworx
|
|
39
|
+
|
|
40
|
+
Instead of calling tools directly, you can ask questions in plain English:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
ask_pipeworx({ question: "your question about Coingecko data" })
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The gateway picks the right tool and fills the arguments automatically.
|
|
47
|
+
|
|
48
|
+
## More
|
|
49
|
+
|
|
50
|
+
- [All tools and guides](https://github.com/pipeworx-io/examples)
|
|
51
|
+
- [pipeworx.io](https://pipeworx.io)
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pipeworx/mcp-coingecko",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "CoinGecko MCP — wraps CoinGecko free API (no auth required)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"types": "src/index.ts",
|
|
8
|
+
"keywords": ["mcp", "mcp-server", "model-context-protocol", "pipeworx", "coingecko"],
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/pipeworx-io/mcp-coingecko"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"typecheck": "tsc --noEmit"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"typescript": "^5.7.0"
|
|
19
|
+
}
|
|
20
|
+
}
|
package/server.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
+
"name": "io.github.pipeworx-io/coingecko",
|
|
4
|
+
"title": "Coingecko",
|
|
5
|
+
"description": "CoinGecko MCP — wraps CoinGecko free API (no auth required)",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"websiteUrl": "https://pipeworx.io/packs/coingecko",
|
|
8
|
+
"repository": {
|
|
9
|
+
"url": "https://github.com/pipeworx-io/mcp-coingecko",
|
|
10
|
+
"source": "github"
|
|
11
|
+
},
|
|
12
|
+
"remotes": [
|
|
13
|
+
{
|
|
14
|
+
"type": "streamable-http",
|
|
15
|
+
"url": "https://gateway.pipeworx.io/coingecko/mcp"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
interface McpToolDefinition {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: 'object';
|
|
6
|
+
properties: Record<string, unknown>;
|
|
7
|
+
required?: string[];
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface McpToolExport {
|
|
12
|
+
tools: McpToolDefinition[];
|
|
13
|
+
callTool: (name: string, args: Record<string, unknown>) => Promise<unknown>;
|
|
14
|
+
meter?: { credits: number };
|
|
15
|
+
cost?: Record<string, unknown>;
|
|
16
|
+
provider?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* CoinGecko MCP — wraps CoinGecko free API (no auth required)
|
|
21
|
+
*
|
|
22
|
+
* Tools:
|
|
23
|
+
* - get_coin: detailed info for a specific cryptocurrency
|
|
24
|
+
* - search_coins: search cryptocurrencies by name or symbol
|
|
25
|
+
* - get_market_data: top coins by market cap with prices and changes
|
|
26
|
+
* - get_trending: currently trending coins on CoinGecko
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
const BASE_URL = 'https://api.coingecko.com/api/v3';
|
|
31
|
+
|
|
32
|
+
const tools: McpToolExport['tools'] = [
|
|
33
|
+
{
|
|
34
|
+
name: 'get_coin',
|
|
35
|
+
description:
|
|
36
|
+
'Get live cryptocurrency data by CoinGecko ID (e.g., \'bitcoin\', \'ethereum\'). Returns USD price, market cap, 24h/7d/30d price changes, ATH, circulating supply, and a short description.',
|
|
37
|
+
inputSchema: {
|
|
38
|
+
type: 'object',
|
|
39
|
+
properties: {
|
|
40
|
+
id: {
|
|
41
|
+
type: 'string',
|
|
42
|
+
description: 'CoinGecko coin ID (lowercase), e.g. "bitcoin", "ethereum", "solana", "dogecoin"',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
required: ['id'],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'search_coins',
|
|
50
|
+
description:
|
|
51
|
+
'Search for cryptocurrencies by name or symbol. Returns matching coins with their IDs. Example: search_coins({ query: "bitcoin" })',
|
|
52
|
+
inputSchema: {
|
|
53
|
+
type: 'object',
|
|
54
|
+
properties: {
|
|
55
|
+
query: {
|
|
56
|
+
type: 'string',
|
|
57
|
+
description: 'Search query — coin name or symbol, e.g. "bitcoin", "ETH", "sol"',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
required: ['query'],
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'get_market_data',
|
|
65
|
+
description:
|
|
66
|
+
'Get top cryptocurrencies ranked by market cap with current prices, 24h changes, and volume. Example: get_market_data({ vs_currency: "usd", limit: 10 })',
|
|
67
|
+
inputSchema: {
|
|
68
|
+
type: 'object',
|
|
69
|
+
properties: {
|
|
70
|
+
vs_currency: {
|
|
71
|
+
type: 'string',
|
|
72
|
+
description: 'Currency to show prices in, e.g. "usd", "eur", "btc" (default: "usd")',
|
|
73
|
+
},
|
|
74
|
+
order: {
|
|
75
|
+
type: 'string',
|
|
76
|
+
description: 'Sort order: "market_cap_desc", "volume_desc", "price_desc" (default: "market_cap_desc")',
|
|
77
|
+
},
|
|
78
|
+
limit: {
|
|
79
|
+
type: 'number',
|
|
80
|
+
description: 'Number of coins to return, 1-250 (default: 20)',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
required: [],
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: 'get_trending',
|
|
88
|
+
description:
|
|
89
|
+
'Get the top trending cryptocurrencies on CoinGecko right now, ranked by 24-hour search activity. Returns coin IDs, names, symbols, market cap ranks, and trend scores. No parameters required.',
|
|
90
|
+
inputSchema: {
|
|
91
|
+
type: 'object',
|
|
92
|
+
properties: {},
|
|
93
|
+
required: [],
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
];
|
|
97
|
+
|
|
98
|
+
async function callTool(name: string, args: Record<string, unknown>): Promise<unknown> {
|
|
99
|
+
switch (name) {
|
|
100
|
+
case 'get_coin':
|
|
101
|
+
return getCoin(args.id as string);
|
|
102
|
+
case 'search_coins':
|
|
103
|
+
return searchCoins(args.query as string);
|
|
104
|
+
case 'get_market_data':
|
|
105
|
+
return getMarketData(
|
|
106
|
+
(args.vs_currency as string) ?? 'usd',
|
|
107
|
+
(args.order as string) ?? 'market_cap_desc',
|
|
108
|
+
(args.limit as number) ?? 20,
|
|
109
|
+
);
|
|
110
|
+
case 'get_trending':
|
|
111
|
+
return getTrending();
|
|
112
|
+
default:
|
|
113
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async function getCoin(id: string) {
|
|
118
|
+
const params = new URLSearchParams({
|
|
119
|
+
localization: 'false',
|
|
120
|
+
tickers: 'false',
|
|
121
|
+
community_data: 'false',
|
|
122
|
+
developer_data: 'false',
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
const res = await fetch(`${BASE_URL}/coins/${encodeURIComponent(id)}?${params}`);
|
|
126
|
+
if (!res.ok) throw new Error(`CoinGecko error: ${res.status}`);
|
|
127
|
+
|
|
128
|
+
const data = (await res.json()) as {
|
|
129
|
+
id: string; symbol: string; name: string;
|
|
130
|
+
description: { en: string };
|
|
131
|
+
market_data: {
|
|
132
|
+
current_price: Record<string, number>;
|
|
133
|
+
market_cap: Record<string, number>;
|
|
134
|
+
total_volume: Record<string, number>;
|
|
135
|
+
price_change_percentage_24h: number;
|
|
136
|
+
price_change_percentage_7d: number;
|
|
137
|
+
price_change_percentage_30d: number;
|
|
138
|
+
ath: Record<string, number>;
|
|
139
|
+
ath_change_percentage: Record<string, number>;
|
|
140
|
+
circulating_supply: number;
|
|
141
|
+
total_supply: number | null;
|
|
142
|
+
};
|
|
143
|
+
market_cap_rank: number;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const md = data.market_data;
|
|
147
|
+
return {
|
|
148
|
+
id: data.id,
|
|
149
|
+
symbol: data.symbol,
|
|
150
|
+
name: data.name,
|
|
151
|
+
market_cap_rank: data.market_cap_rank,
|
|
152
|
+
description: data.description.en?.slice(0, 500),
|
|
153
|
+
price_usd: md.current_price.usd,
|
|
154
|
+
market_cap_usd: md.market_cap.usd,
|
|
155
|
+
volume_24h_usd: md.total_volume.usd,
|
|
156
|
+
change_24h_pct: md.price_change_percentage_24h,
|
|
157
|
+
change_7d_pct: md.price_change_percentage_7d,
|
|
158
|
+
change_30d_pct: md.price_change_percentage_30d,
|
|
159
|
+
ath_usd: md.ath.usd,
|
|
160
|
+
ath_change_pct: md.ath_change_percentage.usd,
|
|
161
|
+
circulating_supply: md.circulating_supply,
|
|
162
|
+
total_supply: md.total_supply,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
async function searchCoins(query: string) {
|
|
167
|
+
const params = new URLSearchParams({ query });
|
|
168
|
+
const res = await fetch(`${BASE_URL}/search?${params}`);
|
|
169
|
+
if (!res.ok) throw new Error(`CoinGecko error: ${res.status}`);
|
|
170
|
+
|
|
171
|
+
const data = (await res.json()) as {
|
|
172
|
+
coins: Array<{
|
|
173
|
+
id: string; name: string; api_symbol: string; symbol: string;
|
|
174
|
+
market_cap_rank: number | null; thumb: string;
|
|
175
|
+
}>;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
return {
|
|
179
|
+
count: data.coins.length,
|
|
180
|
+
coins: data.coins.slice(0, 20).map((c) => ({
|
|
181
|
+
id: c.id,
|
|
182
|
+
name: c.name,
|
|
183
|
+
symbol: c.symbol,
|
|
184
|
+
market_cap_rank: c.market_cap_rank,
|
|
185
|
+
})),
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
async function getMarketData(vsCurrency: string, order: string, limit: number) {
|
|
190
|
+
const perPage = Math.min(250, Math.max(1, limit));
|
|
191
|
+
const params = new URLSearchParams({
|
|
192
|
+
vs_currency: vsCurrency,
|
|
193
|
+
order,
|
|
194
|
+
per_page: String(perPage),
|
|
195
|
+
page: '1',
|
|
196
|
+
sparkline: 'false',
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
const res = await fetch(`${BASE_URL}/coins/markets?${params}`);
|
|
200
|
+
if (!res.ok) throw new Error(`CoinGecko error: ${res.status}`);
|
|
201
|
+
|
|
202
|
+
const data = (await res.json()) as Array<{
|
|
203
|
+
id: string; symbol: string; name: string; current_price: number;
|
|
204
|
+
market_cap: number; market_cap_rank: number; total_volume: number;
|
|
205
|
+
price_change_percentage_24h: number; high_24h: number; low_24h: number;
|
|
206
|
+
}>;
|
|
207
|
+
|
|
208
|
+
return {
|
|
209
|
+
vs_currency: vsCurrency,
|
|
210
|
+
count: data.length,
|
|
211
|
+
coins: data.map((c) => ({
|
|
212
|
+
id: c.id,
|
|
213
|
+
symbol: c.symbol,
|
|
214
|
+
name: c.name,
|
|
215
|
+
rank: c.market_cap_rank,
|
|
216
|
+
price: c.current_price,
|
|
217
|
+
market_cap: c.market_cap,
|
|
218
|
+
volume_24h: c.total_volume,
|
|
219
|
+
change_24h_pct: c.price_change_percentage_24h,
|
|
220
|
+
high_24h: c.high_24h,
|
|
221
|
+
low_24h: c.low_24h,
|
|
222
|
+
})),
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
async function getTrending() {
|
|
227
|
+
const res = await fetch(`${BASE_URL}/search/trending`);
|
|
228
|
+
if (!res.ok) throw new Error(`CoinGecko error: ${res.status}`);
|
|
229
|
+
|
|
230
|
+
const data = (await res.json()) as {
|
|
231
|
+
coins: Array<{
|
|
232
|
+
item: {
|
|
233
|
+
id: string; coin_id: number; name: string; symbol: string;
|
|
234
|
+
market_cap_rank: number; score: number;
|
|
235
|
+
};
|
|
236
|
+
}>;
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
return {
|
|
240
|
+
coins: data.coins.map((c) => ({
|
|
241
|
+
id: c.item.id,
|
|
242
|
+
name: c.item.name,
|
|
243
|
+
symbol: c.item.symbol,
|
|
244
|
+
market_cap_rank: c.item.market_cap_rank,
|
|
245
|
+
score: c.item.score,
|
|
246
|
+
})),
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export default { tools, callTool, meter: { credits: 1 } } satisfies McpToolExport;
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"outDir": "dist",
|
|
10
|
+
"rootDir": "src",
|
|
11
|
+
"declaration": true
|
|
12
|
+
},
|
|
13
|
+
"include": ["src"]
|
|
14
|
+
}
|