StockAgent
MCP Servers for stock agent
Ask AI about StockAgent
Powered by Claude Β· Grounded in docs
I know everything about StockAgent. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
AI Trading Agent with MCP (Model Context Protocol)
Build an autonomous AI trading agent that can execute real trades, analyze options, and monitor macroeconomic conditionsβall through natural language conversation.
π― What This Project Does
This repository contains OpenAPI specifications that enable AI assistants (Claude, ChatGPT, etc.) to:
- Execute trades via Alpaca (stocks, ETFs, options)
- Analyze options chains with Greeks via Tradier
- Monitor macroeconomic conditions via FRED (Federal Reserve data)
Using Workato's MCP connector, these specs become MCP servers that AI can call as tools.
ποΈ Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β USER CONVERSATION β
β "Buy $5000 of NVDA" or "Check the yield curve" β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CLAUDE / CHATGPT β
β AI reasoning and decision making β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MCP PROTOCOL LAYER β
β Standardized tool calls via Workato β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββΌββββββββββββββββ
βΌ βΌ βΌ
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β ALPACA β β TRADIER β β FRED β
β Trading API β β Options API β β Economic API β
β β β β β β
β β’ Orders β β β’ Options Chainsβ β β’ Yield Curve β
β β’ Positions β β β’ Greeks β β β’ Unemployment β
β β’ Portfolio β β β’ Historical β β β’ Inflation β
β β’ Account β β β’ Quotes β β β’ GDP β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
π Repository Contents
| File | Description |
|---|---|
alpaca_openapi.yaml | Trading execution (orders, positions, account) |
tradier_openapi.yaml | Options data (chains, Greeks, quotes) |
fred_openapi.yaml | Macroeconomic data (rates, inflation, employment) |
README.md | This file |
π Quick Start
Prerequisites
- Workato Account - Sign up for Workato (MCP connector required)
- Alpaca Account - Sign up for Alpaca (free paper trading)
- Tradier Account - Sign up for Tradier (free sandbox)
- FRED API Key - Get free key
Step 1: Set Up Alpaca
- Create account at alpaca.markets
- Go to Paper Trading dashboard
- Generate API keys (Key ID + Secret Key)
- Note: Use
paper-api.alpaca.marketsfor testing
Step 2: Set Up Tradier
- Create account at developer.tradier.com
- Get your Sandbox Access Token from dashboard
- Note: Use
sandbox.tradier.comfor free delayed data
Step 3: Set Up FRED
- Go to FRED API Keys
- Request a free API key (instant approval)
Step 4: Import to Workato
For each API:
- In Workato, go to App Connections β Create Connection
- Select HTTP connector with OpenAPI option
- Upload the corresponding
.yamlfile - Configure authentication:
| API | Auth Type | Configuration |
|---|---|---|
| Alpaca | API Key (Header) | APCA-API-KEY-ID and APCA-API-SECRET-KEY headers |
| Tradier | Bearer Token | Authorization header with your access token |
| FRED | API Key (Query) | api_key query parameter |
Step 5: Create MCP Server
- In Workato, go to MCP Servers β Create Server
- Add your HTTP connections as tools
- Publish the MCP server
- Copy the MCP server URL
Step 6: Connect to Claude
In Claude.ai:
- Go to Settings β Integrations β MCP Servers
- Add your Workato MCP server URL
- Authorize the connection
- Start chatting!
π¬ Example Conversations
Trading with Alpaca
User: What's my current portfolio value?
Claude: [Calls Alpaca:Get_Account]
Your portfolio is worth $99,595.06 with $43,581 buying power.
You have 24 open positions.
User: Buy $5000 of NVDA
Claude: [Calls Alpaca:Create_Order]
β Bought 26.3 shares of NVDA at $190.15
Order filled. Total cost: $5,001.95
Options Analysis with Tradier
User: What covered calls can I sell on SOFI?
Claude: [Calls Tradier:Get_Option_Chains with greeks=true]
Here are the best opportunities for SOFI (current price $26.92):
| Strike | Expiry | Premium | Delta | Annual Return |
|--------|--------|---------|-------|---------------|
| $29 | Feb 20 | $1.38 | 0.40 | 48.4% |
| $30 | Feb 20 | $1.10 | 0.34 | 38.3% |
| $28 | Feb 20 | $1.72 | 0.47 | 60.0% |
Recommendation: The $29 strike offers the best risk/reward balance.
Macro Analysis with FRED
User: What's the current macro environment?
Claude: [Calls FRED:Get_Series_Observations for T10Y2Y, VIXCLS, DFF, UNRATE]
π Market Regime Check (January 2026)
| Indicator | Value | Signal |
|-----------|-------|--------|
| Yield Curve (10Y-2Y) | +0.64% | β
Normal |
| VIX | 14.49 | β
Low volatility |
| Fed Funds Rate | 4.33% | π‘ Restrictive |
| Unemployment | 4.1% | β
Healthy |
Regime: RISK-ON
Current conditions favor growth assets.
π Available Tools
Alpaca (Trading)
| Tool | Description |
|---|---|
getAccount | Account balance, buying power, status |
getAllPositions | All open positions with P&L |
getPosition | Single position details |
createOrder | Create market/limit/stop orders |
cancelOrder | Cancel open order |
closePosition | Close a position (full or partial) |
getPortfolioHistory | Historical portfolio value |
getMarketClock | Market open/close status |
Tradier (Options)
| Tool | Description |
|---|---|
getQuotes | Stock/ETF quotes |
getOptionChains | Full options chain with Greeks |
getOptionExpirations | Available expiration dates |
getOptionStrikes | Strike prices for expiration |
getHistoricalPrices | OHLCV data |
getMarketClock | Market status |
FRED (Macro)
| Tool | Description |
|---|---|
getSeriesObservations | Economic data values |
getSeriesInfo | Series metadata |
searchSeries | Search for series |
getReleaseDates | Economic calendar |
getCategory | Browse data categories |
π Key FRED Series
| Series ID | Name | Frequency | Use Case |
|---|---|---|---|
T10Y2Y | 10Y-2Y Yield Spread | Daily | Recession indicator |
VIXCLS | VIX | Daily | Fear gauge |
DFF | Fed Funds Rate | Daily | Monetary policy |
UNRATE | Unemployment Rate | Monthly | Economic health |
CPIAUCSL | CPI | Monthly | Inflation |
BAMLH0A0HYM2 | High Yield Spread | Daily | Credit risk |
ICSA | Initial Claims | Weekly | Labor market |
GDP | GDP | Quarterly | Economic growth |
β οΈ Important Disclaimers
- Paper Trading Only: Start with paper trading to test your setup
- Not Financial Advice: This is an educational project
- Options Risk: Options trading involves substantial risk
- API Limits: Be aware of rate limits on all APIs
- Data Delays: Tradier sandbox has 15-minute delayed data
π§ Troubleshooting
Common Issues
401 Unauthorized (Alpaca)
- Check API key format (needs both Key ID and Secret)
- Verify using correct base URL (paper vs live)
- Ensure headers are named correctly
422 Unprocessable Entity (Alpaca Orders)
- Don't send empty
stop_lossortake_profitfor simple orders - Use either
qtyORnotional, not both - Check market hours for day orders
400 Bad Request (Tradier)
- Verify Bearer token format
- Check symbol format for options
No Data (FRED)
- Add
file_type=jsonto requests - Check series_id spelling (case-sensitive)
π Resources
π€ Contributing
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Submit a pull request
π License
MIT License - see LICENSE file for details.
π Acknowledgments
- Anthropic for Claude and MCP
- Alpaca for commission-free trading API
- Tradier for options data API
- FRED for economic data
- Workato for MCP server hosting
Built with β€οΈ by the AI Trading Agent community
Remember: Always test with paper trading before using real money!
