Skip to main content
Glama
Public.com MCP Server

Public.com MCP Server

by Gajesh2007

Public.com MCP Server

An MCP (Model Context Protocol) server that provides AI assistants with access to Public.com's stock and options trading APIs.

Features

  • Real-time market data - Stock and crypto quotes, bid/ask spreads, volume

  • Options analytics - Chains, expirations, Greeks (delta, gamma, theta, vega, rho, IV)

  • Portfolio management - View positions, equity, buying power, transaction history

  • Order placement - Single-leg and multi-leg orders with safety guards

  • Pre-trade analysis - Preflight calculations for cost estimates before trading

Related MCP server: Schwab MCP Server

Prerequisites

Installation

Via npm

npm install -g public-com-mcp

Via npx (no install)

npx public-com-mcp

From source

git clone https://github.com/Gajesh2007/public-com-mcp.git
cd public-com-mcp
bun install

Configuration

Edit .env with your credentials:

# Required - your API secret key
PUBLIC_API_SECRET_KEY=your-api-secret-key

# Optional - default account ID (use get_accounts to find yours)
PUBLIC_DEFAULT_ACCOUNT_ID=

# Safety - set to "true" to enable live trading (default: false)
ENABLE_TRADING=false

Usage

With Claude Desktop

Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):

Using npx (easiest):

{
  "mcpServers": {
    "public-stocks": {
      "command": "npx",
      "args": ["public-com-mcp"],
      "env": {
        "PUBLIC_API_SECRET_KEY": "your-api-key"
      }
    }
  }
}

Using global install:

{
  "mcpServers": {
    "public-stocks": {
      "command": "public-com-mcp",
      "env": {
        "PUBLIC_API_SECRET_KEY": "your-api-key"
      }
    }
  }
}

Using Bun (from source):

{
  "mcpServers": {
    "public-stocks": {
      "command": "bun",
      "args": ["run", "/path/to/public-com-mcp/src/index.ts"]
    }
  }
}

Standalone

# Via npx
npx public-com-mcp

# Via global install
public-com-mcp

# From source with Bun
bun run src/index.ts

Development

# Run with hot reload
bun run dev

# Build for distribution
bun run build

# Run tests
bun test

Available Tools

Market Data

Tool

Description

get_quote

Get real-time quote for a single symbol

get_quotes

Batch quotes for multiple symbols (max 50)

get_instrument

Get trading capabilities for a symbol

search_instruments

Search/filter available instruments

Options

Tool

Description

get_option_expirations

List available expiration dates

get_option_chain

Full options chain for an expiration

get_option_greeks

Greeks for option contracts

Account

Tool

Description

get_accounts

List your trading accounts

get_portfolio

Portfolio snapshot with positions

get_account_history

Transaction history

Orders

Tool

Description

preflight_order

Estimate costs before placing

preflight_multileg

Estimate multi-leg strategy costs

place_order

Place single-leg order*

place_multileg_order

Place options spread*

cancel_order

Cancel pending order*

get_order

Check order status

*Requires ENABLE_TRADING=true

Example Prompts

Once connected to Claude, you can ask:

  • "What's the current price of AAPL?"

  • "Show me the options chain for SPY expiring next Friday"

  • "What are the Greeks for AAPL 250 calls expiring in February?"

  • "What's in my portfolio?"

  • "How much would it cost to buy 10 shares of NVDA?"

Safety

Trading is disabled by default. The place_order, place_multileg_order, and cancel_order tools will not execute unless ENABLE_TRADING=true is set in your environment.

When trading is disabled, you can still:

  • View real-time quotes and market data

  • Analyze options chains and Greeks

  • View your portfolio and account history

  • Run preflight calculations to estimate order costs

Project Structure

src/
├── index.ts          # Entry point (stdio transport)
├── server.ts         # MCP server configuration
├── client/
│   ├── types.ts      # TypeScript type definitions
│   ├── auth.ts       # API token management
│   └── public-api.ts # HTTP client for Public.com
├── tools/
│   ├── market-data.ts # Quote & instrument tools
│   ├── options.ts     # Options chain & Greeks
│   ├── account.ts     # Portfolio & history
│   └── orders.ts      # Order placement (guarded)
└── schemas/
    └── index.ts       # Zod validation schemas

License

MIT

Disclaimer

This software is provided as-is. Trading stocks and options involves risk. Always verify orders before enabling live trading. The authors are not responsible for any financial losses.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables trading and portfolio management through the Alpaca API, allowing users to place orders, manage positions and watchlists, access market data, and retrieve account information through natural language.
      4
      ISC
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to securely interact with Charles Schwab accounts through OAuth authentication, providing access to account balances, real-time market quotes, options chains, transaction history, order management, and comprehensive market data.
      1
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      This MCP server connects AI assistants to a Public.com brokerage account, enabling natural language trading of stocks, options, and crypto, along with portfolio management, quotes, and orders.
      46
      914 PyPI
      67
      Apache 2.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to read a Trading 212 portfolio (balances, positions, orders, history) and place trades via the public API, supporting both demo and live environments.
      MIT