通过 goldprice.dev MCP 服务器,在 Claude 中查询黄金、白银和铜的价格。本地配置需要免费 API 密钥和 Node.js。付费套餐返回实时价格,Free 套餐的价格有延迟。
- 所有套餐均可使用 MCP,包括 Free。
- 可查询现货价、不同 K 金的每克价格和历史价格。
- 每个回答都附有报价时间。
获取免费 API 密钥
在 goldprice.dev 注册即可获取免费 API 密钥,无需信用卡。Free 套餐每月可调用 5,000 次,每分钟最多发送 10 次请求。
安装 Node.js,连接服务器时,Claude 会通过它在本地启动 goldprice.dev MCP 程序。
将服务器添加到 Claude Desktop
打开 Claude Desktop 的配置文件:macOS 上为 ~/Library/Application Support/Claude/claude_desktop_config.json,Windows 上为 %APPDATA%\Claude\claude_desktop_config.json。在 mcpServers 下添加 goldprice 条目,并将 YOUR_API_KEY 替换为你的密钥。
保存文件,完全退出 Claude 后重新打开。macOS 上请使用 Cmd-Q。仅关闭窗口还不够,因为 MCP 服务器只在 Claude 启动时加载一次。
{ "mcpServers": { "goldprice": { "command": "npx", "args": [ "-y", "@nusantara-ventures/goldprice-mcp" ], "env": { "GP_KEY": "YOUR_API_KEY" } } }}也可添加到 Claude Code
安装 Node.js 后,将 YOUR_API_KEY 替换为你的 goldprice.dev 密钥,再运行 Claude Code 命令。该命令通过 -e 设置 GP_KEY。
claude mcp add goldprice -e GP_KEY=YOUR_API_KEY -- npx -y @nusantara-ventures/goldprice-mcp连接远程服务器
使用 https://api.goldprice.dev/v1/mcp/,选择流式 HTTP,并保留末尾的斜杠。远程服务器无需安装,也不需要 Node.js 或 API 密钥。运行 Claude Code 命令即可添加。
不提供密钥时,可使用 get_spot_price、list_commodities、get_carat、search_docs、get_metadata和get_historical,价格与 Free 一样延迟 15 分钟。get_physical_price 和 get_forward_view 返回 plan_gated 错误,start_checkout 返回 api_key_required。get_physical_price 需要 Basic 或更高套餐,get_forward_view 仅限旧版套餐。get_historical 提供 30 天的每日历史数据,更长的历史数据需要付费套餐。 如需实时价格,请按上述方法使用本地服务器和付费密钥,或使用 REST API。
claude mcp add --transport http goldprice https://api.goldprice.dev/v1/mcp/向 Claude 查询价格
连接服务器后,用自己的话提问即可。Claude 会为每次请求调用相应工具。
“现在以印度卢比计价的 22K 黄金每克多少钱?”会调用 get_carat。
“现在以美元计价的黄金价格是多少?”会调用 get_spot_price。
“显示上个月白银的每日收盘价”会调用 get_historical。
“哪些国家有经销商报价?”会调用 get_physical_price,需要 Basic 或更高套餐。
Claude 可以读取哪些数据
所有套餐均提供黄金、白银和铜的现货价。K 金每克价格涵盖 24K 到 10K,支持 35 种货币。Claude 可以列出支持的代码、查看单位和数据更新时间,并搜索 goldprice.dev 文档。
Free 提供 30 天的每日历史数据,Basic 提供一年的数据,更高套餐提供更长的历史数据。日内 K 线需要 Plus 或 Pro,经销商报价需要 Basic 或更高套餐。
Claude 会读取返回的数值,并附上报价时间。这些价格仅供参考,不构成交易要约。通过 Claude 购买付费套餐会调用结账工具,并需要你的确认。
遇到问题时
如果 Claude 中没有显示工具,请检查 JSON 格式,常见原因是多余的末尾逗号。修正并保存后,完全退出 Claude Desktop 再重新打开,以重新加载服务器。
如果出现 invalid_api_key,请在 Claude Desktop 配置的 env 块中设置 GP_KEY。在命令行中设置无效,因为 Claude Desktop 不会继承终端的环境变量。