# pyth-mcp [Health: Active]

**Category:** 💰 Finance & Fintech  
**Repository:** https://github.com/hajirabegumbegum907-max/pyth-mcp  
**GitHub Stars:** 0  
**npm Downloads (last month):** 420  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/pyth-mcp

## Description
Zero-dependency Pyth Network Hermes price feeds, feed catalog, TTL cache, CLI, and MCP stdio server

## Tools
Capabilities this server exposes over MCP:

- **pyth_get_price** — Get one latest price, confidence interval, EMA, publish time, and staleness
- **pyth_get_prices** — Get up to 100 prices with independent per-feed cache entries
- **pyth_get_price_history** — Return the in-session price history for one feed
- **pyth_list_feeds** — Search the Hermes feed catalog with optional asset and limit filters
- **pyth_resolve_feed** — Resolve a symbol or feed id to canonical feed metadata
- **pyth_stream_prices** — Stream live price updates for up to 100 feeds for a bounded duration
- **pyth_ping** — Check Hermes reachability with a small live request

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "pyth-mcp": {
    "command": "npx",
    "args": ["-y","pyth-mcp"],
    "env": {
      "PYTH_API_KEY": ""
    }
  }
}
```

**Requires environment variables:** `PYTH_API_KEY` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What pyth-mcp does

pyth-mcp exposes Pyth Network Hermes price feeds through an MCP stdio server and a command-line interface. It can retrieve one quote or a batch of up to 100 feeds, search the Hermes catalog, resolve symbols and feed IDs, inspect prices collected during the current session, and stream updates for a bounded period.

Quote data includes the raw integer value, exact decimal representation, exponent, confidence interval, EMA price, publish time, and staleness indicators. Built-in mappings cover BTC/USD, ETH/USD, SOL/USD, USDC/USD, and USDT/USD; other assets can be found through catalog search or addressed with a full symbol or 64-character hexadecimal feed ID.

The project uses Node.js built-ins only and provides TypeScript declarations for its programmatic API. It is intended for agents or applications that need structured market data from Pyth rather than a general-purpose trading or portfolio system.

## How it works

The MCP process communicates over newline-delimited JSON-RPC 2.0 on standard input and output. It negotiates supported MCP protocol versions and keeps stdout reserved for protocol messages. The server accepts closed tool schemas, so invalid inputs receive JSON-RPC invalid-parameter errors.

Latest prices use independent per-feed cache entries. The default price-cache lifetime is 30 seconds, while catalog results default to a one-hour lifetime. Cache data is stored on disk under `.pyth-mcp/`; unreadable cache files are quarantined and rebuilt. The cache also prunes expired data and observes entry and size limits.

Fresh quotes fetched during a process session are added to bounded in-memory ring buffers. Price history is returned newest last and is not persisted to disk. If a refresh fails, the client can use the last known quote with an explicit stale marker. Requests have bounded timeouts and retries, including handling for HTTP 429 responses and their `Retry-After` values.

## Setup and configuration

Install the package with npm and run the MCP process with:

```bash
npm install pyth-mcp
npx -y pyth-mcp
```

An MCP client can launch it with the `pyth-mcp` command and no account setup. Docker users can build the included image and run it interactively; the container starts the stdio server directly.

The implementation requires Node.js 20 or newer. `PYTH_ROOT` selects the project root when no CLI `--root` option is supplied. Other configuration variables include `PYTH_BASE_URL`, `PYTH_TIMEOUT_MS`, `PYTH_CACHE_TTL_MS`, `PYTH_CATALOG_TTL_MS`, and `PYTH_RETRIES`. Set `PYTH_API_KEY` before retrieving live price updates where the Hermes service requires authentication. The key is sent as a bearer token and is redacted from CLI and public configuration output.

## Tools and capabilities

- `pyth_get_price` retrieves one latest quote with confidence, EMA, publish-time, and staleness information.
- `pyth_get_prices` fetches up to 100 feeds, with separate cache handling and per-feed errors.
- `pyth_get_price_history` returns the current session's bounded history for one feed.
- `pyth_list_feeds` searches the Hermes catalog, with optional asset-type and result-limit filters.
- `pyth_resolve_feed` maps a symbol or feed ID to canonical feed metadata.
- `pyth_stream_prices` emits live updates for as many as 100 feeds during a bounded interval.
- `pyth_ping` performs a small live Hermes request to check reachability.

The CLI adds commands for initialization, catalog searches, single or batch price retrieval, history, watch loops, configuration, and MCP startup. Watch mode can poll at an interval, emit JSON, continue after transient failures, and report alerts when a configured threshold is crossed.

## Limitations and notes

Session history exists only in memory and is lost when the process ends. A quote is marked stale when its oracle update is more than 60 seconds old; allowing stale data can return the last known history value after a failed refresh. Batch price requests can contain both successful quotes and individual errors, but fail when none of the requested feeds can be returned.

Hermes access is public in the default configuration, but live price retrieval may require an API key under current service policy. Catalog entries that cannot be parsed are skipped and reported rather than stopping the whole catalog request. The server is focused on Pyth feed access and does not provide order execution or trading operations.

_Full upstream README: https://allmcps.com/mcp/pyth-mcp/readme_

