NewModel Context Protocol

CommodityPriceAPI MCP Server

Connect Claude, Cursor, Windsurf, VS Code, Cline, Codex, and any MCP-compatible client to real-time and historical commodity prices — gold, silver, oil, natural gas, wheat, coffee, and 520+ more. Your AI assistant queries the market in plain English; the MCP server handles the API calls. Use the hosted server with nothing to install, or run it locally with npx.

hostedmcp.commoditypriceapi.com/mcp
npm@commoditypriceapi/mcp
transportstreamable http · stdio
tools9
licenseMIT

Quick start

Up and running in three steps.

1

Get a free API key

Sign up for an unlimited free trial for integrations — no card required — and copy your API key from the dashboard.

2

Connect the server

Add the hosted URL https://mcp.commoditypriceapi.com/mcp to your client and enter your key on the connect page. Prefer to run it yourself? Use the npx config instead.

3

Ask in plain English

Ask: "What's the current gold price?" Your AI assistant calls the API for you.

Hosted vs local

Both run the same server with the same 9 tools and answer the same prompts. They differ in where the server runs and how your API key reaches it.

HostedLocal (npx)
InstallNothing. Add the URL to your client.Node.js 18+; npx fetches the package.
ConnectionStreamable HTTP to mcp.commoditypriceapi.com/mcpstdio, a process on your machine
API keyEntered once on our connect page. Your client stores an access token, not the key.Stored in plain text in your client config (env block).
Works inClaude on the web and desktop, and any client with remote MCP supportDesktop and terminal clients that can launch local processes
UpdatesAlways the latest versionnpx -y picks up new releases when the client restarts
ToolsThe same 9 toolsThe same 9 tools

How connecting to the hosted server works

The hosted server at https://mcp.commoditypriceapi.com/mcp uses OAuth 2.1, the sign-in flow built into the MCP specification. You never paste your key into a config file.

  1. 01Your client finds the sign-in endpoints from the server URL and registers itself. You do not create an OAuth app.
  2. 02It opens a CommodityPriceAPI connect page in your browser, showing the name of the app asking for access.
  3. 03You paste your API key and click Connect. The key is checked against your account before access is granted.
  4. 04Your client receives an access token and uses it for every tool call. To disconnect, remove the server or clear its authentication in your client.

Set up your client

Pick hosted or local, then your client. Either way you need a CommodityPriceAPI key.

Add a URL. Nothing to install; you sign in with your API key.

Claude setup: hosted server

In Claude on the web or desktop, open Settings → Connectors → Add custom connector, name it CommodityPriceAPI and paste the URL below. Click Connect, then enter your API key on the page that opens.

Remote MCP server URL

https://mcp.commoditypriceapi.com/mcp

Have your API key ready for the connect page. Find it in your dashboard.

Verify it works

After setup, try these prompts — each one should trigger the tool listed next to it.

PromptExpected tool
"What's the current gold price?"get_gold_price
"Get the latest silver and Brent crude prices."get_latest_rates
"Show gold's hourly price on November 4th, 2026."get_intraday_rates
"What was the gold price on January 2nd, 2020?"get_historical_rates
"Show daily gold prices for the first week of August 2026."get_time_series
"How much did gold change between January and August 2026?"get_fluctuation
"Which commodity symbols do you support?"list_symbols
"How much of my API quota is left?"get_usage

Tool reference

9 tools, the full API surface — every CommodityPriceAPI v3 endpoint is exposed as an MCP tool your assistant can call. Parameters marked * are required.

ToolEndpointParametersWhat it does
get_latest_rates/v3/rates/latestsymbols*, quoteLatest rates for one or more symbols. Rates may lag up to 10 minutes depending on plan.
get_gold_price/v3/rates/latest/xauquote, includeShortcut for the latest gold (XAU) rate, including bid/ask. include=gram, tola or carat adds a per-gram, per-tola or per-carat breakdown next to the troy-ounce rate.
get_silver_price/v3/rates/latest/xagquote, includeShortcut for the latest silver (XAG) rate, including bid/ask. include=gram, tola or carat adds a per-gram, per-tola or per-carat breakdown next to the troy-ounce rate.
get_intraday_rates/v3/rates/intradaysymbol*, interval*, date*, startTimeRates of one symbol through one UTC day, at an interval from 1m to 1d. Each point is the rate recorded at that exact mark, not an OHLC bar. Up to 100 points per call; pass nextStartTime back as startTime to page through the day. Advanced and Enterprise plans only.
get_historical_rates/v3/rates/historicalsymbols*, date*Open/high/low/close rates on a specific past date, back to 1990-01-01. If no rate exists for the exact date, the most recent earlier rate is returned together with its own date.
get_time_series/v3/rates/time-seriessymbols*, startDate*, endDate*Daily historical rates between two dates. Maximum span: 1 year.
get_fluctuation/v3/rates/fluctuationsymbols*, startDate*, endDate*How each symbol changed between two dates: start rate, end rate, absolute change, and percent change.
list_symbols/v3/symbols—All 520+ supported symbols with name, category, quote currency, unit, and update frequency. Call this before rate tools when unsure of a symbol.
get_usage/v3/usage—Current plan, quota, and usage for the configured API key.
  • symbols takes a comma-separated list, e.g. XAU,XAG,BRENTOIL-SPOT. There are 520+ symbols across Metals, Energy, Agriculture, and more — see the full list of supported symbols.
  • Symbols that cannot be returned are never dropped silently. The result includes an unresolved map keyed by the symbol you sent: a suggestions list for ambiguous or unknown codes (HTTP 206, the valid rates are still in rates), or resolvedTo when a code had exactly one match, e.g. GOLD is answered as XAU (HTTP 200). If nothing resolves, the tool returns a SYMBOL_NOT_FOUND error carrying the same map.
  • quote returns the rate in the currency you want. Ask "What is the gold price in euros?" and the assistant passes quote=EUR, so the rate comes back in EUR. Without it, each symbol is returned in its default currency. Available on the Standard, Advanced and Enterprise plans; the Basic plan and the legacy Lite plan ignore it and return the default quote for each symbol.
  • get_intraday_rates takes a single symbol and an interval of 1m, 5m, 10m, 15m, 30m, 45m, 1h, 2h, 4h, 8h, 12h or 1d. Symbols updated every 10 minutes accept only multiples of 10 minutes, and symbols updated hourly or less often have no intraday data. A call returns at most 100 points; when nextStartTime is not null, the assistant passes it back as startTimefor the next page. Rates come in the symbol's own currency (no quote). See the intraday endpoint docs for details.
  • Dates use YYYY-MM-DD format; intraday startTime uses HH:mm UTC.

Example prompts & output

Things you can ask — anything the API can answer, your assistant can answer.

Live prices

  • "What's the current gold price?"
  • "Get the latest prices for silver, copper, and WTI crude."
  • "What's gold trading at in euros?"

Historical data

  • "What was the price of wheat on January 2nd, 2026?"
  • "Compare gold and silver prices over the last 30 days."
  • "Show me daily natural gas prices for Q1 2026."

Intraday & price changes

  • "Show gold's hourly price on November 4th, 2026."
  • "When did Brent crude peak during yesterday's session?"
  • "How much did Brent crude fluctuate this quarter?"
  • "Did gold go up or down since the start of the year, and by how much?"

Discovery & account

  • "Which commodity symbols do you support for energy?"
  • "How much of my API quota is left this month?"

What the tool returns

Ask "What's the current gold price?" and get_gold_price returns structured JSON your assistant turns into a plain-English answer — e.g. "Gold (XAU) is currently trading at $4,386.23 per troy ounce (bid $4,385.93 / ask $4,386.23)."

Tool output

{
  "success": true,
  "timestamp": 1786617187,
  "rates": {
    "XAU": {
      "rate": 4386.23,
      "bid": 4385.93,
      "ask": 4386.23
    }
  },
  "metadata": {
    "XAU": {
      "unit": "T.oz",
      "quote": "USD"
    }
  }
}

Error codes

Tool calls never crash the server. Upstream errors come back as structured results with error, code, message, a guidance field and, for symbol errors, the unresolved map, so your assistant can explain what went wrong instead of echoing a status code. Partial results (HTTP 206) are not errors: they arrive as normal results with the valid rates plus unresolved.

CodeMeaning
400VALIDATION_ERROR — a required parameter is missing, a date is not in YYYY-MM-DD format, the start date is after the end date, a time-series range exceeds 365 days, include is not gram, tola or carat, or an intraday interval, date or startTime is not valid for the symbol. BAD_REQUEST — the symbol has no intraday data (it is updated hourly or less often).
401UNAUTHORIZED — no API key was sent. Local server: check that COMMODITYPRICEAPI_KEY is set in your client config's env block. Hosted server: your client is not signed in, or its token has expired; reconnect from your client.
402PAYMENT_REQUIRED — your trial has ended, your subscription is inactive, the request asks for more symbols than your plan allows per request, or get_intraday_rates was called on a plan below Advanced.
403LIMIT_REACHED — monthly request quota used up. Upgrade or wait for the quota to reset.
404USER_NOT_FOUND — the API key is invalid. SYMBOL_NOT_FOUND — none of the requested symbols resolved; the result carries an unresolved map with suggestions. QUOTE_NOT_FOUND — unsupported quote currency. RATE_NOT_FOUND / DATA_NOT_FOUND — the symbols are valid but have no data for that date, range or intraday window.
429Rate limited — wait a minute and retry.
499Request to the upstream API timed out (see COMMODITYPRICEAPI_REQUEST_TIMEOUT_MS).
502Server could not reach the upstream API.

Example error result for an invalid symbol:

Error result

{
  "error": "SYMBOL_NOT_FOUND",
  "code": 404,
  "message": "The symbol is not supported, please visit the documentation for a list of supported symbols",
  "unresolved": {
    "ZW": {
      "message": "Did you mean ZW-SPOT (Wheat Spot) or ZW-FUT (Wheat Futures)?",
      "suggestions": ["ZW-SPOT", "ZW-FUT"]
    },
    "XYZ": {
      "message": "We don't recognise this symbol code and could not match it to any commodity we carry. See our symbols page for the symbols this API uses."
    }
  },
  "guidance": "None of the requested symbols are valid. Check the 'unresolved' map above for suggested symbols, or call list_symbols to see all valid commodity symbols."
}

Environment variables

For the local server only: set these in the env block of your MCP client config. The hosted server needs no configuration.

VariableRequiredDefaultDescription
COMMODITYPRICEAPI_KEYYes—Your CommodityPriceAPI key.
COMMODITYPRICEAPI_REQUEST_TIMEOUT_MSNo15000Upstream request timeout in milliseconds.

Troubleshooting

The most common issues and their fixes. Still stuck? Contact support or open an issue on GitHub.

Hosted: the connect page says the API key isn't valid

Copy the key again from your dashboard and paste it without spaces. If you regenerated the key, the old one no longer works.

Hosted: tools stop working with invalid_token or 401

The client's access token has expired or was revoked. Clear the server's authentication in your client (in Claude Code: /mcp → Clear authentication) and connect again; the client registers itself and asks for your key once more.

Hosted: my client can't connect to a remote server

Some clients only run local stdio servers. Use the mcp-remote bridge from the Cline tab under Set up your client, or switch to the local server.

Local: client uses an old tool list after updating

Restart the client and confirm it loaded the latest npm version.

401 UNAUTHORIZED or 404 USER_NOT_FOUND

401 means no key reached the API: with the local server, check that COMMODITYPRICEAPI_KEY is set in your MCP client config's env block. 404 USER_NOT_FOUND means a key was sent but it is not valid: copy it again from your dashboard.

A symbol you asked for is missing from the response

Look at the unresolved map in the result; it is keyed by the symbol you sent. An entry with suggestions means the code was ambiguous or unknown — pick one of the suggested symbols, e.g. BRENTOIL-SPOT for Brent crude. An entry with resolvedTo means the rate was returned under that symbol instead. An entry saying the symbol is supported but has no rate means there is no data for that request. Call list_symbols to browse valid codes.

499 timeouts

The upstream API did not respond in time. On the local server, increase COMMODITYPRICEAPI_REQUEST_TIMEOUT_MS (default: 15000 ms). On the hosted server, retry the request.

Give your AI assistant market data

Start with an unlimited free trial for integrations — no card required. Connect to the hosted server in a minute, or run the open source (MIT) server yourself.