MCP Reference

[MCP REFERENCE]

AXIS speaks Model Context Protocol so agents can read and write the product: load symbols, edit Pine Script™, run scripts, and drive the live PWA. Two planes — Worker (no tab: health, run, scripts, market) and App (app_invoke through a connected Studio tab). Transport: Streamable HTTP at https://worker.axis.hoox.sh/mcp, or axis mcp stdio.

AXIS v2.28.0 · Worker 12 tools · App 5 tools · endpoint https://worker.axis.hoox.sh/mcp

Quick Start
Client configs
Remote HTTP (Cursor / Inspector)GET /mcp is public (tool names). tools/call requires Bearer pn_…
{
  "mcpServers": {
    "axis": {
      "url": "https://worker.axis.hoox.sh/mcp",
      "headers": { "Authorization": "Bearer pn_…" }
    }
  }
}
Stdio (axis mcp)Forwards newline-delimited JSON-RPC from stdin to POST /mcp. Prefer AXIS_API_KEY over --key in client configs.
AXIS_API_KEY=pn_… axis mcp
# one-shot also accepts --key (avoid in generated configs — argv is visible via ps)
axis mcp config --stdio   # emits AXIS_API_KEY in env, not --key argv
PWA bridge (Settings)Tab mints a one-time WS ticket over Bearer — the long-lived key never appears in the WebSocket URL.
Studio → Settings → General → Worker (cloud + MCP)
  Worker URL: https://worker.axis.hoox.sh  (or http://127.0.0.1:8787)
  API key:    pn_…

Studio → Settings → General → MCP
  Connect this tab to MCP: ON
  Hint should show Bridge: open
UC

Use Cases

5 flows

End-to-end agent flows for Worker health, Pine run, live chart drive, editor execute, and lag diagnosis. Each card lists tools and the expected outcome.

[ Use Case ]01

Probe Worker without a tab

Confirm D1, keys, and MCP flags before attaching a browser session.

  1. 01Mint pn_… with axis keys create.
  2. 02Point the client at POST /mcp with Bearer.
  3. 03Call axis_health — check features.mcp and mcpBridge.
  4. 04Optional: axis_scripts_list for the cloud library.
axis_healthaxis_scripts_list

Agent knows the Worker plane is live with no PWA required.

[ Use Case ]02

Run Pine on the Worker

Evaluate a script against OHLCV without opening Studio.

  1. 01axis_run({ script, ticker, timeframe, data? }).
  2. 02Inspect plots / strategy events in the tool result.
  3. 03Or axis_request path=/api/run for the raw HTTP shape.
axis_runaxis_request

Plots and errors returned over MCP — no invented TradingView® host APIs.

[ Use Case ]03

Load a symbol in the live tab

Agent drives the connected PWA: load bars, read last close.

  1. 01Confirm app_session_status.connected ≥ 1.
  2. 02app_invoke chart.load with symbol + interval.
  3. 03app_get path=bars (or chart.bars) for bar count / last close.
app_session_statusapp_invokeapp_get

Chart shows the requested symbol; agent reports bar stats.

[ Use Case ]04

Edit Pine and run on the chart

Put an indicator in the editor and execute on the live series.

  1. 01app_invoke editor.set with the Pine doc.
  2. 02app_invoke editor.run (or indicators.add + indicators.run).
  3. 03results.get / editor.diagnostics for output.
app_invokeapp_capabilities

Script runs on the attached tab with diagnostics visible.

[ Use Case ]05

Diagnose a lagging chart

Chart feels a bar behind — compare venue clock, tick, and engine series.

  1. 01app_invoke chart.lag — read the verdict.
  2. 02stream.get + engine.series for socket / series bounds.
  3. 03engine.tick or stream.reset({ resubscribe: true }) to repair.
app_invoke

Clear lag verdict and optional socket re-subscribe.

[]
01

Worker

12 tools
[ Worker ]01HTTPread

axis_health

Worker health JSON: status, version, feature flags (scripts, d1, keys, onchain, market, mcp).

Plane: worker

[ Worker ]02HTTPnetwork

axis_request

Allowlisted Worker HTTP — returns { ok, status, body }. Not an open proxy.

Plane: worker

Blocked: /mcp recursion, /api/stream, OAuth device-flow, path traversal. Resource axis://allowlist lists the live table.

Parameters
pathrequiredstringWorker path starting with /
methodGET | POST | PUT | DELETEHTTP method (default GET)
queryobjectQuery string params
bodyanyJSON body for POST/PUT
headersobjectExtra headers; Authorization is injected
[ Worker ]03HTTPnetwork

axis_run

POST /api/run — Pine Script™ against OHLCV (Worker proxy or in-worker Pyodide). Returns plots, strategy events, errors.

Plane: worker

Parameters
scriptrequiredstringPine source
dataobject[]OHLCV rows { time, open, high, low, close, volume? }
tickerstringSymbol label
timeframestringInterval e.g. 1h
inputsobjectinput.* overrides
[ Worker ]04HTTPread

axis_scripts_list

Cloud script library metadata (no source). Bearer-partitioned.

Plane: worker

[ Worker ]05HTTPread

axis_scripts_get

Fetch one cloud script by id (full source).

Plane: worker

Parameters
idrequiredstringScript id
[ Worker ]06HTTPmutate

axis_scripts_put

Create/upsert cloud script { name, content, id?, description?, path?, revision? }.

Plane: worker

Parameters
namerequiredstringDisplay name
contentrequiredstringPine Script™ source
idstringExisting id to upsert
[ Worker ]07HTTPmutate

axis_scripts_delete

Delete a cloud script by id.

Plane: worker

Parameters
idrequiredstringScript id
[ Worker ]08HTTPread

axis_keys_validate

Validate the current Bearer or an explicit { key }.

Plane: worker

[ Worker ]09HTTPmutate

axis_keys_create

Create a key with { adminToken, tier? } — same as X-Admin-Token.

Plane: workerCLI: axis keys create

Parameters
adminTokenrequiredstringAdmin token
tierstringOptional tier
[ Worker ]10HTTPread

axis_usage

Usage stub / KV counters for the key.

Plane: worker

[ Worker ]11HTTPnetwork

axis_onchain

Proxy GET under /api/onchain — { path, query? }.

Plane: worker

Parameters
pathrequiredstringSuffix after /api/onchain
queryobjectQuery params
[ Worker ]12HTTPnetwork

axis_market

Proxy GET under /api/market — { path, query? }.

Plane: worker

Parameters
pathrequiredstringSuffix after /api/market
queryobjectQuery params
02

App

5 tools
[ App ]01HTTPread

app_session_status

Connected PWA tab count for this API-key session. Start here before app_invoke.

Plane: app

[ App ]02HTTPread

app_capabilities

Capability catalog from the connected tab — call if the client has not cached ids.

Plane: app

[ App ]03HTTPmutate

app_invoke

{ capability, payload? } — wait for JSON result (default 20s). Primary write/read path into the live PWA.

Plane: app

No tab → SESSION_OFFLINE. MCP_BRIDGE unbound → NO_MCP_BRIDGE. Timeouts → TIMEOUT. Snapshots redact secrets.

Parameters
capabilityrequiredstringCapability id e.g. chart.load
payloadobjectCapability-specific args
[ App ]04HTTPread

app_get

Sanitized app snapshot; optional dotted path. OHLCV summarized unless includeBars: true.

Plane: app

Parameters
pathstringDotted path into snapshot
includeBarsbooleanInclude full bar series
[ App ]05HTTPmutate

app_set

Allowlisted dotted path + value (symbol, interval, source, engine, theme, editor.doc, …).

Plane: app

Anything else → PATH_DENIED.

Parameters
pathrequiredstringAllowlisted dotted path
valuerequiredanyNew value
03

Capabilities

7 tools
[ Capabilities ]01HTTPmutate

chart.*

chart.get / set / load / reload / live / layout / theme / type / screenshot / zoom / bars / lag.

Plane: app

[ Capabilities ]02HTTPmutate

editor.*

editor.get / set / run / diagnostics — Pine buffer on the live tab.

Plane: app

[ Capabilities ]03HTTPmutate

indicators.*

indicators.list / add / remove / update / run. remove detaches chart panes; code edits need run after.

Plane: app

[ Capabilities ]04HTTPmutate

alerts.*

alerts.list / create / update / remove — local browser / webhook alerts.

Plane: app

[ Capabilities ]05HTTPmutate

library.* / watchlist.*

library.list / read / write / remove · watchlist.get / add / remove / lists.

Plane: app

[ Capabilities ]06HTTPmutate

engine.* / stream.*

engine.get / series / tick / repair · stream.get / reset. Diagnose lag and re-subscribe sockets.

Plane: app

[ Capabilities ]07HTTPmutate

panels / theme / settings / tabs

panels.get/set · theme.get/set · settings.get/set · plugins.list/activate · drawings.* · workspace.export/import · results.get · logs.get · status.get · app.command / shortcut / event · app.tab.list / app.tab.switch.

Plane: app

theme.set accepts theme / presetId / uiScale / toggle. settings.set is allowlisted (endpoint, engine, interval, historyBars, live.*, uiScale, …) — secrets never round-trip. Multi-tab: app.tab.list then app.tab.switch before app_invoke.

04

Connect

3 tools
[ Connect ]01anymutate

API key (pn_…)

Mint with axis keys create (needs ADMIN_TOKEN). Same Bearer as cloud script storage.

CLI: axis keys create

Production fail-closes when D1 is bound without API_KEYS KV.

[ Connect ]02HTTPread

McpBridgeDO

PWA opens wss://…/api/mcp/bridge?ticket=… after minting a 30s one-time ticket over Bearer. Session partitioned by SHA-256 of the key.

Plane: app

Status bar MCP capsule: session dot (bridge + tab count) and activity dot (recent app_invoke).

[ Connect ]03stdio

axis mcp

Local stdio process that forwards JSON-RPC lines to POST /mcp for clients that only spawn a process.

CLI: axis mcp --key pn_…

05

Protocol

3 tools
[ Protocol ]01HTTPread

GET /mcp

Public discovery — server name and tool names. No Bearer required.

[ Protocol ]02HTTPread

tools/list

Enumerate Worker + App plane tools (auth required for calls).

[ Protocol ]03HTTPread

Limits & errors

60 RPC methods / minute / key; batches max 10; body cap 1 MiB. Common codes: NO_KEY, SESSION_OFFLINE, NO_MCP_BRIDGE, MCP_ALLOWLIST, TIMEOUT, PATH_DENIED.

Surfaces2
Worker Tools12
App Tools5
axis_health → app_invoke → chart.load