MCP Server

#

Let an AI assistant read your quotes, charts, portfolios and accounts — and place trades — by talking to your running copy of Medved Trader.

MCP (Model Context Protocol) is the standard that AI clients such as Claude Desktop and Claude Code use to call outside tools. Turning on Medved Trader's MCP server publishes MT's data and actions as tools your assistant can use: "What's my P&L on the tech watchlist?", "Chart me AAPL's last 30 days of daily bars", "Cancel my open orders."

The server runs inside Medved Trader and listens on your own machine. Nothing is sent to Medved Trader's servers, and the assistant only sees what it asks for, when it asks.

Read this before you enable it. A key can be granted the ability to place, modify and cancel real orders on any trading account you have started. New keys are read-only until you grant that yourself, so the risk is one you opt into deliberately — but treat every key like a password regardless.

Turning it on

Go to Settings → App → API and find the MCP Server panel.

  1. Check Enable MCP API.
  2. Leave Port at the default (16240) unless something else on your machine already uses it.
  3. Click Add Key. Give the key a nickname that says which client it's for ("Claude Desktop", "laptop"), so you can tell your keys apart later.
  4. Copy the key now. It's shown in full exactly once. Afterwards the list only shows the first and last few characters.
  5. Click the key's Access cell to choose what it may do. New keys are Read only — see below.
  6. Click Apply and enter your account password when prompted.

Changing any of these settings — enabling the server, changing the port, allowing local network access, or adding, removing or disabling a key — requires your account password (or your PIN, if you log in with a social login).

The MCP server, like all of Medved Trader's APIs, requires a Premium subscription. A trial subscription includes it.

The server won't start until at least one enabled key exists. Every request has to present a key, so with no keys the port would reject everything — Medved Trader doesn't open it at all.

What a key is allowed to do

Each key carries its own set of permissions. Click a key's Access cell to open the picker; tick as many as you need, or use the Read only / Full access presets at the top.

AccessLets the assistant
Market dataRead quotes, charts, history and option chains. Changes nothing.
Portfolios: readSee what's in your portfolios and watchlists, including quantities and cost basis.
Portfolios: modifyAdd and remove symbols, create portfolios, and change which symbol your linked windows are showing.
Accounts: readConnect accounts and read balances, positions and order history. Cannot send an order.
Trading: place ordersPlace, modify and cancel real orders.
App controlSave, load and rearrange your window layouts, and other app-level actions.

A new key gets Read only — market data, portfolios and accounts, all read-only. That covers most of what people actually want ("how's my portfolio doing?", "chart me AAPL") without putting anything at risk.

Access is enforced, not just advertised. Tools a key doesn't grant are left out of the list the assistant is given, so a read-only key isn't offered the order tools in the first place — and if a client calls one anyway, the server rejects it. Granting the least you need is a real barrier, not a matter of how carefully you word your requests.

Managing keys

The key list shows each key's nickname, masked value, access, and when it was last used — useful for spotting a key nothing is using any more. Uncheck Enabled to switch a key off while keeping it, or remove it outright. Either takes effect as soon as you apply; a client using that key starts getting rejected immediately. If a key leaks, delete it and add a new one — keys can't be edited or rotated in place.

Access from other machines

By default the server only accepts connections from the same computer. Allow MCP connections from local/private network extends that to other machines on your home or office network (10.x, 192.168.x and 172.16–31.x addresses).

Connections are plain HTTP, with no encryption. Off your own machine, the API key travels the network in the clear and anyone who captures it has full access to your accounts. Leave this off unless you need it, and never expose the port to the internet or forward it through a router.

Connecting your AI client

Point the client at http://localhost:16240/mcp and have it send the API key as a bearer token. Most MCP clients take a config file like this:

{
  "mcpServers": {
    "medved-trader": {
      "url": "http://localhost:16240/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY_HERE"
      }
    }
  }
}

Replace YOUR_API_KEY_HERE with the key you copied, and the port if you changed it. If your client can't set an Authorization header, it can send the key as X-API-Key instead.

Medved Trader has to be running for any of this to work. If the client reports the server as unavailable, check that MT is open, that the MCP panel still shows the server enabled, and that at least one key is enabled.

What the assistant can do

Twenty-eight tools, in four groups. You don't call these yourself — the assistant picks them based on what you ask — but it's worth knowing what's on the table.

Market data

ToolWhat it does
get_quoteLatest quote for one or more symbols — last, bid, ask, change, volume, day range, 52-week range. Accepts a symbol list, or CURRENT (the active portfolio window), ACTIVE (all open portfolio windows), or * (everything MT has data for).
get_symbol_snapshotEvery field MT tracks for a symbol in one call — quote, OHLC, 52-week, change, volume and turnover, fundamentals, options open interest and more. Takes the same symbol inputs as get_quote (a list, or CURRENT / ACTIVE / *).
get_historyHistorical OHLCV bars. Intraday by the minute, or daily, weekly, monthly and yearly bars. Can exclude extended hours.
get_option_chainOption chain for an underlying — expirations, strikes, calls and puts.
enum_symbolsLists the symbols MT currently knows about.
get_linked_symbol / set_linked_symbolReads or sets the symbol for a link colour group. Setting it retargets every window linked to that colour — the assistant can drive what your screen is showing — so set_linked_symbol needs Portfolios: modify access, not just market data.
get_linked_symbol_colorsLists the link colour groups.

Portfolios and watchlists

ToolWhat it does
enum_portfoliosLists your portfolios and watchlists with their IDs.
get_portfolio_symbolsThe symbols in a portfolio; optionally with quantity, cost basis, commission and notes per row.
add_symbols_to_portfolioAdds symbols to a portfolio, updates existing rows, or creates a new portfolio.
remove_symbols_from_portfolioRemoves rows from a portfolio.
add_portfolioCreates a new, empty portfolio or watchlist. Takes a name, and optionally an ID (auto-generated if omitted) and a type (simple, the default, or watchlist).
delete_portfolioDeletes a portfolio and everything in it, by ID.

Trading

ToolWhat it does
enum_trading_accountsLists the trading accounts available to the API.
start_trading_account / stop_trading_accountConnects or disconnects an account. Nothing else in this group works until the account is started.
get_account_balancesCash, buying power, equity and so on.
get_positionsOpen positions.
get_transactionsOrders and transactions, including order status.
place_orderPlaces a real order. Market, limit, stop and stop-limit, single or multi-leg.
modify_orderChanges an open order — price, quantity, type.
cancel_orderCancels one or more open orders.
get_trade_logReads the trade activity log — order placements, fills, partial fills, cancels, rejections and other order-lifecycle events. Read-only, and works without starting the account. Optional filters by account, symbol, activity type and time.

Order tools send the order and return right away; they don't wait to hear back from the broker. A successful result means "sent", not "filled" or even "accepted". The assistant has to check get_transactions to find out what actually happened — and so should you.

Application

ToolWhat it does
get_app_versionThe running application name and version. Available to every key.
get_layout / set_layoutReads the current window layout as XML, or replaces it with an edited one — a way to rearrange, open and close many windows at once. Needs App control access.
save_layout / load_layoutSaves the current layout to a file, or loads a saved one back and applies it. Needs App control access.
get_layout_commands / set_layout_commandsReads or sets the layout commands stored in a saved layout file. These are settings the layout applies every time it is loaded — for example, “make Schwab the preferred quote source” (SourcePriority SCHWAB High). save_layout can store them too. Needs App control access.
update_chartsMakes open charts recalculate and repaint, optionally only for one symbol. With drawings set, they also reload their trendlines and other drawings — for when the drawings were changed from outside Medved Trader. Needs App control access.

An assistant cannot close Medved Trader. There is no shutdown tool, and no setting that adds one — starting and stopping the program stays yours alone.

Staying in control

  • Grant the least access that does the job. This is the one that matters most, because it's the only control that removes the capability rather than relying on judgement — yours or the assistant's. If you're not asking it to trade, don't grant trading.
  • Trading tools do nothing until you start an account. Even with trading access, an assistant can't send an order on an account that isn't started. Leaving accounts stopped is a second, independent brake.
  • Most clients ask before each tool call. Read those prompts — especially for place_order, modify_order and cancel_order. Be wary of standing "always allow" approvals for the order tools.
  • An assistant can misread you. It's software following a text instruction, and "sell some of my AAPL" leaves a lot of room. Confirm quantity, price and account before approving anything that moves money.
  • The last-used column is your audit trail. If a key shows recent use you can't account for, disable it.
  • Turn the server off when you aren't using it. Unchecking Enable MCP API closes the port.

Troubleshooting

SymptomCause
Client says the server is unreachableMT isn't running; the server isn't enabled; no enabled key exists; or the client's port doesn't match the one in Settings.
Every request comes back unauthorizedThe key is wrong, disabled or deleted. Keys can't be recovered — if you didn't copy it, delete the key and add a new one.
Enabled the server but nothing is listeningMost often no key has been added yet. The port isn't opened until there's an enabled key.
Port won't bindAnother application has it. Pick a different port in Settings and update your client config to match.
Another machine can't connectAllow local/private network access has to be on, and both machines have to be on the same private network. Restart the server after changing it.
A quote or history request comes back emptyMT has no data for that symbol. The MCP server reads what MT already has — it doesn't add data feeds or entitlements.

For developers

If you're writing your own MCP client, or want to know exactly what each tool takes and returns, see the MCP Server API Reference. For Medved Trader's other APIs and when to use each one, see Medved Trader APIs.