IG.com MCP Server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
IG.com MCP Server
A Model Context Protocol (MCP) server that provides ChatGPT and other AI agents with access to IG.com's trading APIs. This server enables natural language interaction with IG.com for trading operations, market data retrieval, account management, and more.
Features
š Secure Authentication: Login via tool call or environment variables
š¼ Account Management: View balances, accounts, and account details
š Market Data: Real-time and historical price data
š Trading Operations: Place orders, manage positions, and working orders
š Instrument Search: Search for trading instruments by name or keyword
š Watchlists: Manage and view watchlists
š§ Generic API Caller: Flexible access to any IG API endpoint
š Railway Ready: Pre-configured for easy deployment on Railway
Related MCP server: Interactive Brokers MCP Server
Prerequisites
Node.js 18+ or Docker
IG.com account with API access
IG.com API key (obtain from IG Labs)
Getting Started
Local Development
Clone the repository:
git clone <your-repo-url> cd ig-mcp-serverInstall dependencies:
npm installSet up environment variables (optional, but recommended):
cp .env.example .env # Edit .env with your IG credentialsOr set environment variables:
export IG_API_KEY=your_api_key export IG_USERNAME=your_username export IG_PASSWORD=your_password export IG_API_URL=https://api.ig.com/gateway/dealBuild the project:
npm run buildRun the server:
npm startOr for development with auto-reload:
npm run dev
IG.com API Setup
Log into your IG.com account
Navigate to My Account > Settings > API Keys
Generate a new API key
Note your API key, username, and password
If you have 2FA enabled, append the 6-digit code to your password when authenticating
Usage with ChatGPT
Configuration
Add the MCP server to your ChatGPT configuration:
{
"mcpServers": {
"ig": {
"command": "node",
"args": ["/path/to/ig-mcp-server/dist/index.js"],
"env": {
"IG_API_KEY": "your_api_key",
"IG_USERNAME": "your_username",
"IG_PASSWORD": "your_password"
}
}
}
}Authentication
If credentials are not set via environment variables, ChatGPT will prompt you for login details:
Use the
ig_logintool with your credentialsThe server will authenticate and store the session
Session remains active until logout or expiration
Available Tools
Authentication
ig_login: Authenticate with IG.com APIig_logout: Log out and clear session
Account Management
ig_get_accounts: Get all accountsig_get_account_balance: Get balance for a specific account
Trading
ig_place_order: Place a new trading orderig_get_positions: Get all positions (open and closed)ig_get_open_positions: Get only open positionsig_close_position: Close an existing positionig_get_working_orders: Get pending/working ordersig_delete_working_order: Delete a working order
Market Data
ig_get_market_data: Get current market data for an instrumentig_search_instruments: Search for instrumentsig_get_historical_prices: Get historical price data
Watchlists
ig_get_watchlists: Get all watchlistsig_get_watchlist_markets: Get markets in a watchlist
Generic API Access
ig_call_api: Call any IG API endpoint directly
Deployment on Railway
Option 1: Using Railway CLI
Install Railway CLI:
npm i -g @railway/cliLogin to Railway:
railway loginInitialize Railway project:
railway initSet environment variables:
railway variables set IG_API_KEY=your_api_key railway variables set IG_USERNAME=your_username railway variables set IG_PASSWORD=your_password railway variables set IG_API_URL=https://api.ig.com/gateway/dealDeploy:
railway up
Option 2: Using Railway Dashboard
Create a new project on Railway
Connect your GitHub repository
Add environment variables in the Railway dashboard:
IG_API_KEYIG_USERNAMEIG_PASSWORDIG_API_URL(optional, defaults to live API)
Deploy: Railway will automatically detect the Dockerfile and deploy
Option 3: Using Docker
The included Dockerfile can be used with any Docker-compatible platform:
docker build -t ig-mcp-server .
docker run --env-file .env ig-mcp-serverRailway Deployment Notes
ā ļø Important: MCP servers communicate via stdio (stdin/stdout), NOT HTTP. Railway deployment is primarily for keeping the service running. The agent connects locally through an MCP client, not via HTTP endpoints.
See RAILWAY_DEPLOYMENT.md for detailed Railway deployment guide.
Security Considerations
ā ļø Important Security Notes:
Credentials: Never commit credentials to version control. Use environment variables or Railway's secure variable storage.
Session Management: Sessions are stored in memory per connection. For production:
Consider implementing session encryption
Add session expiry based on your security requirements
Use connection-based isolation (already implemented)
Public Access: This server is designed to be used with ChatGPT's MCP integration, not as a publicly accessible API. Ensure proper network isolation.
API Keys: Rotate API keys regularly and use read-only keys when possible for non-trading operations.
š Production Security Settings
For publicly accessible deployments (like Railway), enable strict security:
# Require credentials via environment variables only (no tool calls)
REQUIRE_ENV_CREDENTIALS=true
# Add MCP server API key for access control
MCP_SERVER_API_KEY=your_secure_random_keySee SECURITY.md for comprehensive security guide.
API Reference
IG.com API Documentation
Full API documentation is available at labs.ig.com.
Common Endpoints Used
Authentication:
POST /sessionAccounts:
GET /accountsPositions:
GET /positionsOrders:
POST /positions/otcMarket Data:
GET /markets/{epic}Historical Prices:
GET /prices/{epic}/{resolution}/{from}/{to}
Error Handling
The server returns both user-friendly messages and detailed debug information:
{
"message": "User-friendly error message",
"data": { ... },
"debug": {
"status": 401,
"statusText": "Unauthorized",
"response": { ... }
}
}Development
Project Structure
ig-mcp-server/
āāā src/
ā āāā index.ts # MCP server entry point
ā āāā ig-client.ts # IG API client
ā āāā session-manager.ts # Session management
ā āāā types.ts # TypeScript types
āāā dist/ # Compiled JavaScript
āāā Dockerfile # Docker configuration
āāā package.json
āāā tsconfig.json
āāā README.mdBuilding
npm run buildLinting
npm run lintDevelopment Mode
npm run devTroubleshooting
Authentication Issues
Verify your API key, username, and password are correct
If using 2FA, append the code to your password
Check that you're using the correct API URL (live vs demo)
Connection Issues
Ensure the server is running and accessible
Check network connectivity to IG API
Verify environment variables are set correctly
Session Expiry
IG sessions are valid for 6 hours initially
Sessions extend with activity
If you encounter authentication errors, try logging in again
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License - see LICENSE file for details
Support
For issues and questions:
IG API Documentation: labs.ig.com
IG Support: Contact IG.com support for API-related issues
MCP Documentation: Model Context Protocol
Disclaimer
This software is provided for educational and development purposes. Trading involves risk. Always test thoroughly with a demo account before using with live trading. The authors are not responsible for any financial losses.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogā¦
This server cannot be deployed
Maintenance
Related MCP Connectors
Agentic brokerage access to a US brokerage account: quotes, orders, positions, cash and documents.
Connect brokerage accounts to AI assistants: holdings, orders, asset lookup, and approved trading.
Unified financial infrastructure connecting AI agents directly to trade live/demo brokerage accounts, Web3 non-custodial wallets, real-time market data across equities, ETFs, crypto, forex, options, DeFi swaps, and prediction markets, institutional research feeds, and algorithmic strategy backtesters.
Read-only access to your MetaTrader 4 and 5 accounts for AI agents: balances, open positions, trade history with win rate, live quotes, symbol specs and candles. It cannot place, modify or close orders.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables 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.2123 npm9MIT
- AlicenseBqualityCmaintenanceEnables 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.14317 npm227MIT
- AlicenseNot gradedqualityDmaintenanceProvides AI models with secure access to Interactive Brokers trading data and functionality, enabling account management, market data retrieval, and trading operations through natural language interactions.18MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to interact with Trading 212 investment accounts for portfolio tracking, account management, and real-time order execution. It supports managing investment pies, analyzing historical data, and monitoring market performance across multiple instrument types.232MIT