Guide
Claude MCP setup: connect Claude to real-time market data
The setup takes a minute. The interesting part is what Claude does with the data afterwards, especially when the market you ask about closed hours ago.
On this page
- Pick a Claude client and get a key
- Set up the Claude MCP server in Claude Code
- Set up Claude Desktop
- Connect from the Claude API
- Five prompts to test the connection
- What a good answer looks like
- What happens when the market is closed
- ChatGPT: the same server over OAuth
- Troubleshooting the connection
- Questions
Key takeaways
- Claude reaches TickerLayer through the Model Context Protocol: one server URL, https://mcp.tickerlayer.com/mcp, plus an API key header or an OAuth sign-in.
- Claude Code needs one command, Claude Desktop uses a small local bridge in its config file, and the Claude API connects server-side through its MCP connector.
- A good market answer names the price, the time it was set and the session; for a closed market it says so and gives the next open.
- The ten tools are read-only, and every tool call counts as one REST request on your plan, free tier included.
To connect Claude to live market data, add TickerLayer as an MCP server. In Claude Code that is one claude mcp add command; in Claude Desktop it is a short config block; in your own app it is two parameters on the Claude API. Claude then sees ten read-only tools for quotes, bars, market hours and bond yields, and calls them instead of answering from memory.
MCP, the Model Context Protocol, is the open standard Claude uses to call external tools. The financial MCP server guide explains the protocol and the full tool catalog. This page is the practical half: setup in each Claude client, five prompts that test the connection, and what a good answer looks like in pre-market and after the close.
Pick a Claude client and get a key
- Claude CodeTerminal agent. Connects straight to the hosted server with your key as a header.
- Claude DesktopChat app. Uses a pinned local bridge from its config file; needs Node.js 18 or newer.
- Claude APIYour own app. The Messages API connects to the server for you with the MCP connector.
All three need a TickerLayer API key from the dashboard. A free API key works: the MCP server forwards each tool call to the REST API, so calls count against the free tier's 3,000 requests a month and follow your plan's entitlements.
Set up the Claude MCP server in Claude Code
- Export your keyPut it in
TICKERLAYER_API_KEYso it never appears literally in your shell history. - Add the serverRegister the hosted URL over HTTP with an
x-api-keyheader. - Confirm it connectedList your MCP servers and check that
tickerlayerreports connected. - Ask a market questionStart a session and ask something that needs live data, such as the status of the US market.
export TICKERLAYER_API_KEY="YOUR_API_KEY"
claude mcp add --transport http tickerlayer https://mcp.tickerlayer.com/mcp \
--header "x-api-key: $TICKERLAYER_API_KEY"
claude mcp listSet up Claude Desktop
Claude Desktop reads MCP servers from claude_desktop_config.json (Settings, Developer, Edit Config). The tested setup runs a pinned mcp-remote bridge that forwards to the hosted server over HTTP and keeps the key in an environment variable rather than in the command arguments. Paste this, replace the placeholder, and restart the app:
{
"mcpServers": {
"tickerlayer": {
"command": "npx",
"args": [
"-y", "[email protected]", "https://mcp.tickerlayer.com/mcp",
"--transport", "http-only",
"--header", "x-api-key:${TICKERLAYER_API_KEY}"
],
"env": { "TICKERLAYER_API_KEY": "YOUR_API_KEY" }
}
}
}Connect from the Claude API
In your own application, the Messages API opens the MCP connection for you. Pass the server in mcp_servers and reference it from tools; the authorization_token is sent as a bearer token, which the TickerLayer server accepts as your API key.
import os
import anthropic # pip install anthropic
client = anthropic.Anthropic() # reads ANTHROPIC_API_KEY
response = client.beta.messages.create(
model="claude-opus-5",
max_tokens=16000,
betas=["mcp-client-2025-11-20"],
mcp_servers=[{
"type": "url",
"url": "https://mcp.tickerlayer.com/mcp",
"name": "tickerlayer",
"authorization_token": os.environ["TICKERLAYER_API_KEY"],
}],
tools=[{"type": "mcp_toolset", "mcp_server_name": "tickerlayer"}],
messages=[{"role": "user", "content": "Is the US stock market open, and where is US:KO trading?"}],
)
for block in response.content:
if block.type == "mcp_tool_use":
print("tool:", block.name, block.input)
elif block.type == "text":
print(block.text)Tool calls run on the API side and come back as mcp_tool_use and mcp_tool_result blocks alongside Claude's text. The AI trading bot tutorial extends this into a full agent loop with guardrails and a paper ledger.
Five prompts to test the connection
| Prompt | Tool Claude should call | A good answer includes |
|---|---|---|
| "Is the US stock market open right now?" | get_market_status for stocks, market US | The session name (pre-market is not "open") and the next open |
| "How is Coca-Cola trading? Use US:KO." | get_snapshot for US:KO | Last price, the time it was set, change against the previous close |
| "What is the 10-year US Treasury yield compared with Germany's?" | get_bond_yield for US:10Y and DE:10Y | Both yields with their observation dates, and the gap in basis points |
| "Pull daily EURUSD bars for June 2026 and summarize the trend." | get_history for forex EURUSD, 1 day | First and last close, the range, dates in UTC |
| "When does Tokyo open next, in my time zone?" | get_market_status for stocks, market JP | next_open converted from UTC to your zone |
What a good answer looks like
On 28 September 2026 at 10:43 UTC, get_snapshot for US:KO returned a last price of 88.16 stamped 06:43 New York time, a previous close of 87.81 and a change of +0.35 (+0.40%), while get_market_status reported pre_market with is_open: true. The same numbers can produce an honest answer or a misleading one:
Grounded answer
- US:KO last traded at 88.16 at 06:43 New York time, in the pre-market session.
- That is 0.35 (0.40%) above Friday's close of 87.81.
- The regular session opens at 09:30 New York, 13:30 UTC.
Answer to push back on
- "Coca-Cola is trading at 88.16 right now," with no time or session.
- "The market is open," because
is_openwas true in pre-market. - Any price with no tool call behind it.
What happens when the market is closed
Ask about Tokyo in the European morning and the answer should change shape. At 10:52 UTC, 19:52 in Tokyo, the status tool reported the market closed and gave the next open:
get_market_status for Japan, after the close
{
"asset": "stocks",
"market": "JP",
"status": "closed",1
"is_open": false,
"reason": "Outside primary session",
"timezone": "Asia/Tokyo",
"local_time": "2026-09-28T19:52:47.463+09:00",2
"next_open": "2026-09-29T00:00:00.000Z"3
}
statusClosed, so any price Claude quotes is the last known value, not a live one.local_timeThe market's own clock, handy for "it is evening in Tokyo".next_open00:00 UTC is 09:00 in Tokyo the next morning.
Where the question landed, in UTC
Hours in UTC
A snapshot still returns data at that hour, which is correct: it is the last known value. For JP:7203 it showed a last trade of 2,986.5 stamped 06:30:01 UTC, the 15:30 Tokyo close, against a previous close of 2,989.5. A good closed-market answer reads like this: "Tokyo is closed. JP:7203 last traded at 2,986.5 at the 15:30 close, down 3.0 (0.10%). Trading resumes at 09:00 Tokyo time, 00:00 UTC." The stock market hours guide covers sessions across markets.
ChatGPT: the same server over OAuth
ChatGPT apps and connectors are built on MCP as well, so the same server works there with an OAuth sign-in instead of a key. Developer mode is available on Plus, Pro, Business, Enterprise and Edu plans:
- Enable developer modeIn ChatGPT on the web: Settings, Apps & Connectors, Advanced settings, Developer mode.
- Create the connectorName it TickerLayer, set the MCP server URL to
https://mcp.tickerlayer.com/mcpand choose OAuth. - Sign in onceChatGPT redirects to the TickerLayer sign-in; approve access.
- Turn it on in a chatOpen the + menu, choose Developer mode and enable TickerLayer.
Troubleshooting the connection
| Symptom | Likely cause | Fix |
|---|---|---|
| 401 or "unauthorized" | Missing key or wrong header name | Send exactly x-api-key, or redo the OAuth sign-in |
403 inside a tool result | Your plan does not include that data | Check the feeds on pricing; retrying will not help |
400 invalid symbol or 404 symbol not available | Bare ticker or wrong asset class | Use US:KO, not KO; indices such as US500 are their own class |
429 responses | Too many calls per second, or the monthly quota is used up | Ask for fewer symbols per turn, or read 429 handling |
| No tools in Claude Desktop | Invalid JSON or Node.js older than 18 | Validate the config file and restart the app |
Questions
What is Claude MCP?
It is Claude's support for the Model Context Protocol, the open standard for connecting an AI client to external tools. Adding an MCP server gives Claude new tools, such as live market data lookups.
Can Claude get real-time stock prices?
Yes, through an MCP server such as TickerLayer's. Claude calls a quote or snapshot tool and reads the result, including its timestamp. Availability and delay vary by market.
Is the Model Context Protocol free?
The protocol is an open standard. The data behind a server may be paid; TickerLayer's MCP server works with a free API key within 3,000 REST requests a month.
Does Claude Desktop support remote MCP servers?
Yes. Use the documented mcp-remote bridge in the config file, or, where your Claude app offers custom connectors by URL, the OAuth sign-in.
Can ChatGPT use the same MCP server?
Yes. ChatGPT connects to https://mcp.tickerlayer.com/mcp as a developer-mode connector with OAuth, no API key to paste.
Why does Claude quote a price when the market is closed?
Snapshots return the last known value at any hour. A good answer labels it with its timestamp and says the market is closed; add that rule to Claude's instructions if it does not.