API guide

Financial MCP server: give AI agents live market data

A model that guesses a price is worse than one that admits it doesn't know. MCP lets it ask instead, and the way the tools are designed decides whether it asks well.

On this page
  1. What is MCP? Hosts, clients, servers and tools
  2. The ten TickerLayer MCP tools
  3. Connect a client with an API key or OAuth sign-in
  4. Example prompts and the tool calls behind them
  5. Guardrails: market hours, freshness and honest failure
  6. Hosted financial MCP server or build your own
  7. Cost, limits and pay-per-call access
  8. Questions

Key takeaways

  • The Model Context Protocol (MCP) is an open standard that lets an AI client discover typed tools on a server and call them, so a model fetches a quote instead of recalling one.
  • TickerLayer's hosted financial MCP server at https://mcp.tickerlayer.com/mcp exposes ten read-only tools: quotes, trades, snapshots, bars, symbols, market calendars and bond yields.
  • Clients authenticate with an x-api-key header or an OAuth 2.1 sign-in, and every tool call runs under the same plan, entitlements and rate limits as a REST request.
  • In market status, is_open is also true in pre-market and post-market, so an agent that needs the regular session must check for status "open".
  • Build your own MCP server only for private logic such as positions or risk; run it next to the hosted market-data server rather than re-implementing quotes.

A financial MCP server is a Model Context Protocol server that exposes market data as tools an AI model can call: "latest quote for US:KO", "trading sessions in Tokyo today", "daily EURUSD bars for June". The model reads each tool's description and input schema, picks the one that answers the question, and gets structured JSON back instead of inventing a number from its training data.

TickerLayer runs one at https://mcp.tickerlayer.com/mcp. This guide covers how MCP works, the ten tools with real outputs, both ways to authenticate, when to build your own server, and the guardrails that keep an agent honest about market hours and stale data. For a client-by-client walkthrough, see how to connect Claude to live market data; for a working agent loop, see the AI trading bot tutorial.

What is MCP? Hosts, clients, servers and tools

MCP separates three roles. The host is the app you talk to: Claude, ChatGPT, an IDE or your own agent. Inside it, a client holds one connection to one server, and the server publishes tools, each with a name, a description and a JSON Schema for its inputs. Remote servers speak Streamable HTTP: JSON-RPC messages sent as HTTP POSTs, with responses that may arrive as a short server-sent event stream.

  1. Your question"Is KO up today?"
  2. MCP hostClaude, ChatGPT, IDE, agent
  3. tools/callget_snapshot US:KO
  4. TickerLayer MCPmcp.tickerlayer.com/mcp
  5. REST APIyour plan and limits
  6. JSON answerprice plus timestamp
One question, one tool call. The server is a thin layer over the REST API, so nothing about your entitlements changes.

Tools beat letting the model write HTTP code, because the tool schema carries the knowledge the model would otherwise guess: that stocks need a country prefix (US:KO, never KO), that indices are their own asset class (US500, not US:US500), that timestamps are Unix milliseconds. The TickerLayer server also sends these conventions as server instructions during the handshake, so a well-behaved client reads them before the first call.

AI clientMCP serverREST API
  1. initializeprotocol version, client infoAI client to MCP server
  2. capabilities + instructionssymbol and timestamp conventionsMCP server to AI client
  3. tools/listAI client to MCP server
  4. 10 tool schemasall annotated read-onlyMCP server to AI client
  5. tools/call get_market_status{"asset_class":"stocks","market":"US"}AI client to MCP server
  6. GET /markets/status?asset=stocks&market=USMCP server to REST API
  7. 200 JSONREST API to MCP server
  8. result: text + structuredContentMCP server to AI client
The handshake and one tool call, as captured against the hosted server on 2026-09-28.

The ten TickerLayer MCP tools

Every tool is read-only: none of them places orders, changes an account or writes anything. Six of them take an asset_class of crypto, forex, stocks, indices, etfs, commodities or perpetuals (perpetuals need the Perpetuals plan). The calendar tools cover the classes that have trading hours; perpetual contracts trade around the clock.

ToolAnswersKey inputs
get_quoteCurrent bid and ask with sizesasset_class, symbol
get_last_tradeMost recent trade: price, size, timeasset_class, symbol
get_snapshotQuote, last trade, previous close and change in one callasset_class, symbol
get_previous_closeLast completed daily bar, or the latest settled intraday barasset_class, symbol, optional interval (1m to 1d)
get_historyOHLCV bars between two UTC datesasset_class, symbol, multiplier, timespan (minute, hour, day), from, to
list_symbolsSymbols the account can query, filtered by textasset_class, search, limit
get_market_statusOpen, closed, pre-market or post-market, with next open and closeasset_class, market or symbol
get_market_sessionsPre-market, primary and post-market windows for a datemarket, date
get_market_holidaysFull closures and early closesmarket, year
get_bond_yieldLatest daily government bond yieldsymbol as COUNTRY:TENOR, e.g. US:10Y
The complete tool list, verified with tools/list against the hosted server.

Two behaviours are worth knowing before you write prompts. get_previous_close with interval: "1m" returns the most recently settled bar with its own bar_start and bar_end, so on a Monday morning it hands back the last minute of Friday's session rather than an empty result. And list_symbols filters the account's catalog by substring, which is how a model should turn "Coca-Cola" into US:KO instead of guessing a ticker.

get_snapshot is the workhorse: most "how is X doing" questions need exactly one call. Here is what it returned for Coca-Cola during the US pre-market on 28 September 2026:

get_snapshot result for US:KO

{
  "symbol": "US:KO",
  "bid": 88.11,
  "ask": 88.2,
  "last_price": 88.16,1
  "last_timestamp": 1790592229876,2
  "last_size": 100,
  "prev_close": 87.81,3
  "change": 0.35,
  "change_percent": 0.39864
}
  1. last_priceThe latest trade. At this hour it is a pre-market print, not a regular-session price.
  2. last_timestampUnix milliseconds: 10:43:49 UTC, which is 06:43 in New York. A good answer quotes this time.
  3. prev_closeFriday's regular-session close, the base for change.
  4. change_percentPercent change of the last trade against the previous close.
Trimmed (sizes omitted). The tool returns the JSON as text and the same object as structuredContent.

Connect a client with an API key or OAuth sign-in

There are two ways in. Clients that can send HTTP headers (Claude Code, Cursor, VS Code, Windsurf, custom agents) send your key as x-api-key, or as Authorization: Bearer with the same key. OAuth-capable clients such as ChatGPT developer-mode connectors need only the URL: the server implements the MCP authorization spec (OAuth 2.1 with discovery, PKCE, dynamic client registration and refresh tokens), so the client opens a TickerLayer sign-in and you approve access once.

Claude CodeShell
claude mcp add --transport http tickerlayer https://mcp.tickerlayer.com/mcp \
  --header "x-api-key: YOUR_API_KEY"
Any client that accepts headersJSON
{
  "mcpServers": {
    "tickerlayer": {
      "type": "http",
      "url": "https://mcp.tickerlayer.com/mcp",
      "headers": { "x-api-key": "YOUR_API_KEY" }
    }
  }
}
FeatureAPI key headerOAuth sign-in
Typical clientIDEs, CLIs, agents you runChat apps such as ChatGPT
What you pasteURL and keyURL only
Key stored in the client
Same plan, entitlements and limits as REST
Separate MCP quota
Both paths end in the same account. Config details for each client live in the [MCP docs](/docs/mcp#connect).

Example prompts and the tool calls behind them

The best way to judge a financial MCP server is to watch which tools a model picks. These prompts come from the MCP documentation; the right column is what a capable model calls.

PromptTool callsWhat to check in the answer
"How is Coca-Cola doing today?"get_snapshot stocks US:KO (after list_symbols if unsure)Price with its time, and whether the session is regular
"Is the US stock market open right now?"get_market_status stocks, market USPre-market is reported as pre-market, not as open
"Pull daily EURUSD bars for June and summarize the trend."get_history forex EURUSD, 1 day, 2026-06-01 to 2026-06-30Dates are UTC; the summary cites first and last close
"What is the 10-year US Treasury yield, and how does Germany compare?"get_bond_yield US:10Y and DE:10YYields are daily observations with a date
"When does Tokyo open next?"get_market_status stocks, market JPnext_open converted to local time

Guardrails: market hours, freshness and honest failure

Connecting is the easy part. The hard part is time. Agents fail in three predictable ways: they describe a weekend price as live, they treat pre-market as the open market, and they paper over a failed tool call with a number from memory. All three are fixable, and the tools give you what you need.

get_market_status for US stocks at 10:49 UTC

{
  "asset": "stocks",
  "market": "US",
  "status": "pre_market",1
  "is_open": true,2
  "phase": "pre_market",
  "timezone": "America/New_York",
  "next_open": "2026-09-28T13:30:00.000Z",3
  "next_close": "2026-09-28T20:00:00.000Z"
}
  1. statusThe field to branch on. The regular session reports "open"; this is "pre_market".
  2. is_openTrue in pre-market and post-market too. Never use it alone to mean "regular session".
  3. next_openISO 8601 in UTC: 13:30 UTC is 09:30 in New York.
Captured through the MCP server on 2026-09-28. Calendars are indicative; the response carries a data notice saying so.

Rules worth putting in the system prompt, and in code

  • Call get_market_status before calling a price "live"; the regular session is status: "open".
  • Quote every price with its timestamp, converted to the market's time zone.
  • Outside the session, present a snapshot as the last known value and say when it was set.
  • Treat bond yields as daily observations: a Friday date on a Monday is normal, not stale.
  • On a tool error, say the data is unavailable. Never substitute a remembered price.
  • A 403 inside a tool result means the plan does not include that data; do not retry with invented endpoints.
  • Keep anything that acts on a price (alerts, orders) in deterministic code outside the model.

Prompts steer; code enforces. If the answer feeds a decision, re-check status and freshness in your own code, as the AI trading bot tutorial does. The exchange calendar API guide covers sessions and holidays in depth, and bad ticks and stale prices covers freshness budgets.

Hosted financial MCP server or build your own

You rarely need to rebuild market-data tools, but you often need a few private ones: your positions, your risk limits, a spread calculation your desk trusts. MCP hosts can connect to several servers at once, so the practical architecture is layered: your small server for private logic, the hosted server for data.

  1. AI hostClaude, ChatGPT, an IDE or your agent loopyou talk here
  2. Your MCP serverPositions, risk checks, house calculationsoptional
  3. TickerLayer MCP serverTen read-only market-data toolshosted
  4. TickerLayer REST APIPlans, entitlements, rate limits
  5. Aggregation layerDerived, indicative market data
Build only the layer that is yours. Both servers can be attached to the same host.

If you do build an MCP server of your own, the Python MCP SDK keeps it short. This server adds one tool, spread in basis points, on top of the REST quote endpoint. It was tested with mcp 2.2 and httpx on Python 3.12:

spread_server.pyPython
"""A tiny MCP server with one private tool: spread in basis points."""
import os

import httpx
from mcp.server.mcpserver import MCPServer  # pip install "mcp>=2.2" httpx

API = "https://api.tickerlayer.com"
KEY = os.environ["TICKERLAYER_API_KEY"]

mcp = MCPServer("spread-tools")


@mcp.tool()
def spread_bps(asset_class: str, symbol: str) -> dict:
    """Bid-ask spread in basis points for one symbol, with the quote time.

    asset_class is crypto, forex, stocks, indices, etfs or commodities;
    stocks use COUNTRY:TICKER, for example US:KO.
    """
    resp = httpx.get(f"{API}/{asset_class}/quote/{symbol}",
                     headers={"x-api-key": KEY}, timeout=10)
    resp.raise_for_status()
    q = resp.json()
    bid, ask = float(q["bid"]), float(q["ask"])
    mid = (bid + ask) / 2
    return {"symbol": q["symbol"], "spread_bps": round((ask - bid) / mid * 10_000, 3),
            "timestamp": q["timestamp"]}


if __name__ == "__main__":
    mcp.run()  # stdio: the host launches this file as a subprocess
Attach it next to the hosted serverShell
claude mcp add --transport stdio --env TICKERLAYER_API_KEY=YOUR_API_KEY \
  spread-tools -- python spread_server.py

# Tool result for spread_bps("stocks", "US:KO"), US pre-market:
# {"symbol": "US:KO", "spread_bps": 5.671, "timestamp": 1790592872094}

Tool design rules that make models pick the right call

Whatever you build, the model only sees names, descriptions and schemas. These are the rules the hosted server follows, and they carry over to any MCP server tutorial you start from:

  • Few tools, uniform parameters. Ten tools with the same asset_class and symbol pair beat sixty per-asset tools. Models tend to choose worse as the list grows.
  • Conventions in the description. Put the symbol format and a counter-example ("US:US500 is invalid, use indices US500") where the model reads it, not in a README it never sees.
  • Errors as results, not crashes. Return a tool result flagged as an error with a plain sentence ("symbol not in catalog") so the model can recover or say so.
  • Structured output. Return the JSON object as well as text, with units and timestamp fields named consistently, so the host can render it and the model can cite it.
  • Read-only by annotation. Mark data tools read-only and non-destructive; hosts can use those hints to decide when to ask the user first.

Use the hosted server when

  • You need quotes, bars, calendars or yields and nothing proprietary.
  • You want OAuth sign-in for chat apps without running infrastructure.
  • Symbol conventions and schemas should stay someone else's job.

Build your own when

  • Tools must read private data: positions, orders, internal risk.
  • You need a calculation the model should not improvise.
  • The server must run offline over stdio next to your code.

Cost, limits and pay-per-call access

MCP access comes with every TickerLayer key, including the free tier, and consumes the same request quota. Paid feeds start at $49 a month on Individual plans with 250,000 REST calls; see pricing. If an agent should pay per call without an account at all, x402 pay-per-call payments cover 41 REST resources for a few cents each, settled in USDC.

MCP tools are request and response. For a price that updates on screen, use the WebSocket stream and let the agent read from your own cache. The MCP overview page lists every supported client.

Questions

What is an MCP server in finance?

It is a Model Context Protocol server whose tools return financial data such as quotes, bars, market hours and yields. An AI client discovers the tools and calls them, so answers come from live data rather than the model's memory.

Is there a free MCP server for stock market data?

TickerLayer's hosted MCP server works with a free API key. Each tool call counts as one REST request against the free tier's 3,000 requests a month.

Can an MCP server place trades?

An MCP server can expose any tool, but TickerLayer's ten tools are read-only market data. TickerLayer is not a broker and does not execute orders.

Which AI clients work with the TickerLayer MCP server?

Claude Code, Claude Desktop through a local bridge, Cursor, VS Code, Windsurf, the ChatGPT app through OAuth, and agents built on model APIs that support remote MCP servers.

What is the difference between MCP and a REST API?

REST is the transport for data; MCP is a discovery and calling convention for AI clients. The TickerLayer MCP server wraps the REST API, so the data, entitlements and limits are identical.

Does the MCP server stream real-time prices?

No. MCP tools answer one request at a time. For continuous updates use the WebSocket stream and let the agent read the latest values from your application.

Keep reading

Ready to integrate?

Start with the free tier, explore the docs, and connect via REST or WebSocket in minutes.