trading-mcp-server
The trading-mcp-server provides AI agents with comprehensive tools for market analysis, strategy development, paper trading, and guarded live order execution (focused on Indian markets via NSE/Angel One SmartAPI).
Configuration & Mode Management
Get/update trading config, check effective trading mode (notify/paper/live), switch between paper and live modes, validate trading permissions.
Live trading requires an explicit
ALLOW_LIVE_TRADINGsafeguard set by a human in.env.
Market Data
Fetch live prices, historical OHLCV candles (multiple timeframes), market status, symbol metadata (token, lot size, tick size), and curated watchlist symbols.
Technical Indicators
Calculate SMA, EMA, RSI, MACD, Bollinger Bands, ATR, and volume analysis; detect support/resistance levels and trend direction; get all standard indicators in one snapshot call.
News & Sentiment
Fetch symbol-specific news with per-item sentiment, browse Indian market news by category/sentiment, get overall market mood, sector-by-sector sentiment, free-text news search (NewsAPI), and aggregate sentiment analysis.
Portfolio & Order History
Fetch portfolio and order history (paper or live), calculate per-position exposure vs. limits, and unrealized P&L.
Risk Calculators
Position sizing (risk % + stop-loss), ATR-based stop-loss suggestions, target price for desired R:R ratio, max daily loss check, portfolio concentration check, and full pre-trade validation.
Strategy Evaluation & Backtesting
Evaluate intraday (multi-timeframe) and swing trade setups, compare indicator snapshots for up to 10 symbols side-by-side, scan watchlist for intraday/swing opportunities ranked by confidence, and backtest built-in strategies (MA crossover, RSI reversal, MACD trend, breakout volume).
Paper Trading Engine
Place/close simulated orders, fetch paper trades and portfolio, calculate performance metrics (win rate, P&L, drawdown), generate full reports, and reset the account to starting capital.
Guarded Live Order Execution
Stage/validate orders (returns approval token) without executing, re-run validation separately, execute prepared intraday or delivery BUY orders after human approval token, block delivery SELL orders (recorded as recommendations only, never sent to broker), and list/cancel pending live orders.
Broker Read-Only Access
Fetch broker funds/margins, today's positions, delivery holdings, and order status by ID.
Notifications
Send free-text messages via Telegram or Discord, and send formatted 'ACTION REQUIRED' trade recommendation alerts.
Safety & Audit: All orders are logged; live trading requires explicit human approval via both an .env switch and a per-order token; delivery sell orders are never automatically executed.
Click on "Install 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., "@trading-mcp-serverevaluate intraday trade setup for RELIANCE"
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.
trading-mcp-server
A local MCP (Model Context Protocol) server that exposes safe trading tools for AI agents such as Claude Code and Copilot CLI. The agent does the reasoning; this server provides market data, technical indicators, news, sizing helpers, a paper-trading engine, backtesting, and a guarded broker layer (Angel One SmartAPI, NSE).
Execution model — one switch, three modes (EXECUTION_MODE):
notify—place_orderreturns a manual-placement recommendation (and a Telegram alert if configured). Nothing is executed.paper—place_orderfills in a simulated paper account. (default)live—place_orderplaces a real order — but only whenALLOW_LIVE_TRADING=true(a human-only switch in.env; no tool can change it). With it off, live orders degrade to notify.
Safety guarantees:
The broker is reached only when
EXECUTION_MODE=liveandALLOW_LIVE_TRADING=true.Delivery (CNC) sell is never sent to the broker in any mode — it always degrades to a notify recommendation so the user can verify holdings and sell manually.
Every order decision is appended to an audit log (
storage/trade_logs.jsonl).
Where trading policy lives: risk limits, intraday/swing selection, and position sizing are not in the server — they live in a client-side trading_config.yaml that your agent reads and enforces. The server only validates that orders are structurally well-formed. See docs/CLIENT_INTEGRATION.md.
Nothing produced by this server is financial advice.
Installation
# local development (editable, from a sibling checkout)
pip install -e ../trading-mcp-server
# with broker + scanner extras (needed for live data / Chartink watchlist)
pip install -e "../trading-mcp-server[broker,scanners]"
# future, once published to PyPI
pip install trading-mcp-serverRequires Python 3.10+.
Related MCP server: GearTrade MCP Server
Running the server
The server speaks MCP over stdio:
trading-mcp-server
# or
python -m trading_mcp_server.serverIt resolves its configuration and state from a home directory:
TRADING_MCP_HOMEenvironment variable, if setotherwise the current working directory
There it reads <home>/.env (execution mode, the live master switch, broker credentials) and writes <home>/storage/ (paper-trading state, audit log). This keeps the package independent of any repo path — point TRADING_MCP_HOME at your trading project.
Register in a client (e.g. .mcp.json for Claude Code):
{
"mcpServers": {
"trading-agent": {
"command": "trading-mcp-server",
"env": { "TRADING_MCP_HOME": "C:\\path\\to\\your\\trading-repo" }
}
}
}What it exposes
Tools (by category)
Category | Tools |
Config |
|
Market data |
|
Indicators |
|
News |
|
Portfolio |
|
Risk (calculators) |
|
Strategy |
|
Paper trading |
|
Order execution |
|
Broker (read) |
|
Notifications |
|
To open a position use
place_order(it routes to the paper engine in paper mode, the broker in live mode, or a recommendation in notify mode). Risk policy is enforced by your agent viatrading_config.yaml— see docs/CLIENT_INTEGRATION.md.
Resources
trading://config— current configuration (secrets redacted)trading://safety-rules— the safety rules the server enforces
Prompts
intraday_trade_analysis(symbol)— disciplined intraday workflowswing_trade_analysis(symbol)— swing/delivery workflowpaper_trading_review()— profitability review workflow
Backtest strategies built in: ma_crossover, rsi_reversal, macd_trend, breakout_volume.
Package structure
src/trading_mcp_server/
├── server.py # FastMCP entry point (create_server, main)
├── config.py # .env-backed TradingConfig — single source of truth
├── tools/ # MCP tool modules (one per category, register(mcp))
├── resources/ # MCP resources
├── prompts/ # MCP prompts
├── services/ # data provider, indicators, risk, validation, paper engine, broker safety layer
├── broker/ # SmartAPI adapter — the ONLY module talking to the real broker
├── backtest/ # engine + built-in strategies
└── utils/ # logging/audit, market hours, instrument lookup
tests/ # pytest suite (config, safety, paper engine, indicators, backtest)Development
pip install -e ".[dev]"
python -m pytest tests -q # run tests (no network, no broker needed)
python -m trading_mcp_server.server # run server from sourceConfiguration reference
The server reads only a few execution switches from <home>/.env (template:
examples/.env.example):
Key | Values | Notes |
|
| the one switch; default |
|
| human-only; live orders place only when |
|
| Telegram alert on paper fills |
| number | paper engine capital |
| secrets | Angel One credentials (live + live data) |
| secret | optional news search |
| secrets | Telegram notifications |
| secrets | Discord notifications |
Trading policy (risk limits, intraday/swing, sizing) is not here — it lives
in a client-side trading_config.yaml read by your agent. Template:
examples/trading_config.example.yaml.
Full guide: docs/CLIENT_INTEGRATION.md.
Publishing to PyPI (future)
Bump
versioninpyproject.tomlandsrc/trading_mcp_server/__init__.py.python -m build(requirespip install build).python -m twine upload dist/*(requires a PyPI account + API token).Consumers then switch from
pip install -e ../trading-mcp-servertopip install trading-mcp-server— no other change needed.
License
MIT
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Appeared in Searches
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/mukul8896/trading-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server