Skip to content

MCP tools

Connect an AI client to the product’s typed tools for markets, indicators, plans, alerts, and watchlists. Start with a local, read-only tool call.

Use a local product checkout and Rust toolchain. For tools that call application services, start the host development stack or the complete Docker app.

The tool catalog is the contract: backend/crates/mcp/src/tool_catalog.rs. Use the client’s tools/list result for current parameter schemas rather than guessing tool names or borrowing a different MCP server’s API.

Build from the product repository root:

Terminal · build the MCP binary
cd backend
cargo build --locked --bin open-trading-mcp

Add a server entry to your client’s MCP configuration. Replace the absolute checkout path below with your actual path; on Windows the executable ends in .exe.

Example · Cursor or Claude Desktop MCP configuration
{
"mcpServers": {
"open-trading-mcp": {
"command": "/absolute/path/to/open-trading/backend/target/debug/open-trading-mcp",
"env": {
"OT_RUST_URL": "http://localhost:2000",
"OT_NEST_URL": "http://localhost:3000"
}
}
}
}

The client launches the binary and communicates over stdin/stdout. There is no HTTP URL in this mode. Restart or reload the MCP server in the client after changing its configuration or rebuilding the binary.

For a host development stack, run from the product repository root:

Terminal · MCP HTTP server
make run-mcp-http

Connect an MCP client or Inspector with Streamable HTTP at http://localhost:8181. The complete Docker app already exposes its HTTP MCP listener at http://127.0.0.1:8181 by default; do not start a second listener on the same port.

For the hosted MCP Inspector workflow, the server needs MCP_CORS_ENABLED=true. Enable it only for the intended client workflow. CORS is not access control, and the server should remain private.

An HTTP client must initialize, send notifications/initialized, and retain the MCP session/connection for subsequent requests. Separate curl invocations can report “Session not found”; use a real MCP client rather than treating this transport like a stateless JSON API.

In your connected client’s tool browser, select list_exchanges with no parameters. Its tools/call parameters are:

Tool call parameters · list_exchanges
{
"name": "list_exchanges",
"arguments": {}
}

This is the parameters object inside an initialized MCP client’s request, not a standalone HTTP body. The tool returns MCP text content containing a JSON list of supported exchange IDs and labels. Use those IDs for subsequent market tools; do not invent them.

This call reads the shared exchange catalog and does not require an AI key or live market response. It verifies the client/tool connection, not every backend.

Tools Requirement or behavior
list_exchanges Shared supported-exchange catalog
market_ohlc, indicator_bundle, performance_bundle Market data access; indicator calculations use the shared Rust implementation
feed_snapshot, market_orderbook Running Rust API and available live feed/subscription; may return null without one
compute_plan_levels Market data plus a fixed-percentage levels helper; not the AI generate-plan action
generate_trading_plan Rust API and configured LLM providers; returns analysis, plan and chat without Nest persistence
list_llm_providers, list_llm_models, list_ollama_models Rust API; model availability also depends on the chosen provider/service
recognize_pattern Rust vision path and screenshot input; provider configuration may be required
alerts_*, watchlists_* NestJS and its session-scoped data

compute_plan_levels requires context_summary as a string: use "" when there is no context, not null. Use generate_trading_plan when you want the AI workflow corresponding to the application’s plan action. Neither tool automatically saves a plan through NestJS.

MCP creates its own anonymous Nest session through /api/session/ensure by default. The browser and MCP client can therefore see different alert and watchlist stores even when connected to the same services.

To deliberately share the browser’s session, set OT_NEST_SESSION in the MCP process environment to its ot_session cookie or bare JWT. Do not copy that credential into a public example, issue, screenshot, or repository.

Variable Default
OT_RUST_URL http://localhost:2000
OT_NEST_URL http://localhost:3000
OT_NEST_SESSION Unset; MCP obtains its own session
  1. Implement the typed parameters and operation in src/tools/.
  2. Update src/tool_catalog.rs and the exact #[tool] handler in src/handler.rs.
  3. Keep run_tool dispatch and schema_for_tool in src/in_process.rs aligned.
  4. Use the existing NestClient or RustApiClient for those service calls.
  5. Run the relevant checks, rebuild the binary, and reload the client’s server.

With a configured hybrid stack and market connectivity, run from the product root:

Terminal · MCP validation
make lint
bash make/mcp/smoke-product-mcp.sh

The smoke script builds the binary, checks catalog consistency, and exercises selected domains against live services. Expect OK: product MCP smoke passed. It is not a complete end-to-end test of every tool or AI provider.

Source: the MCP development guide. For connection failures, see Troubleshooting.