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.
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:
{
"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:
// .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)
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.
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.
| Parameter | Type | Description | |
|---|---|---|---|
| query | string | required | Natural-language screen query. E.g. 'profitable small caps with low debt and momentum' |
// 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.
| Parameter | Type | Description | |
|---|---|---|---|
| screen_name | string | required | Name of the predefined screen (see list below) |
batch_screen_stocks
Compare up to 20 tickers side-by-side. Returns a comparison table with rankings.
| Parameter | Type | Description | |
|---|---|---|---|
| tickers | string[] | required | Array of NSE symbols. Max 20. |
| fields | string[] | optional | Fields 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.
| Parameter | Type | Description | |
|---|---|---|---|
| ticker | string | required | NSE symbol. E.g. 'HDFCBANK', 'RELIANCE', 'INFY' |
{
"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.
| Parameter | Type | Description | |
|---|---|---|---|
| ticker | string | required | NSE symbol |
| mode | "lite" | "full" | optional | Default: "full". Use "lite" for speed in screener workflows. |
| start_date | string | optional | ISO date. E.g. '2025-01-01'. Defaults to 1 year. |
| end_date | string | optional | ISO date. Defaults to today. |
get_advanced_analysis
Institutional-grade quant modules: Smart Money Flow, DCF valuation, Wyckoff phase detection, and optimal position sizing.
| Parameter | Type | Description | |
|---|---|---|---|
| ticker | string | required | NSE symbol |
| analysis_types | string[] | optional | Subset 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.
| Parameter | Type | Description | |
|---|---|---|---|
| ticker | string | required | NSE symbol |
| company_name | string | optional | Optional 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.
| Parameter | Type | Description | |
|---|---|---|---|
| ticker | string | required | NSE 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.
| Parameter | Type | Description | |
|---|---|---|---|
| ticker | string | required | NSE ticker (e.g. 'INFY.NS') |
| strategy_description | string | required | Plain 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.
| Parameter | Type | Description | |
|---|---|---|---|
| ticker | string | required | NSE symbol |
| fundamental_data | object | optional | Pass output of get_fundamental_analysis to avoid re-fetching |
| technical_data | object | optional | Pass output of get_technical_analysis to avoid re-fetching |
get_peer_comparison
Benchmarks a stock against its sector peers and returns relative percentile ranks.
| Parameter | Type | Description | |
|---|---|---|---|
| ticker | string | required | NSE symbol |
get_stock_ratios
Returns the full ratio snapshot for a ticker: valuation, profitability, leverage, efficiency, and growth.
| Parameter | Type | Description | |
|---|---|---|---|
| ticker | string | required | NSE 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.
// 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#
| Tier | Tool Calls / min | Tool Calls / month | Notes |
|---|---|---|---|
| Free | 10 | 5,000 | API key required |
| Developer | 60 | 200,000 | Pay-as-you-go after limit |
| Enterprise | 300 | Unlimited | Dedicated infra, SLA-backed |
Error Reference#
| Error Code | HTTP Status | Meaning |
|---|---|---|
| UNAUTHORIZED | 401 | Missing or invalid STOPLOSS_API_KEY |
| TICKER_NOT_FOUND | 404 | Symbol not in the database. Call list_available_stocks to validate. |
| RATE_LIMIT | 429 | Too many requests. Back off and retry with exponential jitter. |
| ANALYSIS_FAILED | 500 | Upstream computation error. The response will include a descriptive error string. |
| TOOL_UNAVAILABLE | 503 | Temporary maintenance. Check status.stoploss.ai. |
Changelog#
- 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
- Added batch_screen_stocks — compare up to 20 tickers
- Added get_peer_comparison with sector percentile ranks
- Reduced P95 latency from 350ms → 183ms
- Initial release: 8 tools, NSE coverage, stdio transport