Skip to main content

MCP server for the Public.com Trading API

Project description

Public.com MCP Server

License Python MCP

An MCP (Model Context Protocol) server that connects AI assistants to your Public.com brokerage account. Trade stocks, options, and crypto — get quotes, manage orders, and view your portfolio — all through natural language.

Disclaimer: For illustrative and informational purposes only. Not investment advice or recommendations. Use at your own risk.

Tools

Read-Only

Tool Description
check_setup Verify API credentials and connectivity
get_accounts List all brokerage accounts
get_portfolio View positions, equity, buying power, open orders
get_orders List active/open orders
get_order Get status of a specific order
get_history Transaction history (trades, deposits, dividends, etc.)
get_quotes Real-time quotes for stocks, crypto, options
get_instrument Details about a specific tradeable instrument
get_all_instruments List all available instruments with filters
get_option_expirations Available expiration dates for options
get_option_chain Full option chain (calls + puts) for a symbol
get_option_greeks Greeks (delta, gamma, theta, vega, rho, IV)
preflight_order Estimate costs/impact before placing a single-leg order
preflight_multileg_order Estimate costs for multi-leg options strategies

Write (Destructive)

Tool Description
place_order Place a single-leg order (stocks, crypto, options)
place_multileg_order Place multi-leg orders (spreads, straddles, etc.)
cancel_order Cancel an existing order
cancel_and_replace_order Atomically cancel and replace an order

Prerequisites

Installation

pip install publicdotcom-mcp-server

Or install from source:

git clone https://github.com/publicdotcom/publicdotcom-mcp-server.git
cd publicdotcom-mcp-server
pip install .

Configuration

Set your API credentials as environment variables:

# Required
export PUBLIC_COM_SECRET=your_api_secret_key

# Optional — sets a default account so you don't need to specify it each time
export PUBLIC_COM_ACCOUNT_ID=your_account_id

Usage

Claude Desktop

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

{
  "mcpServers": {
    "public-com": {
      "command": "publicdotcom-mcp-server",
      "env": {
        "PUBLIC_COM_SECRET": "your_api_secret_key",
        "PUBLIC_COM_ACCOUNT_ID": "your_account_id"
      }
    }
  }
}

Claude Desktop (using uvx)

If you prefer using uvx (no pre-install needed):

{
  "mcpServers": {
    "public-com": {
      "command": "uvx",
      "args": ["publicdotcom-mcp-server"],
      "env": {
        "PUBLIC_COM_SECRET": "your_api_secret_key",
        "PUBLIC_COM_ACCOUNT_ID": "your_account_id"
      }
    }
  }
}

Running Directly

# stdio transport (default — for Claude Desktop, Claude Code, etc.)
publicdotcom-mcp-server

# Or run as a Python module
python -m publicdotcom_mcp_server

Testing with MCP Inspector

npx @modelcontextprotocol/inspector publicdotcom-mcp-server

Development

# Clone and install in development mode
git clone https://github.com/publicdotcom/publicdotcom-mcp-server.git
cd publicdotcom-mcp-server
pip install -e ".[dev]"

# Run tests
pytest

# Run the server locally
python -m publicdotcom_mcp_server

How It Works

This server wraps the publicdotcom-py Python SDK, exposing each API operation as an MCP tool. The MCP protocol allows AI clients to discover and call these tools through a standardized interface.

AI Client (Claude, etc.)
    ↕ MCP Protocol (stdio)
Public.com MCP Server
    ↕ HTTPS
Public.com Trading API

All tools include proper MCP tool annotations:

  • Read-only tools are marked with readOnlyHint: true
  • Write tools are marked with destructiveHint: true

License

Apache 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

publicdotcom_mcp_server-0.1.0.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

publicdotcom_mcp_server-0.1.0-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file publicdotcom_mcp_server-0.1.0.tar.gz.

File metadata

  • Download URL: publicdotcom_mcp_server-0.1.0.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for publicdotcom_mcp_server-0.1.0.tar.gz
Algorithm Hash digest
SHA256 879499aac0d429372ca8d2020bfa191d159f7831bc8a294a63d5ec1d6aad60da
MD5 f926124b52a679b8fff4753c91ec55a2
BLAKE2b-256 db4dc63e879189dbc946209d88f6944f8c842d827e50f73b9eab1a926f343c3e

See more details on using hashes here.

File details

Details for the file publicdotcom_mcp_server-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for publicdotcom_mcp_server-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a79b44b5a380acb62bdc8b0e7e8413a178810a81889a06243abab994f7a795a7
MD5 2e9d3a17bf5f7bef05c045d3ed48d5bb
BLAKE2b-256 091729c8167a3fea1444891aa432ca993055b2fbf46a5f8db29a8b4f4cfb8556

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page