DEV Community

Cover image for Connecting an AI assistant to a trading account through MCP, read-only first
Aleksandr B.
Aleksandr B.

Posted on AI-assisted

Connecting an AI assistant to a trading account through MCP, read-only first

This week we tightened how AI assistants connect to Trend0x, and I want to write down how we think about it while it's fresh.

Trend0x has an MCP server. It lets your own assistant (Claude, Cursor, VS Code, Cline) read market data, look at your strategy drafts, run backtests and check paper trading. Useful. But an agent token opens a trading account, and that changes how careful you need to be.

So the rule we build around is simple: start read-only, and make every step beyond that a deliberate one.

Disclosure: I'm a co-founder of Trend0x. This post uses our own MCP server as the example.

What you need

  • A Trend0x account. The free plan is enough.
  • Node.js 20 or newer.
  • An MCP client that can run a local stdio server.

1. Get your agent token

In the app, switch to Pro mode and open Account → Security & agent. That is where your agent token lives. If your account shows permission and expiry options, pick Read only and a short expiry. If you ever regenerate the token, the old one stops working.

Copy the token into your client's secret store or a private environment variable. Never paste it into a chat, a URL or a Git repository. The token is not an exchange password, and exchange API keys never go to the agent at all: they stay in the app's connection settings.

2. Get the bridge

The documented route is a small stdio bridge. It has no runtime dependencies and does not start a bot or a local server.

git clone https://github.com/trend0xai/my-openclaw-skills.git
cd my-openclaw-skills
npm test
Enter fullscreen mode Exit fullscreen mode

No npm install and no third-party runtime libraries.

3. Add it to your client

Most clients accept the common mcpServers format. Use the absolute path to the bridge script, and pass the token through env:

{
  "mcpServers": {
    "trend0x": {
      "command": "node",
      "args": ["/absolute/path/to/my-openclaw-skills/scripts/mcp-stdio.mjs"],
      "env": {
        "TREND0X_AGENT_TOKEN": "<from your secret store>"
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Keep this file out of Git. If your client can read secrets from a store, use that instead of the plain value.

The bridge is read and preview only by default. Nothing in this config lets the agent change anything.

There is also a direct HTTP endpoint at https://app.trend0x.com/api/mcp. If you use it, send the token in a header, never in a URL: URLs end up in logs.

4. Start with discovery

Before you ask the assistant anything, check what it can see. Discovery is public; account tools need the token. With the token set in your environment (not typed into a command that lands in shell history):

node scripts/trend0x-mcp.mjs list
node scripts/trend0x-mcp.mjs call manage_strategies '{"action":"list"}'
node scripts/trend0x-mcp.mjs call account_risk_settings '{"action":"get"}'
Enter fullscreen mode Exit fullscreen mode

Then try it from the client, for example: "List my saved strategies and tell me which ones are running on paper."

Two things I learned to check when reading results:

  • Don't trust the HTTP status alone. Look at isError, success, message and confirm_required in the result. Prefer result.structuredContent when it is there.
  • Missing is not zero. A connection status without a balance does not mean the wallet is empty.

5. When you want more than read-only

At some point you will want the agent to run a backtest or prepare a change. Two layers stay in place when you allow that.

On the bridge. Writes are off until you set TREND0X_ALLOW_WRITES=1 in your private config (or pass --allow-write to the CLI). Backtests count as writes here, because they save results. Many changes can be previewed first with dry_run.

On the server. Allowing writes on the bridge does not replace approval. The server still enforces ownership, permissions, capabilities and its own confirmations. Not every direct tool has a separate server confirmation step, though. So the approval of the exact action (a trade, a runner activation, a risk change, a transfer) stays with you. Keep writes off until you actually need them.

A few habits that come with it:

  • The bridge never retries a write on its own. After a timeout, a 429, a 502/504 or an unclear exchange response, check the current state before you repeat anything.
  • Keep the token in one private place. If you think it leaked, regenerate it.
  • Leave withdrawals disabled on every exchange key. The agent never needs them.

What this does not do

A saved draft is not a running strategy. A positive backtest is not permission to go live. Backtests and paper trading are simulations on data that is already known, so they are not forecasts, and real fills can differ. Trend0x is software, not financial advice, and trading can lose money.

Why read-only first

Honestly, the hard part of connecting an agent to a trading account isn't the protocol. It's deciding what the agent should never be able to do on its own. Read-only by default, a write guard you switch on yourself and your approval for every exact action are our answer for now. We're still building, step by step.

If you try it, I'd like to hear what breaks or what's missing.

Thanks for reading ❤️

Top comments (0)