commodities.sh

MCP server

commodities.sh serves 30 streamable HTTP MCP tools at https://api.commodities.sh/api/mcp. 7 of them answer with no account and no credential. The rest take a Pro credit key in the Authorization header.

1. Connect

Point any MCP host at the endpoint directly. Nothing to install and no third-party account — this is the whole tool set.

bash
claude mcp add --transport http commodities https://api.commodities.sh/api/mcp

Cursor takes the same shape in .cursor/mcp.json — the JSON under step 4 below, with or without the headers block.

Claude Desktop

Desktop is the exception: its claude_desktop_config.json takes local command-line servers, so a remote URL does not go there. Add it through the interface instead — Settings (Ctrl+,) → Connectors → Add custom connector — and paste:

bash
https://api.commodities.sh/api/mcp

That gets you the 7 free tools. Custom connectors authenticate with OAuth and have no field for a static key, so a Pro key needs the stdio bridge in step 4.

Published as

io.github.sawftware-apps/commodities-sh in the official MCP Registry, pointing at the same endpoint above. That entry is the canonical record of who publishes this server, and it is what the directories read — but it is a feed rather than a storefront, so the endpoint stays the way to connect. All 30 tools are on it.

2. What works immediately

These 7 need no credential. They are the reference layer — call them before paying for anything, because the paid tools take codes that only these can tell you.

3. Call a tool

Your agent host does this for you once connected. Over raw JSON-RPC it looks like this — no credential, real response:

bash
curl -s -X POST https://api.commodities.sh/api/mcp \
  -H 'content-type: application/json' \
  -H 'accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call",
       "params":{"name":"catalog.search","arguments":{"q":"crude"}}}'
json
{
  "query": "crude",
  "results": [
    {
      "code": "CL",
      "name": "WTI Cushing",
      "sector": "energy",
      "unit": "USD/bbl",
      "available": true,
      "match": "synonym",
      "matched_on": "crude"
    }
  ]
}

4. The paid tools, and where the key goes

The other 23 tools need a key. It goes in the transport headers — never in a tool argument, since no tool takes one. Start with a free key at /signup — email, verify, done — which covers the price, FX, stats and spread tools plus a 30-day window of price.history at 50 calls a day. Positioning, inventories, fundamentals, minerals, trade and the packs need a Pro key from /get-started. Both go in the same header, so upgrading changes nothing here:

bash
claude mcp add --transport http commodities https://api.commodities.sh/api/mcp \
  --header "Authorization: Bearer cs_live_…"
json
{
  "mcpServers": {
    "commodities": {
      "type": "http",
      "url": "https://api.commodities.sh/api/mcp",
      "headers": {
        "Authorization": "Bearer cs_live_…"
      }
    }
  }
}

Claude Desktop cannot send a static header through a custom connector, so route it through the mcp-remote bridge in claude_desktop_config.json. The colon has no space after it on purpose — Desktop on Windows and Cursor mangle spaces inside arguments — and the key lives in env so it stays out of the process list:

json
{
  "mcpServers": {
    "commodities": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://api.commodities.sh/api/mcp",
        "--header",
        "Authorization:${AUTH_HEADER}"
      ],
      "env": {
        "AUTH_HEADER": "Bearer cs_live_…"
      }
    }
  }
}

Call account.quota to confirm the key is being read — it is free, and it reports the credits left and the scopes the key may read.

5. What failure looks like

A paid tool with no credential answers with a readable tool error — HTTP 200, a normal JSON-RPC result, and a sentence naming the remedy. It used to return a bare HTTP 402 that never reached the tool layer, which is how a customer holding a valid key was told the server wanted a crypto payment. The x402 requirements still travel in structuredContent.accepts for any client that can settle them.

json
{
  "jsonrpc": "2.0", "id": 1,
  "result": {
    "isError": true,
    "content": [{ "type": "text", "text":
      "No credential was sent, so price could not be served. Send a Pro credit key
       as an HTTP header on this endpoint — Authorization: Bearer cs_live_… — and
       the call will be billed against your monthly credits. …" }],
    "structuredContent": {
      "error": "PAYMENT_REQUIRED", "route": "price", "price_usd": 0.01,
      "accepts": [{ "scheme": "exact", "network": "eip155:8453", "amount": "10000" }]
    }
  }
}

A key that arrived but is wrong says so in those words — a different answer from sending none at all, which is the distinction you need to tell a transport problem from a credential one:

json
{
  "jsonrpc": "2.0", "id": 1,
  "result": {
    "isError": true,
    "content": [{ "type": "text", "text":
      "A key was sent but is not valid, so price was not served and nothing was
       charged. … This is different from sending no key at all — the header did
       arrive." }],
    "structuredContent": { "error": "INVALID_API_KEY", "route": "price" }
  }
}

Settling x402 per call is still not something a standard MCP host does, even though the requirements now arrive with the error. Per-call payment is built for the REST API; over MCP, use a key.

I connected the server. What now?

Check the tools appear, then call one. 7 of the 30 tools need no credential — start with catalog.search to resolve a commodity name to an instrument code. The other 23 need a key in the Authorization header or an x402 payment; without either they return a 402 rather than data. A free key from /signup covers the price, FX, stats and spread tools. If no tools appeared at all, the server was added but your host has not reloaded it — restart the client, and check the endpoint you pasted ends in /api/mcp.

Do MCP tools require an API key?

The 7 free reference tools do not: catalog.list, catalog.search, calendar.get, trade.codes, minerals.list, cash.reports, account.quota answer immediately. The other 23 require either a Pro credit key sent as "Authorization: Bearer cs_live_…" on the MCP endpoint, or an x402 USDC payment. The header is the practical route for an MCP host; call account.quota to confirm your key is being read.

Where does the API key go in an MCP config?

In the transport headers, not in a tool argument — no tool takes a credential. In Claude Code's .mcp.json or Cursor's .cursor/mcp.json, add a "headers" object alongside "url" with "Authorization": "Bearer cs_live_…". With the Claude Code CLI, pass --header "Authorization: Bearer cs_live_…". Claude Desktop is the exception: its custom connectors authenticate with OAuth and have no field for a static key, so run it through the mcp-remote stdio bridge and pass the header there.

Can an MCP client pay with x402 automatically?

Not automatically. A paid tool called without a credential returns a readable tool error naming what to do, and the x402 payment requirements travel with it in structuredContent.accepts — so a client that can settle has everything it needs, but no standard MCP host does that today. For agent payments use the REST API, which is built for it; over MCP use a Pro credit key in the Authorization header.

What tools does commodities.sh MCP expose?

30 tools at https://api.commodities.sh/api/mcp, covering the catalogue, cash and fundamentals prices, EIA inventories, CFTC positioning, spreads, USDA and USGS fundamentals, cash grain bids, the minerals dossier, release surprises, trade flows, farm-gate prices and decision packs. Each maps to a REST capability and returns the same observation contract.

All 30 tools

Related