ig-trading-mcp
A modern Node.js client for IG Trading API with built-in MCP (Model Context Protocol) server for AI integration. Trade forex, indices, commodities and more through IG's REST API, now with AI assistant support.
✨ Features
- 🤖 MCP Server - 21 tools for AI assistants (Claude, Cursor, etc.)
- 📊 Complete IG REST API - Trading, positions, orders, market data
- 🔐 Enterprise Security - RSA encryption, rate limiting, audit logging
- 🚀 Modern JavaScript - ES modules, async/await, full TypeScript support
- 🛡️ Battle-tested - Production-ready with comprehensive error handling
🚀 Quick Start
Install & Run with npx (no installation needed)
Basic Setup
- Initialize configuration:
- Edit
.env
with your IG credentials:
- Test connection:
- Start MCP server for AI tools:
🎯 Usage Examples
Command Line Interface
As a Node.js Library
🤖 AI Integration (MCP)
Configure with Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json
:
Configure with Cursor
Add to .cursor/mcp.json
in your project:
Available MCP Tools (21)
Account Management (5)
ig_login
- Authenticate with IGig_logout
- End sessionig_get_accounts
- List all accountsig_switch_account
- Change active accountig_get_account_activity
- View account history
Position Management (5)
ig_get_positions
- View open positionsig_create_position
- Open new positionig_update_position
- Modify positionig_close_position
- Close specific positionig_close_all_positions
- Close all positions
Order Management (3)
ig_get_working_orders
- View pending ordersig_create_working_order
- Place new orderig_delete_working_order
- Cancel order
Market Data (4)
ig_search_markets
- Search tradeable marketsig_get_market_details
- Get market infoig_get_historical_prices
- Historical dataig_get_client_sentiment
- Market sentiment
Watchlists (4)
ig_get_watchlists
- View all watchlistsig_get_watchlist
- Get specific watchlistig_create_watchlist
- Create watchlistig_add_to_watchlist
- Add market to list
🔒 Security Features
- RSA Encryption - Password encryption using pidCrypt (IG-compatible)
- Secure Storage - Credentials encrypted with AES-256-GCM
- Rate Limiting - Automatic throttling (60 req/min)
- Audit Logging - Track all operations
- Session Management - JWT tokens with auto-refresh
- Input Validation - Joi schemas for all inputs
📁 Project Structure
🛠️ API Reference
Account Methods
Trading Methods
Order Methods
Market Data Methods
📋 Requirements
- Node.js 18.0.0 or higher
- IG Trading Account (demo or live)
- API Key from IG (get from My IG > Settings > API keys)
🧪 Testing
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
🏗️ Built On
This project is built on top of gfiocco/node-ig-api, enhancing it with:
- Modern ES modules and async/await patterns
- MCP (Model Context Protocol) server for AI integration
- Enhanced security with RSA encryption
- CLI interface for easy usage with npx
- Comprehensive error handling and rate limiting
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
⚠️ Disclaimer
This software is for educational purposes only. Trading CFDs carries risk and you could lose more than your initial deposit. Use at your own risk. The authors are not responsible for any financial losses incurred through use of this software.
🔗 Resources
📞 Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Made with ❤️ for the trading community
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Tools
Enables AI assistants to interact with IG Trading API for forex, indices, and commodities trading. Provides 21 tools for account management, position trading, order placement, market data analysis, and watchlist management.
Related MCP Servers
- AsecurityFlicenseAqualityTransforms AI assistants into autonomous crypto trading agents with real-time market analysis, portfolio management, and trade execution across 17+ blockchains.Last updated -321915
- -securityAlicense-qualityEnables AI assistants to interact with the QuantConnect cloud platform for algorithmic trading. Supports creating and managing trading strategies, running backtests, deploying live algorithms, and performing comprehensive trading operations through the QuantConnect API.Last updated -Apache 2.0
- AsecurityAlicenseAqualityEnables AI assistants to interact with Interactive Brokers trading accounts to retrieve market data, check positions, and place trades. Includes pre-configured IB Gateway and handles OAuth authentication automatically.Last updated -61394MIT License