TradeMCP
TradeMCP is a read-only MCP server for Indian equities that provides market data, technical and fundamental analysis, stock screening, and portfolio analytics.
Search NSE/BSE stocks by ticker, company name, ISIN, or index alias.
Fetch live/delayed quotes, OHLCV price history, index snapshots, and market breadth.
Compute 57+ technical indicators, composite buy/sell signals, candlestick patterns, risk statistics, and support/resistance levels.
Retrieve fundamentals, valuation metrics, 54 ratios, DuPont analysis, 0–100 health scores, and annual/quarterly financial statements.
Compare 2–5 stocks side by side on price, valuation, quality, and momentum.
Screen NIFTY 50/100/500 or the NSE universe with fundamental and technical filters.
Analyze portfolios for valuation, P&L, allocation, concentration, per-holding signals, benchmark risk, and risk flags.
Return results as markdown or JSON via all tools.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@TradeMCP show RELIANCE live quote, RSI and 52-week range"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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/trademcpOnce 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/trademcpOr run the helper script (repository only — it is not in the npm package):
.\scripts\install.ps1 # Windows./scripts/install.sh # macOS / LinuxRelated 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.ps1That 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 | 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 ( | 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
commandpath with your own. If you installed withpip 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 |
| Search NSE listings by ticker or company name → code, name, ISIN, series |
| 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 |
| OHLCV candles (bars of 1d/1wk/1mo, or intraday 1h/30m/15m/5m, over a 1mo–max window) + period return, high/low, volume |
| 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 |
| Advancers/decliners, A/D ratio, average & median move, top gainers/losers, % above 200-DMA |
| 2–5 stocks side by side: price, valuation, ROE, margin, D/E, CAGR, health score, technical score |
Technical
Tool | What it does |
| Any of 57 indicators with recent values |
| Every indicator scored into signals + composite Strong Buy → Strong Sell, risk stats (volatility, Sharpe, Sortino, max drawdown, beta, alpha, relative strength), candlestick patterns |
| 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 |
| 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) |
| Focused valuation sheet + plain-English cheap/expensive read + optional peer comparison |
| 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 |
| 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 ( |
| 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 |
|
| HTTP timeout in seconds |
|
| Disk cache location |
|
| Quote cache seconds (5 min) |
|
| Price history cache seconds (15 min) |
|
| Fundamentals cache seconds (6 h) |
|
| NSE listing cache seconds (12 h) |
|
| Screener.in profile cache seconds (24 h) |
|
| Parallel upstream requests |
|
| Set to |
| 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 testsKnown 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.mdLicense
MIT — see LICENSE. Provided free of charge, with no warranty; it is a research tool, not investment advice.
Available Tools
14 toolstrademcp_analyze_portfolioARead-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_stocksARead-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_statementsARead-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_fundamentalsARead-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_snapshotARead-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_breadthARead-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_historyARead-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_quoteBRead-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_resistanceBRead-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_analysisARead-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_indicatorsARead-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_valuationARead-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_stocksARead-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_symbolARead-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
Scored across 14 tools
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.
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.
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.
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
Related MCP Connectors
Hosted MCP server for Indian NSE/BSE stock research: 59 tools for quotes, financials and ratios, peers, shareholding and pledge, filings with extracted facts, screens, F&O and FII/DII context. Source and freshness on every answer; no buy/sell calls.
Live stock quotes, a stock screener, crypto prices and FX rates as agent tools.
Live crypto + IDX stock market intelligence for AI agents — 19 tools, no API key.
48 tools for ~8,000 NSE & BSE stocks: quotes, screener, financials, filings, FII/DII, options
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides 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 npm13MIT
- AlicenseAqualityBmaintenanceIndian 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.55229 npm147MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to perform deep Indian stock research with fundamentals, forensic scores, DCF valuation, screening, and news for 6000+ NSE/BSE stocks.17 npm1MIT
- AlicenseAqualityCmaintenanceEnables AI assistants to query live NSE & BSE stock market data, with 55 tools covering quotes, financials, screeners, FII/DII flows, option chains, and company filings.55MIT