stoploss.ai · mcp server

Documentation

The Stoploss.ai MCP Server gives AI assistants native access to institutional-grade Indian market intelligence — fundamental screening, technical signals, live news sentiment, and quant models — through the standard Model Context Protocol.

Tools
13
Avg Latency
<200ms
Coverage
NSE + BSE

Quickstart#

The MCP server supports direct SSE and stdio bridge. Pick your client:

Claude Desktop (Zero Local Files)

Claude Desktop communicates over local stdio. Use the modern on-the-fly runner via uvx mcp-proxy (Python) or npx mcp-remote (Node.js) with zero local files or downloads:

Add to claude_desktop_config.json:

json
{
  "mcpServers": {
    "stoploss": {
      "command": "uvx",
      "args": [
        "mcp-proxy",
        "https://api.stoploss.space/mcp/sse?api_key=sl_live_your_key_here"
      ]
    }
  }
}

Restart Claude Desktop. You will see stoploss connected with all 13 tools in the bottom-left toolbar.

Cursor / VS Code (Native SSE)

Cursor supports direct SSE connection without any local scripts or proxies:

json
// .cursor/mcp.json  (or .vscode/mcp.json)
{
  "mcpServers": {
    "stoploss": {
      "url": "https://api.stoploss.space/mcp/sse?api_key=sl_live_your_key_here"
    }
  }
}

Python SDK (Remote SSE)

python
from mcp.client.sse import sse_client
from mcp import ClientSession
import asyncio, os

async def main():
    api_key = os.environ.get("STOPLOSS_API_KEY", "sl_live_your_key_here")
    headers = {"X-API-Key": api_key}
    url = "https://api.stoploss.space/mcp/sse"

    async with sse_client(url, headers=headers) as (r, w):
        async with ClientSession(r, w) as session:
            await session.initialize()

            # Run a natural-language screen
            result = await session.call_tool(
                "screen_stocks",
                {"query": "momentum breakout with high ROE"}
            )
            print(result.content[0].text)

asyncio.run(main())

Authentication#

All requests require a key passed via the X-API-Key header or ?api_key= parameter. Keys are prefixed sl_live_ for production and sl_test_ for sandbox.

⚠ Never commit your API key to source control. Use environment variables or a secrets manager.

Tools Reference#

Every tool returns a structured JSON object. All responses include a data_as_of timestamp. On failure, the response contains {"error": "...", "status": "failed"}.

screen_stocks

Natural-language stock screener. Parses your query into structured filters and runs them against all NSE/BSE equities.

ParameterTypeDescription
querystringrequiredNatural-language screen query. E.g. 'profitable small caps with low debt and momentum'
json
// Example response
{
  "query": "profitable small caps with low debt and momentum",
  "interpreted_query": "market_cap < 5000 AND net_profit > 0 AND debt_equity < 0.5 AND rsi_14 > 55",
  "confidence": 0.91,
  "results": [
    {
      "symbol": "KPITTECH",
      "company_name": "KPIT Technologies Ltd",
      "sector": "IT",
      "pe_ratio": 42.1,
      "roe": 22.3,
      "rsi_14": 68.4,
      "technical_score": 87,
      "trend_direction": "UPTREND"
    }
  ],
  "count": 14,
  "ai_basket_summary": "Growth-oriented small-cap IT and manufacturing names with clean balance sheets...",
  "data_as_of": "2026-09-30T08:00:00Z"
}

run_predefined_screen

Runs one of 35 institutional-grade pre-built screens by name.

ParameterTypeDescription
screen_namestringrequiredName of the predefined screen (see list below)
Available screens (35 total)
vcp_breakoutmomentum_leadersvalue_compoundershigh_quality_growthnet_net_grahampiotroski_strongbeneish_cleanlow_debt_high_roe52w_high_breakoutrs_top_percentilesmart_money_accumulationwyckoff_springdividend_aristocratsearnings_accelerationsector_rotation_leadersturnaround_candidateshidden_gems_smallcapfii_buying_surge... and 17 more

batch_screen_stocks

Compare up to 20 tickers side-by-side. Returns a comparison table with rankings.

ParameterTypeDescription
tickersstring[]requiredArray of NSE symbols. Max 20.
fieldsstring[]optionalFields to return. Defaults to PE, ROE, RSI, technical_score, trend.

get_fundamental_analysis

Full forensic analysis of a single stock: Beneish M-Score, Altman Z-Score, Piotroski F-Score, DuPont decomposition, and a quality composite score.

ParameterTypeDescription
tickerstringrequiredNSE symbol. E.g. 'HDFCBANK', 'RELIANCE', 'INFY'
json
{
  "symbol": "HDFCBANK",
  "company_name": "HDFC Bank Ltd",
  "beneish_m_score": -2.84,
  "beneish_interpretation": "LOW_MANIPULATION_RISK",
  "altman_z_score": 4.21,
  "altman_zone": "SAFE",
  "piotroski_f_score": 8,
  "piotroski_strength": "STRONG",
  "dupont": {
    "net_profit_margin": 0.183,
    "asset_turnover": 0.09,
    "equity_multiplier": 9.8,
    "roe": 0.161
  },
  "quality_score": "A+",
  "moat_rating": "WIDE",
  "recommendation": "BUY",
  "confidence": "92%",
  "data_as_of": "2026-09-30T08:00:00Z"
}

get_technical_analysis

Technical signal suite. Use lite mode for fast pre-computed signals (~50ms), or full mode for deep analysis including VCP detection, Smart Money divergence, and multi-timeframe EMA alignment.

ParameterTypeDescription
tickerstringrequiredNSE symbol
mode"lite" | "full"optionalDefault: "full". Use "lite" for speed in screener workflows.
start_datestringoptionalISO date. E.g. '2025-01-01'. Defaults to 1 year.
end_datestringoptionalISO date. Defaults to today.

get_advanced_analysis

Institutional-grade quant modules: Smart Money Flow, DCF valuation, Wyckoff phase detection, and optimal position sizing.

ParameterTypeDescription
tickerstringrequiredNSE symbol
analysis_typesstring[]optionalSubset of: ["smart_money","dcf","wyckoff","position_sizing"]. Defaults to all.

get_news_sentiment

Fetches recent news and scores sentiment using NLP. Returns per-article impact scores and aggregated themes. Always live — not cached.

ParameterTypeDescription
tickerstringrequiredNSE symbol
company_namestringoptionalOptional override for news search query

get_optimal_strategy [PRO]

Autonomously discovers the best trading strategy for any NSE stock. Uses Bayesian Optimization (Optuna) distributed across CPU cores with Ray to evaluate 6 canonical strategy archetypes (Trend Follow, Mean Reversion, Momentum, Volatility, Breakout, Combined) filtered through Hidden Markov Model (HMM) regime detection.

ParameterTypeDescription
tickerstringrequiredNSE ticker (e.g. 'RELIANCE.NS', 'TCS.NS')

run_custom_backtest [PRO]

Backtests a user-described trading strategy on a specific NSE stock. Parses natural language descriptions (e.g. “Buy when RSI drops below 30, sell when it crosses 70, use 2x ATR stop loss”) into strict Pydantic schemas, runs VectorBT simulations with realistic position sizing and slippage, and generates an institutional-grade tearsheet.

ParameterTypeDescription
tickerstringrequiredNSE ticker (e.g. 'INFY.NS')
strategy_descriptionstringrequiredPlain English strategy rules and exit conditions

get_recommendation

AI-generated BUY / HOLD / SELL verdict synthesising fundamental, technical, and sentiment signals. Pass pre-fetched data to skip re-fetching and reduce latency.

ParameterTypeDescription
tickerstringrequiredNSE symbol
fundamental_dataobjectoptionalPass output of get_fundamental_analysis to avoid re-fetching
technical_dataobjectoptionalPass output of get_technical_analysis to avoid re-fetching

get_peer_comparison

Benchmarks a stock against its sector peers and returns relative percentile ranks.

ParameterTypeDescription
tickerstringrequiredNSE symbol

get_stock_ratios

Returns the full ratio snapshot for a ticker: valuation, profitability, leverage, efficiency, and growth.

ParameterTypeDescription
tickerstringrequiredNSE symbol

list_available_stocks

Returns all NSE/BSE symbols in the database with sector and industry metadata. Use to validate tickers before calling analysis tools.

json
// No parameters required
{
  "count": 2847,
  "coverage": "NSE + BSE",
  "stocks": [
    { "symbol": "HDFCBANK", "company_name": "HDFC Bank Ltd", "sector": "Financials", "industry": "Private Banks" },
    { "symbol": "RELIANCE", "company_name": "Reliance Industries Ltd", "sector": "Energy", "industry": "Oil & Gas" }
  ],
  "data_as_of": "2026-09-30T08:00:00Z"
}

Rate Limits#

TierTool Calls / minTool Calls / monthNotes
Free105,000API key required
Developer60200,000Pay-as-you-go after limit
Enterprise300UnlimitedDedicated infra, SLA-backed

Error Reference#

Error CodeHTTP StatusMeaning
UNAUTHORIZED401Missing or invalid STOPLOSS_API_KEY
TICKER_NOT_FOUND404Symbol not in the database. Call list_available_stocks to validate.
RATE_LIMIT429Too many requests. Back off and retry with exponential jitter.
ANALYSIS_FAILED500Upstream computation error. The response will include a descriptive error string.
TOOL_UNAVAILABLE503Temporary maintenance. Check status.stoploss.ai.

Changelog#

v2.0.0latestSep 2026
  • New: TimesFM 2.0 momentum scoring integrated into get_technical_analysis
  • New: Wyckoff phase detection in get_advanced_analysis
  • New: 35 predefined screens via run_predefined_screen
  • Improved: screen_stocks confidence scoring (+12% accuracy)
  • SSE transport now stable for long-running sessions
v1.3.0Jul 2026
  • Added batch_screen_stocks — compare up to 20 tickers
  • Added get_peer_comparison with sector percentile ranks
  • Reduced P95 latency from 350ms → 183ms
v1.0.0May 2026
  • Initial release: 8 tools, NSE coverage, stdio transport