Skip to main content
Glama
OptionContext

OptionContext

OptionContext MCP Server

Official Model Context Protocol (MCP) Server for the OptionContext Stock and Options Data APIs. This premium integration delivers rich analytical and structural data for Indian Stock Markets directly into LLM agents and clients supporting the Model Context Protocol.

Installation

You can install the OptionContext MCP package using pip, or run it on-demand with Node and LLM-centric workflows.

Installation via pip

pip install optioncontext_mcp

Direct Run with uvx (Python environment)

uvx optioncontext-mcp

Related MCP server: sahmk-mcp

Configuration

To use the OptionContext MCP Server, you must specify your API key and base endpoint URL. You can configure these options via environment variables:

  • OPTIONCONTEXT_API_KEY: Your Agent-as-a-Service API key.

  • OPTIONCONTEXT_BASE_URL: The OptionContext endpoint gateway URL (defaults to https://mcp.optioncontext.com if omitted).

For local or custom API gateway environments, OPTIONCONTEXT_BASE_URL will fallback automatically to FASTAPI_BASE_URL if defined.

Available Tools

The MCP Server exposes the following powerful market analytical tools to any connected client:

  1. suggest_symbols

    • Description: Search and resolve correct ticker symbols (e.g., searching 'Reliance' to get 'RELIANCE').

    • Arguments:

      • query (string): The search text or company name.

  2. get_market_context

    • Description: Fetch live quote details, last traded price (LTP), volume, and context for Stocks, Indices, and Futures.

    • Arguments:

      • symbol (string): Ticker symbol (e.g. 'NIFTY', 'BANKNIFTY', 'RELIANCE').

      • expiry (string, optional): Expiry cycle ('SPOT', 'NEAR', 'FAR', 'NEXT'). Default is 'SPOT'.

      • asset_type (string, optional): Asset category ('stock', 'index', 'future', 'auto'). Default is 'auto'.

      • api_key (string, optional): Override API Key. If omitted, uses environment key.

  3. get_option_chain

    • Description: Fetch complete option chain matrix including PCR, ATM strike, CE/PE quotes, volume, and Greeks.

    • Arguments:

      • symbol (string): Underlying index or stock ticker (e.g. 'NIFTY', 'BANKNIFTY').

      • api_key (string, optional): Override API Key. If omitted, uses environment key.

  4. get_historical_data

    • Description: Fetch historical daily/intraday OHLCV candles (Requires Plan B subscription).

    • Arguments:

      • symbol (string): Ticker symbol.

      • from_date (string): YYYY-MM-DD.

      • to_date (string): YYYY-MM-DD.

      • interval (string, optional): Candle interval ('ONE_MINUTE', 'FIVE_MINUTE', 'FIFTEEN_MINUTE', 'ONE_DAY'). Default is 'ONE_DAY'.

      • api_key (string, optional): Override API Key.


Disclaimer & Risk Warning:

  • Data Delay: All market prices, quotes, and option chains provided represent the last completed minute (minimum 1-minute delayed feed) and are not real-time tick feeds.

  • Accuracy: Data is provided on an 'as-is' basis without warranties of absolute accuracy or timeliness.

  • No Liability: The service is strictly for analytical/educational purposes. We assume no liability for any trading losses or investment decisions.

  • Regulatory Risk Disclosure: Trading in derivatives (options and futures) involves high risk. Past performance is not indicative of future results.

Available Tools

6 tools
get_agent_infoA

Fetch information about the current Agent API key, including plan type, active status, remaining credits, and symbol access limits. Args: api_key (str, optional): Override API Key. If omitted, uses environment key.

Inputs: api_key. Returns: result

get_batch_market_contextA

Fetch live quote details, last traded price (LTP), volume, and context for a batch of Stocks, Indices, or Futures. Args: symbols (list[str]): Ticker symbols (e.g. ['NIFTY', 'RELIANCE']). expiry (str): Expiry cycle ('SPOT', 'NEAR', 'FAR', 'NEXT'). Default is 'SPOT'. api_key (str, optional): API Key. If omitted, uses OPTIONCONTEXT_API_KEY from environment.

Inputs: symbols (required), expiry, api_key. Returns: result

get_historical_dataA

Fetch historical daily/intraday OHLCV candles (Requires Plan B subscription). Args: symbol (str): Ticker symbol. from_date (str): YYYY-MM-DD. to_date (str): YYYY-MM-DD. interval (str): Candle interval ('ONE_MINUTE', 'FIVE_MINUTE', 'FIFTEEN_MINUTE', 'ONE_DAY'). Default is 'ONE_DAY'. api_key (str, optional): API Key.

Inputs: symbol (required), to_date (required), from_date (required), api_key, +1 more. Returns: result

get_market_contextA

Fetch live quote details, last traded price (LTP), volume, and context for Stocks, Indices, and Futures. Args: symbol (str): Ticker symbol (e.g. 'NIFTY', 'BANKNIFTY', 'RELIANCE'). expiry (str): Expiry cycle ('SPOT', 'NEAR', 'FAR', 'NEXT'). Default is 'SPOT'. asset_type (str): Asset category ('stock', 'index', 'future', 'auto'). Default is 'auto'. api_key (str, optional): API Key. If omitted, uses OPTIONCONTEXT_API_KEY from environment.

Inputs: symbol (required), expiry, api_key, asset_type. Returns: result

get_option_chainA

Fetch complete option chain matrix including PCR, ATM strike, CE/PE quotes, volume, and Greeks. Args: symbol (str): Underlying index or stock ticker (e.g. 'NIFTY', 'BANKNIFTY'). api_key (str, optional): API Key. If omitted, uses OPTIONCONTEXT_API_KEY from environment.

Inputs: symbol (required), api_key. Returns: result

suggest_symbolsA

Search and resolve correct ticker symbols (e.g. searching 'Reliance' to get 'RELIANCE'). Args: query (str): The search text or company name.

Inputs: query (required). Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.4/5.0

    Scored across 6 tools

    Disambiguation5/5

    Each tool serves a clearly distinct purpose: market context for a single symbol, batch market context, option chain, historical data, symbol search, and API key info. The single versus batch distinction is clear, and option chain/historical data are fundamentally different data types.

    Naming Consistency4/5

    All tools use lowercase snake_case, and five of six follow a consistent 'get_' prefix pattern. The exception is 'suggest_symbols', which still uses a verb but deviates from the 'get_' convention, making it slightly inconsistent.

    Tool Count5/5

    Six tools is well within the ideal range for a market data server. Each tool covers a necessary function without unnecessary bloat, making the count appropriate for the server's stated purpose.

    Completeness5/5

    The tool surface covers the core needs of a market data context server: live quotes (single and batch), option chains, historical data, symbol resolution, and API key validation. No obvious dead ends or missing operations for the intended use case.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      An MCP server that provides comprehensive financial insights and analysis by leveraging real-time market data, news, and advanced analytics for stocks, options, financial statements, and economic indicators.
      17
      51
      Python
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Official MCP server for interacting with Saudi market data (Sahmk) via natural language queries, enabling stock quotes, company info, and market summaries inside AI agents like Cursor and Claude Desktop.
      15
      15
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Comprehensive MCP server for real-time stock, cryptocurrency, options, and fundamental analysis, including SEC filings and insider trading data.
      26
      9 npm
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Options analytics MCP server providing 40+ tools for options chain data, position valuation, Greeks, charts, and volatility analysis.
      MIT