tw-stock-mcp
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
tw-stock-mcp
台灣股市資料 MCP 服務器。這個專案是整個 workspace 的資料能力層,負責對外提供 MCP tools、resources 與結構化回應。
專案定位
在這個 workspace 中:
tw-stock-mcp:資料服務層tw-stock-plugin:工作流與插件層tw-stock:報告輸出工作區
Related MCP server: Ashare MCP Server
當前架構
目前主入口是 mcp_server.py,已採用 FastMCP 為主要 transport layer。
FastMCP Server
→ tools / resources
→ services
→ providers
→ external data sources更完整說明請看:
主要能力
MCP Tools
get_stock_dataget_price_historyget_realtime_dataget_best_four_pointsget_market_overviewget_deviation_scanlist_resourcessubscribe_resourceinvalidate_cache
MCP Resources
stock://info/{stock_code}stock://price/{stock_code}stock://price/{stock_code}/{period}stock://realtime/{stock_code}stock://analysis/{stock_code}market://overview
模組分層
Entry Point
mcp_server.py
Tool / Resource Adapters
tw_stock_agent/tools/stock_tools.pytw_stock_agent/services/mcp_resource_service.py
Services
tw_stock_agent/services/stock_service.pytw_stock_agent/services/market_service.pytw_stock_agent/services/cache_service.py
Providers
tw_stock_agent/providers/twstock_provider.pytw_stock_agent/providers/finmind_provider.pytw_stock_agent/providers/factory.py
Shared Support
tw_stock_agent/models/stock_models.pytw_stock_agent/utils/*tw_stock_agent/exceptions/*
Provider 策略
預設 provider 使用 twstock,因為它支援較完整的台股查詢能力,包含 Best Four Points。
若要使用 FinMind:
STOCK_DATA_PROVIDER=finmind
FINMIND_API_TOKEN=your_token注意:
finmind的 realtime 屬於 best-effort 近似值finmind不支援 Best Four Pointsservice layer 會在必要時 fallback 到
twstock
安裝
uv sync啟動
uv run python mcp_server.pyMCP 設定範例
{
"mcpServers": {
"tw-stock-mcp": {
"command": "uv",
"args": ["run", "python", "mcp_server.py"],
"cwd": "/path/to/tw-stock-mcp"
}
}
}開發
uv run ruff check .
uv run ruff format .
uv run mypy tw_stock_agent
uv run pytest備註
TODO.md 仍保留長期 roadmap,但 README 以目前已存在的真實架構為主,而不是過渡期規劃。
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Financial data MCP server for global quotes, news, financials, funds, bonds, IPOs and macro data.
China A-share market data over MCP: 22 tools for quotes, K-line, financials, money flow, top-trader boards, sectors, macro, convertible bonds and factor screening. Five tools need no API key, so you can connect and try it immediately.
MCP server for real-time China A-share stock quotes, indices and market data.
Related MCP Servers
- AlicenseCqualityDmaintenanceProvides comprehensive Taiwan stock market data and analysis through MCP tools. Enables querying real-time stock prices, historical data, company information, technical analysis, and market overviews for TWSE and TPEx listed companies.816MIT
- FlicenseNot gradedqualityDmaintenanceProvides stock market data (search, quotes, real-time, charts) for A-share, Hong Kong, and US stocks via MCP tools.-
- FlicenseNot gradedqualityCmaintenanceProvides a read-only interface to Taiwan stock financial data from the public Mopsfin source, enabling queries for company metrics, financial statements, notes, industry statistics, and financial institution data through MCP tools.-
- AlicenseCqualityBmaintenanceEnables local AI clients and agents to perform TWSE and Osaka Nikkei market research via MCP, including market data retrieval, model forecasting, scenario analysis, and historical strategy validation.21Apache 2.0