
IBKR Portfolio Builder
io.github.adwiteeymauriya由 GitHub 帳號 adwiteeymauriya 發布v0.1.4更新於 Oct 24, 2026
Top-down IBKR research: 468 typed screeners tagged by strategy intent, news, account access.
發布方自己的服務:PortfolioFit
概覽
用於 IBKR 由上而下投資組合研究的遠端 MCP 伺服器:提供 468 個帶類型標籤的篩選器目錄、新聞以及唯讀帳戶資料。
- 可以做什麼
- 依類別、策略意圖與適用商品瀏覽並篩選 468 個 IBKR 篩選器目錄,含反向配對連結與數值過濾參數代碼
- 執行 IBKR 掃描並取得附交易所的排名股票清單,另可對原始掃描代碼做子字串搜尋
- 依名稱模糊查詢合約、讀取完整合約中繼資料,並取得價格快照或 OHLCV 歷史資料
- 讀取帳戶摘要、持倉、未成交委託與近期成交
- 列出已訂閱的新聞來源,並依股票代號取得新聞標題或單篇文章內容
- 適用情境
- 適合讓助理針對 Interactive Brokers 帳戶進行由上而下的篩選與投資組合研究:先確定策略意圖,執行並交叉比對多個掃描,再結合新聞與財報事件縮小候選名單,而非逐一查詢個股。
- 執行需求
- 需要自行部署的遠端 Streamable HTTP 端點(路徑 /mcp),搭配 ib-gateway 服務與 IBKR 模擬帳戶憑證(TWS_USERID、TWS_PASSWORD)。驗證方式由 AUTH_MODE 決定:OAuth 需要 LOGIN_PASSWORD,bearer 模式需要 STATIC_BEARER_TOKEN,並透過 Authorization 標頭傳遞。Claude.ai 連接器需要與 PUBLIC_BASE_URL 相符的公開 HTTPS 網址。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 IBKR Portfolio Builder,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
ibkr-portfolio-builder-mcp
A remote MCP server for top-down portfolio construction with Interactive Brokers. Built to be used as a Claude.ai custom connector, Claude Code MCP, or any HTTP MCP client.
Most ibkr-mcp servers expose individual lookup primitives —
get_quote,get_position,place_order. This one exposes the research workflow: a typed catalog of 468 screeners across 16 categories tagged by strategy intent (value / growth / income / momentum / quality / events / …), per-scan applicable instruments, inverse-pair links, and live news/account access — so an LLM can do real top-down portfolio construction (pick sectors / strategies → run scans → cross-reference with news → narrow to candidates) instead of bottoms-up ticker fishing.
Why this exists
I built this because the existing IBKR-MCP servers in the community treat IBKR as a "look-up-one-ticker" data source. That mirrors how most retail brokerage UIs work, but it's not how good portfolio construction actually happens.
A good top-down workflow looks like:
- Macro thesis ("rates are about to fall, dividend payers should re-rate") →
- Strategy intent ("show me income screens with quality bias on US large caps") →
- Screener composition (run dividend yield + ROE + low debt screens; intersect) →
- Event/news context ("any of these have earnings in the next two weeks? any negative analyst actions?") →
- Narrow candidate set ("five tickers, ranked by my criteria, ready for deeper diligence").
To do that with an LLM, the MCP server needs to expose the research vocabulary, not just the raw API. That's the gap this server fills:
- A typed scan catalog — 468 IBKR scan codes across 16 categories (
Fundamentals,Price Movement,Dividends,Options & Volatility,Events & Earnings,52/26/13 Week High-Low,ESG,Bonds, …) auto-tagged with 28 strategy intent tags (value,growth,quality,income,momentum_up,momentum_down,analyst,technical,gap,volatility,events,leverage,efficiency,risk_adjusted, …). The LLM asks "what value scans exist for US stocks?" and gets a clean, filterable answer instead of trying to guess scan codes from training data. - Inverse pair links — every
HIGH_X ↔ LOW_XandX_ASC ↔ X_DESCpair is precomputed, so the LLM can flip polarity ("what's the opposite of LOW_PE_RATIO?") without guessing. - Per-scan instrument map — the catalog knows which scan applies to
STK,ETF,OPT,BOND, etc. The LLM stops sending Refinitiv scans to bond instruments and getting empty results. - Filter catalog — separate typed map of the numeric filters (
priceAbove,peRatioBelow,divYieldAbove,growthRateAbove,avgVolumeAbove,marketCapAbove, …) grouped by category, with per-instrument applicability notes. - News + screeners in one tool surface — same connector, same auth, same conversation. The LLM can intersect a scan result with recent headlines or upcoming earnings without context-switching.
- Two auth modes — full OAuth 2.1 (DCR + PKCE + well-knowns) for Claude.ai custom connectors, plus a static bearer token for everything else. Same server, same tools.
It's still an early server. The IBKR API has plenty of restrictions on what a paper account can actually see (notably historical news entitlement). But the catalog and workflow shape are production-ready, and they're the load-bearing piece for an LLM-driven research loop.
Quick facts
- Transport: Streamable HTTP at
/mcp. - Auth: OAuth 2.1 (PKCE + RFC 7591 Dynamic Client Registration) AND/OR static bearer token. Selectable via
AUTH_MODE. - Persistence: in-memory only today (sessions / DCR clients / OAuth tokens reset on container restart). Redis is on the roadmap — see below.
- IBKR connection: ib-gateway (
ghcr.io/gnzsnz/ib-gateway:stable) runs as a sibling service in this compose; paper account in read-only API mode by default. - Built on: FastMCP + ib_async.
Tools
Parity with IBKR's official MCP for the 9 read-only tools (skipping the two write/order-instruction tools — see roadmap), plus the 5 screener/news/catalog tools that are this server's reason for existing.
Note on order placement. IBKR's official MCP also exposes
Create Order InstructionandDelete Order Instruction. This server intentionally does not — it runs ib-gateway inREAD_ONLY_API=yesmode so even a misrouted tool call cannot place an order. Order execution belongs in a separate service with its own approval gate. See the roadmap for a possible "staged-only" instruction tool that would write to a local store without ever touching IBKR.
Authentication
AUTH_MODE selects which mechanisms the server accepts. The default is both.
The OAuth endpoints (/authorize, /token, /register, /.well-known/*, /login) are always registered. In bearer mode they're inert — nothing in your README needs to point at them.
Generating secrets
Using the static bearer token
Connecting from Claude.ai (OAuth)
Settings → Connectors → Add custom connector → URL: https://YOUR.DOMAIN/mcp → leave OAuth client id/secret blank (Claude.ai uses DCR). When Claude.ai opens the OAuth flow, you'll be prompted for LOGIN_PASSWORD.
Run
By default this pulls the published multi-arch image from GitHub Container Registry: ghcr.io/adwiteeymauriya/ibkr-portfolio-builder-mcp:latest. To build locally instead (e.g. when iterating on the source), run docker compose build ibkr-mcp first.
ib-gateway takes ~60–90 s to finish IBKR login after first start. Tail logs with docker logs -f ibkr-mcp-gateway.
For local-only use (bearer-token clients, no Claude.ai) this is enough — http://localhost:8000/mcp is now serving. Claude.ai custom connectors require an HTTPS URL on the public internet, so a reverse proxy with TLS in front is needed.
Putting TLS in front for Claude.ai
Pick one. Both end with a working https://your-host/mcp and a valid cert.
Option 1 — Cloudflare Tunnel (no public IP, no port forwarding). Best if the server runs on a home network or a VM behind NAT. Cloudflare gives you a hostname and TLS for free; the tunnel daemon dials out from the server to Cloudflare's edge.
~/.cloudflared/config.yml:
Run with cloudflared tunnel run ibkr-mcp (or install as a systemd unit via cloudflared service install). Then set PUBLIC_BASE_URL=https://ibkr-mcp.your-domain.com in .env and docker compose restart ibkr-mcp.
Option 2 — Caddy reverse proxy with Let's Encrypt. Best if the server has a public IP and ports 80/443 open. Caddy fetches certs automatically.
Caddyfile:
Run with caddy run (or install as a system service: sudo caddy start + a systemd unit). Same .env change as above.
In both cases PUBLIC_BASE_URL must match exactly the URL you give Claude.ai — Claude.ai validates the OAuth issuer against it.
Example LLM prompts (top-down workflow)
Roadmap
Open issues / PRs welcome on any of these.
Layout
License
MIT.
Acknowledgements
- gnzsnz/ib-gateway-docker for the headless ib-gateway image.
- ib_async for the async IBKR client.
- FastMCP for the MCP server framework with built-in OAuth support.
Disclaimer
This software talks to your Interactive Brokers account. By default it runs against a paper account in read-only API mode — orders cannot be placed even if a tool tries. If you switch to a live account, you do so at your own risk. None of the tool output constitutes investment advice; the strategy tagging is a vocabulary helper, not a recommendation engine.
來源:README.md,提交 337a5e1
工具
0版本歷史
1- v0.1.4最新Sep 16, 2026
評分
已滿足適用檢查項的 60%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通必需25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式必需10 分
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
其他 Portfolio 整合

PortfolioFit
fit.portfolio官方發布者
PortfolioFit 是遠端 MCP 伺服器,讓助理依投資指令核對標準化投資組合,並計算配置限制與統計指標。

Cameron Rye Portfolio MCP Server
dev.rye官方發布者
遠端 MCP 端點,提供 Cameron Rye 的部落格、作品集專案、簡介、閱讀清單與網站即時統計,以及聯絡與訂閱工具。
Shlok Bam's portfolio
由 GitHub 帳號 shlokbam 發布
瞭解AI工程師Shlok Bam:專案、經驗、技能、專利。即時、唯讀。AI 翻譯

Harshith Nayaka L portfolio docs
由 GitHub 帳號 HarshithNayakaL 發布
唯讀 MCP 伺服器,提供某作品集網站 JSON API、MCP、A2A 與 NLWeb 的開發者文件。

Harshith Nayaka L portfolio
由 GitHub 帳號 HarshithNayakaL 發布
以唯讀方式存取 Harshith Nayaka L 的作品集網站,讓助理查詢其個人簡介、專案、案例研究、常見問題與 agent 技能。