Skip to main content

MCP Runtime Reference

TradeScript Agent Console showing the browser session projected by the local or self-hosted MCP runtime
Both runtime transports project the same attached browser session, grants, lifecycle, and dynamic capability inventory.

Package entries

EntryPurpose
@tradescript/chart-mcp/browserBrowser attachment, WebMCP, chat tools, gateway client, Agent Console controller
@tradescript/chart-mcp/serverIn-process MCP server composition
@tradescript/chart-mcp/server/stdioLocal stdio transport and loopback bridge
@tradescript/chart-mcp/server/hostedCustomer-operated HTTP/WSS gateway and session-store contracts
@tradescript/chart-mcp/server/websocketBrowser bridge transport

The package binaries are tradescript-chart-mcp for local stdio and tradescript-chart-mcp-hosted for a customer-operated gateway process. The hosted binary requires TRADESCRIPT_MCP_GATEWAY_MODULE=./customer-gateway.mjs; that local module must export createTradeScriptSelfHostedGatewayOptions() and return production gateway options containing the customer's store, identity, authorization, rate-limit, audit, origins, URLs, and limits. Startup fails instead of selecting an anonymous or in-memory runtime when this contract is missing. Relative module paths resolve from the process working directory.

Stable tools

Standard MCP and WebMCP expose six stable tools:

  • tradescript_get_context
  • tradescript_list_controls
  • tradescript_call
  • tradescript_batch
  • tradescript_subscribe
  • tradescript_snapshot

The self-hosted MCP server additionally exposes tradescript_pair_session for one-time browser-session binding. Hundreds of chart and terminal operations are catalog controls discovered through tradescript_list_controls; they are not hundreds of top-level MCP tool schemas.

Customer-hosted routes

RoutePurpose
/mcpAuthenticated MCP transport
/bridgeExact-origin browser WebSocket bridge
/sessionsAuthenticated issue and revoke operations
/sessions/rotateAuthenticated atomic browser-token rotation
/healthzProcess liveness
/readyzStore, routing, and serving readiness

Legacy demo route names are deprecated for one compatibility release and must not be used in new integrations.

All external request and response bodies are validated. Errors use stable codes and safe messages; stack traces, credentials, prompt content, and unbounded tool results are not returned.