TradeStation MCP Server
A Model Context Protocol (MCP) server that provides TradeStation API integration for Claude Code and other MCP clients.
Features
Real-time market data (quotes, bars, option chains)
Account information (balances, positions, orders)
Order preview and validation
Automatic token refresh management
Support for both simulation and live environments
Available Tools
Market Data
marketData
- Get real-time quotes for symbolsbarChart
- Get historical price bars/candlesgetSymbolDetails
- Get detailed symbol informationgetOptionExpirations
- Get available option expiration datesgetOptionStrikes
- Get available option strike prices
Account Management
getAccounts
- List all brokerage accountsgetBalances
- Get account balances and buying powergetPositions
- Get current positions with P&LgetOrders
- Get order history with optional status filtergetOrderDetails
- Get detailed information for a specific ordergetExecutions
- Get fills/executions for a specific order
Order Operations
confirmOrder
- Preview order costs and requirements (READ-ONLY, does not execute trades)
Setup
Prerequisites
Node.js 18 or higher
TradeStation developer account with API credentials
Active TradeStation account (simulation or live)
Installation
Clone this repository:
Install dependencies:
Copy the example environment file:
Edit
.env
and add your TradeStation API credentials:
Build the server:
Getting TradeStation API Credentials
Create a new application to get your Client ID and Client Secret
Complete the OAuth flow to obtain a refresh token
Add the credentials to your
.env
file
Configure in Claude Code
Add the following to your Claude Code MCP configuration file:
macOS/Linux: ~/.config/claude-code/mcp_config.json
Windows: %APPDATA%\claude-code\mcp_config.json
Alternatively, if you have a .env
file in the project directory, you can omit the env
section and the server will automatically load credentials from the .env
file.
Usage
Once configured, the MCP tools will be automatically available in Claude Code. You can use them like this:
Development
Project Structure
Testing
The project includes several test scripts to verify API functionality:
Building
This compiles the TypeScript source to JavaScript in the build/
directory.
Environment Variables
Variable | Required | Description |
| Yes | Your TradeStation API client ID |
| Yes | Your TradeStation API client secret |
| Yes | OAuth refresh token for authentication |
| Yes | OAuth redirect URI (must match app config) |
| No | Default account ID for operations |
| No | Environment: 'simulation' or 'production' (default: simulation) |
Troubleshooting
Token Errors
If you see authentication errors:
Verify your credentials in the
.env
file are correctEnsure your refresh token hasn't expired
Check that your TradeStation account has API access enabled
Build Errors
If the build fails:
Ensure you have Node.js 18 or higher installed
Delete
node_modules
andbuild
directoriesRun
npm install
againRun
npm run build
MCP Connection Issues
If Claude Code can't connect to the server:
Verify the path to
build/index.js
in your MCP config is correctCheck that the server built successfully (
build/index.js
exists)Review Claude Code logs for error messages
API Documentation
For detailed TradeStation API documentation, visit:
License
ISC
Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Enables real-time trading and market data access through TradeStation's API. Supports market quotes, historical data, account management, portfolio tracking, and order preview functionality for both simulation and live trading environments.