S
StockBud Docs

API Reference

MCP tools and endpoints available in StockBud

API Reference

StockBud exposes its functionality through MCP (Model Context Protocol) tools. These tools can be called by any MCP-compatible AI assistant like Claude, ChatGPT, or custom integrations.

All tools are available via the MCP stdio transport. Connect using your AI assistant's MCP configuration.

Connection

{
  "mcpServers": {
    "stockbud": {
      "command": "uv",
      "args": ["run", "python", "scripts/start/stockbud_main.py"],
      "cwd": "/path/to/mcp-server-stockbud.io"
    }
  }
}

Portfolio Management

ToolDescription
get_portfolioGet current portfolio with all positions
get_positionsList all open positions
get_accountGet account balance and buying power
analyze_portfolioAI-powered portfolio analysis

Market Data

ToolDescription
get_quoteGet real-time quote for a symbol
get_market_dataGet OHLCV bars for a symbol
get_market_sentimentGet overall market sentiment
analyze_stockDeep analysis of a specific stock

Trading

Trading tools require a funded Alpaca account. Use paper trading for testing.

ToolDescription
place_orderPlace a buy/sell order
cancel_orderCancel a pending order
get_ordersList recent orders
close_positionClose a position

Research & Analysis

ToolDescription
technical_analysisGet technical indicators
fundamental_analysisGet fundamental metrics
news_analysisGet news with sentiment
options_chainGet options data

Example Usage

Get Portfolio

{
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "name": "get_portfolio",
    "arguments": {}
  },
  "id": 1
}

Analyze Stock

{
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "name": "analyze_stock",
    "arguments": {
      "symbol": "NVDA",
      "include_technicals": true,
      "include_fundamentals": true
    }
  },
  "id": 2
}

Tool Schemas

For detailed input/output schemas, see the MCP Server Schema.

Rate Limits

CategoryLimit
Market Data200 requests/minute
Trading10 orders/minute
Analysis50 requests/minute

Error Handling

All tools return errors in a consistent format:

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid symbol",
    "data": {
      "symbol": "XYZ",
      "reason": "Symbol not found in market"
    }
  },
  "id": 1
}

Common error codes:

CodeMeaning
-32600Invalid request
-32601Method not found
-32602Invalid params
-32603Internal error
-32000Market closed
-32001Insufficient funds

On this page