MCP Protocol

The Model Context Protocol (MCP) enables AI assistants like Claude to interact with Paper's API using natural language. Trade, manage portfolios, and analyze market data through conversational interfaces.

Getting Started

Prerequisites

Before setting up MCP integration, you'll need:

  1. Paper Trading Account - Sign up at app.paperinvest.io
  2. API Key - Generate from your account settings

Installation

For Claude Desktop

  1. Install Claude Desktop from claude.ai

  2. Configure MCP in your Claude settings:

Claude Desktop Configuration

JSON
claude_desktop_config.json
{
  "mcpServers": {
    "paper-invest": {
      "command": "npx",
      "args": ["@paperinvest/mcp-server"],
      "env": {
        "PAPER_INVEST_API_KEY": "your-api-key-here"
      }
    }
  }
}

  1. Restart Claude Desktop to load the MCP server

For Other AI Assistants

Paper's MCP server can be integrated with any AI assistant that supports the Model Context Protocol. Contact your AI provider for specific integration instructions.

Available Tools

The MCP server provides comprehensive tools for account management, trading, portfolio operations, and market data access.

Account Management Tools

ToolDescriptionExample
get_account
Get account details by IDShow me account details for account-123
update_account
Update account nameRename my account to "Long Term Holdings"
freeze_account
Freeze a trading accountFreeze my trading account

Portfolio Management Tools

ToolDescriptionExample
create_portfolio
Create a new portfolio within an accountCreate an IRA portfolio in my account
get_portfolio
Get portfolio detailsShow me my main portfolio
get_account_portfolios
List all portfolios for an accountShow all my portfolios
reset_portfolio
Reset portfolio to initial stateReset my test portfolio

Trading Tools

ToolDescriptionExample
create_order
Place a new order (supports all order types)Buy 100 shares of AAPL at market price
create_batch_orders
Create multiple orders at onceBuy AAPL, MSFT, and GOOGL in one batch
get_order
Get specific order detailsShow me order 123e4567-e89b-12d3
cancel_order
Cancel an existing orderCancel order 123e4567-e89b-12d3
get_account_orders
List orders for an accountShow me all my pending orders
cancel_all_account_orders
Cancel all orders for an accountCancel all my open orders
get_today_filled_orders
Get all orders filled todayShow me all trades executed today

Supported Order Types

The create_order tool supports all order types:

  • MARKET - Execute immediately at best available price
  • LIMIT - Execute at specified price or better
  • STOP - Convert to market order when stop price is reached
  • STOP_LIMIT - Convert to limit order when stop price is reached
  • TRAILING_STOP - Stop price follows favorable price movements
  • TRAILING_STOP_LIMIT - Trailing stop that converts to limit order
  • DEBIT - Multi-leg option strategy with net debit
  • CREDIT - Multi-leg option strategy with net credit
  • EVEN - Multi-leg option strategy with no net debit/credit
  • BRACKET - Parent order with automatic take-profit and stop-loss

Position Tools

ToolDescriptionExample
get_portfolio_equities
Get all equity positions in a portfolioShow me all stocks in my portfolio
get_portfolio_options
Get all option positions in a portfolioShow me my option positions

Market Data Tools

ToolDescriptionExample
get_quote
Get real-time price quote for a symbolWhat is the current price of MSFT?
get_batch_quotes
Get quotes for multiple symbols at onceShow me prices for AAPL, MSFT, and GOOGL
get_market_hours
Get market hours for an exchangeWhat are the market hours today?
is_market_open
Check if market is open for a symbolIs the market open for trading AAPL?

Activity & Reporting Tools

ToolDescriptionExample
get_portfolio_activities
Get activity log for a portfolioShow me all activities in my portfolio today
get_day_trades
Get day trade activity for a portfolioShow me my day trades this week

Margin Trading Tools

ToolDescriptionExample
upgrade_to_margin
Upgrade portfolio to margin accountUpgrade my portfolio to margin trading

Example Conversations

Basic Trading

Example: Market Order

Conversation
User: Buy 50 shares of Apple


Claude: I'll help you buy 50 shares of Apple (AAPL). Let me first check the current price.


[Checking current price of AAPL...]
Current price: $175.25


I'll place a market order for 50 shares of AAPL.


[Placing order...]
✓ Order placed successfully!
- Order ID: 123e4567-e89b-12d3-a456-426614174000
- Symbol: AAPL
- Quantity: 50 shares
- Order Type: Market
- Estimated Cost: $8,762.50 (plus fees)

Portfolio Analysis

Example: Portfolio Review

Conversation
User: Show me how my portfolio is performing today


Claude: I'll analyze your portfolio performance for today.


[Retrieving portfolio data...]


Your Portfolio Performance Today:
- Total Value: $125,430.50
- Today's Change: +$1,245.75 (+1.00%)


Holdings:
1. AAPL: 100 shares @ $175.25 (+2.1% today)
2. MSFT: 50 shares @ $425.50 (-0.5% today)
3. GOOGL: 25 shares @ $145.75 (+1.8% today)


Cash Balance: $45,230.25
Buying Power: $90,460.50

Advanced Orders

Example: Limit Order

Conversation
User: Set a limit order to buy Tesla if it drops to $240


Claude: I'll create a limit order to buy Tesla (TSLA) at $240 or better.


[Checking current TSLA price...]
Current price: $245.50


[Creating limit order...]
✓ Limit order created!
- Order ID: 456e7890-e89b-12d3-a456-426614174111
- Symbol: TSLA
- Type: Limit Buy
- Limit Price: $240.00
- Time in Force: Day


Your order will execute if TSLA reaches $240 or lower today.

Security

API Key Management

  • Never share your API key in conversations or screenshots
  • Use environment variables to store sensitive credentials
  • Rotate keys regularly from your account settings
  • Set key permissions to limit access to specific operations

Best Practices

  1. Start with small trades to familiarize yourself with the system
  2. Verify order details before confirming large trades
  3. Monitor your positions regularly
  4. Use limit orders for better price control
  5. Review activity logs to track all operations

Configuration Options

Environment Variables

VariableDescriptionRequired
PAPER_INVEST_API_KEY
Your Paper Trading API keyYes
PAPER_BASE_URL
API base URL (default: https://api.paperinvest.io)No

Limitations

  • Paper trading only - All trades are simulated, not real
  • Market hours - Some operations may be limited outside trading hours
  • Rate limits - Subject to API rate limiting (see Rate Limiting)
  • Supported securities - Currently supports US equities only

Troubleshooting

Common Issues

IssueSolution
MCP server not connectingCheck API key and restart Claude Desktop
Orders failingVerify portfolio has sufficient buying power
Market data unavailableCheck if market is open and symbol is valid
Authentication errorsRegenerate API key and update configuration

See Also