MCP Server
Connect AI assistants to Pyth market data via the Model Context Protocol
The Pyth MCP server gives AI assistants direct, structured access to Pyth market data through the Model Context Protocol. You can discover feeds, fetch real-time and historical prices, replay every update in a short window, and generate chart-ready candles, all within a single conversation.
MCP endpoint: https://mcp.pyth.network/mcp — no self-hosting required.
Tools
| Category | Tool | Description | API key |
|---|---|---|---|
| Discovery | get_symbols | Find feeds by text, asset type, instrument type or futures chain | Optional |
| Real-time | get_latest_price | Latest prices for up to 100 feeds | Yes |
| Historical | get_historical_price | Prices at one point in time for up to 50 feeds | Yes |
| Historical | get_price_range | Every price update in a window of up to 60 seconds | Yes |
| Charting | get_candlestick_data | OHLC candles for one feed (up to 500 per response) | Yes |
| Utility | convert_date_to_timestamp | Convert a date to Unix seconds and microseconds | No |
Price tools accept full symbols (Crypto.BTC/USD) or plain pairs (BTC/USD).
API Key
Every user brings their own Pyth Pro API key; the hosted server has none of its own. See Acquire an API Key.
Give the server your key in one of three ways. A key passed on a call overrides a configured one.
- In your MCP client's configuration (recommended): your client sends the key as an
Authorization: Bearer <key>header on every request. The Setup tabs below show how for each client. - As an environment variable, for a local server: set
PYTH_PRO_ACCESS_TOKENin the server'senvblock. - On each call: the
access_tokenparameter. Your assistant asks for the key when none is configured.
Configure the key in your client rather than pasting it into chat, and keep it out of config files you commit or share.
get_symbols works without a key. With a key, it also lists feeds visible only to Pro keys and marks each feed entitled: true or false: whether your key can query that feed.
Setup
- Endpoint:
https://mcp.pyth.network/mcp - Transport: Streamable HTTP
- Auth: connecting needs no key; the price tools use your key, sent as an
Authorization: Bearerheader
Replace YOUR_API_KEY with your Pyth Pro API key.
Add Server
claude mcp add --transport http pyth https://mcp.pyth.network/mcp \
--header "Authorization: Bearer YOUR_API_KEY"This adds Pyth only to the folder you run the command in. To use it in every project, add --scope user; any project you open can then call the price tools with your key.
Verify
claude mcp listTool Reference
Every price tool also takes an optional access_token. Leave it out when your client sends the key.
get_symbols
Search and list Pyth Pro feeds.
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | No | Text filter, e.g. BTC, gold, AAPL |
asset_type | string | No | crypto, crypto-index, crypto-redemption-rate, fx, equity, metal, rates, interest-rate, nav, commodity, funding-rate, eco, kalshi |
instrument_type | string | No | spot, future, perp, rate, index, nav |
symbol_chain_id | string | No | Futures chain, exact match (e.g. VX for all VIX futures) |
include_inactive | boolean | No | Include retired feeds. Default false |
verbose | boolean | No | Return every catalog field (trading schedules, market sessions, corporate actions). Default false |
limit | number | No | Default 50, max 200 |
offset | number | No | Default 0 |
- Each feed has a
state. Onlystablefeeds return prices;betaandcoming_soonfeeds are listed but cannot be queried yet. - With a key, each feed carries
entitled, and the list includes feeds visible only to Pro keys.
get_latest_price
Fetch the latest prices for one or more feeds.
| Parameter | Type | Required | Description |
|---|---|---|---|
symbols | string[] | No* | BTC/USD or Crypto.BTC/USD |
price_feed_ids | number[] | No* | Feed IDs from get_symbols |
channel | string | No | real_time, fixed_rate@50ms, fixed_rate@200ms or fixed_rate@1000ms. Default fixed_rate@200ms |
properties | string[] | No | Fields to return (see below) |
* At least one of symbols or price_feed_ids is required.
- Up to
100feeds per request. If bothsymbolsandprice_feed_idsare sent, only the IDs are used. properties:price,bestBidPrice,bestAskPrice,exponent,publisherCount,confidence,fundingRate,fundingTimestamp,fundingRateInterval,marketSession,emaPrice,emaConfidence,feedUpdateTimestamp. The default is the first six plusmarketSessionandfeedUpdateTimestamp.- Prices are integers with an
exponent. Each response also carriesdisplay_*values (display_price,display_bid,display_ask,display_funding_rate, …) with the exponent applied.
get_historical_price
Get prices at a single historical timestamp.
| Parameter | Type | Required | Description |
|---|---|---|---|
symbols | string[] | No* | BTC/USD or Crypto.BTC/USD |
price_feed_ids | number[] | No* | Feed IDs |
timestamp | number | Yes | Unix seconds, milliseconds, or microseconds |
channel | string | No | Same values as get_latest_price |
* At least one of symbols or price_feed_ids is required.
- Up to
50feeds per request. If both are sent, only the IDs are used. - The timestamp is aligned down to the channel's update interval.
Historical data is available from April 2025 onward.
get_price_range
Return every price update for one or more feeds within a short window, such as the seconds around a liquidation or a news event.
| Parameter | Type | Required | Description |
|---|---|---|---|
symbols | string[] | No* | BTC/USD or Crypto.BTC/USD |
price_feed_ids | number[] | No* | Feed IDs |
start | number | Yes | Window start: Unix seconds, milliseconds, or microseconds |
end | number | Yes | Window end, at most 60 seconds after start |
limit | number | No | Rows per page. Default 100, max 500 |
after | string | No | next_cursor from the previous page |
channel | string | No | Same values as get_latest_price |
* At least one of symbols or price_feed_ids is required. Up to 50 feeds.
- When
has_moreistrue, call again with the same arguments andafterset tonext_cursor.
get_candlestick_data
Fetch OHLC candlestick data for a single feed.
| Parameter | Type | Required | Description |
|---|---|---|---|
symbol | string | Yes | BTC/USD or Crypto.BTC/USD |
resolution | string | Yes | 1, 5, 15, 30, 60, 120, 240, 360, 720, D, W, M |
from | number | Yes | Start time (Unix seconds) |
to | number | Yes | End time (Unix seconds) |
channel | string | No | Same values as get_latest_price |
frommust be earlier thanto.- Up to
500candles per response; larger results come back withtruncated: true. - For funding-rate feeds, candles chart the mark price. Use
get_latest_priceorget_historical_pricefor the funding rate itself.
convert_date_to_timestamp
Convert a date to Unix timestamps for the other tools. No key needed.
| Parameter | Type | Required | Description |
|---|---|---|---|
date_string | string | Yes | ISO 8601, e.g. 2026-01-01 or 2026-01-01T14:30:00Z. Dates without a timezone are read as UTC |
Troubleshooting
"This tool requires your Pyth Pro access token"
- Cause: No key reached the server.
- Fix: Configure the key in your client (see Setup), then restart or reconnect the client. Or pass it as
access_token.
Invalid or expired key
- Cause: The server rejected the key (HTTP 401).
- Fix: Check that the header reads exactly
Authorization: Bearer <key>, or get a new key from Acquire an API Key.
Not entitled to a feed
- Cause: Your key is valid, but your plan does not include the feed (HTTP 403). The error names the entitlement group it needs.
- Fix: Run
get_symbolswith your key and pick feeds withentitled: true.
Symbol not found or ambiguous
- Fix: Use the full symbol or a feed ID from
get_symbols. For an ambiguous pair, the error lists the matching feeds.
Feed listed in missing_feed_ids
- Cause: The feed is not live yet (
betaorcoming_soon), or the channel is faster than the feed'smin_channel. - Fix: Check the feed's
stateandmin_channelinget_symbols, or use a slower channel.
No historical data
- Fix: Use timestamps from April 2025 onward, and not in the future.
Truncated candles
- Symptom: Response includes
truncated: true - Fix: Narrow the time range or use a larger resolution.
Next: MCP Skills
Once the server is connected, you can go beyond raw tool calls with MCP Skills — pre-built prompt templates that teach your AI assistant specific workflows:
- Portfolio tracking — value, allocation, and P&L in one question
- Volatility analysis — annualized vol, ATR, and risk comparison
- FX conversion — cross-rate conversions through Pyth feeds
- Data export — dump OHLC, snapshots, or feed catalogs as CSV/JSON
- And more — price alerts, funding rates, cross-asset comparisons, integration guidance
Browse all 9 skills with example prompts on the MCP Skills page.
Local Development
Optionally run the MCP server locally:
git clone https://github.com/pyth-network/pyth-crosschain.git
cd pyth-crosschain
pnpm install
pnpm --filter @pythnetwork/mcp buildThen configure your client with stdio transport. The local server reads your key from PYTH_PRO_ACCESS_TOKEN:
{
"mcpServers": {
"pyth": {
"command": "node",
"args": ["<path-to-repo>/apps/mcp/dist/index.js"],
"env": {
"PYTH_PRO_ACCESS_TOKEN": "YOUR_API_KEY"
}
}
}
}