- Home
- MCP servers
- IG Trading
IG Trading
- javascript
2
GitHub Stars
javascript
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"kea0811-ig-trading-mcp": {
"command": "npx",
"args": [
"ig-trading-mcp",
"serve"
],
"env": {
"IG_DEMO": "true",
"IG_API_KEY": "YOUR_API_KEY",
"IG_PASSWORD": "YOUR_PASSWORD",
"IG_IDENTIFIER": "YOUR_IDENTIFIER"
}
}
}
}You set up and run an MCP (Model Context Protocol) server that exposes IG Trading actions to AI assistants. This server provides a secure, audited bridge between IG Trading REST APIs and AI tools, enabling automated trading workflows, position management, market data access, and more via 21 specialized MCP tools.
How to use
You use an MCP client to talk to the ig-trading-mcp server. Start the server locally, connect your AI assistant to it, and then invoke the available MCP tools to login, fetch accounts, search markets, place and manage orders, view positions, and monitor market sentiment. The server handles authentication, session management, and secure communication, so your AI assistant can operate on your IG Trading account without exposing raw credentials.
How to install
Prerequisites you need before installation: Node.js 18.0.0 or higher, and an IG Trading account (demo or live) with an API key.
Step 1: Install and run the MCP server with npx (no local installation required) or install globally.
# Run directly with npx
npx ig-trading-mcp serve --api-key YOUR_KEY --identifier YOUR_ID --password YOUR_PWD
# Or install globally
npm install -g ig-trading-mcp
ig-trading-mcp serve
```,
Additional setup and configuration
Configure your environment with your IG credentials in a secure manner. You can initialize configuration, test the connection, and then start the MCP server for AI tools.
# Initialize configuration
npx ig-trading-mcp init
# Edit environment variables (example values shown as placeholders)
IG_API_KEY=your_api_key_here
IG_IDENTIFIER=your_username_here
IG_PASSWORD=your_password_here
IG_DEMO=true
```,
Security and reliability features
The MCP server includes RSA encryption for credentials, AES-256-GCM for secure storage, rate limiting to protect the API, audit logging for all operations, session management with JWT tokens and auto-refresh, and input validation with Joi.
Usage with a Node.js client (example)
You can also use the ig-trading-mcp library directly in a Node.js application to perform common IG Trading operations.
import { IGService } from 'ig-trading-mcp';
const ig = new IGService({
apiKey: 'YOUR_API_KEY',
identifier: 'YOUR_USERNAME',
password: 'YOUR_PASSWORD',
isDemo: true
});
// Login
await ig.login();
// Get accounts
const accounts = await ig.getAccounts();
console.log('Balance:', accounts.accounts[0].balance);
// Search markets
const markets = await ig.searchMarkets('EUR/USD');
// Create position
const position = await ig.createPosition({
epic: 'CS.D.EURUSD.CFD.IP',
direction: 'BUY',
size: 1,
orderType: 'MARKET',
guaranteedStop: false,
forceOpen: true
});
// Get positions
const positions = await ig.getPositions();
// Close position
await ig.closePosition(position.dealId);
// Logout
await ig.logout();
```,
Tools overview (21 MCP tools)
The MCP server exposes a set of tools you can call to manage accounts, positions, orders, markets, and watchlists.
Available tools
ig_login
Authenticate with IG Trading and establish a session for subsequent actions.
ig_logout
End the current IG Trading session and clear authentication state.
ig_get_accounts
List all IG Trading accounts linked to the authenticated user.
ig_switch_account
Change the active account for subsequent trading operations.
ig_get_account_activity
Retrieve a view of account history and activity.
ig_get_positions
Fetch all open trading positions.
ig_create_position
Open a new trading position with specified parameters.
ig_update_position
Modify an existing trading position.
ig_close_position
Close a specific trading position.
ig_close_all_positions
Close all open trading positions.
ig_get_working_orders
View pending (working) orders.
ig_create_working_order
Place a new working order.
ig_delete_working_order
Cancel a working order.
ig_search_markets
Search for tradeable markets by term.
ig_get_market_details
Get detailed information about a market.
ig_get_historical_prices
Fetch historical price data for a market.
ig_get_client_sentiment
Retrieve market sentiment data.
ig_get_watchlists
List all watchlists for the account.
ig_get_watchlist
Get details of a specific watchlist.
ig_create_watchlist
Create a new watchlist.
ig_add_to_watchlist
Add a market to an existing watchlist.