About StockAgent
StockAgent is an MCP server in the Finance category: mCP Servers for stock agent.
Install
git clone https://github.com/craigde/StockAgentThis server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.
Tools (8)
cancelOrderCancel open order
Parameters not published.
closePositionClose a position (full or partial)
Parameters not published.
createOrderCreate market/limit/stop orders
Parameters not published.
getAccountAccount balance, buying power, status
Parameters not published.
getAllPositionsAll open positions with P&L
Parameters not published.
getMarketClockMarket open/close status
Parameters not published.
getPortfolioHistoryHistorical portfolio value
Parameters not published.
getPositionSingle position details
Parameters not published.
Ask AI
Ask AI about StockAgent
Powered by Claude · Grounded in docs
Security checks
- ✓README presentThe repository ships documentation.
5 checks have not been run yet.
README
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!
README copy captured when this server was indexed; it may lag the repository. The original is authoritative.