MCP integration
Connect AI tools to gold market data
API reference · Code and response examples
MCP for gold market data
Model Context Protocol (MCP) lets an AI application discover and call xauapi’s read-only market-data tools. The integration covers quotes, candles and feed status for JustMarkets XAUUSD.
Use https://api.xauapi.com/mcp with an active API key. Clients must support custom Bearer authentication headers. OAuth-only connectors are not supported.
One-click setup prompts
Set up with your AI
Copy a complete prompt, then paste it into a new chat.
Includes setup context, read-only tools and safe credential handling. Copying does not connect a server or include your API key.
View full prompt
Connection setup
- Use an MCP client that supports remote Streamable HTTP servers and the required authentication.
- Add the MCP endpoint and configure your API key through the client’s secure credential settings.
- Discover the available tools and start with
get_feed_statusbefore requesting prices.
The connection profile below is not a universal client configuration file. Map these fields to your client’s settings. Replace YOUR_API_KEY in secure client settings; never paste real keys into a chat.
{
"name": "xauapi",
"transport": "streamable-http",
"url": "https://api.xauapi.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}Read-only tools
| Tool | Arguments | Returns |
|---|---|---|
get_quote | Optional feed: justmarkets | Bid, Ask, spread, source timestamp and freshness. |
get_candles | Required interval: M1 | M5 | M15; optional feed: justmarkets | Broker OHLC candles, with timestamps and Bid price basis. |
get_feed_status | Optional feed: justmarkets | Connection and stale-data indicators. |
All three tools are read-only. No order placement, account changes or billing actions are exposed. Only JustMarkets is supported. Date-range filters and candle pagination are not supported.
Example tool call
{
"name": "get_quote",
"arguments": {
"feed": "justmarkets"
}
}{
"feed": "justmarkets",
"symbol": "XAUUSD",
"timestamp": "2026-10-06T08:30:00Z",
"sampled": true,
"bid": 2650.4,
"ask": 2650.6,
"spread": 0.2,
"stale": false
}This is an illustrative data payload, not a complete MCP protocol exchange. A client handles protocol negotiation and the tool-result envelope.
Responses include structuredContent and an isError flag inside the JSON-RPC result. Check that flag even when HTTP status is 200. The service is stateless Streamable HTTP with JSON responses; GET event streams are not supported.
Example prompts
- “Check the JustMarkets gold feed status and report whether the data is stale.”
- “Show the latest XAUUSD Bid, Ask and spread, including the source timestamp.”
- “Summarize the available M5 gold candles and identify any gaps.”
These prompts do not run on this site. An assistant should state the source and timestamp, preserve stale-data warnings and explain that sampled data can miss intermediate ticks.
Access, limits & errors
Tool calls reuse your API key’s access and share your account allowance. Admitted data requests count even when the feed is unavailable. Initialization, ping and tool discovery do not consume annual allowance. Pro includes 12 million annual requests; Max includes 240 million.
Invalid credentials, quota limits and stale feeds must produce actionable errors rather than fabricated prices. No background polling or automatic connection is enabled here.
Protocol references: Streamable HTTP · MCP tools. Use a client compatible with Streamable HTTP and Bearer headers.