pipe-stock-analysis
This server provides read-only Taiwan stock market data retrieval and deterministic financial analysis. It does not place trades, manage portfolios, or make investment recommendations.
Data Retrieval
Historical stock prices: Fetch historical price data with automatic FinMind-to-TWSE fallback
Latest official quotes: Get the latest closing quote from TWSE or TPEx
Material announcements: Retrieve current MOPS regulatory announcements
Stock news: Fetch recent news items via Google News RSS with Yahoo fallback
Valuation data: Historical PER, PBR, and dividend yield
Monthly revenue: Historical monthly revenue figures
Institutional flows: Institutional investor buy/sell volumes
Financial reports: Income statement, balance sheet, and cash flow data
Margin trading: Margin-purchase and short-sale balance history
Analysis
Technical analysis: Calculate trend, momentum, return, and volatility metrics over a configurable lookback period
Fundamental analysis: Summarize valuation ratios and monthly revenue growth trends
Financial health: Summarize profitability, balance-sheet strength, and cash generation
Margin trading analysis: Summarize changes in margin-purchase and short-sale balances
Institutional flow analysis: Aggregate buy, sell, and net volumes by investor type
Service
Health check: Verify the MCP service is running and healthy
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., "@pipe-stock-analysis Get technical indicators for TSMC (2330) over the last 30 days."
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.
Pipe Stock Analysis
Self-hostable, read-only financial-market MCP (Model Context Protocol, a standard for AI clients to invoke external tools) server for Taiwan-listed securities and global stocks. It retrieves market data and computes reproducible indicators; it does not make investment decisions or place trades.
Why this repository exists
Run your own instance. This project does not route other people to the maintainer's server, bundle API credentials, require OpenConnector, or require a hosted account.
The public default calls FinMind and Finnhub directly with credentials from your local
.env.FinMind is optional and supports anonymous access with lower limits. Finnhub-backed tools require your own API key.
Advanced deployments can select the OpenConnector adapter so this process holds only a narrow runtime token.
.env, OAuth state, private keys, SQLite databases, and generated credentials are ignored by Git.
Related MCP server: etfedge-mcp
Three-step self-hosting
# 1. Clone
git clone https://github.com/Gratia2533/pipe-stock-analysis.git && cd pipe-stock-analysis
# 2. Create local configuration; optionally add FINMIND_TOKEN / FINNHUB_API_KEY
cp .env.example .env
# 3. Start with the default Direct adapter on a standard Docker bridge network
docker compose up -d --buildTo enter a Finnhub API key without exposing it in shell history, use the interactive helper and choose whether to restart the services:
./scripts/set-finnhub-key.shVerify both local services:
curl http://127.0.0.1:8010/healthz
curl http://127.0.0.1:8011/healthzInternal MCP without OAuth:
http://127.0.0.1:8010/mcpOAuth-protected MCP:
http://127.0.0.1:8011/mcp
Both endpoints are published only on 127.0.0.1. Keep port 8010 private; expose only port 8011 through a public HTTPS reverse proxy or tunnel.
Data backends
Direct (default)
DATA_BACKEND=direct
FINMIND_TOKEN=
FINNHUB_API_KEY=The service starts without either optional credential, so TWSE, TPEx, MOPS, news, and deterministic analytics remain available. FinMind uses anonymous limits when its token is empty. A Finnhub tool reports a configuration error only when called without FINNHUB_API_KEY.
OpenConnector (advanced, Linux/WSL)
Use this mode when a dedicated OpenConnector already exposes the curated FinMind and Finnhub Actions. The advanced Compose injects only its runtime token; upstream credentials remain in OpenConnector's encrypted credential store. For fail-closed separation, FINMIND_TOKEN and FINNHUB_API_KEY must be unset in this mode.
DATA_BACKEND=openconnector
OPEN_CONNECTOR_BASE_URL=http://127.0.0.1:8001
OPEN_CONNECTOR_RUNTIME_TOKEN=your-local-runtime-tokenBecause a bridged container cannot reach a connector bound to host loopback, the advanced Compose file intentionally uses Linux/WSL host networking while both services remain bound to 127.0.0.1:
docker compose -f compose.openconnector.yaml up -d --buildDirect and OpenConnector modes use the same MCP tools and analytics code. OpenConnector is an adapter, not a separate branch or repository.
Tools
Historical prices with FinMind → TWSE fallback
Latest TWSE / TPEx official close quotes
TWSE market and sector indices, ETF rankings, listing/IPO pipeline, and trading calendar
Valuation, monthly revenue, institutional flows, financial reports, margin trading
MOPS material announcements and recent news
Deterministic technical, fundamental, financial-health, institutional-flow, and margin summaries
Finnhub global symbol search, quotes, candles, company profiles, financial metrics, reported statements, and company news
Local development
Requires Python 3.11+ and uv.
cp .env.example .env
uv sync --dev
set -a; source .env; set +a
MCP_TRANSPORT=streamable-http MCP_HOST=127.0.0.1 uv run finance-mcpFor stdio clients on the same host:
MCP_TRANSPORT=stdio uv run finance-mcpHermes configuration
For a local HTTP deployment:
hermes mcp add pipe-stock-analysis --url http://127.0.0.1:8010/mcp
hermes mcp test pipe-stock-analysisFor stdio, point your MCP client to uv run finance-mcp from this repository. Configure the command and its environment in your own local client configuration; never commit tokens into this repository.
Analysis skill
The reusable cross-market Hermes analysis workflow is included at skills/stock-analysis/SKILL.md. Install it directly from the raw GitHub URL:
hermes skills install https://raw.githubusercontent.com/Gratia2533/pipe-stock-analysis/main/skills/stock-analysis/SKILL.mdOAuth deployment
Compose starts a separate OAuth-protected instance on port 8011 while leaving the port 8010 instance available for trusted local clients. Set FINANCE_OAUTH_ISSUER_URL, FINANCE_OAUTH_RESOURCE_URL, FINANCE_OAUTH_USERNAME, and FINANCE_OAUTH_PASSWORD for the public deployment. OAuth runtime data is stored in a persistent private volume and excluded by .gitignore.
The issuer and resource URLs must use the same public HTTPS hostname that forwards to 127.0.0.1:8011. The default OAuth deployment is a single server process; keep it single-process because private_key_jwt assertion replay protection uses a process-local JTI cache. A multi-worker deployment would require a shared replay cache.
Verification
uv run ruff check .
uv run pytest -qScope and disclaimer
Read-only data and deterministic calculations only.
No orders, broker accounts, portfolio access, or personalized investment recommendations.
Data availability, latency, and accuracy depend on upstream providers. Verify material information independently.
This is software, not investment advice.
References and inspiration
FinMind: upstream open-source project behind the optional FinMind market-data integration. This repository does not vendor FinMind code or credentials.
Finnhub: optional upstream provider for global-stock data. Endpoint availability depends on the user's Finnhub plan.
TradingAgents: conceptual reference for role-based research workflows. This server deliberately keeps data retrieval and deterministic calculations separate from agent orchestration and investment decisions.
License
Available Tools
15 toolsanalyze_taiwan_stock_financial_healthC
Summarize reported profitability, balance-sheet strength and cash generation.
Inputs: stock_id (required), lookback_years. Returns: object
analyze_taiwan_stock_fundamentalC
Summarize valuation and monthly-revenue growth without investment recommendations.
Inputs: stock_id (required), revenue_lookback_months, valuation_lookback_days. Returns: object
analyze_taiwan_stock_institutional_flowsC
Aggregate institutional investor buy, sell and net volumes by investor type.
Inputs: stock_id (required), lookback_days. Returns: object
analyze_taiwan_stock_margin_tradingC
Summarize changes in margin-purchase and short-sale balances.
Inputs: stock_id (required), lookback_days. Returns: object
analyze_taiwan_stock_technicalC
Calculate deterministic trend, momentum, return and volatility metrics.
Inputs: stock_id (required), source, lookback_days. Returns: object
get_taiwan_stock_financial_reportsC
Get income statement, balance sheet and cash-flow rows for a Taiwan company.
Inputs: stock_id (required), start_date (required), end_date. Returns: object
get_taiwan_stock_institutional_flowsC
Get institutional investor buy and sell volumes for a Taiwan stock.
Inputs: stock_id (required), start_date (required), end_date. Returns: result
get_taiwan_stock_margin_tradingB
Get margin-purchase and short-sale balances for a Taiwan stock.
Inputs: stock_id (required), start_date (required), end_date. Returns: result
get_taiwan_stock_material_announcementsC
Get current MOPS announcements; announcement_date is the release date, not event date.
Inputs: stock_id (required), limit, market, include_details. Returns: result
get_taiwan_stock_monthly_revenueC
Get historical monthly revenue for a Taiwan company.
Inputs: stock_id (required), start_date (required), end_date. Returns: result
get_taiwan_stock_newsB
Get up to 10 Taiwan-stock news items from Google News RSS with Yahoo fallback.
Inputs: stock_id (required), limit, source. Returns: result
get_taiwan_stock_official_quoteA
Get the latest official TWSE or TPEx close quote for a Taiwan security.
Inputs: stock_id (required), market. Returns: object
get_taiwan_stock_pricesB
Get Taiwan stock prices with optional FinMind-to-TWSE fallback.
Inputs: stock_id (required), start_date (required), source, end_date. Returns: result
get_taiwan_stock_valuationC
Get historical PER, PBR and dividend-yield data for a Taiwan stock.
Inputs: stock_id (required), start_date (required), end_date. Returns: result
healthA
Return the Finance MCP service status.
Inputs: no named parameters. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 15 tools
Each tool targets a distinct aspect of Taiwan stock analysis (financials, fundamentals, institutional flows, margin trading, technical, prices, etc.), with no overlapping purposes or ambiguity.
All tool names follow a consistent verb_stock_aspect pattern, using either 'analyze' or 'get' as verbs, and 'taiwan_stock' as the noun prefix, with 'health' as a notable but clear exception.
15 tools is well-scoped for a comprehensive stock analysis server, covering financial reporting, valuation, sentiment, technical analysis, and market data without being excessive.
The tool set covers the full lifecycle of stock analysis: raw data (prices, quotes, reports), derived metrics (valuation, financial health), and aggregate analyses (fundamental, institutional flows, technical, margin trading), with no obvious gaps.
Maintenance
Related MCP Connectors
Zero-auth Streamable HTTP MCP server for cited Web3, token risk, and on-chain deep research.
Hosted MCP server for SEC, FRED, Polymarket, Deribit, OKX, and FMP.
Open-source MCP server for Zerodha Kite Connect. Portfolio, market data, backtesting, alerts.
Hosted MCP server for Indian market quotes, option-chain Greeks and multi-broker telemetry.
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 gradedqualityBmaintenanceRead-only MCP server for Taiwan active ETF research database, providing tools to list ETFs, track buy/sell deltas, view stock history and PnL, and find consensus buys across ETFs.5-
- AlicenseNot gradedqualityDmaintenanceAn open-source MCP server that aggregates Taiwan public data sources (data.gov.tw, TWSE, MOEA, CWA, etc.) and exposes them through the Model Context Protocol, enabling AI agents to query Taiwan data with a single configuration line.1Apache 2.0
- FlicenseAqualityCmaintenanceRead-only SQL MCP server for quantitative finance data (DuckDB) with stock quotes, financials, and historical K-lines, enabling cross-database JOIN queries.1-