MCP Server, connect AI to live metals data
Integrate Metals-API with ChatGPT, Claude, Cursor or any MCP-compatible assistant. Get real-time precious metals prices directly in your AI conversations.
"What's the current price of gold per ounce in USD?"
What is MCP and why does it matter?
The Model Context Protocol (MCP) lets AI assistants access external data in real time. Instead of outdated training data, your AI can fetch live metals prices from our API — just by asking a question.
Example: Ask Claude "What's the current price of gold?" and it will call our
metals.latest tool automatically.
Real-time prices
Live gold, silver, platinum and 743+ symbols instantly.
Natural language
Ask questions like "Compare gold and silver prices this week" and get accurate answers.
Same API quota
MCP calls use your existing API plan. Each AI request counts as one API call.
Available MCP tools
A comprehensive suite of tools to access metals market data from your AI assistant.
Get real-time prices for gold, silver, platinum, palladium, and 743+ supported symbols.
Retrieve historical prices for any specific date.
Calculate price changes between two dates with percentage and absolute values.
Convert amounts between any metal or currency pairs instantly.
Get Open/High/Low/Close price data for technical analysis.
List all 743+ supported symbols available metal and currency symbols.
Get daily price data over a date range for trend analysis.
Get intraday candles for a single symbol on a specific date (intervals from 1m to 1d).
Set up in one step
Paste this line into your AI agent (Claude Code, Cursor, Codex, Gemini CLI, VS Code or Windsurf). It reads the instructions, adds the Metals-API server and checks that it works.
Paste into your agent
No API key needed: the agent adds the server and you sign in to Metals-API once in the browser. Create an account if you do not have one.
Using ChatGPT or the Claude app? They connect by signing in, with no key to paste: see the steps below.
Connect manually
Same URL for every client. Most of them connect by signing in, with no key.
ChatGPT connects by signing in to your Metals-API account. There is no key to paste.
- Open Settings → Connectors and add a custom MCP connector.
- Paste the URL above as the remote server URL.
- Choose OAuth and leave the client ID and secret empty.
- Create the connector, then log in to Metals-API and approve access.
Same steps on claude.ai and in Claude Desktop. Claude connects by signing in to your Metals-API account.
- Open Settings → Customize → Connectors → Add custom connector.
- Name it, for example
Metals-API, and paste the URL above as the remote server URL. - Click Add, then Connect. Leave the OAuth fields under Advanced settings empty.
- Log in to Metals-API and approve access.
Add the server from a terminal, then sign in from Claude Code. There is no key to paste.
claude mcp add --transport http --scope user metals-api https://mcp.metals-api.com/mcp
In Claude Code, type /mcp, choose metals-api and pick Authenticate. Log in to Metals-API and approve access.
Use an API key instead
claude mcp add --transport http --scope user metals-api https://mcp.metals-api.com/mcp \ --header "Authorization: Bearer YOUR_API_KEY"
Replace YOUR_API_KEY with your key. Log in to see it filled in, or create an account.
Paste this into ~/.cursor/mcp.json (on Windows, %USERPROFILE%\.cursor\mcp.json). If the file already has servers, add metals-api next to them. There is no key to paste.
{
"mcpServers": {
"metals-api": {
"url": "https://mcp.metals-api.com/mcp"
}
}
}
Open Cursor Settings → MCP and click the login button next to metals-api. Log in to Metals-API and approve access.
Use an API key instead
{
"mcpServers": {
"metals-api": {
"url": "https://mcp.metals-api.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}
Replace YOUR_API_KEY with your key. Log in to see it filled in, or create an account.
Any client that speaks MCP over HTTP works: Codex, Gemini CLI, VS Code, Windsurf and others.
- Add a remote (HTTP) MCP server with the URL above. Do not wrap it with
npxormcp-remote. - Send the header
Authorization: Bearer YOUR_API_KEY.
The config snippet for each client is in llms.txt, which is what the one-step set up uses.
Replace YOUR_API_KEY with your key. Log in to see it filled in, or create an account.
Then ask: "What's the current price of gold per ounce?"
Call it from code
You can also call the MCP server directly over HTTP.
Python example: get the gold price
import httpx
import json
import asyncio
MCP_SERVER_URL = "https://mcp.metals-api.com/mcp"
API_KEY = "YOUR_API_KEY"
async def call_mcp_tool(tool_name: str, arguments: dict):
async with httpx.AsyncClient(timeout=60) as client:
init_response = await client.post(
MCP_SERVER_URL,
headers={"Authorization": f"Bearer {API_KEY}"},
json={
"jsonrpc": "2.0",
"id": "1",
"method": "initialize",
"params": {
"protocolVersion": "2024-11-05",
"capabilities": {},
"clientInfo": {"name": "PythonClient"}
}
}
)
session_id = init_response.headers.get("Mcp-Session-Id")
response = await client.post(
MCP_SERVER_URL,
headers={
"Mcp-Session-Id": session_id,
"Authorization": f"Bearer {API_KEY}"
},
json={
"jsonrpc": "2.0",
"id": "2",
"method": "tools/call",
"params": {
"name": tool_name,
"arguments": arguments
}
}
)
return response.json()
async def main():
result = await call_mcp_tool(
"metals.latest",
{"symbols": "XAU", "base": "USD"}
)
if result.get("result", {}).get("rates", {}).get("XAU"):
rate = result["result"]["rates"]["XAU"]
price = 1 / rate
print(f"Current Gold Price: ${price:.2f} USD per ounce")
else:
print(json.dumps(result, indent=2))
asyncio.run(main())
Frequently asked questions
Authorization: Bearer YOUR_API_KEY. Never put the key in the URL. Register here to get a key.metals.symbols tool or visit our symbols page for a complete list.