Skip to content

Profitmaker MCP Server

Drive a running Profitmaker terminal from an AI agent over the Model Context Protocol. The MCP server exposes one tool per command in the shared command registry (@profitmaker/mcp), which sits on top of the same REST + ui:command control surface documented in remote-control.md. The CLI (cli.md) is the same registry behind a profitmaker shell command.

Setup

The server talks to a running terminal server (boot it per server-api.md). It is configured by two env vars:

VarDefaultMeaning
PROFITMAKER_URLhttp://localhost:3001Terminal server HTTP base.
PROFITMAKER_TOKEN(none)Bearer token. Use the server’s API_TOKEN (resolves to the single bootstrap user — perfect for an agent), or a session/SSO token for a specific user.

.mcp.json

{
"mcpServers": {
"profitmaker": {
"command": "bun",
"args": ["packages/mcp/src/bin.ts"],
"env": {
"PROFITMAKER_URL": "http://localhost:3001",
"PROFITMAKER_TOKEN": "your-api-token"
}
}
}
}

Or via the CLI’s stable entrypoint (after bun add @profitmaker/cli or in-repo):

{ "mcpServers": { "profitmaker": { "command": "profitmaker", "args": ["mcp"],
"env": { "PROFITMAKER_URL": "http://localhost:3001", "PROFITMAKER_TOKEN": "your-api-token" } } } }

How errors surface

Every tool returns the server’s response as JSON text. On failure the tool result is flagged isError and the message is passed through verbatim — so an agent sees the real cause: a 503 No UI client connected for a ui_* tool when no browser is open, a 400 zod validation message, or a connection error when the server is down. ui_* tools (and dashboards_set_active) require a browser tab to be open and connected to the same server/user.

Tool reference

REST-backed tools take effect immediately and stream to any open browser via state:changed. ui_* tools require a connected browser (they round-trip a ui:command). Parameters in code are required; name? are optional.

ToolParamsDescription
dashboards_list—List all dashboards for the current user (id, title, isDefault). Use this first to discover dashboard ids.
dashboards_getdashboardIdGet one dashboard with all of its widgets (positions, types, groups, visibility).
dashboards_createtitle, description?, isDefault?Create a new dashboard (a tab in the terminal). Returns the created dashboard incl. its new id. Appears live in any open browser.
dashboards_updatedashboardId, title?, description?, isDefault?, layout?Update a dashboard’s title/description/layout/isDefault. Only the fields you pass change.
dashboards_deletedashboardIdDelete a dashboard and all of its widgets (cascades). The tab disappears live.
dashboards_set_activedashboardIdSwitch the active dashboard tab in the live UI (ui:command). Requires a browser to be open and connected; returns 503 otherwise.
widgets_list_types—List every widget type that can be added: the built-in types plus any module-provided widget types (<moduleId>.<widget>). Call before widgets_add.
widgets_listdashboardIdList the widgets on a dashboard.
widgets_adddashboardId, type, position, defaultTitle?, userTitle?, groupId?, config?, showGroupSelector?, isVisible?Add a widget. type from widgets_list_types. position is pixels {x,y,width,height}. Bind to a group (groupId) so it follows that group’s instrument. Appears live.
widgets_updatewidgetId, userTitle?, config?, groupId?, showGroupSelector?, isVisible?, isMinimized?Update a widget’s title, config, group binding, or visibility. Only passed fields change.
widgets_movewidgetId, x, yMove a widget to a new {x,y} pixel position (keeps its current size). Moves live.
widgets_resizewidgetId, width, heightResize a widget (keeps its position). Visible live.
widgets_removewidgetIdRemove a widget from its dashboard. Disappears live.
groups_list—List instrument groups. A group carries an exchange/market/tradingPair context; widgets bound to it all follow it.
groups_createname, color?, tradingPair?, exchange?, market?, account?, description?Create an instrument group. Bind widgets to it so they all show the same instrument.
groups_set_group_contextgroupId, tradingPair?, exchange?, market?, account?Change a group’s instrument context. EVERY widget bound to it retargets live — chart, order book and trades resubscribe to the new symbol.
groups_assign_widgetwidgetId, groupIdBind a widget to a group.
marketdata_list_exchanges—List every exchange id the server can serve market data for.
marketdata_get_capabilitiesexchange, market?, providerId?Get an exchange’s capabilities as reported by the serving provider.
marketdata_get_candlesexchange, symbol, market?, providerId?, timeframe?, limit?Fetch recent OHLCV candles. Returns [ts, o, h, l, c, v] arrays.
marketdata_get_orderbookexchange, symbol, market?, providerId?, limit?Fetch the current order book (bids/asks).
marketdata_get_recent_tradesexchange, symbol, market?, providerId?, limit?Fetch the most recent public trades.
marketdata_get_tickerexchange, symbol, market?, providerId?Fetch the latest ticker (last/bid/ask/volume).
providers_list_available—List server-side data/trading providers (id, displayName, exchanges, priority, fromModule). Pass an id as providerId to market-data tools. Built-in is “ccxt”.
modules_searchquerySearch npm for installable Profitmaker modules.
modules_installname, version?Install a module from npm (no server restart).
modules_enableidEnable an installed module (no restart).
modules_disableidDisable an installed module (no restart).
ui_get_ui_state—Ask the live UI what it shows: active dashboard id + open widgets (id+type). Requires a connected browser.
ui_bring_widget_to_frontdashboardId, widgetIdRaise a widget’s z-order in the live UI. Requires a connected browser.
ui_set_widget_settingswidgetId, widgetType, settingsApply per-widget settings live (e.g. { "timeframe": "5m" } for a chart). Requires a connected browser.

31 tools.

Worked scenario — “create a scalping dashboard for BTC/USDT on bybit”

An agent prompt like “create a scalping dashboard with orderbook + trades + chart for BTC/USDT on bybit” maps to:

  1. widgets_list_types → confirm chart, orderbook, trades are available.
  2. dashboards_create { "title": "Scalping BTC" } → returns dashboardId.
  3. groups_create { "name": "Scalp", "tradingPair": "BTC/USDT", "exchange": "bybit", "market": "spot", "color": "#00BCD4" } → returns groupId.
  4. widgets_add ×3 with dashboardId, groupId, and a type + position:
    • chart { "x": 20, "y": 80, "width": 700, "height": 420 }
    • orderbook { "x": 740, "y": 80, "width": 320, "height": 420 }
    • trades { "x": 1080, "y": 80, "width": 320, "height": 420 }
  5. dashboards_set_active { "dashboardId": … } → the user’s browser switches to the new tab.
  6. (optional) marketdata_get_ticker { "exchange": "bybit", "symbol": "BTC/USDT" } to confirm data is flowing.
  7. Later: groups_set_group_context { "groupId": …, "tradingPair": "ETH/USDT" } retargets all three widgets at once; ui_set_widget_settings sets the chart timeframe; ui_get_ui_state reads back what the user sees.

This exact flow is exercised end to end (and asserted) by scripts/stage3-scenario.ts — see cli.md.