patternfetch how-to

How to give your AI trading agent live market context

Connect patternfetch over MCP (one-click OAuth or a Bearer key) or call the REST API directly, then pull a token-compact market-state brief — patterns, levels, regime, indicators and a one-line summary your agent can act on. Five short steps, copy-paste ready.

~5 minutes · MCP or REST · free to try

Try free — no signup Read the docs

TL;DR

Add one MCP server (or one REST call) and your agent gets the digested market state — patterns, levels, regime, indicators, and a one-line summary — for ~$0.01 a call. Free to try.

Step 1 — Get access (free)

Three ways in, all free to start. Pick whichever fits your client:

Option A — No-signup demo (zero setup)

A real brief with no key, to confirm the shape of the data:

curl -X POST https://patternfetch.com/v1/demo \
  -H "Content-Type: application/json" \
  -d '{ "ticker": "BTC/USDT", "timeframe": "4h" }'

Option B — Grab a free key ($0.05 starter credit, ~5 briefs)

curl -X POST https://patternfetch.com/v1/keys \
  -H "Content-Type: application/json" \
  -d '{ "email": "you@example.com" }'
# -> { "key": "pf_…" }   (shown once — store it)

Option C — Just connect via OAuth (no key at all)

Skip key handling entirely: add the MCP URL in your client and click Authorize — patternfetch mints a free-tier key for you automatically. That's covered in Step 2.

Step 2 — Connect your client

The MCP server lives at https://patternfetch.com/mcp (Streamable HTTP) and exposes four tools: patternfetch_brief, patternfetch_delta, patternfetch_analogs, and patternfetch_capabilities. There are two ways to connect.

Claude.ai connector (OAuth, one-click)

In Claude.ai, open Settings / Customize → Connectors → Add custom connector, paste the URL, and click Authorize. A free-tier key is minted for you — nothing to paste.

# Claude.ai → Settings / Customize → Connectors → Add custom connector
https://patternfetch.com/mcp
# click Authorize → free-tier key minted automatically

Claude Desktop / Cursor (config file)

These read a local mcpServers config. The simplest path is the mcp-remote bridge, which forwards a remote Streamable-HTTP server and lets you pass your Bearer key as a header:

{
  "mcpServers": {
    "patternfetch": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://patternfetch.com/mcp",
        "--header",
        "Authorization: Bearer pf_…"
      ]
    }
  }
}

Prefer no bridge? If your client speaks Streamable HTTP natively, point it straight at the URL and attach the key as a header instead:

{
  "mcpServers": {
    "patternfetch": {
      "url": "https://patternfetch.com/mcp",
      "headers": { "Authorization": "Bearer pf_…" }
    }
  }
}

Smithery (OAuth)

Add the server URL in Smithery and click Authorize — same one-click OAuth flow, a free-tier key is minted for you. Nothing to paste.

Raw REST (no MCP client)

Any HTTP client works. Send your key as a Bearer token in the Authorization header — see Step 3.

Step 3 — Get your first brief

One call turns a ticker + timeframe into the whole market state.

Via REST

curl -X POST https://patternfetch.com/v1/brief \
  -H "Authorization: Bearer pf_…" \
  -H "Content-Type: application/json" \
  -d '{ "ticker": "BTC/USDT", "timeframe": "4h" }'

Via MCP

Have your agent call the tool patternfetch_brief with { "ticker": "BTC/USDT", "timeframe": "4h" }. In a chat client just ask it to "get a patternfetch brief for BTC/USDT 4h" and it will pick the tool.

You send
{ "ticker": "BTC/USDT",
  "timeframe": "4h" }
You get back (token-compact)
{
  "nl": "BTC/USDT: uptrend (moderate),
         +1.94% last 4h, RSI 58.3 (neutral),
         double_bottom (conf 0.86).",
  "regime": { "trend":"up","strength":0.42,
              "volPct":2.13 },
  "patterns": [
    { "name":"double_bottom","confidence":0.86 } ],
  "levels": {
    "support":[{ "price":59820.4 }],
    "resistance":[{ "price":63450.8 }] },
  "indicators": {
    "rsi":{ "v":58.3,"state":"neutral" },
    "ema":{ "v":61240.8,"state":"above_20_50" } }
}

The nl line is a ready-to-reason summary, so your model never does arithmetic on raw numbers (where LLMs hallucinate). See it live →

Step 4 — Poll efficiently

Don't re-pull a full brief on a loop. Call /v1/delta to get only what changed since your last brief. When nothing material has moved it returns changed:false and is billed at just $0.001 — so an idle watch loop stays cheap.

curl -X POST https://patternfetch.com/v1/delta \
  -H "Authorization: Bearer pf_…" \
  -H "Content-Type: application/json" \
  -d '{ "ticker": "BTC/USDT", "timeframe": "4h" }'
# nothing moved -> { "changed": false }   (billed $0.001)
# something moved -> the changed patterns / levels / regime

Step 5 — Use it in an agent loop

Expose patternfetch as a tool to your LLM. The same brief works through LangChain tools, OpenAI function-calling, and Claude tool use — it's one JSON in, one JSON out. Here is a generic tool/function schema an LLM can call:

{
  "name": "patternfetch_brief",
  "description": "Get a token-compact market-state brief (patterns, levels, regime, indicators, and a one-line nl summary) for a crypto ticker + timeframe.",
  "parameters": {
    "type": "object",
    "properties": {
      "ticker":    { "type": "string", "description": "e.g. BTC/USDT" },
      "timeframe": { "type": "string", "enum": ["1m","5m","15m","1h","4h","1d"] }
    },
    "required": ["ticker", "timeframe"]
  }
}

To decide, your agent mainly reads four fields: the nl summary, regime, the top pattern, and the nearest level — no need to feed the raw candle array into context. Loop with /v1/delta between briefs to keep cost and tokens low.

The efficient pattern:

brief once to anchor → poll with delta → only re-reason when changed:true. Read nl + regime + top pattern + nearest level. That's the whole market state in a few hundred tokens.

FAQ

How do I connect with no key?

Use OAuth. In Claude.ai (Settings / Customize → Connectors → Add custom connector), Claude Desktop, Cursor, or Smithery, add https://patternfetch.com/mcp and click Authorize. patternfetch mints a free-tier key for you automatically — there is nothing to paste.

How do I avoid burning tokens?

Read the digested fields, not raw candles: the nl summary plus regime, the top pattern and the nearest level are a few hundred tokens instead of a multi-thousand-token OHLCV array. To poll, call /v1/delta so you only pull what changed (and pay $0.001 when nothing moved).

Which timeframes are supported?

Crypto spot from 1m to 1d — for example 1m, 5m, 15m, 1h, 4h, 1d.

Is this investment advice?

No. It's impersonal market data and algorithmic signals, for informational purposes only — not advice, not personalized, non-executing. See the disclaimer.

Try free Docs