
金属价格
STDIO通过GoldAPI获取贵金属价格的MCP服务器
通过GoldAPI获取贵金属价格的MCP服务器
An MCP server that provides current and historical gold/precious metal prices via the GoldAPI.io service.
mcp>=1.0.0
requests>=2.31.0
pip install -r requirements.txt
(Windows users: useexport GOLDAPI_API_KEY="your_api_key_here"
set
instead of export
)The server provides one MCP tool:
This server is designed to be installed manually by adding its configuration to the cline_mcp_settings.json
file.
mcpServers
object in your cline_mcp_settings.json
file:"mcp_metal_price": { "args": [ "/c", "python", "-m", "mcp_metal_price" ], "env": { "GOLDAPI_API_KEY": "Your GOLDAPI_API_KEY" } }
Get current or historical metal prices.
Parameters:
currency
(string, default: "USD"): Currency code (ISO 4217 format)metal
(string, default: "XAU"): Metal symbol (XAU, XAG, XPT, XPD)date
(string, optional): Historical date in YYYYMMDD formatExample Usage:
{ "currency": "EUR", "metal": "XAU" }
Start the server with:
python src/server.py
Once the server is running, you can connect to it from MCP clients like Cline or Claude.
The server runs on stdio by default. In your MCP client, you can connect using:
cmd /c python src/server.py
Example tool usage in Cline/Claude:
<use_mcp_tool> <server_name>gold-price</server_name> <tool_name>get_gold_price</tool_name> <arguments> { "currency": "USD", "metal": "XAU" } </arguments> </use_mcp_tool>
The server returns price data in JSON format:
{ "timestamp": 1713600000, "metal": "XAU", "currency": "USD", "price": 2345.67, "unit": "per troy ounce" }
This project is licensed under the terms of the MIT license. See LICENSE file for details.