Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2
TurtleStack Trading MCP Server is a comprehensive Model Context Protocol (MCP) server that provides unified access to multiple Indian stock brokers through Claude AI. It enables seamless trading operations, portfolio management, and advanced technical analysis across Kite (Zerodha), Groww, Dhan, and AngelOne brokers.
License
turtlehq-tech/turtlestack-lite
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
🏆 Most Advanced Multi-Broker Trading MCP Server for Claude AI - Unified API for Kite (Zerodha), Groww, and Dhan with 40+ Technical Indicators, Real-time Trading, Portfolio Management, and Cloudflare Workers Support.
🎯Multi-Broker Support: Seamlessly trade across Kite (Zerodha), Groww, and Dhan
📊Advanced Technical Analysis: 40+ indicators including RSI, MACD, Bollinger Bands, VWAP, ATR
🔄Real-time Trading: Live order placement, modification, and cancellation
💼Portfolio Management: Unified portfolio tracking across all brokers
☁️Cloudflare Workers: Deploy globally with edge computing
🤖Claude AI Integration: Natural language trading commands
🔒Enterprise Security: No stored credentials, session-based authentication
⚡High Performance: Optimized for speed and reliability
🏗️Modular Architecture: Easy to extend and customize
git clone https://github.com/turtlehq-tech/turtlestack-lite.gitcd turtlestack-litenpm installnpm startAdd this configuration to your Claude Desktop settings (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{"mcpServers": {"turtlestack-lite": {"command":"node","args": ["/path/to/turtlestack-lite/src/index.js"] } }}Replace/path/to/turtlestack-lite/ with your actual installation path:
# Example paths:# macOS: "/Users/yourusername/Projects/turtlestack-lite/src/index.js"# Linux: "/home/yourusername/turtlestack-lite/src/index.js"# Windows: "C:\\Users\\yourusername\\turtlestack-lite\\src\\index.js"
🔒 Security Note: No API keys or secrets are stored in the configuration. All credentials must be provided through Claude commands for maximum security.
Important: This repository contains dummy placeholder values for all sensitive IDs and tokens. Before using the project, you must replace these placeholders with your actual credentials.
The following files contain placeholder values that need to be replaced with your actual credentials:
tests/debugAuthentication.js:16,17- ReplaceYOUR_CLIENT_ID_HEREandYOUR_PROGRESS_TOKEN_HEREtests/testClaudeConnection.js:21,22- ReplaceYOUR_CLAUDE_SESSION_TOKEN_HEREandYOUR_CLAUDE_CLIENT_ID_HEREtests/testGrowwOrderFix.js:13- ReplaceYOUR_GROWW_API_KEY_HEREtests/testGrowwOrderReference.js:11- ReplaceYOUR_GROWW_API_KEY_HEREtests/debugAuthentication.js:44- ReplaceYOUR_GROWW_JWT_TOKEN_HEREtests/testClaudeConnection.js:40,52- ReplaceYOUR_GROWW_JWT_TOKEN_HERE
bridge.js:4- ReplaceYOUR_WORKER_SUBDOMAIN.YOUR_USERNAME.workers.devcloudflare/wrangler.toml:17- ReplaceYOUR_KV_NAMESPACE_ID_HEREcloudflare/mcp-config-for-claude.json:5- Replace worker URL in the embedded command
- Go toKite Connect Developer Console
- Create an app to get
api_keyandapi_secret - Generate access token using the authentication flow
- Use browser developer tools to inspect network requests on Groww web app
- Extract JWT token from Authorization header
- Token format:
eyJraWQiOiJ...(long JWT string)
- Go toDhan API Portal
- Get your
access_tokenandclient_id
- Create KV namespace:
wrangler kv:namespace create "SESSIONS_KV" - Note the namespace ID from the output
- Update your worker subdomain based on your Cloudflare account
- Never commit real credentials to version control
- Use environment variables for production deployments
- Rotate tokens regularly for security
- Test with dummy data first before using real credentials
Replace these specific placeholders to get started quickly:
# 1. Update test files with your tokenssed -i's/YOUR_GROWW_JWT_TOKEN_HERE/your_actual_groww_token/g' tests/testClaudeConnection.jssed -i's/YOUR_GROWW_API_KEY_HERE/your_actual_api_key/g' tests/testGroww*.js# 2. Update Cloudflare config (if using workers)sed -i's/YOUR_WORKER_SUBDOMAIN.YOUR_USERNAME.workers.dev/your-worker.your-account.workers.dev/g' bridge.jssed -i's/YOUR_KV_NAMESPACE_ID_HERE/your_actual_kv_id/g' cloudflare/wrangler.toml
npm install
# Run all testsnpmtest# Run unit tests onlynpm run test:unit# Run integration tests onlynpm run test:integration# Run tests with watch modenpm run test:watch# Demo technical indicatorsnode tests/demo.js
src/├── brokers/│ ├── BaseBroker.js # Base interface for all brokers│ ├── KiteBroker.js # Kite (Zerodha) implementation│ ├── GrowwBroker.js # Groww implementation│ ├── DhanBroker.js # Dhan implementation│ └── index.js # Broker exports and factory├── server/│ └── UnifiedTradingServer.js # Main MCP server (v2.0.0)├── utils/│ ├── logger.js # Logging utility│ ├── formatters.js # Data formatting utilities│ ├── technicalIndicators.js # Backward compatibility wrapper│ └── technicalIndicators/ # Modular technical analysis│ ├── index.js # Main aggregation file│ ├── trendIndicators.js # SMA, EMA, VWAP, ADX, Parabolic SAR│ ├── momentumIndicators.js # RSI, MACD, Stochastic, Williams %R, CCI, MFI│ ├── volatilityIndicators.js # Bollinger Bands, ATR│ ├── volumeIndicators.js # OBV│ └── supportResistanceIndicators.js # Fibonacci, Support/Resistance└── index.js # Entry pointtests/├── unit/│ └── technicalIndicators.test.js # Technical indicators unit tests├── integration/│ ├── brokers.test.js # Broker integration tests│ └── unifiedTradingServer.test.js # Server integration tests├── fixtures/│ └── mockData.js # Test data fixtures└── demo.js # Technical indicators demonpm start# or for developmentnpm run dev- ✅ Kite (Zerodha) - Fully implemented with advanced features
- ✅ Groww - Fully implemented with advanced features
- ✅ Dhan - Fully implemented with advanced features
- 🏗️ Modular Design: Each broker in separate file
- 🔌 Pluggable: Easy to add new brokers
- 🧪 Testable: Individual components can be tested
- 📝 Maintainable: Clean separation of concerns
- 🔄 Scalable: Supports unlimited brokers
# List all available brokersList brokers# Set active brokerSet active broker to kite# Authenticate Kite with access tokenAuthenticate kite with api_key: your_api_key and access_token: your_access_token# Authenticate Kite with request tokenAuthenticate kite with api_key: your_api_key, api_secret: your_api_secret, and request_token: your_request_token# Authenticate GrowwAuthenticate groww with access_token: your_groww_access_token# Authenticate DhanAuthenticate dhan with access_token: your_dhan_access_token and client_id: your_dhan_client_id# Get portfolio from active brokerShow my portfolio# Get portfolio from specific brokerShow my groww portfolio# Compare portfolios across brokersCompare my portfolios across all brokers# Place order using active brokerCreate buy order for RELIANCE 10 shares at market price# Get marginsShow my account margins# Get consolidated portfolio across all brokersShow me my consolidated portfolio across all brokers# Kite Advanced FeaturesGet my Kite mutual fund holdingsPlace GTT order for RELIANCEGet historical data for INFY# Groww Advanced Features Get technical indicators RSI for RELIANCESearch for instruments containing "TATA"Get historical candle data for HDFC# Dhan Advanced FeaturesGet option chain for NIFTYPlace bracket order with stop loss and targetGet live market feed for instruments# Logout from specific brokerLogout from kite# Logout from all brokersLogout from all brokers# Technical Analysis OperationsGet RSI for RELIANCEGet MACD for INFY Get Bollinger Bands for HDFCGet VWAP for TATA STEELGet ATR for NIFTY# Cross-broker technical comparisonCompare RSI for RELIANCE across all brokersCompare MACD for INFY across kite and groww- ✅ Technical Analysis: RSI, MACD, Bollinger Bands, SMA, EMA, Stochastic
- Mutual Funds: Holdings, orders, SIP management
- GTT (Good Till Triggered): Advanced conditional orders
- Historical Data: OHLC data with custom intervals
- Instruments: Complete instrument master data
- Order Management: Modify, cancel, bracket orders
- Profile & Margins: Account details and fund limits
- ✅ Technical Analysis: RSI, MACD, Bollinger Bands (Native API support)
- Historical Data: Candlestick data for any time period
- Advanced Search: Complex instrument filtering
- Order Management: Create, modify, cancel orders
- Market Data: Real-time quotes and live feeds
- Instrument Details: Complete security information
- ✅ Technical Analysis: RSI, MACD, Bollinger Bands, SMA, EMA, Stochastic
- Option Chain: Complete options data with Greeks
- Bracket/Cover Orders: Advanced order types with SL/Target
- Kill Switch: Emergency stop for all trading activities
- Live Market Feed: Real-time price updates
- Security Info: Detailed instrument information
- Order Book/Trade Book: Complete trading history
- Exchange Status: Real-time market status updates
# Get specific technical indicatorsGet RSI for RELIANCE with period 14Get MACD for INFY from kite brokerGet Bollinger Bands for HDFC with period 20Get VWAP for TATA STEEL from growwGet ATR for NIFTY with period 14Get ADX for RELIANCE with period 14# Multiple indicators at onceGet technical indicators RSI,MACD,BOLLINGER for RELIANCE# Compare same indicator across brokersCompare RSI for RELIANCE across all brokersCompare MACD for INFY across kite,groww,dhanCompare Bollinger Bands for HDFC across authenticated brokers# With custom periods and timeframesGet RSI for RELIANCE with period 21 and interval 1hGet MACD for INFY with fast_period 10, slow_period 20, signal_period 7Get Bollinger Bands for HDFC with period 20 and standard_deviations 2.5- SMA (Simple Moving Average): Any period
- EMA (Exponential Moving Average): Any period
- VWAP (Volume Weighted Average Price): Intraday trading benchmark
- Parabolic SAR: Stop and Reverse trend following system
- ADX (Average Directional Index): Trend strength indicator
- RSI (Relative Strength Index): 14-period default, overbought/oversold
- MACD (Moving Average Convergence Divergence): 12,26,9 default parameters
- Stochastic Oscillator: %K and %D lines
- Williams %R: Momentum oscillator
- CCI (Commodity Channel Index): Price deviation indicator
- MFI (Money Flow Index): Volume-weighted RSI
- Bollinger Bands: 20-period with 2 standard deviations default
- ATR (Average True Range): Volatility measurement
- OBV (On-Balance Volume): Volume flow indicator
- MFI (Money Flow Index): Price and volume momentum
- Fibonacci Retracement: Key retracement levels (23.6%, 38.2%, 50%, 61.8%)
- Support/Resistance Levels: Automated level detection
- Groww: Native API support for technical indicators via
/technical/{indicator}endpoints - Kite & Dhan: Historical data + local calculation using comprehensive TechnicalIndicators utility class
- Consistent API: Unified command interface across all brokers regardless of implementation
- Cross-Broker Comparison: Compare same indicator across multiple brokers simultaneously
- Real-time Calculation: Indicators calculated from live historical data with customizable parameters
- Intelligent Routing: UnifiedTradingServer automatically routes requests to appropriate broker methods
get_technical_indicators- Multiple indicators at onceget_rsi- Relative Strength Indexget_macd- Moving Average Convergence Divergenceget_bollinger_bands- Bollinger Bandsget_vwap- Volume Weighted Average Priceget_atr- Average True Rangeget_adx- Average Directional Indexcompare_technical_indicators- Cross-broker comparison
# Individual technical indicatorsGet RSIfor RELIANCE with period 14Get MACDfor INFY from kiteGet Bollinger Bandsfor HDFC with period 20 and standard_deviations 2Get VWAPfor TATASTEEL from groww Get ATRfor NIFTY with period 14 from dhanGet ADXfor RELIANCE with period 14# Multiple indicatorsGet technical indicators RSI,MACD,BOLLINGER,VWAPfor RELIANCE# Cross-broker comparisonCompare RSIfor RELIANCE across all brokersCompare MACDfor INFY across kite,growwCompare VWAPfor HDFC across authenticated brokers
- ✅No stored credentials: All API keys/tokens provided via commands
- ✅Session-based: Credentials cleared when server restarts
- ✅Broker isolation: Each broker maintains separate credentials
- ✅Runtime authentication: Authenticate only when needed
- ✅Modular security: Each broker handles its own authentication
To add a new broker (e.g., Upstox):
- Create broker file:
src/brokers/UpstoxBroker.js - Extend BaseBroker: Implement all required methods
- Add to index: Export in
src/brokers/index.js - Update server: Add to broker registry in
UnifiedTradingServer.js - Test: Authenticate and test all operations
The modular architecture makes adding new brokers straightforward and maintainable.
For deploying to Cloudflare Workers, see the complete setup guide in/cloudflare/README.md.
Apache 2.0 License - see LICENSE file for details.
About
TurtleStack Trading MCP Server is a comprehensive Model Context Protocol (MCP) server that provides unified access to multiple Indian stock brokers through Claude AI. It enables seamless trading operations, portfolio management, and advanced technical analysis across Kite (Zerodha), Groww, Dhan, and AngelOne brokers.
Topics
Resources
License
Contributing
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Contributors2
Uh oh!
There was an error while loading.Please reload this page.