Connect Claude to Alpaca: the MCP setup, on paper money first
Alpaca ships an official MCP server with 65 tools. The setup is one command. The part worth slowing down for is the single setting that decides whether an order is real.
Coil is not affiliated with Alpaca or Anthropic. This page documents Alpaca’s public MCP server as their docs described it on 2026-11-11. If their page and this one disagree, theirs is right.
Alpaca gives your agent the hands. What to buy, and when to stand aside, is the other half: connect Coil to your agent the same way, free and with no key.
1. What you need first
- Alpaca API keys. A free paper trading account is enough. Generate the keys in Alpaca’s dashboard.
- Python 3.10 or newer, and uv. The server runs through
uvx, which comes with uv. - Claude Code or Claude Desktop. Any MCP client works; these are the two most people use.
2. The command, for Claude Code
claude mcp add alpaca --scope user --transport stdio uvx alpaca-mcp-server \
--env ALPACA_API_KEY=your_alpaca_api_key \
--env ALPACA_SECRET_KEY=your_alpaca_secret_key
This server runs on your own machine: uvx fetches Alpaca’s package and Claude Code talks to it over stdio. Robinhood’s works the other way round, with a remote address and a sign-in through the browser. The keys live in the client’s configuration, so there is never a reason to paste them into the chat.
3. The same thing in Claude Desktop
Add this to claude_desktop_config.json and restart the app:
{
"mcpServers": {
"alpaca": {
"command": "uvx",
"args": ["alpaca-mcp-server"],
"env": {
"ALPACA_API_KEY": "your_alpaca_api_key",
"ALPACA_SECRET_KEY": "your_alpaca_secret_key"
}
}
}
}
4. The setting that decides whether orders are real
The server trades paper money unless you tell it otherwise. ALPACA_PAPER_TRADE defaults to true. A live order takes two deliberate acts: that variable set to false, and live keys in place of the paper ones.
Leave both alone until the agent has run on paper for a few weeks and you have read every order it placed. Nothing in this server stops to ask whether you are sure. What the model sends goes straight to Alpaca’s Trading API, and Alpaca’s docs tell you to review an AI-suggested order before confirming it.
5. Give it fewer tools
All 65 tools are on by default, across ten toolsets: account, trading, watchlists, assets, stock-data, crypto-data, options-data, corporate-actions, news and fixed-income-data. An agent that only reads has no business holding the one that places orders. ALPACA_TOOLSETS takes a comma-separated list:
--env ALPACA_TOOLSETS=account,stock-data,news
Start there, and add trading only when you have a reason to.
6. Prove it with a read
Ask Claude for your account balance and open positions; a paper account that answers is the success case. If it fails, check the two usual causes first: uvx is not on your path, or the keys are live keys while the server is still in paper mode.
7. The other half: what to trade, and when not to
Connected is the easy part. The server will place whatever the model decides, and a language model left alone with a market feed trades too often and chases what has already moved. Before it reaches for an order tool, the agent needs a read of the market: whether today is worth trading at all, whether this name is at an entry or already extended, and what would make the trade wrong.
That read is what Coil serves, over the same kind of line, with no key and no account:
claude mcp add --transport http coil https://mcp.coil.trade/mcp
Coil’s server has no brokerage tools, so nothing on that line can touch your Alpaca account. It answers questions: the market regime, which names lead, whether one stock is at an entry or should wait. Your agent reads Coil first and trades through Alpaca second, and on the days the read says to stand aside, standing aside is the trade.
Coil publishes every trade its own engine makes, the losses included, at /results. Read that before you trust any of this. For other clients and the copy-paste steps, see the connect page.
Common questions
Does Alpaca’s MCP server trade real money by default?
No. Paper trading is the default: ALPACA_PAPER_TRADE is true unless you change it. Live orders need that variable set to false and live API keys in place of paper keys. Both are deliberate acts, which is the point.
Where do the Alpaca API keys go?
In the MCP client’s own configuration: the --env flags of the claude mcp add command, or the env block in Claude Desktop’s config file. Never paste them into the chat. Alpaca’s docs say the same, and a key typed into a conversation should be treated as leaked and rotated.
Do I need a paid Alpaca plan?
Not to start. A free paper account and its keys are enough to connect and test. Alpaca’s docs note that some live market data may need their Algo Trader Plus subscription.
Robinhood or Alpaca for an AI agent?
They differ in ways that matter. Robinhood’s agentic server is remote: you add an address and sign in through your browser, and it needs their agentic account. Alpaca’s server runs on your own machine with API keys, defaults to paper money, and covers options, crypto and news as well as stocks. If you want weeks of practice before a real order, Alpaca’s paper default is the easier place to get them.
Is Coil affiliated with Alpaca?
No. Coil does not run, proxy or see anything on Alpaca’s server. Coil’s own MCP server is a separate line with no brokerage tools on it: claude mcp add --transport http coil https://mcp.coil.trade/mcp.