home / mcp / ib analytics mcp server
Provides an MCP server to run IB Analytics analyses, supporting multi-account portfolio analytics, data retrieval, risk/cost/tax analysis, and automated reporting.
Configuration
View docs{
"mcpServers": {
"knishioka-ib-sec-mcp": {
"command": "uvx",
"args": [
"--from",
"ib-sec-mcp[mcp] @ git+https://github.com/knishioka/ib-sec-mcp",
"ib-sec-mcp"
],
"env": {
"TOKEN": "your_token_here",
"QUERY_ID": "your_query_id"
}
}
}
}IB Analytics provides an MCP server integration that enables Claude Desktop and Claude Code to communicate with the IB Analytics analysis engine. You can run a local MCP server, configure it in your Claude clients, and perform automated, multi-account portfolio analysis, tax and cost analytics, and advanced reporting workflows using predefined prompts and tools.
You will connect a Claude client to the MCP server using a local MCP configuration. The MCP server exposes a set of tools and resources that let you perform portfolio analysis, market data lookups, tax and cost analyses, and automated reporting. Start the MCP server on your machine, then configure Claude Desktop or Claude Code to point to the local MCP process. Once connected, you can issue natural language prompts or scripted tool compositions to analyze accounts, compare performance, or generate reports.
Prerequisites: you need Python 3.12+ and an environment where you can install Python packages. You also need an IB Flex Query account to supply credentials when you fetch data.
Step by step install flow if you are using the MCP-enabled Python package setup shown in the source configuration:
pip install -e .
pip install -e ".[mcp]"
pip install -e ".[dev]"
pip install -e ".[dev,mcp,visualization,reporting]"Configure your IB Flex Query credentials in your environment or in a local .env file. You will typically set QUERY_ID and TOKEN to enable data fetches. You can run the MCP server in a development or production-like environment depending on your needs.
Two concrete MCP setup options are provided for integrating with Claude clients. Use the configuration that matches your workflow.
Option 1 configures Claude Desktop to launch the MCP server via uvx with a packaged MCP module from GitHub. This does not require cloning a local repository.
Do not expose your credentials. Use environment variables or secret management to store QUERY_ID and TOKEN, and avoid committing them to version control. Enable debug mode only in non-production troubleshooting. Use restricted permissions for the MCP server process and limit network exposure to trusted clients.
If you encounter connection issues, verify that QUERY_ID and TOKEN are correctly set in your environment, check that the MCP server process is running, and ensure Claude client configuration points to the correct local process. Review logs for authentication or data fetch errors and validate that your IB Flex Query settings return data as expected.
The MCP server exposes a range of portfolio analysis, market data, tax and cost analytics, and reporting tools. These tools enable you to analyze performance, review risk metrics, fetch stock and options data, and generate comprehensive reports inside Claude workflows.
1) Investor workflow: fetch data from IB Flex Query, run portfolio and performance analysis, and generate a console or HTML report for a given account.
2) Developer workflow: compose a sequence of analyses and create an automated report generation step that can be run as part of a broader data science pipeline.
Analyze overall trading performance and generate performance metrics.
Assess risk scenarios including market and interest rate risk.
Provide a high-level summary of portfolio holdings and metrics.
Fetch and analyze stock data for a given symbol.
Retrieve the latest price for a symbol.
Return detailed information about a stock.
Obtain options chain data for a symbol.
Compute option Greeks for strategies.
Calculate implied volatility metrics for options.
Compute tax implications and liabilities.
Analyze commissions and trading costs.
Evaluate tax loss harvesting opportunities.
Time series data for a symbol over a date range.
Snapshot of all positions on a specific date.
Compare portfolio snapshots across dates.
Aggregate statistics over time for positions.
List dates that have available position snapshots.