Skip to content

MCP server for Massive API - Options trading data ad analysis

Notifications You must be signed in to change notification settings

luiblade/massive-mcp-server

Repository files navigation

πŸš€ Massive API MCP Server

A production-ready Model Context Protocol (MCP) server that provides real-time market data from Massive API for ChatGPT integration. Built specifically for the OPTION TRADER ChatGPT project.

πŸ“‹ Overview

This MCP server exposes 5 powerful tools for accessing live market data:

  1. get_stock_quote - Real-time stock quotes
  2. get_options_chain - Options chain data with Greeks and IV
  3. get_historical_bars - Historical OHLCV price data
  4. get_market_snapshot - Comprehensive market snapshots
  5. search_ticker - Search for ticker symbols

🎯 Features

  • βœ… Built with FastMCP framework for optimal performance
  • βœ… Async/await for concurrent requests
  • βœ… Comprehensive error handling
  • βœ… Detailed logging
  • βœ… Production-ready deployment to Render.com
  • βœ… Environment-based configuration
  • βœ… Type hints and documentation
  • βœ… ChatGPT Developer Mode compatible

πŸ“¦ Prerequisites

  • Python 3.10 or higher
  • Massive API key (from trademassive.com)
  • Render.com account (for deployment)
  • ChatGPT Plus subscription with Developer Mode access

πŸ› οΈ Installation

Local Setup

  1. Clone or navigate to the project directory:

    cd /home/ubuntu/massive-mcp-server
  2. Create a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\\Scripts\\activate
  3. Install dependencies:

    pip install -r requirements.txt
  4. Set up environment variables:

    cp .env.example .env

    Edit .env and add your Massive API key:

    MASSIVE_API_KEY=FbDpcHDdxr8qQAH0BQZToWkyxEqU9ead
    
  5. Run the server locally:

    python server.py

🌐 Deployment to Render.com

Method 1: Using Render Dashboard (Recommended)

  1. Push your code to GitHub:

    git init
    git add .
    git commit -m "Initial commit: Massive API MCP Server"
    git branch -M main
    git remote add origin https://github.com/YOUR_USERNAME/massive-mcp-server.git
    git push -u origin main
  2. Create a new Web Service on Render:

    • Go to Render Dashboard
    • Click "New +" β†’ "Web Service"
    • Connect your GitHub repository
    • Select the massive-mcp-server repository
  3. Configure the service:

    • Name: massive-mcp-server
    • Region: Oregon (US West)
    • Branch: main
    • Runtime: Python 3
    • Build Command: pip install -r requirements.txt
    • Start Command: python server.py
    • Instance Type: Free
  4. Add Environment Variables: In the "Environment" section, add:

    • Key: MASSIVE_API_KEY
    • Value: FbDpcHDdxr8qQAH0BQZToWkyxEqU9ead
  5. Deploy:

    • Click "Create Web Service"
    • Wait for deployment to complete (usually 2-3 minutes)
    • Your server URL will be: https://massive-mcp-server.onrender.com

Method 2: Using render.yaml (Blueprint)

  1. Push your code to GitHub (same as Method 1, step 1)

  2. Create from Blueprint:

    • Go to Render Dashboard
    • Click "New +" β†’ "Blueprint"
    • Connect your repository
    • Render will auto-detect render.yaml
    • Add the MASSIVE_API_KEY environment variable
    • Click "Apply"

πŸ€– Connecting to ChatGPT Developer Mode

Once deployed, connect your MCP server to ChatGPT:

Step 1: Get Your Server URL

After deployment on Render, your server URL will be:

https://massive-mcp-server.onrender.com

Step 2: Configure ChatGPT

  1. Open ChatGPT Settings:

    • Go to ChatGPT
    • Click your profile β†’ Settings
    • Navigate to Beta Features
    • Enable "Developer Mode"
  2. Add MCP Server:

    • Go to "Customize ChatGPT" β†’ "Create new GPT" or open your existing "OPTION TRADER" project
    • In the "Configure" tab, scroll to "Actions"
    • Click "Create new action"
  3. Configure MCP Connection:

    • Server URL: https://massive-mcp-server.onrender.com
    • The server will automatically expose its tools via MCP protocol

Step 3: Test the Connection

In ChatGPT, try these test queries:

Get me a quote for AAPL
Show me the options chain for SPY expiring on 2026-02-20
Get historical daily bars for TSLA from 2026-01-01 to 2026-01-27
Search for Microsoft ticker

πŸ“š Tool Documentation

1. get_stock_quote(symbol)

Get real-time stock quote.

Parameters:

  • symbol (string, required): Stock ticker symbol (e.g., 'AAPL', 'TSLA', 'SPY')

Returns:

  • Current price, bid/ask, volume, and other quote data

Example:

get_stock_quote('AAPL')
# Returns: {"symbol": "AAPL", "price": 192.50, "bid": 192.48, "ask": 192.52, ...}

2. get_options_chain(symbol, expiration)

Get options chain data.

Parameters:

  • symbol (string, required): Stock ticker symbol
  • expiration (string, optional): Expiration date in YYYY-MM-DD format

Returns:

  • Options chain with calls/puts, strikes, Greeks, IV, volume, OI

Example:

get_options_chain('SPY', '2026-02-20')
# Returns full options chain for SPY expiring Feb 20, 2026

3. get_historical_bars(symbol, timeframe, from_date, to_date, limit)

Get historical OHLCV data.

Parameters:

  • symbol (string, required): Stock ticker symbol
  • timeframe (string, optional): Bar size - '1Min', '5Min', '15Min', '1H', '1D' (default: '1D')
  • from_date (string, optional): Start date YYYY-MM-DD
  • to_date (string, optional): End date YYYY-MM-DD
  • limit (integer, optional): Max bars to return (default: 100, max: 10000)

Returns:

  • Historical OHLCV bars with timestamps

Example:

get_historical_bars('AAPL', '1D', '2026-01-01', '2026-01-27')
# Returns daily bars for January 2026

4. get_market_snapshot(symbol)

Get comprehensive market snapshot.

Parameters:

  • symbol (string, required): Stock ticker symbol

Returns:

  • Quote, daily stats, trading statistics, market status

Example:

get_market_snapshot('TSLA')
# Returns comprehensive Tesla market data

5. search_ticker(query, limit)

Search for ticker symbols.

Parameters:

  • query (string, required): Search term (company name or partial symbol)
  • limit (integer, optional): Max results (default: 10)

Returns:

  • List of matching symbols with names and exchanges

Example:

search_ticker('apple')
# Returns: [{"symbol": "AAPL", "name": "Apple Inc.", "exchange": "NASDAQ", ...}]

πŸ”§ Configuration

Environment Variables

Variable Description Required Default
MASSIVE_API_KEY Your Massive API key Yes -
PORT Server port No 8000
HOST Server host No 0.0.0.0
LOG_LEVEL Logging level No INFO

API Endpoints

The Massive API base URL is:

https://api.trademassive.com/v1

πŸ§ͺ Testing

Test Locally

# Activate virtual environment
source venv/bin/activate

# Run server
python server.py

# In another terminal, test with curl or Python
python -c "
import asyncio
from server import get_stock_quote

async def test():
    result = await get_stock_quote('AAPL')
    print(result)

asyncio.run(test())
"

Test on Render

Once deployed, your server will be accessible at:

https://massive-mcp-server.onrender.com

πŸ“Š Usage Examples in ChatGPT

Once connected, you can ask ChatGPT natural language questions:

Stock Quotes:

  • "What's the current price of Apple stock?"
  • "Get me a quote for SPY"
  • "Show me Tesla's current trading data"

Options Analysis:

  • "Show me the options chain for AAPL expiring next month"
  • "What are the call options available for SPY at 500 strike?"
  • "Analyze the put options for TSLA"

Historical Data:

  • "Get me the last 30 days of daily bars for NVDA"
  • "Show me AAPL's 5-minute bars from today"
  • "What was the trading volume for SPY last week?"

Market Snapshots:

  • "Give me a complete market snapshot for Amazon"
  • "Show me all trading data for Microsoft"

Ticker Search:

  • "Find the ticker symbol for Nvidia"
  • "Search for tech companies"

πŸ” Troubleshooting

Common Issues

1. "MASSIVE_API_KEY not configured" error

  • Ensure you've set the MASSIVE_API_KEY environment variable
  • Check that your API key is valid and active

2. Server won't start locally

  • Verify Python version (3.10+)
  • Check all dependencies are installed: pip install -r requirements.txt
  • Ensure port 8000 is not already in use

3. Render deployment fails

  • Check build logs in Render dashboard
  • Verify requirements.txt is in root directory
  • Ensure environment variable is set correctly

4. ChatGPT can't connect to server

  • Verify server is running (check Render logs)
  • Confirm server URL is correct
  • Check that server is publicly accessible

Logs

View logs in real-time on Render:

  1. Go to your service in Render Dashboard
  2. Click on "Logs" tab
  3. Monitor for any errors or issues

πŸ—οΈ Project Structure

massive-mcp-server/
β”œβ”€β”€ server.py              # Main MCP server with all tools
β”œβ”€β”€ requirements.txt       # Python dependencies
β”œβ”€β”€ render.yaml           # Render deployment configuration
β”œβ”€β”€ .env.example          # Example environment variables
β”œβ”€β”€ .gitignore           # Git ignore rules
└── README.md            # This file

πŸ” Security

  • Never commit your .env file or API keys to Git
  • Keep your API key secure and rotate it regularly
  • Use environment variables for all sensitive data
  • The .gitignore file is configured to exclude .env

πŸ“ License

This project is provided as-is for use with the OPTION TRADER ChatGPT project.

🀝 Support

For issues with:

πŸŽ‰ Quick Start Checklist

  • Python 3.10+ installed
  • Massive API key obtained
  • Dependencies installed (pip install -r requirements.txt)
  • .env file created with API key
  • Server tested locally (python server.py)
  • Code pushed to GitHub
  • Render account created
  • Service deployed on Render
  • Environment variable set on Render
  • Server URL obtained from Render
  • ChatGPT Developer Mode enabled
  • MCP server connected to ChatGPT
  • Tools tested in ChatGPT

Built with ❀️ for the OPTION TRADER ChatGPT Project

Massive API MCP Server - Bringing real-time market data to your AI trading assistant

About

MCP server for Massive API - Options trading data ad analysis

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages