Skip to main content
Glama
pyon-mcp

pyon-mcp

by K4L-EL

pyon-mcp

MCP (Model Context Protocol) server for the Pyon trading platform. It lets AI agents - Claude Code, Claude Desktop, Codex, or any MCP client - drive Pyon end to end: search markets, generate research, build and edit node-graph strategies with AI, run backtests, diagnose problems, and optimize parameters with 2-D sweeps.

Runs over stdio, talks to api.pyon.io, and needs only Node 18+.

Getting an API key

  1. Sign in at app.pyon.io.

  2. Open Account > API Access.

  3. Create a personal access token. It looks like pyk_....

Set it as the PYON_API_KEY environment variable wherever the server runs.

Variable

Required

Default

Purpose

PYON_API_KEY

yes

-

Personal access token (pyk_...)

PYON_API_URL

no

https://api.pyon.io

API base URL override

Related MCP server: OpenFinClaw CLI

Setup

Claude Code

claude mcp add pyon -e PYON_API_KEY=pyk_... -- npx -y pyon-mcp

Or, from a local checkout:

npm install && npm run build
claude mcp add pyon -e PYON_API_KEY=pyk_... -- node /path/to/pyon-mcp/dist/index.js

Claude Desktop

Add to claude_desktop_config.json (Settings > Developer > Edit Config):

{
  "mcpServers": {
    "pyon": {
      "command": "npx",
      "args": ["-y", "pyon-mcp"],
      "env": {
        "PYON_API_KEY": "pyk_..."
      }
    }
  }
}

Codex

Add to ~/.codex/config.toml:

[mcp_servers.pyon]
command = "npx"
args = ["-y", "pyon-mcp"]
env = { PYON_API_KEY = "pyk_..." }

Start here: get_capabilities

Pyon turns a strategy description into a node graph literally. An indicator name the engine does not know, or a threshold outside an indicator's range, produces a strategy that backtests to zero trades and looks broken for no visible reason - an RSI > 120 entry can never fire, because RSI is bounded 0-100.

So call get_capabilities before writing any strategy description, edit instruction, or sweep bound. It returns the real catalog: 61 market indicators with their value ranges and indicatorParams, 9 portfolio indicators, 8 operators, 8 trigger types, 13 action types, the 5 supported timeframes, the 3 quantityType modes, 7 option strategyType values, and the 47 tradable tickers.

The catalog is fetched from GET /api/capabilities and falls back to a copy bundled with this server if that endpoint is unavailable. Every response names which source it used. The same catalog is readable as markdown in the pyon://capabilities resource.

Tools

Every input schema is strict: an unknown or misspelled parameter (timeFrame, start_date, limit) is rejected with an explicit error rather than silently ignored. Every rejection message states what IS allowed.

Tool

Parameter

Type

Allowed values

Default

get_capabilities

section

enum, optional

indicators, portfolio_indicators, operators, triggers, actions, timeframes, tickers, all

all

search_symbols

query

string, required

1-100 chars; ticker or name fragment

-

list_strategies

-

-

no parameters

-

get_strategy

strategyId

string, required

UUID from list_strategies or create_strategy

-

create_strategy

description

string, required

at least 10 chars after trimming, max 8000

-

analysisId

string, optional

UUID from create_research or list_research

none

edit_strategy

strategyId

string, required

UUID

-

instruction

string, required

at least 10 chars after trimming, max 8000

-

run_backtest

strategyId

string, required

UUID

-

startDate

string, optional

YYYY-MM-DD, real calendar date, not in the future

365 days ago

endDate

string, optional

YYYY-MM-DD, not in the future, after startDate, at least 7 days from it

today

timeframe

enum, optional

1m, 5m, 15m, 1h, 1d (lowercase)

the strategy's native timeframe

initialCapital

number, optional

100 to 100000000

50000

diagnose_strategy

strategyId

string, required

UUID

-

question

string, optional

at least 10 chars when given, max 2000

general health check

optimize_strategy

strategyId

string, required

UUID

-

xNodeId

string, required

a node id from get_strategy

-

xField

string, required

a numeric config key on that node

-

xMin / xMax

number, required

finite; xMax strictly greater than xMin

-

yNodeId

string, required

a node id from get_strategy; may equal xNodeId

-

yField

string, required

a numeric config key; the two axes must not be the same node and field

-

yMin / yMax

number, required

finite; yMax strictly greater than yMin

-

steps

integer, optional

3 to 10 (runs steps x steps backtests)

5

timeframe

enum, optional

1m, 5m, 15m, 1h, 1d

server's choice

create_research

prompt

string, required

at least 10 chars after trimming, max 8000

-

get_research

analysisId

string, required

UUID from create_research or list_research

-

list_research

-

-

no parameters

-

get_job_status

jobId

string, required

non-empty; a job id or a backtest id from a timeout message

-

What each tool does

Tool

Summary

Wait

get_capabilities

The indicator / operator / action / ticker catalog, with API fetch and bundled fallback

none

search_symbols

Resolve tickers and names against Pyon's market database

none

list_strategies

Saved strategies with id, name, nodeCount, updatedAt

none

get_strategy

Per-node id, type, label, and flattened config (feeds optimize_strategy)

none

create_strategy

AI-build a new strategy, optionally grounded in research

up to 300s

edit_strategy

AI-edit a strategy; returns a before/after verification verdict

up to 300s

run_backtest

Metrics plus verbatim diagnostics; flags 0-trade causes and short daily windows

up to 180s

diagnose_strategy

AI debugger with sample-backtest evidence; message, issues, suggested fix

up to 300s

optimize_strategy

2-D parameter sweep; best cell, current cell, sharpe grid

up to 600s

create_research

Generate a saved research report; returns analysisId plus executive summary

up to 300s

get_research

Fetch a saved report: score, view, truncated narratives

none

list_research

List saved research reports

none

get_job_status

Escape hatch when a wait timed out; also accepts backtest ids

none

Validation rules worth knowing

  • Ids are UUIDs. A strategy name will be rejected; the message points at list_strategies.

  • Dates are YYYY-MM-DD real calendar dates, never in the future. 2025-02-30, 2024-1-5, 01/02/2024 and full timestamps are all rejected.

  • Backtest windows need endDate after startDate and at least 7 days between them. A 1d strategy tested over fewer than 300 days still runs, but the result carries a warning explaining that the window, not the strategy, may be what the metrics are measuring.

  • Timeframes are exactly 1m, 5m, 15m, 1h, 1d. 1D, daily, 1w and 30m are rejected - these are the five bar sizes the engine resolves.

  • Sweep axes must describe a real range (xMax > xMin, yMax > yMin) and must not point at the same node id and config field, which would test one dimension twice.

  • Prompts for create_strategy, edit_strategy, create_research and the optional diagnose_strategy question need at least 10 characters, because a vague prompt produces a vague strategy.

Resources

URI

Contents

pyon://getting-started

Auth setup, the typical agent workflow, enforced input rules, plan limits

pyon://capabilities

The full capability catalog as readable markdown

Errors you may see

  • 401 - invalid or revoked API key. Create a new one in Account > API Access at app.pyon.io.

  • 402 - a plan limit was hit; the message explains which. Upgrade at app.pyon.io/app/account/billing.

  • Timeouts - long AI jobs keep running server-side; the timeout message includes the job id to check with get_job_status.

  • Invalid arguments - the message names the parameter and the allowed values. Fix and retry; these never reach the API.

Development

npm install
npm run build   # tsc -> dist/
npm run smoke   # offline, keyless: tools/list, JSON Schema completeness, and the validation tables
npm run check   # build + smoke

The compiler runs at the strictest settings the code satisfies: strict, noUncheckedIndexedAccess, exactOptionalPropertyTypes, verbatimModuleSyntax, isolatedModules, noImplicitOverride, noImplicitReturns, noFallthroughCasesInSwitch, noUnusedLocals, noUnusedParameters, allowUnreachableCode: false and allowUnusedLabels: false. noPropertyAccessFromIndexSignature is deliberately left off: it only forces process.env["PYON_API_KEY"] bracket syntax and catches nothing here. Wire payloads are read through the case-insensitive helpers in src/format.ts, which return unknown, so every tool has to narrow a value before putting it in one of the interfaces in src/types.ts - a backend field rename surfaces as a compile error rather than a missing JSON key.

scripts/smoke.mjs runs entirely offline. It asserts the 13 tools and 2 resources are registered, that every published JSON Schema names its parameters and sets additionalProperties: false, and it drives every tool's zod schema with a table of bad inputs that must be rejected and good inputs that must parse. It exits non-zero on any failure.

Available Tools

13 tools
create_researchCreate research reportA

Generate a saved AI research report (thesis, risks, catalysts, scored overall view) for a company or asset from a natural-language prompt, waiting up to 300s. Use this when the user wants fundamental or thematic research, or as the first step before building a research-grounded strategy. Parameters: prompt (string, 10 to 8000 characters, required) - what to research and from which angle, e.g. 'deep dive on NVDA: AI capex cycle, risks, and valuation'. Resolve tickers with search_symbols first. Returns analysisId, title, symbol, overallScore, overallView, and a truncated executive summary. Pass the returned analysisId to create_strategy to build a strategy grounded in this research. If the wait times out, the error includes a jobId to check with get_job_status.

Inputs: prompt (required).

create_strategyCreate strategy (AI build)A

Build a brand new trading strategy from a natural-language description using Pyon's AI builder, waiting up to 300s for the build to finish. Use this when the user wants a new strategy; pass analysisId to ground the build in a saved research report from create_research. Parameters: description (string, 10 to 8000 characters, required) - name the instrument, entry rule, exit rule and position size; analysisId (UUID, optional) from create_research or list_research. Call get_capabilities FIRST so the indicator names, operators, action types and tickers you write into the description are ones the engine supports, and so thresholds stay inside each indicator's range (an RSI entry above 100 can never fire). Returns the new strategyId, name, a summary of what was built, and a nextSteps hint. Always evaluate the result with run_backtest before editing or optimizing. If the wait times out, the error includes a jobId for get_job_status.

Inputs: description (required), analysisId.

diagnose_strategyDiagnose strategy (AI debugger)A

Ask Pyon's AI debugger to analyze a strategy, running a fresh sample backtest as evidence; waits up to 300s. Use this when run_backtest shows zero trades, poor returns, or confusing diagnostics and you need a causal explanation before editing. Parameters: strategyId (UUID, required); question (string, 10 to 2000 characters, optional) - ask something specific such as 'why did this take zero trades in 2025?', or omit it entirely for a general health check. Returns a diagnosis message, a structured list of up to 10 issues, and, when available, a ready-to-use edit request (agentRequest) that can be passed directly to edit_strategy as the instruction. If the wait times out, the error includes a jobId to check with get_job_status.

Inputs: strategyId (required), question.

edit_strategyEdit strategy (AI edit)A

Modify an existing strategy with a natural-language instruction using Pyon's AI editor, waiting up to 300s. Use this to change entry/exit logic, thresholds, position sizing, symbols, or to fix issues found by diagnose_strategy. Parameters: strategyId (UUID, required; from list_strategies); instruction (string, 10 to 8000 characters, required) stating exactly what to change and to what - diagnose_strategy's agentRequest can be pasted here verbatim. Use get_capabilities to check indicator names and ranges before writing the instruction. Returns a verification verdict comparing a sample backtest before and after the edit, with before/after trade counts and return percentages, plus revertToVersion for undoing a bad edit. Verdict values: improved (better), unchanged (no measurable change), degraded (worse), broke (errored or stopped trading - revert), still_zero (zero trades before and after - root cause not fixed). If the wait times out, the error includes a jobId to check with get_job_status.

Inputs: strategyId (required), instruction (required).

get_capabilitiesGet strategy capability catalogA

Return the catalog of everything Pyon's strategy engine understands: market indicators (with their value ranges and indicatorParams), portfolio indicators, comparison operators, trigger types, action types, backtest timeframes, order sizing modes, option strategy types, and the tradable ticker universe. CALL THIS BEFORE writing a create_strategy description, an edit_strategy instruction, or choosing optimize_strategy sweep bounds. Strategy text is turned into a node graph literally, so an indicator name the engine does not know, or a threshold outside an indicator's range, silently produces a strategy that backtests to zero trades and looks broken for no visible reason - RSI, STOCH_K, STOCH_D, ADX and MFI are bounded 0-100, so an RSI threshold above 100 can never fire; WILLR is -100 to 0 (oversold is about -80, not +20); BB is %B on a 0-100 scale, not a price. Parameters: section (optional, one of: indicators, portfolio_indicators, operators, triggers, actions, timeframes, tickers, all; default "all"). Timeframes are always 1m, 5m, 15m, 1h, 1d. The catalog is fetched from the Pyon API and falls back to a copy bundled with this server if the endpoint is unavailable; the response always names which source was used. Results are cached for the session, so calling it repeatedly is cheap.

Inputs: section.

get_job_statusGet job statusA

Check a Pyon async job directly - the escape hatch when a waiting tool timed out. create_strategy, edit_strategy, diagnose_strategy, optimize_strategy, and create_research keep running server-side after a client timeout, and their timeout errors include the jobId to pass here; run_backtest timeouts name a backtest id, which this tool also accepts (it falls back to the backtest endpoint when the id is not a job). Parameters: jobId (non-empty string, required) - copy it verbatim from the timeout error message; job ids stay resolvable indefinitely, so a not-found error means the id is wrong, not expired. Returns the job status plus, when completed, a compact view of the result, or the error message when failed. Call it again after a short wait if the job is still running.

Inputs: jobId (required).

get_researchGet research reportA

Fetch a saved research report by analysisId. Use this to re-read research created earlier (find ids with list_research) before building or editing strategies based on it. Parameters: analysisId (UUID, required; from create_research or list_research). Returns title, symbol, overall score and view, and truncated narrative sections: executive summary, thesis, risks, catalysts, and conclusion. Full layouts and raw data are never dumped.

Inputs: analysisId (required).

get_strategyGet strategy detailA

Fetch a single strategy's structure: name, description, native timeframe, and a per-node summary with each node's id, type, label, and flattened numeric/string config values. Use this before optimize_strategy - the node ids and config field names shown here are exactly what optimize_strategy needs as xNodeId/xField and yNodeId/yField - or to understand what a strategy actually does before editing it. Parameters: strategyId (UUID, required; find it with list_strategies). Returns compact JSON; the raw graph is never dumped.

Inputs: strategyId (required).

list_researchList research reportsA

List the user's saved research reports. Use this to find an analysisId for get_research or to check whether relevant research already exists before generating a new report with create_research. Parameters: none - the arguments object may be empty or omitted entirely. Returns a compact list of up to 25 reports with analysisId, title, symbol, and timestamps where available.

Inputs: no named parameters.

list_strategiesList strategiesA

List the user's saved trading strategies on Pyon. Use this to find an existing strategy's id before calling get_strategy, run_backtest, edit_strategy, diagnose_strategy, or optimize_strategy, or to check what already exists before building something new with create_strategy. Parameters: none - the arguments object may be empty or omitted entirely. Returns id (UUID), name, nodeCount, and updatedAt for up to 100 strategies; call get_strategy for the native timeframe and node-level detail.

Inputs: no named parameters.

optimize_strategyOptimize strategy (2-D parameter sweep)A

Run a 2-D parameter sweep over two numeric config fields of a strategy's nodes, backtesting a steps x steps grid of value combinations; waits up to 600s. Use this after a strategy already trades sensibly (verify with run_backtest) to tune thresholds, periods, or sizes. Call get_strategy FIRST to obtain the exact node ids and config field names, and get_capabilities to keep the bounds inside the indicator's real range (sweeping an RSI threshold from 80 to 140 wastes half the grid on cells that can never fire). Parameters: strategyId (UUID, required); xNodeId and xField, yNodeId and yField (strings from get_strategy, required) - the two axes must not be the same node id AND field; xMin/xMax and yMin/yMax (finite numbers, required) with xMax > xMin and yMax > yMin - the steps values are spaced linearly and include both endpoints (xMin 10, xMax 30, steps 5 tests 10, 15, 20, 25, 30); steps (whole number 3 to 10, default 5); timeframe: one of 1m, 5m, 15m, 1h, 1d - optional override, defaults to what the server picks. Returns the best cell (highest sharpe, preferring cells that actually traded), the strategy's current cell, the sharpe grid as compact rows of numbers (rows = y values top to bottom, columns = x values left to right), the sweep window and timeframe, and a verbatim warning when every cell produced zero trades. If the wait times out, the error includes a jobId to check with get_job_status.

Inputs: xMax (required), xMin (required), yMax (required), yMin (required), +7 more.

run_backtestRun backtestA

Backtest a strategy over a historical window and wait up to 180s for it to finish. Use this after create_strategy or edit_strategy to measure real performance, and before optimize_strategy to establish a baseline. Parameters: strategyId (UUID, required); startDate and endDate (YYYY-MM-DD, optional, must be real past dates with endDate after startDate and at least 7 days between them - default is the last 365 days); timeframe: one of 1m, 5m, 15m, 1h, 1d - defaults to the strategy's native timeframe, fetched automatically; initialCapital in USD (number 100 to 100000000, default 50000). Returns metrics (totalTrades, totalOrders, totalReturnPct, sharpeRatio, maxDrawdownPct, winRate) plus up to 8 diagnostic messages verbatim - read these, they carry gate pass-rate evidence explaining WHY the strategy did or did not trade - and an explicit note when 0 trades closed but orders were opened (the strategy entered and is still holding, which is not the same as a dead strategy). A warning is added when a 1d strategy is tested over fewer than 300 days, since that is too few bars to judge it. On timeout the error names the backtest id, which get_job_status accepts as a fallback.

Inputs: strategyId (required), endDate, startDate, timeframe, +1 more.

search_symbolsSearch symbolsA

Search Pyon's market database for tradable instruments by ticker or company name fragment. Use this first whenever you need an exact symbol to mention in a research prompt or strategy description, for example resolving 'Apple' to AAPL or checking whether Pyon covers a given asset. Parameters: query (string, 1-100 characters, required) - a ticker or name fragment. Returns up to 20 matches as compact JSON with symbol, name, exchange, and assetClass. Note that Pyon only trades a fixed universe: call get_capabilities(section='tickers') for the definitive tradable list.

Inputs: query (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.7/5.0

    Scored across 13 tools

    Disambiguation5/5

    Each tool targets a distinct action/resource combination: list/get/create/edit for strategies and research, plus dedicated tools for backtesting, optimizing, diagnosing, capability lookup, symbol search, and async job status. There is no overlap or ambiguity between tool purposes.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern using snake_case (e.g., list_strategies, get_research, create_strategy, run_backtest). The pattern is uniform across the entire set, making it predictable and easy to navigate.

    Tool Count5/5

    13 tools is well within the ideal range for a domain-specific server. Each tool serves a clear purpose in the strategy management and research workflow, with no redundant or unnecessary additions.

    Completeness4/5

    The tool set provides strong lifecycle coverage for strategies (create, read, edit, test, optimize, diagnose) and research (create, read, list). The only notable gap is the absence of a delete/archive operation for strategies, which is a minor omission given the otherwise complete workflow.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      B
      maintenance
      Full-lifecycle algorithmic trading MCP server. AI strategy generation from plain English, backtesting, live bot deployment to 10+ brokers, portfolio monitoring, and prediction markets. Stocks, options, crypto, futures. 32 tools. Free tier.
      -
    • A
      license
      A
      quality
      D
      maintenance
      An MCP server that enables autonomous AI agents to connect to Tastytrade for market scanning, option strategies, account management, and optionally placing trades with built-in safety controls.
      9
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      The MCP server for AlphaForge — the agent-native quant CLI: write strategies in JSON, optimize with Optuna TPE, validate with walk-forward, export to TradingView Pine v6. This server lets your AI agent drive the whole pipeline over MCP.
      17
      1
      Apache 2.0