mcp_coingecko_price_ts 1.0.1 → 1.0.4

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.
@@ -1,17 +1,17 @@
1
- - [x] Verify that the copilot-instructions.md file in the .github directory is created.
2
-
3
- - [x] Clarify Project Requirements
4
-
5
- - [x] Scaffold the Project
6
-
7
- - [x] Customize the Project
8
-
9
- - [x] Install Required Extensions
10
-
11
- - [x] Compile the Project
12
-
13
- - [x] Create and Run Task
14
-
15
- - [x] Launch the Project
16
-
17
- - [x] Ensure Documentation is Complete
1
+ - [x] Verify that the copilot-instructions.md file in the .github directory is created.
2
+
3
+ - [x] Clarify Project Requirements
4
+
5
+ - [x] Scaffold the Project
6
+
7
+ - [x] Customize the Project
8
+
9
+ - [x] Install Required Extensions
10
+
11
+ - [x] Compile the Project
12
+
13
+ - [x] Create and Run Task
14
+
15
+ - [x] Launch the Project
16
+
17
+ - [x] Ensure Documentation is Complete
@@ -0,0 +1,22 @@
1
+ name: Publish Package
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*.*.*' # Trigger on version tags like v1.0.0
7
+
8
+ jobs:
9
+ publish:
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - uses: actions/setup-node@v4
15
+ with:
16
+ node-version: '20'
17
+ registry-url: 'https://registry.npmjs.org'
18
+ - run: npm ci
19
+ - run: npm run build --if-present
20
+ - run: npm publish
21
+ env:
22
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # Use the secret
@@ -1,14 +1,14 @@
1
- {
2
- "version": "0.2.0",
3
- "configurations": [
4
- {
5
- "type": "node",
6
- "request": "launch",
7
- "name": "Launch Program",
8
- "skipFiles": ["<node_internals>/**"],
9
- "program": "${workspaceFolder}/src/index.ts",
10
- "preLaunchTask": "build",
11
- "outFiles": ["${workspaceFolder}/dist/**/*.js"]
12
- }
13
- ]
14
- }
1
+ {
2
+ "version": "0.2.0",
3
+ "configurations": [
4
+ {
5
+ "type": "node",
6
+ "request": "launch",
7
+ "name": "Launch Program",
8
+ "skipFiles": ["<node_internals>/**"],
9
+ "program": "${workspaceFolder}/src/index.ts",
10
+ "preLaunchTask": "build",
11
+ "outFiles": ["${workspaceFolder}/dist/**/*.js"]
12
+ }
13
+ ]
14
+ }
package/README.md CHANGED
@@ -1,95 +1,106 @@
1
- # CoinGecko Price MCP Server
2
-
3
- A simple Model Context Protocol (MCP) server that provides cryptocurrency pricing information using the CoinGecko API.
4
-
5
- ## Features
6
-
7
- - **get_crypto_price**: A tool to fetch the current price of a cryptocurrency in a specific currency.
8
- - Inputs:
9
- - `crypto_id`: The CoinGecko ID of the cryptocurrency (e.g., 'bitcoin', 'ethereum').
10
- - `currency`: The target currency for the price (e.g., 'usd', 'brl').
11
-
12
- ## Prerequisites
13
-
14
- - Node.js (v18 or higher recommended)
15
- - npm
16
-
17
- ## Installation
18
-
19
- 1. Clone or navigate to the project repository.
20
- 2. Install dependencies:
21
-
22
- ```bash
23
- npm install
24
- ```
25
-
26
- ## Building the Project
27
-
28
- Compile the TypeScript code to JavaScript:
29
-
30
- ```bash
31
- npm run build
32
- ```
33
-
34
- The compiled output will be in the `dist` directory.
35
-
36
- ## Usage
37
-
38
- ### Testing Locally with MCP Inspector (The `npx` Way)
39
-
40
- You can test the server interactively using the MCP Inspector. This allows you to inspect tools and resources and make tool calls directly.
41
-
42
- 1. Build the project first:
43
- ```bash
44
- npm run build
45
- ```
46
-
47
- 2. Run the inspector using `npx`, pointing it to your built server script:
48
-
49
- ```bash
50
- npx @modelcontextprotocol/inspector node dist/index.js
51
- ```
52
-
53
- _Note: On Windows, use a full path or ensuring valid path syntax if you encounter issues._
54
-
55
- 3. Open the URL provided in the terminal (usually `http://localhost:5173`) to interact with your server.
56
-
57
- ### Running Directly
58
-
59
- You can run the server directly (it communicates via Stdio), but it is designed to be used by an MCP client (like Claude Desktop or the Inspector).
60
-
61
- ```bash
62
- npm start
63
- ```
64
-
65
- ### Developing
66
-
67
- To run the server in development mode (using `tsx`):
68
-
69
- ```bash
70
- npm run dev
71
- ```
72
-
73
- ## Setup with Claude Desktop
74
-
75
- To use this server with Claude Desktop apps:
76
-
77
- 1. Locate your Claude Desktop configuration file:
78
- - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
79
- - Windows: `%APPDATA%\Claude\claude_desktop_config.json`
80
-
81
- 2. Add the server configuration:
82
-
83
- ```json
84
- {
85
- "mcpServers": {
86
- "coingecko": {
87
- "command": "node",
88
- "args": ["/absolute/path/to/mcp_coingecko_price_ts/dist/index.js"]
89
- }
90
- }
91
- }
92
- ```
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
1
+ # CoinGecko Price MCP Server
2
+
3
+ A simple Model Context Protocol (MCP) server that provides cryptocurrency pricing information using the CoinGecko API.
4
+
5
+ ## Features
6
+
7
+ - **get_crypto_price**: A tool to fetch the current price of a cryptocurrency in a specific currency.
8
+ - Inputs:
9
+ - `crypto_id`: The CoinGecko ID of the cryptocurrency (e.g., 'bitcoin', 'ethereum').
10
+ - `currency`: The target currency for the price (e.g., 'usd', 'brl').
11
+
12
+ ## Prerequisites
13
+
14
+ - Node.js (v18 or higher recommended)
15
+ - npm
16
+
17
+ ## Installation
18
+
19
+ 1. Clone or navigate to the project repository.
20
+ 2. Install dependencies:
21
+
22
+ ```bash
23
+ npm install
24
+ ```
25
+
26
+ ## Building the Project
27
+
28
+ Compile the TypeScript code to JavaScript:
29
+
30
+ ```bash
31
+ npm run build
32
+ ```
33
+
34
+ The compiled output will be in the `dist` directory.
35
+
36
+ ## Usage
37
+
38
+ ### Testing Locally with MCP Inspector (The `npx` Way)
39
+
40
+ You can test the server interactively using the MCP Inspector. This allows you to inspect tools and resources and make tool calls directly.
41
+
42
+ 1. Build the project first:
43
+ ```bash
44
+ npm run build
45
+ ```
46
+
47
+ 2. Run the inspector using `npx`, pointing it to your built server script:
48
+
49
+ ```bash
50
+ npx @modelcontextprotocol/inspector node dist/index.js
51
+ ```
52
+
53
+ _Note: On Windows, use a full path or ensuring valid path syntax if you encounter issues._
54
+
55
+ 3. Open the URL provided in the terminal (usually `http://localhost:5173`) to interact with your server.
56
+
57
+ ### Running Directly
58
+
59
+ You can run the server directly (it communicates via Stdio), but it is designed to be used by an MCP client (like Claude Desktop or the Inspector).
60
+
61
+ ```bash
62
+ npm start
63
+ ```
64
+
65
+ ### Developing
66
+
67
+ To run the server in development mode (using `tsx`):
68
+
69
+ ```bash
70
+ npm run dev
71
+ ```
72
+
73
+ ## Setup with Claude Desktop
74
+
75
+ To use this server with Claude Desktop apps:
76
+
77
+ 1. Locate your Claude Desktop configuration file:
78
+ - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
79
+ - Windows: `%APPDATA%\Claude\claude_desktop_config.json`
80
+
81
+ 2. Add the server configuration:
82
+
83
+ ```json
84
+ {
85
+ "mcpServers": {
86
+ "coingecko_price": {
87
+ "command": "node",
88
+ "args": ["/absolute/path/to/mcp_coingecko_price_ts/dist/index.js"]
89
+ }
90
+ }
91
+ }
92
+ ```
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 CHANGED
@@ -1,2 +1,3 @@
1
+ #!/usr/bin/env node
1
2
  export {};
2
3
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,12 +1,13 @@
1
+ #!/usr/bin/env node
1
2
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
3
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
3
4
  import * as z from 'zod/v4';
4
5
  const mcpServer = new McpServer({
5
- name: 'tools-with-sample-server',
6
+ name: 'mcp_coingecko_price_ts',
6
7
  version: '1.0.0'
7
8
  });
8
9
  console.log('McpServer started');
9
- mcpServer.registerTool('coingecko-price-ts', {
10
+ mcpServer.registerTool('get_crypto_price', {
10
11
  title: 'Get Cryptocurrency Price',
11
12
  description: 'Get the current price of a cryptocurrency from CoinGecko.',
12
13
  inputSchema: {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,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,0BAA0B;IAChC,OAAO,EAAE,OAAO;CACnB,CAAC,CAAC;AAEH,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;AAEjC,SAAS,CAAC,YAAY,CAClB,oBAAoB,EACpB;IACI,KAAK,EAAE,0BAA0B;IACjC,WAAW,EAAE,2DAA2D;IACxE,WAAW,EAAE;QACT,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;QACrB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;KACvB;CACJ,EACD,KAAK,EAAG,EAAC,SAAS,EAAE,QAAQ,EAAC,EAAG,EAAE;IAC9B,MAAM,QAAQ,GAAG,MAAM,KAAK,CACxB,qDAAqD,SAAS,kBAAkB,QAAQ,EAAE,CAC7F,CAAC;IACF,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IACnC,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG,wBAAwB,SAAS,OAAO,QAAQ,OAAO,KAAK,EAAE,CAAC;IAC9E,OAAO;QACH,OAAO,EAAE,CAAC,EAAE,IAAI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AAQ,CAAC,IAAI,EAAE,CAAC;IACnC,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG,wBAAwB,SAAS,OAAO,QAAQ,OAAO,KAAK,EAAE,CAAC;IAC9E,OAAO;QACH,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;KAC5C,CAAC;AACN,CAAC,CACJ,CAAC;AACF,KAAK,UAAU,IAAI;IACf,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACnC,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;AAC5C,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;IACjB,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;IACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "name": "mcp_coingecko_price_ts",
3
- "version": "1.0.1",
3
+ "version": "1.0.4",
4
4
  "type": "module",
5
+ "bin": {
6
+ "mcp_coingecko_price_ts": "./dist/index.js"
7
+ },
5
8
  "main": "dist/index.js",
6
9
  "scripts": {
7
10
  "build": "tsc",
package/src/index.ts CHANGED
@@ -1,43 +1,44 @@
1
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
- import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
3
- import * as z from 'zod/v4';
4
-
5
- const mcpServer = new McpServer({
6
- name: 'mcp_coingecko_price_ts',
7
- version: '1.0.0'
8
- });
9
-
10
- console.log('McpServer started');
11
-
12
- mcpServer.registerTool(
13
- 'get_crypto_price',
14
- {
15
- title: 'Get Cryptocurrency Price',
16
- description: 'Get the current price of a cryptocurrency from CoinGecko.',
17
- inputSchema: {
18
- crypto_id: z.string(),
19
- currency: z.string()
20
- }
21
- },
22
- async ( {crypto_id, currency} ) => {
23
- const response = await fetch(
24
- `https://api.coingecko.com/api/v3/simple/price?ids=${crypto_id}&vs_currencies=${currency}`
25
- );
26
- const data = await response.json();
27
- const price = data[crypto_id][currency];
28
- const output = `The current price of ${crypto_id} in ${currency} is ${price}`;
29
- return {
30
- content: [{ type: 'text', text: output }],
31
- };
32
- }
33
- );
34
- async function main() {
35
- const transport = new StdioServerTransport();
36
- await mcpServer.connect(transport);
37
- console.log('MCP server is running...');
38
- }
39
-
40
- main().catch(error => {
41
- console.error('Server error:', error);
42
- process.exit(1);
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
+
6
+ const mcpServer = new McpServer({
7
+ name: 'mcp_coingecko_price_ts',
8
+ version: '1.0.0'
9
+ });
10
+
11
+ console.log('McpServer started');
12
+
13
+ mcpServer.registerTool(
14
+ 'get_crypto_price',
15
+ {
16
+ title: 'Get Cryptocurrency Price',
17
+ description: 'Get the current price of a cryptocurrency from CoinGecko.',
18
+ inputSchema: {
19
+ crypto_id: z.string(),
20
+ currency: z.string()
21
+ }
22
+ },
23
+ async ( {crypto_id, currency} ) => {
24
+ const response = await fetch(
25
+ `https://api.coingecko.com/api/v3/simple/price?ids=${crypto_id}&vs_currencies=${currency}`
26
+ );
27
+ const data = await response.json();
28
+ const price = data[crypto_id][currency];
29
+ const output = `The current price of ${crypto_id} in ${currency} is ${price}`;
30
+ return {
31
+ content: [{ type: 'text', text: output }],
32
+ };
33
+ }
34
+ );
35
+ async function main() {
36
+ const transport = new StdioServerTransport();
37
+ await mcpServer.connect(transport);
38
+ console.log('MCP server is running...');
39
+ }
40
+
41
+ main().catch(error => {
42
+ console.error('Server error:', error);
43
+ process.exit(1);
43
44
  });
package/tsconfig.json CHANGED
@@ -1,44 +1,44 @@
1
- {
2
- // Visit https://aka.ms/tsconfig to read more about this file
3
- "compilerOptions": {
4
- // File Layout
5
- "rootDir": "./src",
6
- "outDir": "./dist",
7
-
8
- // Environment Settings
9
- // See also https://aka.ms/tsconfig/module
10
- "module": "nodenext",
11
- "target": "esnext",
12
- // "types": [],
13
- // For nodejs:
14
- // "lib": ["esnext"],
15
- // "types": ["node"],
16
- // and npm install -D @types/node
17
-
18
- // Other Outputs
19
- "sourceMap": true,
20
- "declaration": true,
21
- "declarationMap": true,
22
-
23
- // Stricter Typechecking Options
24
- "noUncheckedIndexedAccess": true,
25
- "exactOptionalPropertyTypes": true,
26
-
27
- // Style Options
28
- // "noImplicitReturns": true,
29
- // "noImplicitOverride": true,
30
- // "noUnusedLocals": true,
31
- // "noUnusedParameters": true,
32
- // "noFallthroughCasesInSwitch": true,
33
- // "noPropertyAccessFromIndexSignature": true,
34
-
35
- // Recommended Options
36
- "strict": true,
37
- "jsx": "react-jsx",
38
- "verbatimModuleSyntax": true,
39
- "isolatedModules": true,
40
- "noUncheckedSideEffectImports": true,
41
- "moduleDetection": "force",
42
- "skipLibCheck": true,
43
- }
44
- }
1
+ {
2
+ // Visit https://aka.ms/tsconfig to read more about this file
3
+ "compilerOptions": {
4
+ // File Layout
5
+ "rootDir": "./src",
6
+ "outDir": "./dist",
7
+
8
+ // Environment Settings
9
+ // See also https://aka.ms/tsconfig/module
10
+ "module": "nodenext",
11
+ "target": "esnext",
12
+ // "types": [],
13
+ // For nodejs:
14
+ // "lib": ["esnext"],
15
+ // "types": ["node"],
16
+ // and npm install -D @types/node
17
+
18
+ // Other Outputs
19
+ "sourceMap": true,
20
+ "declaration": true,
21
+ "declarationMap": true,
22
+
23
+ // Stricter Typechecking Options
24
+ "noUncheckedIndexedAccess": true,
25
+ "exactOptionalPropertyTypes": true,
26
+
27
+ // Style Options
28
+ // "noImplicitReturns": true,
29
+ // "noImplicitOverride": true,
30
+ // "noUnusedLocals": true,
31
+ // "noUnusedParameters": true,
32
+ // "noFallthroughCasesInSwitch": true,
33
+ // "noPropertyAccessFromIndexSignature": true,
34
+
35
+ // Recommended Options
36
+ "strict": true,
37
+ "jsx": "react-jsx",
38
+ "verbatimModuleSyntax": true,
39
+ "isolatedModules": true,
40
+ "noUncheckedSideEffectImports": true,
41
+ "moduleDetection": "force",
42
+ "skipLibCheck": true,
43
+ }
44
+ }