MCP Reference

[MCP REFERENCE]

PYNE MCP exposes the Pine Script™ toolchain to LLM hosts over stdio (pyne-mcp / pyne mcp). The same tools run in-process via pyne mcp call and first-class pyne execute — no shell-out. Tool names are prefixed pyne_ so they never collide with AXIS. Stdio serving needs hoox-pyne[mcp]; call / execute do not.

hoox-pyne[mcp] • v0.6.34 · 32 tools · 2 resources · 3 prompts · bin pyne-mcp

Quick Start
Client configs
Cursor / Claude (stdio)Requires pip install "hoox-pyne[mcp]". pyne mcp call works without the extra.
{
  "mcpServers": {
    "pyne": {
      "command": "pyne-mcp",
      "args": []
    }
  }
}
Module entry (pyne mcp config --module)Same server as the pyne-mcp console script.
{
  "mcpServers": {
    "pyne": {
      "command": "python",
      "args": ["-m", "pynescript.mcp"]
    }
  }
}
Shell without stdio hostIn-process ops — no MCP SDK, no blocking stdio server.
pyne mcp call lint script.pine
pyne execute script.pine --mode interpret --bars 50
pyne symbols script.pine
pyne diagnostics script.pine
Compose / GHCR streamable-httpHTTP daemon for compose. CLI/editor hosts still use stdio (pyne-mcp).
docker pull ghcr.io/hoox-sh/pyne/mcp:0.6.34
docker run --rm -p 5003:8080 ghcr.io/hoox-sh/pyne/mcp:0.6.34
# or: docker compose up -d mcp
UC

Use Cases

5 flows

End-to-end agent flows for lint/run, Runtime.execute, builtins, v6 convert, and Pro runner deploy. Each card lists tools and the expected outcome.

[ Use Case ]01

Lint then smoke-run

Agent pastes a script, wants diagnostics and a 50-bar synthetic run before deeper work.

  1. 01pyne_lint({ source }) — collect findings.
  2. 02pyne_run({ source, bars: 50 }) — compile + synthetic OHLCV.
  3. 03If ok:false kind=parse, fix line/column and retry.
pyne_lintpyne_run

Findings + truncated plot samples without leaving the agent loop.

[ Use Case ]02

Runtime.execute with mode

Full Runtime.run path (interpret / compile / auto) with optional caller OHLCV.

  1. 01Prefer pyne execute / pyne_execute over pyne_run when you need Runtime semantics.
  2. 02Pass mode=interpret for fast iteration; compile when Numba parity matters.
  3. 03Raise sample only as needed (max 64) to avoid large plot dumps.
pyne_executepyne_parity

Deterministic bar loop result with truncated series payloads.

[ Use Case ]03

Explain a builtin

User asks what ta.sma takes — answer from metadata, not guesswork.

  1. 01pyne_builtin({ name: "ta.sma" }).
  2. 02Optionally pyne_hover at the call site for contextual markdown.
pyne_builtinpyne_hover

Signature and docs from builtin_metadata.json.

[ Use Case ]04

Convert to v6

Upgrade a v5 script and clear remaining convert warnings.

  1. 01Use prompt convert_to_v6 or pyne_convert({ to: 6, source }).
  2. 02pyne_lint on the result — chase W002 / C002.
  3. 03pyne_check / pyne_parse to confirm clean parse.
pyne_convertpyne_lintpyne_checkconvert_to_v6

Converted source returned in JSON — nothing written to disk.

[ Use Case ]05

Deploy to Pro runner

Push a script to the hosted runner when PYNE_API_URL and ADMIN_TOKEN are set.

  1. 01pyne_runner_deploy with the script payload.
  2. 02pyne_runner_list / show to verify.
  3. 03pyne_runner_tick or enable/disable jobs as needed.
pyne_runner_deploypyne_runner_listpyne_runner_tick

Remote script registered; secrets stay out of tool results.

[]
01

Validate

9 tools
[ Validate ]01anyread

pyne_info

Version, Numba availability, mcp extra installed, and entry-point names.

CLI: pyne info --json

[ Validate ]02anyread

pyne_check

Parse-only validation. Accepts source, path, or paths[].

CLI: pyne check

Parameters
sourcestringPasted Pine Script™ body (preferred over path)
pathstringFilesystem path to a .pine / .pyne file
pathsstring[]Batch of file paths
[ Validate ]03anyread

pyne_parse

Structured parse: version, kind, title, and errors[{line,column,message}].

Pine syntax errors are ok:false tool results, not JSON-RPC protocol failures.

Parameters
sourcestringPasted Pine Script™ body (preferred over path)
pathstringFilesystem path to a .pine / .pyne file
[ Validate ]04anyread

pyne_lint

Lint findings array (same as pyne lint --json).

CLI: pyne lint --json

Parameters
sourcestringPasted Pine Script™ body (preferred over path)
pathstringFilesystem path to a .pine / .pyne file
[ Validate ]05anyread

pyne_format

Return formatted source. Does not write the file.

CLI: pyne format

No disk writes — formatted text is in the JSON result only.

Parameters
sourcestringPasted Pine Script™ body (preferred over path)
pathstringFilesystem path to a .pine / .pyne file
[ Validate ]06anyread

pyne_convert

Convert script version (to: 5 or 6). Returns converted source.

CLI: pyne convert --to

Parameters
sourcestringPasted Pine Script™ body (preferred over path)
pathstringFilesystem path to a .pine / .pyne file
torequired5 | 6Target Pine Script™ version
[ Validate ]07anyread

pyne_dump

Parse-and-dump: text dump plus JSON AST tree.

CLI: pyne parse-and-dump

Parameters
sourcestringPasted Pine Script™ body (preferred over path)
pathstringFilesystem path to a .pine / .pyne file
[ Validate ]08anyread

pyne_unparse

Parse-and-unparse round-trip source.

CLI: pyne parse-and-unparse

Parameters
sourcestringPasted Pine Script™ body (preferred over path)
pathstringFilesystem path to a .pine / .pyne file
[ Validate ]09anyread

pyne_diagnostics

Parse errors and lint findings in one list.

CLI: pyne diagnostics

Parameters
sourcestringPasted Pine Script™ body (preferred over path)
pathstringFilesystem path to a .pine / .pyne file
02

Execute

6 tools
[ Execute ]01anyread

pyne_compile

Compile to Python. emit=true includes generated source.

CLI: pyne compile

Parameters
sourcestringPasted Pine Script™ body (preferred over path)
pathstringFilesystem path to a .pine / .pyne file
emitbooleanInclude generated Python in the result
[ Execute ]02anyread

pyne_prewarm

Warm Numba / IR caches before a run loop.

CLI: pyne prewarm

[ Execute ]03anyread

pyne_run

CLI compile + synthetic OHLCV smoke path. Distinct from pyne_execute (Runtime.run).

CLI: pyne run

Parameters
sourcestringPasted Pine Script™ body (preferred over path)
pathstringFilesystem path to a .pine / .pyne file
barsnumberSynthetic bar count
[ Execute ]04anyread

pyne_execute

Runtime.run — interpret / compile / auto with caller OHLCV. Plot cells truncated (sample default 8, max 64). Timeout default 30s, cap 120s. Bars cap 5000.

CLI: pyne execute

Parameters
sourcestringPasted Pine Script™ body (preferred over path)
pathstringFilesystem path to a .pine / .pyne file
mode"interpret" | "compile" | "auto"Evaluation mode
barsnumberBar count when using mock series
ohlcvobject[]Caller-supplied OHLCV rows
samplenumberPlot sample length (default 8, max 64)
timeoutnumberSeconds (default 30, cap 120)
[ Execute ]05anyread

pyne_parity

Interpret vs compile last-value parity (rtol=1e-5, atol=1e-6).

CLI: pyne parity

Parameters
sourcestringPasted Pine Script™ body (preferred over path)
pathstringFilesystem path to a .pine / .pyne file
[ Execute ]06anyread

pyne_optimize

Parameter search. Pass space object or space_json string.

CLI: pyne optimize

Parameters
sourcestringPasted Pine Script™ body (preferred over path)
pathstringFilesystem path to a .pine / .pyne file
spaceobjectSearch space object
space_jsonstringSearch space as JSON string
03

Language

5 tools
[ Language ]01anyread

pyne_symbols

Outline: functions, types, enums, input.*, plots, strategy.entry.

CLI: pyne symbols

Parameters
sourcestringPasted Pine Script™ body (preferred over path)
pathstringFilesystem path to a .pine / .pyne file
[ Language ]02anyread

pyne_hover

Markdown hover at 0-based line / character (LSP handler).

Needs lsprotocol (pulled in by hoox-pyne[mcp]).

Parameters
sourcestringPasted Pine Script™ body (preferred over path)
pathstringFilesystem path to a .pine / .pyne file
linerequirednumber0-based line
characterrequirednumber0-based character
[ Language ]03anyread

pyne_complete

Completion items at cursor.

Parameters
sourcestringPasted Pine Script™ body (preferred over path)
pathstringFilesystem path to a .pine / .pyne file
linenumber0-based line
characternumber0-based character
[ Language ]04anyread

pyne_signature

Signature help for the enclosing call.

Parameters
sourcestringPasted Pine Script™ body (preferred over path)
pathstringFilesystem path to a .pine / .pyne file
linenumber0-based line
characternumber0-based character
[ Language ]05anyread

pyne_builtin

Lookup one builtin_metadata.json row (e.g. ta.sma).

CLI: pyne builtin ta.sma

Parameters
namerequiredstringBuiltin id such as ta.sma
04

Data

4 tools
[ Data ]01anynetwork

pyne_data

Fetch OHLCV. Default provider is mock (offline).

CLI: pyne data

Non-mock providers may hit the network (kind: network on failure).

Parameters
providerstringData provider (default mock)
symbolstringSymbol id
timeframestringBar size
[ Data ]02anynetwork

pyne_download_builtins

List pine-facade templates only — does not write files to disk.

CLI: pyne download-builtins --list

[ Data ]03anyread

pyne_axb1

AXB1 encoder vs golden vectors (hex-exact) + fnv1a32 + reject rules.

[ Data ]04anyread

pyne_sessions

Pooled live sessions: anchor vs store window, zombie suspects.

05

Runner

8 tools
[ Runner ]01anynetwork

pyne_runner_deploy

POST /scripts to the Pro API runner.

CLI: pyne runner deploy

Reads PYNE_API_URL / ADMIN_TOKEN. Never echoes tokens or webhook URLs.

[ Runner ]02anynetwork

pyne_runner_list

List deployed runner scripts.

CLI: pyne runner list

[ Runner ]03anynetwork

pyne_runner_show

Show one runner script.

CLI: pyne runner show

[ Runner ]04anymutate

pyne_runner_delete

Delete a runner script.

CLI: pyne runner delete

[ Runner ]05anynetwork

pyne_runner_tick

POST /cron/run — fire a tick.

CLI: pyne runner tick

[ Runner ]06anynetwork

pyne_runner_jobs

List runner cron jobs.

CLI: pyne runner jobs

[ Runner ]07anymutate

pyne_runner_enable

Enable a runner job.

CLI: pyne runner enable

[ Runner ]08anymutate

pyne_runner_disable

Disable a runner job.

CLI: pyne runner disable

06

Protocol

4 tools
[ Protocol ]01any

{ ok, … }

Every tool returns { ok: true, … } or { ok: false, error, kind, line?, column? }. Prefer source= over path=. Plot series are truncated.

[ Protocol ]02stdioread

Resources

pyne://info (same as pyne_info) and pyne://builtins (+ pyne://builtins/{name}).

[ Protocol ]03stdioread

Prompts

review_pine (lint + convert-to-v6), debug_pine (parse, lint, 50-bar run), convert_to_v6.

[ Protocol ]04CLI

pyne mcp call

In-process tools/call without a stdio host. TOOL may be pyne_lint or short alias lint. Extra args: --arg KEY=VALUE or --json '{…}'.

Surfaces3
Tools32
Resources2+
Prompts3
pyne mcp call lint → execute → plots