trading-mcp-server
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, risk management, a paper-trading engine, backtesting, and a heavily guarded broker layer (Angel One SmartAPI, NSE).
Safety model (non-negotiable):
Paper trading is the default. Real orders require
TRADING_MODE=liveandALLOW_LIVE_TRADING=true(the latter can only be set by a human editing.env— no tool can change it).Every order passes a full validation checklist (stop-loss required, risk:reward minimum, position-size / daily-loss / open-position limits, market-hours check).
Live orders use a prepare → human approval → execute token flow.
Delivery (CNC) sell orders are always blocked — the server only records a recommendation.
Every decision is appended to an audit log (
storage/trade_logs.jsonl).
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 (trading mode, permissions, risk limits, broker credentials) and writes <home>/storage/ (paper-trading state, pending orders, 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 |
|
Strategy |
|
Paper trading |
|
Broker (guarded) |
|
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
See .env.example in the consuming repo. Key flags: TRADING_MODE (paper|live), ALLOW_LIVE_TRADING, REQUIRE_MANUAL_APPROVAL_FOR_LIVE_ORDERS, ALLOW_INTRADAY_BUY/SELL, ALLOW_DELIVERY_BUY, ALLOW_DELIVERY_SELL (keep false), MAX_RISK_PER_TRADE_PERCENT, MAX_DAILY_LOSS_PERCENT, MAX_OPEN_POSITIONS, MAX_POSITION_SIZE_PERCENT, MIN_RISK_REWARD_RATIO, PAPER_STARTING_CAPITAL, BROKER_* credentials.
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.
Latest Blog Posts
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