Get the FREE Ultimate OpenClaw Setup Guide →

fyers

MCP server for FYERS API v3 with auto Oauth

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio quantabox-fyers-mcp-server uv run --directory /path/to/fyers-mcp-server python fyers_mcp_complete.py \
  --env PYTHONWARNINGS="ignore"

How to use

This MCP server provides an automated OAuth flow and a complete trading toolkit for the Fyers API v3. It exposes a set of MCP tools that allow Claude Desktop to authenticate, fetch account information, manage a portfolio, place and manage orders, and retrieve real-time market data. Key capabilities include one-click authentication with automatic token handling, persistent token storage, and auto-refresh of sessions. The server implements functions for getting profile, funds, holdings, positions, placing/modifying/canceling orders, and fetching live quotes for multiple symbols. Claude Desktop users interact with these tools through the configured MCP endpoints, enabling seamless trading automation from the Claude environment.

Available tools cover: Authentication & Profile (authenticate, check_auth_status, get_profile), Portfolio & Funds (get_funds, get_holdings, get_positions), Orders & Trading (place_order, modify_order, cancel_order, get_orders), and Market Data (get_quotes). Usage generally involves calling these functions in Claude Desktop scripts or command blocks, with symbol formats like NSE:SYMBOL-EQ for Indian equities and appropriate order parameters for trading actions. The server handles token storage and refresh, so users can rely on continuous access once authenticated.

How to install

Prerequisites:

  • Python 3.10 or higher
  • Claude Desktop installed
  • Access to Fyers API (App ID and Secret Key)

Installation steps:

  1. Clone the repository and install dependencies git clone https://github.com/quantabox/fyers-mcp-server.git cd fyers-mcp-server

  2. Install via uv (recommended) curl -LsSf https://astral.sh/uv/install.sh | sh uv sync

  3. Or install with pip (local package) pip install .

  4. Obtain Fyers API credentials:

    • Create a Fyers API App at the Fyers dashboard and set the redirect URI to http://localhost:8080/
    • Note App ID and Secret Key
  5. Prepare environment for OAuth flow: cp .env.example .env

    Edit .env and populate FYERS_CLIENT_ID, FYERS_SECRET_KEY, FYERS_REDIRECT_URI

  6. Configure Claude Desktop to connect to the MCP server (example shown in README):

    • Add an entry under mcpServers with the uv command as shown in the mcp_config section above.
  7. Run the MCP server to start using Claude Desktop: uv run python fyers_mcp_complete.py

Additional notes

Tips and reminders:

  • Ensure your .env file contains valid FYERS_CLIENT_ID, FYERS_SECRET_KEY, and FYERS_REDIRECT_URI before authenticating.
  • The Claude Desktop config snippet shown assumes the server is installed at a known directory; adjust the --directory path accordingly.
  • If you encounter authentication issues, verify the redirect URI matches the one registered in the Fyers API dashboard and check the environment file for correct values.
  • For debugging, enable verbose logging by exporting LOG_LEVEL=DEBUG before starting the server.
  • Symbols for market data should follow the format NSE:SYMBOL-EQ for Indian equities; adjust as needed for other markets.
  • The system stores tokens in .env; protect this file as sensitive information.
  • If you change the server path, remember to update Claude Desktop configuration to reflect the new path.

Related MCP Servers

Sponsor this space

Reach thousands of developers