MCP server for Taiwan NHI IHQE healthcare quality indicators
Project description
MCP Taiwan NHI IHQE
MCP Taiwan NHI IHQE wraps Taiwan National Health Insurance Administration's public Healthcare Quality Information Disclosure website:
https://med.nhi.gov.tw/ihqe0000/
The project fetches the public indicator index, parses metric metadata, looks up area codes, and queries hospital-level indicator values. It exposes those flows as a FastMCP server so an MCP client can search available quality metrics and query metric values without manually browsing the website.
Traditional Chinese documentation is available in README.zh-tw.md.
Provided Tools
list_metric
List available quality metrics parsed from the IHQE public index.
Arguments:
keyword: Optional keyword to search by metric id, metric name, or section.limit: Optional maximum number of metrics to return.
Returns:
metrics: Matching metric records.total: Total number of matched records.returned: Number of records returned after applyinglimit.
query_metric
Query hospital values for one quality metric.
Arguments:
metric: Metric id or metric name keyword, for example1711or血脂.year: ROC year/quarter string, for example114Q4.roc_year: ROC or Gregorian year. Use withquarterwhenyearis omitted.quarter: Quarter value such as4orQ4. Use withroc_year.city: City/town code or area name, for example12,1205,新竹市, or香山.hospital_name: Optional hospital name keyword.hospital_id: Optional hospital id.special: Optional special type code.branch: Optional NHI branch code.limit: Maximum number of rows to return. Default is20.
Returns:
metric: The resolved metric metadata.city: The resolved city/town code used in the API call.rows: Hospital-level metric rows.total: Total number of matched rows.returned: Number of rows returned after applyinglimit.
describe_metric
Return the indicator introduction and description for one quality metric.
Arguments:
metric: Metric id or metric name keyword, for example1711or血脂.
Returns:
metric: The resolved metric metadata.title: The indicator page title.introduction: Structured introduction sections (each withtitleandcontent).
health_education
Return the health education content for one quality metric.
Arguments:
metric: Metric id or metric name keyword.
Returns:
metric: The resolved metric metadata.title: The indicator page title.health_education: Structured health education sections (each withtitleandcontent).
Usage
Install Dependencies
uv sync
Run as an MCP Server
This repository includes a local MCP configuration:
{
"mcpServers": {
"tw-nhi-ihqe": {
"command": "uv",
"args": ["run", "ihqe-mcp"]
}
}
}
You can also run the server directly:
uv run ihqe-mcp
The IHQE website currently fails Python's default certificate validation in some environments, so SSL verification is disabled by default for the MCP server. To force verification, set:
IHQE_VERIFY_SSL=true uv run ihqe-mcp
Try the CLI
List available metrics:
uv run ihqe list-metrics
uv run ihqe list-metrics --keyword 血脂
Look up area codes:
uv run ihqe list-areas
uv run ihqe list-areas --keyword 香山
uv run ihqe list-areas --towns
Query a metric:
uv run ihqe query-metric 1711 --year 114Q4 --city 12 --limit 5
uv run ihqe query-metric 1711 --year 114Q4 --city 香山 --keyword 台大 --limit 5
Use JSON output when inspecting raw data:
uv run ihqe query-metric 1711 --year 114Q4 --city 12 --json
Describe an indicator (introduction and methodology):
uv run ihqe describe-metric 1711
uv run ihqe describe-metric 血脂
Show health education content for an indicator:
uv run ihqe health-education 1711
uv run ihqe health-education 血脂 --json
Development
Project Layout
src/mcp_tw_nhi_ihqe/parser.py: HTML parsers for the public index and metric content pages.src/mcp_tw_nhi_ihqe/api.py: Low-level API client and higher-level cached IHQE client.src/mcp_tw_nhi_ihqe/cli.py: Command-line workflow for local testing.src/mcp_tw_nhi_ihqe/mcp.py: FastMCP server and tool definitions.tests/: Unit tests and fixed HTML fixtures.
Run Tests
uv run pytest
Useful Local Checks
uv run ihqe list-metrics --keyword 血脂
uv run ihqe list-areas --keyword 香山
uv run ihqe query-metric 1711 --year 114Q4 --city 12 --limit 2
Notes for Contributors
- Keep network-dependent behavior behind injectable clients or fixed fixtures.
- Prefer adding tests with small HTML/API samples before changing parser logic.
- The official API uses ROC year/quarter values such as
114Q4. - The official API accepts either city codes such as
12or town/district codes such as1205in the samecityquery parameter.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_tw_nhi_ihqe-0.1.0.tar.gz.
File metadata
- Download URL: mcp_tw_nhi_ihqe-0.1.0.tar.gz
- Upload date:
- Size: 18.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a5c040539c994e58c6882ea76cde387c23956b83a7b0966137876f733b18131
|
|
| MD5 |
54f4b37e4ba993bdd890c23e4cbba1a8
|
|
| BLAKE2b-256 |
923e6aba1e778f8647f52011a4aa4c8007b67d26e492e077fa021bd9ed1dcb0c
|
Provenance
The following attestation bundles were made for mcp_tw_nhi_ihqe-0.1.0.tar.gz:
Publisher:
publish.yml on asgard-ai-platform/mcp-tw-nhi-ihqe
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_tw_nhi_ihqe-0.1.0.tar.gz -
Subject digest:
1a5c040539c994e58c6882ea76cde387c23956b83a7b0966137876f733b18131 - Sigstore transparency entry: 1437518578
- Sigstore integration time:
-
Permalink:
asgard-ai-platform/mcp-tw-nhi-ihqe@09e72114c93b8ed21174fdaacc141433d9f5d449 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/asgard-ai-platform
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@09e72114c93b8ed21174fdaacc141433d9f5d449 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mcp_tw_nhi_ihqe-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mcp_tw_nhi_ihqe-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c60f614bb9253c373c94a0722c1f846600971cb094df19cc580990d3ba66010c
|
|
| MD5 |
d5fd109af838ced5884d5db9a35d8bf2
|
|
| BLAKE2b-256 |
e8b295043b0cb22a45fda22e781bef18a598fda41961fafc3715ca23df7a7dfb
|
Provenance
The following attestation bundles were made for mcp_tw_nhi_ihqe-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on asgard-ai-platform/mcp-tw-nhi-ihqe
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_tw_nhi_ihqe-0.1.0-py3-none-any.whl -
Subject digest:
c60f614bb9253c373c94a0722c1f846600971cb094df19cc580990d3ba66010c - Sigstore transparency entry: 1437518584
- Sigstore integration time:
-
Permalink:
asgard-ai-platform/mcp-tw-nhi-ihqe@09e72114c93b8ed21174fdaacc141433d9f5d449 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/asgard-ai-platform
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@09e72114c93b8ed21174fdaacc141433d9f5d449 -
Trigger Event:
push
-
Statement type: