CoinGecko服务器
crazyrabbitLTC 的 mcp-coingecko-server 的镜像,这是一个用于与 CoinGecko Pro API 交互的模型上下文协议服务器
CoinGecko服务器快速入门
安装
npm install coingecko-server
环境设置
创建.env
文件,添加:
COINGECKO_API_KEY=你的API密钥
集成到Claude Desktop
- 安装Claude Desktop
- 修改配置文件(位置因系统而异):
{
"mcpServers": {
"coingecko": {
"command": "node",
"args": ["/path/to/coingecko-server/build/index.js"],
"env": {
"COINGECKO_API_KEY": "你的API密钥"
}
}
}
}
- 重启Claude Desktop
提供的工具
get-coins
:获取支持的币种列表find-coin-ids
:查询币种名称/符号对应的IDget-historical-data
:获取历史价格数据get-ohlc-data
:获取OHLC蜡烛图数据refresh-cache
:刷新本地币种缓存
OpenAI函数调用示例
import { CoinGeckoService } from 'coingecko-server';
import OpenAI from 'openai';
const openai = new OpenAI();
const coinGeckoService = new CoinGeckoService(process.env.COINGECKO_API_KEY);
// 获取函数定义
const functions = CoinGeckoService.getOpenAIFunctionDefinitions();