
Mcp Etf Holdings
io.github.vlearnerv0.4.1更新於 Oct 3, 2026
Find which ETFs hold any stock, compare funds, and pull holdings. Live Yahoo Finance data.
概覽
讓助理查詢 Yahoo Finance 的 ETF 資料:哪些基金持有某檔股票、基金比較,以及主要持股。
- 功能
- 以 Yahoo Finance 即時資料提供七個工具:find_etfs_holding_stock 與 stock_exposure_summary 用來反查哪些 ETF 持有某檔股票,compare_etfs 與 etf_info 用於費用率、規模與報酬,etf_holdings 用於主要持股,search_etfs 依主題尋找基金,lookup_symbol 將名稱解析為代號。多列結果以 markdown 表格回傳,另有五個提示範本以用戶端斜線指令提供。
- 適用情境
- 適合研究 ETF 持股、比較基金費用與報酬、檢查投資組合是否重複持有,或找出哪些基金持有某檔股票。它面向一般性的基金研究,而非交易或投資組合執行。
- 執行需求
- 以 PyPI 套件形式透過 uvx 在本機以 stdio 執行,需要 Python 3.11+ 與 uv,以及 Claude Code、Claude Desktop、VS Code 或 Cursor 等 MCP 用戶端。不需要 API 金鑰或帳號,但需要連線至 Yahoo Finance 的網路。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Mcp Etf Holdings,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
mcp-etf-holdings
An MCP server for ETF data. Ask which funds hold a stock, compare fees, or pull top holdings. Data comes live from Yahoo Finance. No API key.
What you can ask
Search by company name or ticker symbol. "Which ETFs hold Nvidia?" works the same as "Which ETFs hold NVDA?". Ask about several funds at once and you get one comparison table.
Requirements
- Python 3.11+
- An MCP client: Claude Code, Claude Desktop, VS Code, or Cursor
- uv, which runs the server without a manual install
Install uv:
Setup
You don't need to install the server first. Every config below launches it on demand with
uvx, in its own isolated environment.
To put it on your PATH instead, run pip install mcp-etf-holdings, then swap
uvx mcp-etf-holdings for a plain mcp-etf-holdings in any config below.
Claude Code
Claude Desktop
-
Open your config file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS:
-
Add the server:
-
Quit Claude Desktop and reopen it. Closing the window is not enough.
VS Code
-
Create
.vscode/mcp.jsonin your workspace. For a global config, run MCP: Open User Configuration instead. -
Add the server. VS Code uses the key
servers, notmcpServers: -
Restart VS Code.
Cursor
Use the same JSON as Claude Desktop. Put it in .cursor/mcp.json for one project, or
~/.cursor/mcp.json for all of them. Restart Cursor.
Verify it works
Ask your client each of these:
- "Which ETFs hold NVDA?" — calls
find_etfs_holding_stock - "Compare SPY, QQQ and VTI" — calls
compare_etfs, returns one table - "Which ETFs hold Nvidia?" — resolves the name to
NVDAand says so
If you get real numbers back, you're done.
Example prompts
Copy any of these into a client that has the server connected.
Compare funds
Compare SPY, VOO, IVV and SPLG — they all track the S&P 500, so which is cheapest?
Compare QQQ, VGT, XLK and SMH on expense ratio and 5-year return.
Search by name or ticker
Which ETFs hold Nvidia?
What's the ticker for Berkshire Hathaway?
Find me the Vanguard total stock market fund and show its top holdings.
Find the cheapest exposure to a stock
What's the cheapest ETF to get exposure to Nvidia?
I want AMD exposure without buying the stock directly. What are my options, and what do they cost?
Check a portfolio for overlap
I own VOO, QQQ and VGT. Am I doubling up?
Show me every holding that appears in more than one of SPY, SCHD and DGRO.
Discover funds by theme
Find semiconductor ETFs and compare the three biggest.
What dividend ETFs exist, and which has the highest yield?
Research one fund
Give me a deep dive on SCHD.
How concentrated is QQQ? What share of it is the top 5 positions?
Prompt templates
The server registers five prompt templates. Claude Desktop and Claude Code show them as slash-commands, so you don't have to write the prompt yourself.
Tool reference
Tools that return more than one row format the result as a markdown table.
etf_info(ticker)
Metadata for one ETF. For two or more funds, use compare_etfs.
ticker(string) — ETF symbol, e.g."SPY"
Returns name, category, AUM, expense ratio, dividend yield, NAV/price, and YTD / 3-yr / 5-yr returns.
compare_etfs(tickers)
Compares several ETFs in one table.
tickers(array of strings) — e.g.["SPY", "QQQ", "VTI", "SCHD"]. Case-insensitive and de-duplicated. Capped at 10 funds per call.
Returns Ticker, Name, Category, AUM, Expense, Yield, YTD, 3-Yr, 5-Yr. A ticker with no data still gets a row, plus a note naming it, so one typo doesn't discard the rest.
etf_holdings(ticker)
Top holdings of an ETF with portfolio weights.
ticker(string) — ETF symbol, e.g."QQQ"
Returns a ranked table of symbol, name, and weight %.
find_etfs_holding_stock(stock_ticker, limit, custom_etf_universe)
Reverse lookup. Finds which ETFs hold a given stock in their disclosed top positions.
stock_ticker(string) — a ticker like"NVDA"or a company name like"Nvidia". Names are resolved to a ticker, and the output says which one it used.limit(int, default 20) — capped at 50custom_etf_universe(JSON string, optional) — search a specific list instead of the default universe, e.g.'["SPY","QQQ","XLK"]'
Returns matching ETFs sorted by the stock's weight, highest first.
Only top holdings are checked, roughly 10–15 positions per ETF. A stock held outside those positions will not appear.
stock_exposure_summary(stock, limit)
The same reverse lookup, joined with each fund's cost and size. Use it for "what's the cheapest or largest way to hold this stock?".
stock(string) — ticker or company name, e.g."NVDA"or"Nvidia"limit(int, default 10) — capped at 25
Returns ETF, Name, Weight, Rank, Expense, AUM, sorted by weight in the stock.
lookup_symbol(query, limit, asset_type)
Resolves a company or fund name to its ticker symbol.
query(string) — e.g."Nvidia"or"Vanguard total stock market"limit(int, default 10) — capped at 25asset_type(string, default"any") —"any","stock", or"etf"
Returns Symbol, Name, Type, Exchange.
search_etfs(query, limit)
Finds ETFs by name, theme, or category.
query(string) — e.g."semiconductor"or"dividend"limit(int, default 10) — capped at 25
Returns matching ETF tickers with names and exchanges. To resolve a stock name instead
of finding funds, use lookup_symbol.
From source
For development, or to run without waiting on a release:
Without uv:
The repo ships a .vscode/mcp.json pointed at your working tree, so VS Code picks up
local changes with no extra setup. Point other clients at:
Check that the server starts:
It will sit silent, waiting for JSON-RPC on stdin. That is correct for a stdio MCP server.
To poke at the protocol by hand:
Tests
The suite is fully offline. Both yf.Ticker and yf.Search are mocked, the latter by an
autouse fixture, so no test can reach Yahoo by accident.
For coverage:
Layout
Dependencies: mcp (protocol SDK), yfinance (data), pandas (holdings frames),
httpx (transport).
Troubleshooting
Limits
Worth knowing before you trust a number:
- Only the top ~10–15 positions per ETF are published. Anything derived from holdings — reverse lookups, exposure summaries, overlap checks — is a floor, not the full picture.
- The default universe is ~365 funds. A stock held only in small or niche ETFs may not turn up.
- Responses are cached in memory for 24h. Override with
ETF_CACHE_TTL_SECONDS. - Data is fetched live from Yahoo Finance. No API key, but Yahoo's terms and rate limits apply. See NOTICE for attribution.
Contributing
PRs welcome. The most useful contribution is expanding the ETF universe in top_etfs.py.
Wider coverage means better reverse-lookup results in niche sectors and international
markets.
Open an issue first for larger changes.
Disclaimer
Not affiliated with Yahoo Finance, yfinance, or any financial institution. Data is retrieved from Yahoo Finance at runtime and is subject to availability and their terms of service. This is not financial advice.
來源:README.md,提交 1a3a259
工具
0版本歷史
1- v0.4.1最新Oct 3, 2026


