Skip to main content
Glama
TradeMCP

TradeMCP

by aswathas

TradeMCP — Indian Market Intelligence MCP Server

A free Model Context Protocol server for Indian equities (NSE/BSE). It gives an AI agent 14 tools covering live quotes, OHLCV history, 57 technical indicators, full fundamental ratios, financial statements, screeners and portfolio analytics.

No API keys. No paid subscriptions. No account. Every number comes from free public endpoints.

Demo → aswathas.github.io/TradeMCP — the server's own output, served from a saved snapshot.


Install

From source — works today:

git clone https://github.com/aswathas/TradeMCP.git
cd TradeMCP
python -m venv .venv
.venv\Scripts\activate          # Windows
source .venv/bin/activate       # macOS / Linux
pip install -e ".[dev]"

Then point your MCP client at the server you just installed — see Connect to your MCP client below.

Requires Python 3.11+. Two runtime dependencies: mcp and httpx — pydantic comes along as mcp's own dependency (pyproject.toml pins it explicitly). The dev extra adds pytest for the test suite.

The npm package — waiting on publish

The npm package is written and tested, but it is not on the registry yet, so this command will not resolve yet:

npx -y @aswathas/trademcp

Once it is published it becomes the one-command install: the package carries the Python server and builds its own environment on first run, so all you need is Node 18+ and Python 3.11+.

First run takes about half a minute (it builds that environment), after which the server starts in about a second. If your MCP client has a short start-up timeout, install the package once globally so the build happens at install time, then point the client at the trademcp command:

npm i -g @aswathas/trademcp
{ "mcpServers": { "trademcp": { "command": "trademcp" } } }

Claude Code, once the package is published:

claude mcp add trademcp -- npx -y @aswathas/trademcp

Or run the helper script (repository only — it is not in the npm package):

.\scripts\install.ps1            # Windows
./scripts/install.sh             # macOS / Linux

Related MCP server: Tapetide - Indian Stock Market MCP

Showcase

A demo page built from the server's own output. Every figure on it is the server's own — the live board recomputes indicators in the browser from the same raw candles the server returned. The hosted copy is static, so it serves that output from a saved snapshot and labels itself SNAPSHOT on screen; running the server locally is what makes it live.

The image URLs are absolute on purpose: the npm package ships only the server, so relative showcase/... paths would render as broken images on the npm page.

Run it locally (repository only) — the page calls /api/* on that server, which calls the MCP tools themselves:

pip install -e .
python scripts/serve_showcase.py --port 8099
# → http://127.0.0.1:8099/

To republish the demo after changing showcase/site (repository only):

.\scripts\deploy_pages.ps1

That copies showcase/site onto the gh-pages branch, which is what GitHub Pages serves. The branch is a build artefact — showcase/site stays the single source of truth.


Free data sources

Source

Used for

Why it works without a key

Yahoo Finance chart / quote / fundamentals-timeseries

prices, volumes, quotes, statements, trailing ratios

Public endpoints; the quote/summary APIs only need a free cookie+crumb handshake, done automatically

NSE India static CSV listings (nsearchives.nseindia.com)

symbol universe, company names, ISIN, industry

Static files, not behind the bot protection that guards NSE's live JSON API

Screener.in

India-specific ratios: ROCE, ROE, promoter/FII/DII holding, working-capital days

Public company pages, parsed defensively and treated as optional

All ratios are computed locally from the raw statement lines rather than copied off a screen, so the numbers are consistent and auditable.


Connect to your MCP client

Claude Desktop

%APPDATA%\Claude\claude_desktop_config.json (Windows) or ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):

{
  "mcpServers": {
    "trademcp": {
      "command": "C:\\path\\to\\TradeMCP\\.venv\\Scripts\\python.exe",
      "args": ["-m", "trademcp"]
    }
  }
}

MiniMax Code (MCode)

{
  "mcpServers": {
    "trademcp": {
      "command": "C:\\path\\to\\TradeMCP\\.venv\\Scripts\\python.exe",
      "args": ["-m", "trademcp"]
    }
  }
}

Cursor / VS Code / Windsurf

Same mcpServers block in ~/.cursor/mcp.json or .vscode/mcp.json.

Replace the command path with your own. If you installed with pip install -e . globally, "command": "trademcp" and "args": [] also works.

Via npm (once the package is published)

{
  "mcpServers": {
    "trademcp": {
      "command": "npx",
      "args": ["-y", "@aswathas/trademcp"]
    }
  }
}

The tools

All tools are read-only, accept response_format (markdown default, or json), and take an NSE symbol or a company name ("RELIANCE", "tata motors", "NSE:TCS", "RELIANCE.NS", an ISIN, or an index alias).

Market

Tool

What it does

trademcp_search_symbol

Search NSE listings by ticker or company name → code, name, ISIN, series

trademcp_get_quote

Last price, day change/range, volume, 52-week range & position, market cap, P/E, P/B, EPS, dividend yield, beta, 1w/1m/3m/6m/1y returns

trademcp_get_price_history

OHLCV candles (bars of 1d/1wk/1mo, or intraday 1h/30m/15m/5m, over a 1mo–max window) + period return, high/low, volume

trademcp_get_index_snapshot

NIFTY 50, SENSEX, 12 NIFTY sector indices (Bank, IT, Auto, FMCG, Pharma, Realty, Metal, Energy, PSU Bank, Private Bank, Financial Services, Media), INDIA VIX — 15 by default. Yahoo does not publish Nifty Private Bank, so that one comes back under unavailable

trademcp_get_market_breadth

Advancers/decliners, A/D ratio, average & median move, top gainers/losers, % above 200-DMA

trademcp_compare_stocks

2–5 stocks side by side: price, valuation, ROE, margin, D/E, CAGR, health score, technical score

Technical

Tool

What it does

trademcp_get_technical_indicators

Any of 57 indicators with recent values

trademcp_get_technical_analysis

Every indicator scored into signals + composite Strong Buy → Strong Sell, risk stats (volatility, Sharpe, Sortino, max drawdown, beta, alpha, relative strength), candlestick patterns

trademcp_get_support_resistance

5 pivot styles (classic, Camarilla, Fibonacci, Woodie, DeMark), Fibonacci retracements, swing highs/lows, Donchian channels, ATR, 52-week range position

Indicators covered (57) — trend: SMA 20/50/200, EMA 9/21/50/200, MACD (+ signal, histogram), ADX/+DI/−DI, Supertrend, Parabolic SAR, Ichimoku (Tenkan/Kijun/Senkou A/B), Aroon, Vortex, linear slope · momentum: RSI 7/14, Stochastic %K/%D, StochRSI, CCI, Williams %R, MFI, ROC, CMO, TSI, Ultimate Oscillator, Awesome Oscillator · volatility: ATR, true range, Bollinger (+%B, bandwidth), Keltner, Donchian, historical volatility, z-score · volume: OBV, VWAP, Chaikin Money Flow, Accumulation/Distribution, Price-Volume Trend, Force Index, volume ratio.

Candlestick patterns (18) — detected by trademcp_get_technical_analysis, each reported with a bullish/bearish bias: Dragonfly Doji, Gravestone Doji, Doji, Hammer, Shooting Star, Inverted Hammer, Bullish Engulfing, Bearish Engulfing, Harami, Piercing Line, Dark Cloud Cover, Three White Soldiers, Three Black Crows, Morning Star, Evening Star, Marubozu, Tweezer Top, Tweezer Bottom.

Fundamentals

Tool

What it does

trademcp_get_fundamentals

Valuation, profitability, leverage, liquidity, growth, DuPont, 0–100 health score, India-specific ratios (ROCE, ROE, promoter/FII/DII holding, debtor/inventory/payable days, cash conversion cycle)

trademcp_get_valuation

Focused valuation sheet + plain-English cheap/expensive read + optional peer comparison

trademcp_get_financial_statements

Income statement, balance sheet and cash flow, annual or quarterly

Ratios computed (54 across 6 groups): valuation — market cap, enterprise value, P/E, PEG, P/B, P/S, EV/EBITDA, EV/Sales, dividend yield, EPS, book value/share, DPS · profitability — gross/operating/EBITDA/net margin, ROE, ROA, ROCE, ROIC, asset turnover, equity multiplier, effective tax rate · leverage — debt/equity, debt/assets, cash, net debt, net debt/EBITDA, interest coverage, debt/capital · liquidity — current ratio, quick ratio, cash ratio, working capital, working capital/share, operating cash flow, free cash flow, FCF margin, CFO/net income, capex, CFPS, FCFPS · growth — revenue/net income/EPS/CFO YoY, revenue and net income 3-year and 5-year CAGR · DuPont — net margin × asset turnover × equity multiplier, reconciled ROE.

Screening & portfolio

Tool

What it does

trademcp_screen_stocks

Scan NIFTY 50/100/500 or the NSE universe (first 600 symbols in NSE listing order) on 10 fundamental filters + 4 technical filters, sorted and ranked (sort_by + sort_order)

trademcp_analyze_portfolio

Values positions, P&L, weights, sector concentration, per-holding signals, portfolio beta/vol/Sharpe/drawdown vs benchmark, and risk flags


Example questions

  • "Is Reliance a buy right now? Show me the technicals and the fundamentals."

  • "Screen the NIFTY 50 for ROE above 15% and debt/equity under 0.5, sorted by market cap."

  • "What are the support and resistance levels for SBI?"

  • "Compare Infosys and TCS on valuation, growth and momentum."

  • "How is my portfolio of 10 Reliance, 5 TCS and 20 Infosys positioned?"

  • "What is today's market breadth in the NIFTY 50?"


Configuration

Every setting has a sensible default; override with environment variables.

Variable

Default

Purpose

TRADEMCP_TIMEOUT

30

HTTP timeout in seconds

TRADEMCP_CACHE_DIR

~/.cache/trademcp

Disk cache location

TRADEMCP_QUOTE_TTL

300

Quote cache seconds (5 min)

TRADEMCP_PRICE_TTL

900

Price history cache seconds (15 min)

TRADEMCP_FUNDAMENTALS_TTL

21600

Fundamentals cache seconds (6 h)

TRADEMCP_UNIVERSE_TTL

43200

NSE listing cache seconds (12 h)

TRADEMCP_PROFILE_TTL

86400

Screener.in profile cache seconds (24 h)

TRADEMCP_MAX_CONCURRENCY

8

Parallel upstream requests

TRADEMCP_ENABLE_SCREENER_IN

1

Set to 0 to skip Screener.in entirely

TRADEMCP_USER_AGENT

browser UA

Outbound User-Agent

Caching keeps repeat screener and quote calls off the free endpoints. Delete the cache directory to force a refresh.


Verify it works

Repository only — scripts/ and tests/ are not in the npm package.

pip install -e ".[dev]"                # the dev extra is what installs pytest
python scripts/verify_all_tools.py    # calls all 14 tools against live data
python -m pytest tests -q             # 109 offline unit tests

Known limits

  • Prices are delayed — Yahoo serves NSE quotes with a delay, not tick data. This is a research tool, not an order-routing system.

  • No intraday fundamental data — statements update quarterly; the screener therefore reflects the last reported period.

  • Banks and financials have no current ratio (they have no current-asset split), so that metric is blank for them by design, not by failure.

  • ROCE definitions differ. TradeMCP computes ROCE as EBIT ÷ invested capital; Screener.in uses its own capital base, so the two figures differ slightly. Both are shown separately.

  • Screener.in is scraper-based. If its markup changes, that source degrades to "fewer fields" rather than breaking the tool. Everything else keeps working.

  • Rate limits. The free endpoints throttle. Requests are retried with backoff and cached, but a NIFTY 500 screen over cold cache takes roughly 30–60 seconds.


Project layout

src/trademcp/
  app.py            MCPServer instance
  __main__.py       entry point (python -m trademcp)
  config.py         env-driven settings
  http.py           shared client: headers, retries, actionable errors
  cache.py          TTL disk cache
  symbols.py        symbol/name/ISIN/index resolution
  formatting.py     markdown + JSON rendering
  providers/        yahoo.py, nse.py, screener.py
  analytics/        indicators.py, fundamentals.py, signals.py
  tools/            market.py, technical.py, fundamentals.py, screener.py

showcase/
  site/             the static demo page
  screenshots/      the images above
  SPEC.md DEMO.md PROMPT.md

License

MIT — see LICENSE. Provided free of charge, with no warranty; it is a research tool, not investment advice.

Available Tools

14 tools
trademcp_analyze_portfolioA
Read-onlyIdempotent

Analyse an Indian equity portfolio.

Values every holding at the latest price, computes profit and loss, weight and sector concentration, adds each stock's technical signal, then measures the portfolio against the benchmark (beta, annualised volatility, Sharpe, max drawdown) and flags concentration or signal risk.

Args: holdings: list of positions with symbol, quantity and optional cost price benchmark: benchmark index for risk metrics response_format: 'markdown' or 'json'

Returns: Markdown or JSON with 'holdings', 'allocation', 'risk', 'performance' and 'flags'.

Inputs: holdings (required), benchmark, response_format. Returns: result

trademcp_compare_stocksA
Read-onlyIdempotent

Compare two to five Indian stocks across price, valuation, quality and momentum.

Fetches the latest quote, headline fundamental ratios and the technical signal score for each symbol, then lines them up so the differences are obvious.

Args: symbols: two to five symbols or company names response_format: 'markdown' or 'json'

Returns: Markdown table or JSON list with one row per symbol.

Inputs: symbols (required), response_format. Returns: result

trademcp_get_financial_statementsA
Read-onlyIdempotent

Get income statement, balance sheet and cash flow line items for a stock.

Shows revenue, gross profit, operating income, EBITDA, net income and EPS from the income statement; total assets, debt, equity and working capital from the balance sheet; and operating cash flow, free cash flow and capex from the cash flow statement, across the requested number of periods.

Args: symbol: NSE symbol or company name period: 'annual' or 'quarterly' years: number of periods to include response_format: 'markdown' or 'json'

Returns: Markdown or JSON with 'income_statement', 'balance_sheet' and 'cash_flow'.

Inputs: symbol (required), years, period, response_format. Returns: result

trademcp_get_fundamentalsA
Read-onlyIdempotent

Get a full fundamental picture of an Indian stock.

Returns valuation (P/E, P/B, P/S, EV/EBITDA, market cap, dividend yield), profitability (gross/operating/net margin, ROE, ROA, ROCE, ROIC, asset turnover), leverage (debt/equity, net debt/EBITDA, interest coverage), liquidity (current ratio, quick ratio, free cash flow), growth (YoY and 3/5-year CAGR), a DuPont breakdown and a 0-100 health score.

Args: symbol: NSE symbol or company name include_india_metrics: pull India-specific ratios from Screener.in response_format: 'markdown' or 'json'

Returns: Markdown or JSON with 'valuation', 'profitability', 'leverage', 'liquidity', 'growth', 'dupont', 'india_specific' and 'health_score'.

Inputs: symbol (required), response_format, include_india_metrics. Returns: result

trademcp_get_index_snapshotA
Read-onlyIdempotent

Get live quotes for major Indian indices.

Covers NIFTY 50, SENSEX, the NIFTY sector indices (Bank, IT, Auto, FMCG, Pharma, Realty, Metal, Energy, PSU Bank, Private Bank, Financial Services, Media) and INDIA VIX, so the caller can see where the market stands.

Args: indices: optional list of index names to fetch response_format: 'markdown' or 'json'

Returns: Markdown table or JSON list of index quotes with price, change and percent change.

Inputs: indices, response_format. Returns: result

trademcp_get_market_breadthA
Read-onlyIdempotent

Measure market breadth for an Indian index.

Counts advancers, decliners and unchanged stocks among the index constituents, reports the average and median move, and lists the top gainers and losers. Optionally adds the percentage of constituents trading above their 200-day moving average, the classic trend-breadth gauge.

Args: index: index to analyse include_trend: compute the 200-day moving average breadth too response_format: 'markdown' or 'json'

Returns: Markdown or JSON breadth summary with gainers, losers and breadth percentages.

Inputs: index, include_trend, response_format. Returns: result

trademcp_get_price_historyA
Read-onlyIdempotent

Get historical OHLCV candles for an Indian stock.

Returns the most recent candles with date, open, high, low, close and volume, newest first, along with the period's start/end prices and total return so the caller can chart or analyse the series.

Args: symbol: NSE symbol or company name range: lookback window interval: candle size limit: maximum candles to return exchange: 'NSE' or 'BSE' response_format: 'markdown' or 'json'

Returns: Markdown table of candles, or JSON with 'candles' and 'period_summary'.

Inputs: symbol (required), limit, range, exchange, +2 more. Returns: result

trademcp_get_quoteB
Read-onlyIdempotent

Get the latest price quote and key statistics for an Indian stock.

Returns the last traded price, day change, day's range, volume, 52-week range, market capitalisation and valuation multiples (P/E, P/B, EPS, dividend yield, beta), plus 1 week / 1 month / 3 month / 1 year returns.

Args: symbol: NSE symbol or company name exchange: 'NSE' or 'BSE' response_format: 'markdown' or 'json'

Returns: Markdown or JSON quote payload. 'Error: ...' if the symbol cannot be resolved.

Inputs: symbol (required), exchange, response_format. Returns: result

trademcp_get_support_resistanceB
Read-onlyIdempotent

Compute support and resistance levels for an Indian stock.

Returns pivot points in classic, Camarilla, Fibonacci, Woodie and DeMark styles, Fibonacci retracement levels over the recent range, recent swing highs and lows, 20-day Donchian channels, ATR and the position of the price inside its 52-week range.

Args: symbol: NSE symbol or company name range: lookback window response_format: 'markdown' or 'json'

Returns: Markdown or JSON with 'pivots', 'fibonacci_retracement', 'range', 'swing_highs' and 'swing_lows'.

Inputs: symbol (required), range, response_format. Returns: result

trademcp_get_technical_analysisA
Read-onlyIdempotent

Run a full technical analysis and produce a directional read on a stock.

Scores every indicator, explains each signal in plain language, reports the composite score (Strong Buy / Buy / Neutral / Sell / Strong Sell), and adds risk statistics (annualised volatility, Sharpe, Sortino, max drawdown, beta, alpha, 30-day relative strength) plus recent candlestick patterns.

Args: symbol: NSE symbol or company name range: lookback window for the analysis benchmark: benchmark index for beta and relative strength response_format: 'markdown' or 'json'

Returns: Markdown or JSON with 'summary', 'signals', 'indicators', 'statistics' and 'candles'.

Inputs: symbol (required), range, benchmark, response_format. Returns: result

trademcp_get_technical_indicatorsA
Read-onlyIdempotent

Compute technical indicators for an Indian stock.

Covers 60+ indicators across trend (moving averages, MACD, ADX, Supertrend, Ichimoku, Parabolic SAR, Aroon, Vortex), momentum (RSI, Stochastic, CCI, Williams %R, MFI, ROC, CMO, TSI, Ultimate Oscillator), volatility (ATR, Bollinger, Keltner, Donchian, historical volatility), volume (OBV, VWAP, Chaikin Money Flow, Accumulation/Distribution, Force Index) and statistics.

Args: symbol: NSE symbol or company name indicators: names to compute; omit for the full set range: lookback window interval: candle size limit: recent points kept per indicator response_format: 'markdown' or 'json'

Returns: Markdown table (indicator, latest value, recent values) or JSON with 'indicators' and 'series'.

Inputs: symbol (required), limit, range, interval, +2 more. Returns: result

trademcp_get_valuationA
Read-onlyIdempotent

Get a focused valuation sheet for an Indian stock.

Returns market cap, enterprise value, P/E, P/B, P/S, EV/EBITDA, PEG, dividend yield, EPS and book value per share, alongside a plain-English reading of whether the stock looks cheap or expensive versus its own growth and quality metrics.

Args: symbol: NSE symbol or company name peers: include a same-industry peer comparison response_format: 'markdown' or 'json'

Returns: Markdown or JSON with 'valuation', 'growth_context', 'verdict' and optional 'peers'.

Inputs: symbol (required), peers, response_format. Returns: result

trademcp_screen_stocksA
Read-onlyIdempotent

Screen Indian stocks by fundamental and technical criteria.

Scans an index universe (or every NSE-listed stock), pulls the latest fundamentals for each name, applies the fundamental filters, then applies the technical filters to the survivors and returns the best matches.

Args: universe: 'NIFTY 50', 'NIFTY 100', 'NIFTY 500' or 'NSE' min_pe: maximum P/E max_pe: minimum P/E min_roe: minimum return on equity (%) min_roce: minimum return on capital employed (%) min_net_margin: minimum net margin (%) max_debt_to_equity: maximum debt/equity min_market_cap: minimum market cap in rupees min_dividend_yield: minimum dividend yield (%) min_current_ratio: minimum current ratio min_revenue_cagr: minimum 3-year revenue CAGR (%) rsi_below: maximum RSI (oversold screen) rsi_above: minimum RSI (overbought screen) above_sma50: require price above the 50-day average above_sma200: require price above the 200-day average limit: maximum rows to return sort_by: field to sort by sort_order: 'desc' (default) or 'asc' response_format: 'markdown' or 'json'

Returns: Markdown table or JSON with 'matches' and the filter set applied.

Inputs: limit, max_pe, min_pe, min_roe, +15 more. Returns: result

trademcp_search_symbolA
Read-onlyIdempotent

Search NSE-listed companies by ticker symbol or company name.

Use this when the user gives a company name rather than an NSE code, or when a symbol might be ambiguous. Returns the NSE code, company name, ISIN and listing details for each match, ranked with exact symbol matches first.

Args: query: ticker or company name to search for limit: maximum number of matches to return response_format: 'markdown' or 'json'

Returns: Markdown table or JSON list of matches with 'symbol', 'name', 'isin' fields.

Inputs: query (required), limit, response_format. Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 14 tools

    Disambiguation4/5

    Each tool has a reasonably distinct focus, but there is meaningful overlap: get_fundamentals already includes valuation multiples that get_valuation re-exposes, and get_technical_indicators, get_technical_analysis and get_support_resistance all derive from the same indicator/candle pipeline. Descriptions do enough to route an agent (raw indicators vs. scored signal vs. price levels), so confusion is limited but not eliminated.

    Naming Consistency5/5

    Every tool follows the same trademcp_verb_noun snake_case pattern (get_quote, get_price_history, screen_stocks, analyze_portfolio, compare_stocks). Verb usage (get/analyze/compare/screen/search) is coherent and predictable across the set.

    Tool Count5/5

    14 tools sits comfortably in the well-scoped range for a full equity-research server covering quotes, fundamentals, technicals, screening and portfolio analysis. No single tool looks like filler, and the surface is not so large that discovery becomes a burden.

    Completeness4/5

    The lifecycle from symbol lookup through quotes, history, fundamentals, valuation, screening, comparison and portfolio risk is well covered, with no obvious dead ends for analysis workflows. Gaps remain around news/events, corporate actions and dividends, and peer comparison is only available as an option inside get_valuation rather than as a first-class tool.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides real-time and historical Indian stock market data from NSE and BSE exchanges with 66 tools covering quotes, options chains, corporate actions, IPOs, and market analytics for LLM-powered financial analysis.
      42 npm
      13
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Indian stock market (NSE & BSE) MCP server with 55 tools: live quotes, financials, technicals, a 326-ratio screener, FII/DII flows, option chains with IV, parsed annual reports and concall transcripts, IPOs and portfolio tracking for ~8,200 stocks.
      55
      229 npm
      147
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to perform deep Indian stock research with fundamentals, forensic scores, DCF valuation, screening, and news for 6000+ NSE/BSE stocks.
      17 npm
      1
      MIT