TWSE MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@TWSE MCP Server show me the latest revenue growth and stock price for TSMC"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
TWSE MCP Server
A Model Context Protocol (MCP) server that provides real-time access to Taiwan Stock Exchange (TWSE) market data, financial reports, and trading analytics through Claude Desktop.
๐ Quick Start
npx twse-mcpNo installation required! The server connects directly to TWSE's official API to provide comprehensive market data.
Related MCP server: Taiwan Stock Real-Time Analysis MCP Server
๐ Features
Market Data & Analytics
๐ Real-time Trading Data - Daily stock prices, volumes, and OHLC data
๐ Market Indices - TAIEX and sector indices with real-time updates
๐น Technical Indicators - P/E ratios, dividend yields, price-to-book values
๐ Trading Analytics - Top volume stocks, margin trading, 5-second bid/ask stats
Financial Intelligence
๐ฐ Financial Statements - Quarterly income statements and balance sheets
๐ Revenue Reports - Monthly revenue with YoY/MoM comparisons
๐ฏ Profitability Metrics - ROE, ROA, profit margins by company
๐ญ Industry Analysis - EPS statistics and comparisons by sector
Investment Insights
๐ Foreign Investment - Top foreign holdings and sector preferences
๐ ETF Rankings - Most popular ETFs by investor accounts
๐ข Corporate Actions - New IPOs and delisted companies
๐ Market Calendar - Trading holidays and market schedules
๐ ๏ธ Installation
Option 1: NPX (Recommended)
# Run directly without installation
npx twse-mcpOption 2: Global Installation
# Install globally
npm install -g twse-mcp
# Run the server
twse-mcpOption 3: Local Development
# Clone repository
git clone https://github.com/pyang2045/twsemcp.git
cd twse-mcp
# Install dependencies
npm install
# Build and run
npm run build
npm start๐ง Claude Desktop Configuration
macOS
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"twse": {
"command": "npx",
"args": ["twse-mcp"],
"env": {}
}
}
}Windows
Add to %APPDATA%\Claude\claude_desktop_config.json:
{
"mcpServers": {
"twse": {
"command": "npx",
"args": ["twse-mcp"],
"env": {}
}
}
}๐ Available Tools
Market Data (6 tools)
Tool | Description | Example Query |
| Daily trading data for all stocks | "Show today's stock prices" |
| Valuation metrics | "Find undervalued stocks" |
| Market indices (TAIEX, etc.) | "How's the market today?" |
| Daily close vs monthly average | "Show price averages" |
| Monthly trading statistics | "Get monthly highs and lows" |
| Search specific stock | "Find TSMC stock data" |
Financial Reports (6 tools)
Tool | Description | Example Query |
| Monthly revenue reports | "Show revenue growth" |
| Quarterly P&L statements | "Get earnings data" |
| Quarterly balance sheets | "Check debt levels" |
| EPS by industry | "Compare sector earnings" |
| ROE, ROA, margins | "Find profitable companies" |
| Company-specific financials | "Get TSMC financial reports" |
Trading Analysis (3 tools)
Tool | Description | Example Query |
| Most traded stocks | "What's hot today?" |
| Margin/short data | "Show leverage levels" |
| Real-time bid/ask | "Get order flow" |
Investment Research (7 tools)
Tool | Description | Example Query |
| Top foreign holdings | "What are foreigners buying?" |
| Foreign investment by sector | "Foreign sector preferences" |
| Recent IPOs | "Show new stocks" |
| Delisted companies | "Which stocks were delisted?" |
| Popular ETFs | "Top ETF choices" |
| Historical index data | "TAIEX history" |
| Market calendar | "When is market closed?" |
๐ก Example Usage
Basic Market Check
You: "How's the Taiwan stock market doing today?"
Claude: [Uses getMarketIndex to show TAIEX and major indices]
You: "What are the most active stocks?"
Claude: [Uses getTop20Volume to display top traded stocks]Company Research
You: "Analyze TSMC's financial performance"
Claude: [Uses searchFinancials("2330", "income") for earnings]
[Uses searchFinancials("2330", "balance") for financial position]
[Uses searchFinancials("2330", "profit") for profitability metrics]Investment Screening
You: "Find high dividend yield stocks"
Claude: [Uses getStockPERatios to filter for high dividend yields]
You: "Show me what foreign investors are buying"
Claude: [Uses getTopForeignHoldings for top 20 foreign picks]๐ Search Functions
searchStock
Search for specific stock data:
{
"query": "2330", // Stock code or name
"dataType": "daily" // "daily" | "peratio" | "monthly"
}searchFinancials
Search company financial reports:
{
"stockCode": "2330", // Company stock code
"reportType": "income" // "revenue" | "income" | "balance" | "profit"
}๐ Data Sources
Official API: Taiwan Stock Exchange OpenAPI
Base URL: https://openapi.twse.com.tw/
Update Frequency:
Real-time: 5-second stats during market hours
Daily: After market close (~14:30 TST)
Monthly: Financial reports on 10th of each month
Quarterly: Financial statements 45 days after quarter end
๐ง Development
Prerequisites
Node.js >= 18.0.0
TypeScript 5.0+
Build from Source
# Install dependencies
npm install
# Development mode (with hot reload)
npm run dev
# Build for production
npm run build
# Run tests
npm testProject Structure
twse-mcp/
โโโ src/
โ โโโ index.ts # MCP server implementation
โ โโโ api/
โ โโโ twse-client.ts # TWSE API client
โโโ dist/ # Compiled JavaScript
โโโ bin/ # CLI executable
โโโ examples/ # Configuration examples๐ API Response Format
All tools return JSON data with Traditional Chinese field names:
{
"ๅ
ฌๅธไปฃ่": "2330",
"ๅ
ฌๅธๅ็จฑ": "ๅฐ็ฉ้ป",
"ๆถ็คๅน": "595.00",
"ๆฌ็ๆฏ": "25.83",
"ๆฎๅฉ็": "2.02"
}โ ๏ธ Limitations
Rate Limits: TWSE API may have rate limiting
Data Delay: Some data has 15-20 minute delay
Language: Field names in Traditional Chinese
Market Hours: Real-time data only during TSE trading hours (09:00-13:30 TST)
Data Volume: Large queries return first 100 records
๐ค Contributing
Contributions are welcome! Please see our Contributing Guide for details.
Development Workflow
Fork the repository
Create feature branch (
git checkout -b feature/amazing-feature)Commit changes (
git commit -m 'Add amazing feature')Push to branch (
git push origin feature/amazing-feature)Open Pull Request
๐ License
MIT License - see LICENSE file for details
๐ Acknowledgments
Taiwan Stock Exchange for providing the OpenAPI
Anthropic for the MCP SDK
Contributors and users of this project
Available Tools
22 toolsgetBalanceSheetA
Get quarterly balance sheets for all listed companies (general industry)
Inputs: no named parameters.
getETFRankingB
Get top ETFs by regular investment accounts
Inputs: no named parameters.
getFiveSecondStatsB
Get real-time 5-second bid/ask and transaction statistics
Inputs: no named parameters.
getForeignCategoryHoldingsC
Get foreign investor holdings by industry category
Inputs: no named parameters.
getHolidayScheduleA
Get TWSE market holiday schedule and trading days
Inputs: no named parameters.
getIncomeStatementB
Get quarterly income statements for all listed companies (general industry)
Inputs: no named parameters.
getIndexHistoryB
Get historical TAIEX index data (open, high, low, close)
Inputs: no named parameters.
getIndustryEPSA
Get earnings per share (EPS) statistics by industry
Inputs: no named parameters.
getMarginTradingC
Get margin trading and short selling statistics
Inputs: no named parameters.
getMarketIndexA
Get daily market index statistics including TAIEX and other indices
Inputs: no named parameters.
getMonthlyRevenueB
Get monthly revenue reports for all listed companies
Inputs: no named parameters.
getMonthlyStatsB
Get monthly stock trading statistics including high/low prices and volumes
Inputs: no named parameters.
getNewListingsA
Get recently listed companies on TWSE
Inputs: no named parameters.
getProfitAnalysisA
Get comprehensive profitability analysis including ROE, ROA, profit margins
Inputs: no named parameters.
getStockDailyB
Get daily trading information for all listed stocks on TWSE
Inputs: no named parameters.
getStockDayAvgB
Get daily closing prices and monthly average prices for all stocks
Inputs: no named parameters.
getStockPERatiosA
Get P/E ratios, dividend yields, and price-to-book ratios for all stocks
Inputs: no named parameters.
getSuspendedListingsB
Get companies that have been delisted or suspended
Inputs: no named parameters.
getTop20VolumeA
Get top 20 stocks by daily trading volume
Inputs: no named parameters.
getTopForeignHoldingsC
Get top 20 foreign and mainland investor stock holdings
Inputs: no named parameters.
searchFinancialsC
Search financial reports for specific company
Inputs: stockCode (required), reportType.
searchStockC
Search for specific stock information by code or name
Inputs: query (required), dataType.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogโฆ
TDQS
Scored across 22 tools
Tools target distinct data categories (financial statements, trading stats, indices, etc.) with clear descriptions. Minor overlap between daily, real-time, and monthly stock stats, but each serves a specific purpose.
Most tools follow a 'get' + noun phrase pattern. Two search tools (searchFinancials, searchStock) break the pattern, but overall naming is predictable.
22 tools cover a wide range of TWSE data without being excessive. Each tool seems necessary for comprehensive market and financial reporting.
Covers fundamental statements, daily/monthly/real-time trading, indices, EPS, PER, margin trading, foreign holdings. Lacks some advanced data like order book or corporate actions, but solid for typical investor needs.
Related MCP Connectors
Unofficial. TWSE & TAIFEX open data for AI: stock, ETF & futures snapshots, quotes, 270+ datasets.
Taiwan finance open data: ETF, funds, TAIEX, sentiment, business climate, FX. Free & read-only.
Taiwan stock market data (TWMD): official-source, point-in-time-safe datasets via read-only tools.
Taiwan data for AI agents: THSR/TRA timetables, TWSE/TPEx stocks, invoice lottery, garbage, outages
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
- -licenseNot gradedqualityNot gradedmaintenanceProvides real-time stock quotes, technical analysis, and intelligent trading recommendations specifically for the Taiwan stock market. Supports single and multiple stock queries, comparative analysis, and investment decision support through natural language interactions.-
- FlicenseNot gradedqualityDmaintenanceProvides real-time quotes, fund flows, and corporate announcements for Chinese A-share stocks. It enables users to search for stocks, analyze financial indicators, and summarize quarterly reports through natural language.-
- AlicenseNot gradedqualityDmaintenanceEnables querying real-time stock data for A-shares, Hong Kong, and US markets, including search, price details, and market indices via natural language.80 npm6MIT