mcp_coingecko_price_ts 1.0.0 → 1.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.
- package/README.md +14 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/package.json +5 -2
- package/src/index.ts +1 -0
package/README.md
CHANGED
|
@@ -83,7 +83,7 @@ To use this server with Claude Desktop apps:
|
|
|
83
83
|
```json
|
|
84
84
|
{
|
|
85
85
|
"mcpServers": {
|
|
86
|
-
"
|
|
86
|
+
"coingecko_price": {
|
|
87
87
|
"command": "node",
|
|
88
88
|
"args": ["/absolute/path/to/mcp_coingecko_price_ts/dist/index.js"]
|
|
89
89
|
}
|
|
@@ -91,3 +91,16 @@ To use this server with Claude Desktop apps:
|
|
|
91
91
|
}
|
|
92
92
|
```
|
|
93
93
|
*Remember to run `npm run build` after making changes to the source code.*
|
|
94
|
+
|
|
95
|
+
3. You can run this mcp with stdio transport using npx command
|
|
96
|
+
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"mcpServers": {
|
|
100
|
+
"coingecko_price": {
|
|
101
|
+
"command": "npx",
|
|
102
|
+
"args": ["-y", "mcp_coingecko_price_ts"]
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
|
+
import * as z from 'zod/v4';
|
|
5
|
+
const mcpServer = new McpServer({
|
|
6
|
+
name: 'mcp_coingecko_price_ts',
|
|
7
|
+
version: '1.0.0'
|
|
8
|
+
});
|
|
9
|
+
console.log('McpServer started');
|
|
10
|
+
mcpServer.registerTool('get_crypto_price', {
|
|
11
|
+
title: 'Get Cryptocurrency Price',
|
|
12
|
+
description: 'Get the current price of a cryptocurrency from CoinGecko.',
|
|
13
|
+
inputSchema: {
|
|
14
|
+
crypto_id: z.string(),
|
|
15
|
+
currency: z.string()
|
|
16
|
+
}
|
|
17
|
+
}, async ({ crypto_id, currency }) => {
|
|
18
|
+
const response = await fetch(`https://api.coingecko.com/api/v3/simple/price?ids=${crypto_id}&vs_currencies=${currency}`);
|
|
19
|
+
const data = await response.json();
|
|
20
|
+
const price = data[crypto_id][currency];
|
|
21
|
+
const output = `The current price of ${crypto_id} in ${currency} is ${price}`;
|
|
22
|
+
return {
|
|
23
|
+
content: [{ type: 'text', text: output }],
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
async function main() {
|
|
27
|
+
const transport = new StdioServerTransport();
|
|
28
|
+
await mcpServer.connect(transport);
|
|
29
|
+
console.log('MCP server is running...');
|
|
30
|
+
}
|
|
31
|
+
main().catch(error => {
|
|
32
|
+
console.error('Server error:', error);
|
|
33
|
+
process.exit(1);
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC;IAC5B,IAAI,EAAE,wBAAwB;IAC9B,OAAO,EAAE,OAAO;CACnB,CAAC,CAAC;AAEH,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;AAEjC,SAAS,CA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|
5
|
-
"
|
|
5
|
+
"bin": {
|
|
6
|
+
"mcp_coingecko_price_ts": "./dist/index.js"
|
|
7
|
+
},
|
|
8
|
+
"main": "dist/index.js",
|
|
6
9
|
"scripts": {
|
|
7
10
|
"build": "tsc",
|
|
8
11
|
"start": "node dist/index.js",
|
package/src/index.ts
CHANGED