{
  "markdown": "<!-- mcp-name: io.github.MarvinRey7879/patternfetch -->\n\n# patternfetch\n\n**patternfetch is a market-data API for AI agents covering US stocks, ETFs and crypto spot.** One\ncall with a ticker and a timeframe returns a token-compact market-state report: compact candles,\ndetected chart and candlestick patterns, support and resistance levels, market regime, and\ninterpreted indicators (RSI, EMA). Every detected pattern carries its backtested historical hit rate\n**and** its lift against the pattern-free baseline of the same market, so an agent can tell a\npattern that carries information from one that does not. Six tools — `brief`, `multi`, `delta`,\n`analogs`, `scan`, `capabilities` — reachable over REST and MCP, with one-click OAuth, credit\nbilling via Stripe or x402 USDC on Base, a keyless demo endpoint, and $3 starter credit on signup.\nImpersonal market data, not investment advice.\n\n[![npm](https://img.shields.io/npm/v/patternfetch)](https://www.npmjs.com/package/patternfetch)\n[![patternfetch MCP server](https://glama.ai/mcp/servers/MarvinRey7879/patternfetch-client/badges/score.svg)](https://glama.ai/mcp/servers/MarvinRey7879/patternfetch-client)\n[![license](https://img.shields.io/badge/license-MIT-blue)](./LICENSE)\n\n> **Why it's smaller:** for BTC/USDT 4h (120 candles), a raw OHLCV dump is ~3,260 tokens of just numbers the model still has to analyze; patternfetch's interpreted analysis is ~1,323 tokens, already decided. [Reproduce it](https://gist.github.com/MarvinRey7879/cf149d4b57db78fb9cba104c8805d556) (no account needed).\n\n- **Coverage:** US stocks and ETFs (split- and dividend-adjusted, delayed/EOD, via Yahoo), crypto\n  spot (realtime, via Binance).\n- **Timeframes:** `1m`, `5m`, `15m`, `30m`, `1h`, `4h`, `1d`, `1w`.\n- **Access:** REST at `patternfetch.com/v1/*`, MCP at `patternfetch.com/mcp` (Streamable HTTP),\n  plus a local stdio bridge (`patternfetch-mcp`).\n\n## Why base rates and lift\n\nA detector that only reports `double_top, confidence 0.92` tells an agent nothing about whether that\npattern has ever meant anything. patternfetch attaches an `evidence` block to each detected pattern:\n\n```json\n{\n  \"name\": \"double_top\",\n  \"confidence\": 0.92,\n  \"evidence\": {\n    \"scope\": \"US stocks & ETFs\",\n    \"tf\": \"1d\",\n    \"band\": \"0.75-1.00\",\n    \"horizon\": 10,\n    \"n\": 7508,\n    \"hitRate\": 0.431,\n    \"ci95\": 0.011,\n    \"lift\": {\n      \"baseline\": 0.419979,\n      \"baselineN\": 46038,\n      \"lift\": 0.011021,\n      \"ci95\": 0.012075,\n      \"informative\": false,\n      \"reading\": \"indistinguishable-from-baseline\"\n    }\n  }\n}\n```\n\n`hitRate` is the realizable gross directional base rate: the fraction of non-overlapping historical\noccurrences of that pattern, in that timeframe and confidence band, whose close-to-close return over\nthe next `horizon` bars went the expected direction. The forward window starts at detection, so\nthere is no lookahead. No stops, fees or slippage are modelled.\n\n`lift` compares that hit rate against the baseline of the same market with no pattern present. Many\npatterns come back `indistinguishable-from-baseline` — that is the honest result, and reporting it\nis the point. An agent can filter on `informative` instead of trusting a geometric confidence score.\n\n**Calibration.** Across 105 audited categories, 3 fall outside their confidence interval — fewer\nthan the ~5.3 that chance alone predicts across 105 comparisons. For US stocks it is 0 of 60. Method\nand full tables:\n[patternfetch.com/pattern-base-rates-study](https://patternfetch.com/pattern-base-rates-study). The\nmeasurement is reproducible with the open-source\n[honest-signals](https://github.com/MarvinRey7879/honest-signals) tool.\n\n## Quickstart\n\nNo key required — the demo endpoint is public:\n\n```bash\ncurl -X POST https://patternfetch.com/v1/demo \\\n  -H 'content-type: application/json' \\\n  -d '{\"ticker\":\"AAPL\",\"timeframe\":\"1d\"}'\n```\n\nWith a key (self-serve, $3 starter credit):\n\n```bash\ncurl -X POST https://patternfetch.com/v1/keys -d '{\"email\":\"you@example.com\"}'\n\ncurl -X POST https://patternfetch.com/v1/brief \\\n  -H 'authorization: Bearer pf_...' \\\n  -H 'content-type: application/json' \\\n  -d '{\"ticker\":\"BTC/USDT\",\"timeframe\":\"4h\"}'\n```\n\nJavaScript client:\n\n```bash\nnpm install patternfetch\n```\n\n```js\nimport { Patternfetch } from 'patternfetch';\n\nconst { key } = await new Patternfetch().createKey('you@example.com');\nconst pf = new Patternfetch({ apiKey: key });\n\nconst brief = await pf.brief({ ticker: 'AAPL', timeframe: '1d' });\n\nconsole.log(brief.analysis.nl);\n// \"AAPL: uptrend (strong), +0.14% last 1d, RSI 71.66 (overbought),\n//  bearish_engulfing (conf 1, hist 41% over 10b, lift -0.7pp vs 42% base (within noise)).\"\n\nfor (const p of brief.analysis.patterns) {\n  if (p.evidence?.lift.informative) console.log(p.name, p.evidence.hitRate, p.evidence.lift.lift);\n}\n```\n\n## Tools\n\nSix tools, the same set over MCP (`patternfetch_*`) and REST (`POST /v1/*`).\n\n| Tool | What it returns | When an agent calls it |\n|---|---|---|\n| `brief` | Market-state report for one ticker + timeframe: compact candles, patterns with base rate and lift, support/resistance, regime, RSI/EMA, one-line summary. | The default. It needs the current technical picture of one market without dumping raw OHLCV into context. |\n| `multi` | One brief per timeframe (default `1h`, `4h`, `1d`) plus a cross-timeframe alignment read that spells out agreement or divergence, e.g. `1h up / 4h up / 1d down`. | It wants to know whether a setup is confirmed or contradicted across horizons, without three separate `brief` calls. |\n| `delta` | Only what changed since the last brief for that ticker + timeframe — trend flips, new patterns, RSI-state changes. Returns `changed: false` when nothing material moved. | It polls the same market repeatedly. Call `brief` once, then `delta` on every later poll to keep token cost near zero. |\n| `analogs` | Historical windows whose shape resembles current price action, with the full distribution of what followed: win rate, median, mean, min, max and n over a fixed forward horizon. | It wants the historical outcome spread for a setup rather than a point estimate. Not a prediction, not a strategy backtest. |\n| `scan` | Screener over a curated universe of liquid US large-caps, core and sector ETFs and major crypto pairs. Filter by asset class, regime, pattern and minimum base rate; rows return ranked by base rate with 95% CI. Precomputed daily. | It needs to *find* candidates across the market rather than analyse a ticker it already named. Feed the shortlist into `brief`. |\n| `capabilities` | Supported assets, timeframes, endpoints, limits and pricing. No input. | First, before relying on any assumption about coverage. |\n\n### Client methods\n\n| Method | Endpoint |\n|---|---|\n| `brief({ticker, timeframe, limit?, fields?, market?})` | `POST /v1/brief` |\n| `multi({ticker, timeframes?, limit?, market?})` | `POST /v1/multi` |\n| `delta({ticker, timeframe, limit?})` | `POST /v1/delta` |\n| `analogs({ticker, timeframe, window?, horizon?})` | `POST /v1/analogs` |\n| `scan({assetClass?, regime?, pattern?, tf?, minBaseRate?, limit?})` | `POST /v1/scan` |\n| `candles({ticker, timeframe})` | `POST /v1/candles` |\n| `platforms()` | `GET /v1/platforms` |\n| `createKey(email)` | `POST /v1/keys` |\n\n## MCP\n\npatternfetch is a **remote MCP server** (Streamable HTTP) at `https://patternfetch.com/mcp`.\nTools: `patternfetch_brief`, `patternfetch_multi`, `patternfetch_delta`, `patternfetch_analogs`,\n`patternfetch_scan`, `patternfetch_capabilities`.\nDiscovery (`initialize`, `tools/list`) is free — no key. Only `tools/call` needs auth.\n\n**One-click OAuth (nothing to paste)** — in Claude Code, Claude Desktop, Cursor or Smithery, add the\nURL and authorize once; a free-tier key is minted for you:\n\n```bash\nclaude mcp add --transport http patternfetch https://patternfetch.com/mcp\n```\n\nIn **claude.ai**: Customize → Connectors → Add custom connector → `https://patternfetch.com/mcp` → Authorize.\n\n**Or with a Bearer key** — add to your MCP config:\n\n```json\n{\n  \"mcpServers\": {\n    \"patternfetch\": {\n      \"url\": \"https://patternfetch.com/mcp\",\n      \"headers\": { \"Authorization\": \"Bearer pf_...\" }\n    }\n  }\n}\n```\n\nGet a free key (small starter credit) at `https://patternfetch.com/v1/keys`.\n\n### Local stdio bridge\n\nPrefer a local stdio server (Claude Desktop, sandboxes, no inbound HTTP)? This package\nships `patternfetch-mcp`, a zero-dependency stdio↔HTTP bridge that exposes the same tools\nand forwards calls to `patternfetch.com`:\n\n```json\n{\n  \"mcpServers\": {\n    \"patternfetch\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"patternfetch-mcp\"],\n      \"env\": { \"PATTERNFETCH_API_KEY\": \"pf_...\" }\n    }\n  }\n}\n```\n\n`tools/list` works with no key and falls back to the embedded snapshot\n([`mcp-tools.json`](./mcp-tools.json)) when the remote is unreachable, so introspection always\nsucceeds. Tool calls use `PATTERNFETCH_API_KEY`, OAuth or x402. Override the endpoint with\n`PATTERNFETCH_MCP_URL`.\n\nRefresh the snapshot from the live server:\n\n```bash\ncurl -s -X POST https://patternfetch.com/mcp \\\n  -H 'content-type: application/json' \\\n  -H 'accept: application/json, text/event-stream' \\\n  -d '{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/list\"}'\n```\n\n## Pricing\n\n$3 starter credit on signup, at least $0.50 of it usable immediately without a card. After that, pay\nper call from credit, topped up via Stripe or x402 USDC on Base. Studio plan: $19/month including\n$25 of usage.\n\n| Call | Price |\n|---|---|\n| `/v1/brief` | $0.010 |\n| `/v1/multi` | $0.025 |\n| `/v1/delta` | $0.008 ($0.001 when nothing changed) |\n| `/v1/candles` | $0.005 |\n| `/v1/analogs` | $0.050 |\n| `/v1/scan` | $0.020 |\n\nLive figures: `GET /v1/platforms`.\n\n## Legal\n\npatternfetch provides **impersonal market data and algorithmic signals for informational purposes\nonly**. NOT investment, financial, legal or tax advice, and not a recommendation to buy, sell or\nhold any security or crypto-asset. Outputs are not personalized to you. Base rates are gross\ndirectional frequencies without stops, fees or slippage; past performance and historical analogs do\nnot guarantee future results. Markets are volatile — you may lose all capital. Do your own research.\nSee [patternfetch.com/disclaimer](https://patternfetch.com/disclaimer),\n[/methodology](https://patternfetch.com/methodology) and\n[/terms](https://patternfetch.com/terms).\n",
  "bytes": 10343,
  "sha": "5ca605ace9b8754259117a51c47cf2975a36c51eae6cc5d75af7afb0f7c3e65b",
  "repo_slug": "marvinrey7879/patternfetch-client",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_marvinrey7879_patternfetch_8fd5b3a1/readme"
}