Metadata-Version: 2.4
Name: ibkr-mcp
Version: 0.2.4
Summary: Interactive Brokers MCP Server for AI-powered trading
License-Expression: LicenseRef-Proprietary
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: ib-async>=2.0.1
Requires-Dist: loguru>=0.7.3
Requires-Dist: mcp[cli]>=1.21.2
Requires-Dist: numpy>=2.3.5
Requires-Dist: pandas>=2.3.3
Requires-Dist: plotly>=6.5.0
Requires-Dist: pyarrow>=22.0.0
Requires-Dist: python-dotenv>=1.2.1
Requires-Dist: pyyaml>=6.0.3
Requires-Dist: sqlalchemy>=2.0.0
Requires-Dist: aiosqlite>=0.20.0
Requires-Dist: alembic>=1.17.2
Requires-Dist: greenlet>=3.3.0
Provides-Extra: cython
Requires-Dist: cython>=3.0; extra == "cython"
Dynamic: license-file

# ibkr-mcp

Interactive Brokers MCP Server for AI-powered trading assistance.

A [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server that connects AI assistants to Interactive Brokers, enabling intelligent portfolio management, options analysis, and risk monitoring.

## Features

- **Account Management**: Real-time account summary, portfolio positions, and P&L tracking
- **Options Analysis**: Option chain fetching, Greeks calculation, and strategy scanning
- **Risk Monitoring**: Portfolio risk evaluation with configurable limits and alerts
- **Trading Strategies**: Built-in support for covered calls, iron condors, PMCC, vertical spreads
- **News Integration**: Historical news retrieval for market research
- **Playbook Actions**: Automated adjustment suggestions based on risk rules

## Installation

```bash
pip install ibkr-mcp
```

## Prerequisites

- Python 3.12+
- Interactive Brokers TWS or IB Gateway running
- Valid IBKR account credentials

## Configuration

Set environment variables or create a `.env` file:

```bash
# IBKR Connection
IBKR_HOST=127.0.0.1
IBKR_PORT=4001          # TWS: 7497, IB Gateway: 4001
IBKR_CLIENT_ID=0
IBKR_ACCOUNT=U1234567   # MUST: specific account ID

# Optional: Data directories
IBKR_MCP_MARKET_DATA_TYPE=LIVE  # LIVE, FROZEN
```

## Usage

### As MCP Server

Add to your Claude Desktop or other MCP-compatible client configuration:

```json
{
  "mcpServers": {
    "ibkr-mcp": {
      "command": "uvx",
      "args": [
        "ibkr-mcp"
      ],
      "env": {
        "IBKR_ACCOUNT": "U1234567"
      }
    }
  }
}
```

### Available Tools

| Resources                          | Description                                            |
| ----------------------------- | ------------------------------------------------------ |
| `account_summary`       | Retrieve account summary for specific account  |

| Tool                          | Description                                            |
| ----------------------------- | ------------------------------------------------------ |
| `get_portfolio`             | Get portfolio positions with P&L                       |

## Support

For issues and feature requests, please contact the maintainers.

## License

Proprietary - All rights reserved.
