Golden Egg TW Holdings MCP
Enables AI agents to query Taiwan stock holdings across multiple brokerages including Fubon, SinoPac, MasterLink, and E.SUN. It provides a standardized interface for accessing portfolio data and brokerage accounts through the Model Context Protocol.
README
Golden Egg
以 MCP Plugin 方式實現台股庫存查詢功能,讓 AI Agent 能夠輕鬆調用。目前支援富邦、永豐、元富、玉山等四間證券公司。

前置需求
- 在要連接的卷商申請交易憑證,查看最下方的卷商文件
- Python 3.13 或更高版本
- UV 套件管理器
卷商文件
- 元富(masterlink): https://ml-fugle-api.masterlink.com.tw/FugleSDK/ (沒有測試環境)
- 富邦: https://www.fbs.com.tw/TradeAPI/docs/welcome/#%E6%B8%AC%E8%A9%A6%E7%92%B0%E5%A2%83 (有獨立的測試環境帳號憑證)
- 玉山: https://www.esunsec.com.tw/trading-platforms/api-trading/docs/prerequisites#run_simulation (有測試環境,但是沒有單獨的帳號)
- 永豐證卷: https://sinotrade.github.io/zh/tutor/simulation/ (有測試環境,但要用自已的憑證)
安裝 UV
macOS / Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
驗證卷商是否開通
驗證永豐
uv run pytest -W ignore::DeprecationWarning -v -s test/unit/test_shinopac.py
驗證富邦
uv run pytest -W ignore::DeprecationWarning -v -s test/unit/test_fubon_unit.py
驗證玉山證卷
uv run pytest -W ignore::DeprecationWarning -v -s test/unit/test_esun_unit.py
驗證元富證卷
uv run pytest -W ignore::DeprecationWarning -v -s test/unit/test_masterlink_unit.py
其他測試
- 測試所有integration test
pytest -W ignore::DeprecationWarning -v -s - 測試所有unit test
uv run pytest -W ignore::DeprecationWarning -v -s test/unit - 測試所有unit test 不帶 stdout
uv run pytest -W ignore::DeprecationWarning -s test/unit
專案結構
golden-egg/
├── main.py # 主程式入口
├── pyproject.toml # 專案配置
├── uv.lock # UV 依賴鎖定檔案
├── start.sh # 啟動腳本
├── README.md # 專案說明
├── broker/ # 券商 API 模組
│ ├── __init__.py
│ ├── base.py # 券商基礎類別
│ ├── esun/ # 玉山證券 API
│ │ ├── __init__.py
│ │ ├── app.py
│ │ ├── certs/ # 玉山憑證檔案
│ │ ├── client.py
│ │ └── reset.py
│ ├── fubon/ # 富邦證券 API
│ │ ├── __init__.py
│ │ ├── app.py
│ │ ├── certs/ # 富邦憑證檔案
│ │ ├── client.py
│ │ ├── log/ # 富邦日誌
│ │ ├── ocr_demo.py
│ │ └── ocr.py
│ ├── masterlink/ # 元富證券 API
│ │ ├── __init__.py
│ │ ├── app.py
│ │ ├── certs/ # 元富憑證檔案
│ │ ├── client.py
│ │ ├── Configs/ # 元富設定檔案
│ │ └── log/ # 元富日誌
│ └── sinopac/ # 永豐證券 API
│ ├── __init__.py
│ ├── certs/ # 永豐憑證檔案
│ └── client.py
├── config/ # 配置模組
│ ├── __init__.py
│ └── settings.py # 全域設定
├── docs/ # 文件目錄
│ ├── cursor_mcp_setup.md
│ ├── market_data_api_spec.md
│ └── MCP_TESTING_GUIDE.md
├── log/ # 全域日誌目錄
├── models/ # 資料模型
│ ├── __init__.py
│ ├── accounts.py # 帳戶模型
│ ├── common.py # 共用模型
│ ├── data/
│ │ └── stock_info.json # 股票資訊資料
│ ├── holdings.py # 持股模型
│ └── market_data.py # 市場資料模型
├── service/ # 服務層
│ ├── __init__.py
│ ├── holdings_service.py # 持股服務
│ ├── mcp/
│ │ ├── __init__.py
│ │ ├── prompts.py # MCP 提示詞
│ │ ├── resources.py # MCP 資源
│ │ └── tools.py # MCP 工具
│ ├── mcp_server.py # MCP 服務器
│ └── storage_service.py # 儲存服務
├── test/ # 測試目錄
│ ├── conftest.py # 測試配置
│ ├── integration/ # 整合測試
│ │ ├── __init__.py
│ │ ├── test_esun_integration.py
│ │ ├── test_fubon_integration.py
│ │ ├── test_masterlink_integration.py
│ │ └── test_sinopac_integration.py
│ ├── log/ # 測試日誌
│ └── unit/ # 單元測試
│ ├── __init__.py
│ ├── test_esun_unit.py
│ ├── test_fubon_unit.py
│ ├── test_masterlink_unit.py
│ └── test_shinopac.py
└── wheels/ # WHL 檔案目錄
└── README.md
mcp設定
OPEN AI CODEX
# ~/.codex/config.toml
[mcp_servers.golden-egg]
command = "uv"
args = ["run", "--project", "<YOUR_PATH>/golden-egg", "python", "<YOUR_PATH>/golden-egg/main.py"]
CURSOR
# ~/.cursor/mcp.json
{
"mcpServers": {
"golden-egg": {
"command": "<YOUR_PATH>/golden-egg/.venv/bin/python",
"args": ["<YOUR_PATH>/golden-egg/main.py"],
"disabled": false
}
}
}
VSCODE
#檢視>命令選擇區>add mcp server
"golden-egg": {
"command": "<YOUR_PATH>/golden-egg/.venv/bin/python",
"args": ["<YOUR_PATH>/golden-egg/main.py"],
"type": "stdio"
}
授權
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。