# Taiwan-Health-MCP [Health: Active]

**Category:** 🧬 Biology & Bioinformatics  
**Repository:** https://github.com/healthymind-tech/Taiwan-Health-MCP  
**GitHub Stars:** 170  
**Views:** 6  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/taiwan-health-mcp

## Description
讓 AI agent 讀懂台灣醫療：63 個 MCP 工具，涵蓋 FHIR R4 / TW Core 驗證、ICD-10、SNOMED CT、LOINC、TFDA 藥品與臨床計算器。MCP server for Taiwan healthcare data.

## Tools
Capabilities this server exposes over MCP:

- **health_check** — Return runtime readiness of the MCP server and every module-backed service. Call this first before any workflow to confirm the required services are online.
- **calculate_chads2_vasc** — CHA₂DS₂-VASc stroke-risk score for non-valvular atrial fibrillation (0–9). Accepts raw age/sex and computes brackets internally; also returns the 2024 ESC CHA₂DS₂-VA adjusted score (sex removed). Decision support only.
- **calculate_wells_pe** — Wells criteria for pulmonary embolism (two-tier + three-tier risk). Binary findings are booleans; heart_rate_bpm is raw and the >100 criterion is computed.
- **calculate_wells_dvt** — Wells criteria for deep-vein thrombosis (two-tier + three-tier risk). All items are binary clinical findings.
- **calculate_das28** — DAS28 rheumatoid arthritis disease activity. formula=esr needs esr (mm/h); formula=crp needs crp (mg/L). Joint counts are 28-joint (0–28); global_health is a 0–100 VAS (not the 0–10 scale CDAI uses). Returns score and activity band (remission/low/moderate/high).
- **calculate_cdai** — CDAI (lab-free) rheumatoid arthritis disease activity (0–76). Tender and swollen counts use the 28-joint assessment (0–28 each); patient and provider global assessments are 0–10.
- **calculate_bmi** — Body mass index with Taiwan (Asian) cutoffs: <18.5 underweight, 18.5–23.9 normal, 24–26.9 overweight, ≥27 obese. Height in cm (not metres), weight in kg.
- **calculate_egfr** — Estimated glomerular filtration rate using the CKD-EPI 2021 creatinine equation (race-free), adults ≥18 only. serum_creatinine_mgdl in mg/dL (convert µmol/L by dividing by 88.4). Returns eGFR in mL/min/1.73m² and KDIGO CKD stage.
- **calculate_has_bled** — HAS-BLED bleeding risk on oral anticoagulation (0–9). Accepts raw age (the >65 criterion is computed) and raw systolic BP (the H criterion is computed as SBP >160 mmHg). Returns score and high/low bleeding-risk category (≥3 high).
- **calculate_curb65** — CURB-65 community-acquired pneumonia severity (0–5). BUN in mg/dL (threshold >19), respiratory rate ≥30, hypotension SBP<90 or DBP≤60, confusion, age ≥65.
- **calculate_qsofa** — qSOFA sepsis screening (0–3): respiratory rate ≥22, altered mentation (GCS <15), systolic BP ≤100. ≥2 suggests sepsis and further evaluation.
- **calculate_gcs** — Glasgow Coma Scale (3–15). eye_response 1–4, verbal_response 1–5, motor_response 1–6. Returns total, E/V/M sub-scores, and mild/moderate/severe severity (≤8 severe).
- **list_fhir_servers** — List admin-configured external FHIR servers available for MCP workflows. Discovery entry point — returns {count, servers:[...]} with identity, capabilities, non-sensitive auth metadata, and the last stored probe. Secrets are never returned.
- **get_fhir_server_status** — Get the status and configuration of ONE admin-configured external FHIR server (same fields as list_fhir_servers). Does not make a live call — returns the last stored probe. Secrets are never returned.
- **crud_fhir_server** — Perform a controlled FHIR REST operation against an admin-configured server. Never accepts arbitrary URLs; builds standard FHIR paths from operation/resource_type/resource_id. Write ops require confirm_write=true and must be in the server's allowed set.
- **search_medical_codes** — Search ICD-10-CM diagnosis codes and ICD-10-PCS procedure codes (the editions loaded on this server; see health_check.terminology). diagnosis: hybrid BM25 + vector embedding re-ranking; procedure: BM25 only; all (default): both, returned under separate diagnoses/procedures keys. Results are ranked by relevance, not alphabetical. Optional system: icd10cm | icd10pcs, or any CodeSystem of an installed FHIR IG (canonical URL, id, or name words, e.g. nhi_payment = TW Core medical-service-payment-tw, the Taiwan NHI payment / fee-schedule codes for lab tests and procedures). For an IG CodeSystem the keyword may be Chinese or English free text, an abbreviation or chart wording; results carry code, display, matched_term and same-group siblings, and accepted_by_validator (whether fhir_validate_* accepts the code — an excerpt CodeSystem is searched in its fuller installed copy, whose extra codes are flagged false; then use `alternatives`, accepted codings of another system such as ATC). fhir_normalize_code(text, system) does the same within an IG; fhir_lookup_code gives the display of a known code.
- **infer_complications** — Explore the ICD-10-CM hierarchy for a diagnosis code or category prefix. Pure hierarchy lookup: parent codes expand to child codes; leaf codes list siblings.
- **get_nearby_codes** — Retrieve the two ICD-10-CM codes immediately before and after a known code (alphabetical ordering neighbors, not semantic matches).
- **check_medical_conflict** — Fetch full metadata for one diagnosis + one procedure code side-by-side for coding QA / conflict analysis. Returns facts only, no pass/fail verdict.
- **browse_icd_category** — Browse ICD-10-CM structure by chapter or 3-character category. Omit category to enumerate all categories with counts; pass a category to expand it into codes.
- **search_loinc** — Discover LOINC codes and categories with mode-specific search behavior. code (default): hybrid BM25 + semantic search by test name/abbreviation/analyte (optional category narrows to a LOINC class). category: list or filter categories. specimen: search by specimen/system type. component: search by analyte. keyword is required for code/specimen/component modes.
- **interpret_lab_result** — Interpret one lab result against the applicable age/gender-stratified LOINC reference range. Returns the range, the measured value, and a normal/high/low flag. Reference values are general guidance only.
- **batch_interpret_lab_results** — Interpret a full panel of lab results against LOINC reference ranges in one call. results_json must be a JSON array of {loinc_code, value} objects; passing a non-array returns an error without calling the service.
- **query_loinc** — Look up a known LOINC code for full detail or age/gender-stratified reference range. Use after you already know the LOINC code; for discovery use search_loinc.
- **search_snomed_concept** — Search SNOMED CT International Edition by English term (hybrid BM25 + semantic). Returns up to limit closest concepts with concept_id, fsn, preferred_term, active, and hierarchy_tag. For full detail use query_snomed_concept.
- **query_snomed_concept** — Fetch a SNOMED CT concept with optional IS-A hierarchy expansion (ancestors + children). The preferred entry point when you want the concept record AND its surrounding tree.
- **get_snomed_relationships** — Get the clinical attribute relationships (non-IS-A) for a SNOMED CT concept, grouped by relationship type with a human-readable label and list of target concepts.
- **query_snomed_mapping** — Map between ICD-10-CM codes and SNOMED CT concepts (bidirectional). mode=icd: keyword is an ICD-10 code → mapped SNOMED concepts. mode=snomed: keyword is a numeric concept_id or English term → mapped ICD-10 codes.
- **search_drug** — Search Taiwan FDA drug records by mode. drug_name (default), ingredient, license_id, atc_code. Output: { mode, keyword, include_cancelled, results }.
- **identify_unknown_pill** — Identify a Taiwan FDA drug by pill appearance keywords (space-separated), matched conjunctively against appearance fields with a small color/shape synonym map.
- **get_drug_details** — Return the canonical normalized drug record for one Taiwan FDA license, augmented with stage availability and document counts.
- **get_drug_asset_links** — Return persisted asset metadata plus runtime-generated MinIO download links (presigned URLs are null when MinIO is unconfigured).
- **fhir_list_igs** — List the FHIR Implementation Guide (IG) packages installed on this server (isDefault, installOrigin manual|dependency, dependencies). Tools that omit package_id use the package owning the canonical / meta.profile involved, else the default IG. compact=true: just packageId#version → title by install origin, plus the default IG. query: a conversion target or IG name in any language / short name (e.g. '轉為健保事前審查 Bundle', 'TWCM', 'IPS') → the matching installed IGs, ranked, each with its Bundle profiles (bundle_profiles) — use it when you do not know which package_id / bundle_profile a task means.
- **fhir_get_ig** — Details of one IG package: identity, dependencies, and per-resource-type artifact counts. data.deps_missing lists declared dependencies that are not installed (incomplete closure).
- **fhir_list_artifacts** — List an IG's conformance artifacts (StructureDefinitions, ValueSets, CodeSystems, examples) as summary rows. Without package_id only the default IG is listed; all_packages=true lists every installed package. Zero rows comes with data.hint naming the other packages that match. compact=true returns id → title per resource type (about a fifth of the size) instead of full summary rows.
- **fhir_search_artifacts** — Full-text search an IG's artifacts by id / canonical URL / name / title / description. Without package_id only the default IG is searched; all_packages=true searches every installed package. Zero hits comes with data.hint naming the other packages that match (e.g. Claim → the PAS IG). compact=true returns id → title per resource type instead of full summary rows.
- **fhir_list_resource_profiles** — List the IG's selectable resource Profiles (constraint StructureDefinitions), grouped by base FHIR resource type. Without package_id: the default IG (all_packages=true: every installed package; zero rows → data.hint). After choosing one, call fhir_get_profile_required_elements to learn exactly which elements it requires. compact=true (recommended when tool output is limited, e.g. all of TW Core: ~4k instead of ~13k chars) returns per base type a map profile id → title plus the canonical base; pass base_type to narrow further.
- **fhir_rank_resource_profiles** — Rank candidate Profiles by how many of your source-data field keys match each profile's element paths. Suggests only (selectionRequired:true).
- **fhir_get_profile** — Summary of one Profile / StructureDefinition: identity, base definition, derivation, element count. identifier may be an id or a canonical URL, optionally pinned as 'url|version' (an uninstalled version is ARTIFACT_NOT_FOUND).
- **fhir_get_profile_elements** — Read a Profile's StructureDefinition snapshot via a view: elements | element | slices | choices | binding | examples. path is required for element/slices/choices/binding. Raw min is per element and ignores parent optionality — for the effective required set use fhir_get_profile_required_elements.
- **fhir_get_profile_required_elements** — Return every element a profile effectively requires (min>=1 with required ancestors, required slices, choice types, invariant-implied value-or-dataAbsentReason) plus target-implied primary content, each classified as auto, coding, source_fact, workflow_default, derived, ... with cardinality, type, binding, fixed/pattern, mustSupport and a short fill hint. derived rows (e.g. Condition.category) carry allowedCodes and a derivation rule in `hint` (Condition.category: encounter-diagnosis for this visit's diagnoses, problem-list-item only for a longitudinal problem list). mustSupport is NOT required: unlisted and optional:true rows may be left out — never refuse a task because one is missing. Use it before writing a resource so every required field is filled; works for any installed IG (without package_id the package owning the profile is used; 'url|version' pins a version). Profiled extensions are expanded from their definitions, and profile-specific error invariants are listed under `invariants`. verbosity='compact' (default) keeps id/required_by/grounding_class/fixed|pattern|value/choices/allowedCodes/hint and folds profile-pinned subtrees into one copyable `value`; verbosity='full' adds min/max/types/binding/mustSupport per row.
- **fhir_get_valueset** — Return a ValueSet's definition (compose block + metadata) without expanding it.
- **fhir_expand_valueset** — Expand a ValueSet to its member codings, resolved locally where possible. Whole large external systems are not enumerated (TOO_BROAD).
- **fhir_lookup_code** — Look up the display/definition of a (system, code) pair from locally held terminology. accepted_by_validator says whether fhir_validate_* accepts the code for the package; a code defined only in a fuller installed copy of an excerpt CodeSystem returns defined_in and alternatives (accepted codings of another system, e.g. ATC).
- **fhir_validate_code** — Check whether a (system, code) is a member of a ValueSet. Returns valid | invalid | unverifiable. value_set may be pinned as 'url|version'.
- **fhir_normalize_code** — Turn free text into ranked candidate codes for a target system or ValueSet (ConceptMap + lexical + semantic). Provide at least one of value_set or system. Supported: SNOMED CT, LOINC, ICD-10-CM/PCS and every CodeSystem of an installed IG (e.g. TW Core medical-service-payment-tw = Taiwan NHI payment codes for lab tests and procedures, occupation, department codes). For IG CodeSystems the text may be Chinese or English, an abbreviation or chart wording (CRP, TKA, 清創縫合 …); system may also be the CodeSystem id or alias words (nhi_payment). Candidates carry matched_term / matched_language and same-group siblings (e.g. the same test by another method). Drugs: Taiwan NHI drug codes (健保藥品代碼) ARE supported — system='medication-nhi-tw' (TW Core) or 'nhi-medication' (TWPAS), text = brand or generic name in English or Chinese, strength optional (e.g. 'Glucophage 500mg', '脈優錠 5mg', 'amlodipine'); when the default IG ships only an excerpt of a CodeSystem the full installed copy is searched (see warnings / codesystem_copies). ATC: WHO ATC (http://www.whocc.no/atc) is not held as a searchable CodeSystem (TW Core medcation-atc-tw has only 27 Taiwan-specific codes); find the NHI drug instead — its candidate's `linked` lists the drug's ATC code (e.g. {system:'http://www.whocc.no/atc', code:'A10BA02'}). Every candidate carries accepted_by_validator (+ reason): whether fhir_validate_* accepts the code for the resolved package — codes found only in a fuller copy are flagged false (Unknown code under an excerpt); then use data.alternatives (codings of another system the validator accepts, e.g. the drug's ATC coding for the MedicationRequest atc slice) and keep the name in CodeableConcept.text. TFDA licence numbers: system='medication-fda-tw'. Taiwan FDA product details (ingredients, inserts): search_drug / get_drug_details.
- **fhir_resolve_reference** — Mint (or return) a stable urn:uuid reference for a logical key within a build context, so resources can reference each other before finalization.
- **fhir_build_bundle** — Assemble inline FHIR resources into a Bundle, wiring urn:uuid references. Each entry is {resource, key?, fullUrl?, request?}. A key becomes a deterministic UUID v5 fullUrl (same input → same Bundle); references written as the key, urn:uuid:<key> or <Type>/<key> are rewired to it; an invalid fullUrl (urn:uuid:patient-1, uppercase UUID) is normalised like fhir_finalize_bundle. data.changes lists every rewrite, data.unresolved the references no entry matches.
- **fhir_finalize_bundle** — Call this on the finished Bundle before you output it (在輸出最終 Bundle 前呼叫；修正可唯一確定的錯誤，不能確定的不猜、回報候選). repair="content" (default) = ids + content repairs; repair="ids" = only fullUrl / reference / id (v9). IDS: a fullUrl that is not a lowercase urn:uuid / urn:oid / absolute URL (e.g. urn:uuid:patient-1, missing) becomes a deterministic UUID v5; every Reference found through the StructureDefinition snapshot that names an entry by its old fullUrl, a case-different UUID, Type/id or bare id is rewired to the entry's final fullUrl; invalid Bundle.id / resource.id are repaired; a Bundle.type fixed by the Bundle profile is set and a document's Composition moved first. CONTENT (only when the fix is unique; every change listed with its reason): display — a Coding display the terminology rejects is replaced by the code's display only when it is the SAME concept written differently: it equals a valid display / designation after normalising case, punctuation, word order, semantic tag or initialism, or searching the display in the code's own system (fhir_normalize_code) finds that code first (exactly, or sharing ≥ half its words). If the display names another concept (another code ranks first — the code is probably wrong) it is NOT changed: repair_issues + the validator error carry the codes the display denotes; ucum — a Quantity's UCUM code / system from its unit or code text (mmHg → mm[Hg], °C/degC → Cel, 次/分 → /min, a LOINC code in Quantity.code replaced), fitted to the profile's fixed code or required UCUM ValueSet ('min' / '1/min' where /min is fixed; mL/min/1.73m2 → mL/min/{1.73_m2}; μIU/mL → u[IU]/mL); a LOINC code in Quantity.code with no unit is reported (quantity-code-not-ucum) unless the profile allows only one unit (then set); roc-date — 民國 dates (115-10-03, 115/10/03, 民國115年10月3日) → +1911; timezone — a date-time without UTC offset (ROC or Gregorian) takes the site timezone: `timezone` (+08:00 / Asia/Taipei), else a site_config line `timezone: +08:00`, never guessed (else reported: timezone-required); 1–2-digit years reported; system — a non-absolute Coding.system (ICD-10-CM, LOINC, SNOMED CT) or an unknown / ValueSet URL → the one CodeSystem it names (installed CodeSystems + the FHIR R4 external list, URL fragment / last segment, a THO / core ValueSet of that name, a similarly named renamed CodeSystem, the element's bound ValueSets) that holds the code; shape — Coding given as {coding:[one]} / {type: …}, CodeableConcept given as a bare Coding, a code element given as a CodeableConcept, one-item arrays of single elements, a property misplaced one level (Dosage.doseQuantity → doseAndRate[0].doseQuantity, timing.route → dosage.route, doseAndRate.unit → doseQuantity.unit, entry.meta → resource.meta), resourceType from meta.profile, a Bundle without resourceType or with numbered entry keys ("entry[1]"), deep-equal duplicate fullUrl entries dropped; empty — {}, [], "", null removed (ele-1); fixed-slice — a required coding slice the profile fully fixes added; alt-coding — a code missing from the package's excerpt CodeSystem (e.g. an NHI drug code outside TW Core 1.0.0's 35-code medication-nhi-tw) but defined in a fuller installed copy, whose concept links to exactly one coding of another system the validator accepts and a bound ValueSet / coding slice contains (its ATC code), is replaced by that coding (or dropped when already present); CodeableConcept.text kept (set to the original display when absent); code — a required-binding code written as its display or in another case. A change is withdrawn (repair_issues) if the Bundle would get a validation error it did not have (a display error exposed on the Coding whose system was corrected does not count: it stays reported with candidates). v19: the whole result is checked — the finalized Bundle never has a validation error the Bundle as sent does not have (a change that would add one is withdrawn and listed in ambiguous; exposed_errors=allow_under_moved keeps a rename whose new location only shows errors the unknown property hid). v19 round 2 (validator-driven, only one correct fix): a code's display when the code is determined (no other code of its system is named so, the display shares a word with the code's names, no required binding rejects the code; the wording kept as CodeableConcept.text); a Coding's system when the bound ValueSet holds the code with exactly that display under one other system; a code written in the wrong element moved to the one sibling whose required ValueSet holds it (AllergyIntolerance.type 'medication' → category); a string element written as {text}; section entries of a type their section does not take moved to the one section that does. Returns {bundle, changes[{path, from, to, rule, reason?, pointer (RFC 6901 into the Bundle AS SENT), before, after, category, moved_to?}], ambiguous[{pointer, message, category, candidates[{description, patch? (RFC 6902 on the Bundle as sent)}]}] (several fixes possible, or the record must decide), repair_issues[{path, rule, message, candidates}], unresolved[{path, reference, candidates}], notes, id_map, summary}; a finalized Bundle yields changes = [] (idempotent, deterministic). Numbers keep the spelling you wrote (10.0 stays 10.0). Optional bundle_type sets Bundle.type (a profile-fixed type wins). Then validate with fhir_validate_bundle (or call it with normalize_ids=true).
- **fhir_validate_resource** — Validate a FHIR resource against an IG profile, in-process (source:builtin). Pre-flight only. extended_findings (present only when there is something to report, never part of issues): {summary: {errors, unverifiable, incomplete?}, findings: [{kind, severity, path, message, fix?}]} — what local data proves where validator_cli only warns: code-not-in-held-codesystem and unresolvable-profile / malformed-profile (errors, they stop fhir_release_check), no-local-data (unverifiable, counted). checked_fully means every check validator_cli would do was done. Optional source_text/site_config/evidence_map add grounding issues for this resource (is each value stated in the record). Without package_id the IG owning its meta.profile is used ('|version' pins a version; provenance.resolved_by). Issues may carry ranked suggestions [{value, kind, confidence, reason, patch}] (what to change the value to). Record checks (source record-checks, report only): a value that only says the information is absent (未取號 / 不詳 / unknown / pending) is an information-absent error and an identifier with the wrong format for its system (ROC national ID check digit, resident certificate) an identifier-format error; with source_text also event dates coarser than a day, a Quantity without value, a medicine as text only, a diagnosis the record leaves unconfirmed written as confirmed (the record's primary diagnosis slot, bracket-scoped cues), and every identifier / date / quantity value must be found in the record (ungrounded-value; normalised or derived, e.g. ROC dates, units, hospital day N) — a value of another time point or field is value-from-other-event (data.record_checks).
- **fhir_validate_bundle** — Validate a FHIR Bundle in-process: each entry's resource against its meta.profile plus internal reference integrity. extended_findings (present only when there is something to report, never part of issues): {summary: {errors, unverifiable, incomplete?}, findings: [{kind, severity, path, message, fix?}]} — what local data proves where validator_cli only warns: code-not-in-held-codesystem and unresolvable-profile / malformed-profile (errors, they stop fhir_release_check), no-local-data (unverifiable, counted). checked_fully means every check validator_cli would do was done. Optional source_text/site_config/evidence_map add grounding issues (is each value stated in the record). Without package_id the IG owning the meta.profile canonicals is used ('|version' pins a version; provenance.resolved_by). Issues may carry ranked suggestions [{value, kind, confidence, reason, patch}] (what to change the value to) and, for reference-chain errors, caused_by. Slice / profile-match errors (no known slice and slicing CLOSED, a required slice not found, no profile match for a reference) carry slice_match / profile_match: the closest slice or profile, which discriminator failed and how (meta.profile, resourceType, pattern value), and `blocking` — the errors against that profile that stop the match (fix those). fullUrl / reference / id errors (UUIDs must be valid, unresolved reference, bdl-7, invalid id) get the deterministic fix as suggestions plus a Bundle-level id_map / id_changes; normalize_ids=true applies that normalisation first (fhir_finalize_bundle) and validates the result (normalized_bundle, id_changes). Clinical content is never changed. Record checks (source record-checks, report only): a value that only says the information is absent (未取號 / 不詳 / unknown / pending) is an information-absent error and an identifier with the wrong format for its system (ROC national ID check digit, resident certificate) an identifier-format error; with source_text also event dates coarser than a day, a Quantity without value, a medicine as text only, a diagnosis the record leaves unconfirmed written as confirmed (the record's primary diagnosis slot, bracket-scoped cues), and every identifier / date / quantity value must be found in the record (ungrounded-value; normalised or derived, e.g. ROC dates, units, hospital day N) — a value of another time point or field is value-from-other-event (data.record_checks).
- **fhir_check_fact_coverage** — Check a fact list against the record and the Bundle (deterministic, no LLM). Per fact {item, attribute, value, quote}: (1) the quote must be a substring of source_text (full-width / whitespace normalised) — else quote_not_in_record (fabricated basis); (2) the clause around the quote must not negate it or mark it old / pending / not applicable / not established / not done — else not_usable (do not write it; if the conversion target needs it, the case is insufficient_information); (3) the value must be in a STRUCTURED element of an entry of the fact's resource type (text, display, note, narrative do not count), compared with terminology equivalence: PO ↔ route coding (SNOMED 26643006 or an IG route code naming it), BID ↔ Timing.repeat frequency 2 / period 1 d or timing.code, ROC (民國) ↔ ISO dates, unit conversions (0.5 g = 500 mg), number spellings, codes by code or by the coding's display / terminology names — else missing (with found_elsewhere when it sits in another resource type); (4) each missing fact gets suggested_paths from the entry profile's authoring fields. Returns facts: [{index, status: covered|missing|quote_not_in_record|not_usable, reason_code, reason, resource_types, found_at?: [{pointer (RFC 6901), path, value, how}], found_elsewhere?, suggested_paths?, markers?, clause?}] and summary {total, covered, missing, quote_not_in_record, not_usable, coverage, complete}. Generic for all IGs.
- **fhir_release_check** — The final release gate for a converted Bundle. release=true only if ALL hold: the official validator reports 0 errors (the fhir_validate_bundle pipeline; an MCP fallback, unverified codes or no official engine → not-officially-verified); grounding + record checks against source_text report 0 BLOCKING errors (each content finding has gate blocking|advisory; advisory errors are returned in content.advisory_errors but do not stop the release); fact coverage is complete when facts are given (fhir_check_fact_coverage); completeness: every `targets` item is present (count ≥ min, else missing-target), or without targets the Bundle profile's required entry slices are present and a single-entry Bundle is not accepted when the facts name several resource types (suspected-empty-bundle); with neither targets nor facts → incomplete-input (never released). Returns {release, next: send|fix|insufficient_information, reasons: [{code, message, pointer?, count, check}], validation, content, facts, completeness}. Reason codes: validation-failed, validation-error, not-officially-verified, grounding-error, record-check-error, no-source-text, fact-missing, fact-in-other-resource, quote-not-in-record, unusable-fact-written, missing-target, insufficient-information, missing-entry-slice, suspected-empty-bundle, incomplete-input. next=insufficient_information when a missing target's facts are absent from the record or unusable: do not send — the case cannot be converted automatically. Never send a Bundle with release=false.
- **fhir_check_grounding** — Deterministic faithfulness check of a Bundle against the source clinical record: every populated clinical fact and code must be supported by record text (evidence map or auto-locate), with date/number/unit/identifier/dose/frequency normalisation and section, negation and history rules. Returns issues in the fhir_validate_bundle shape. No LLM.
- **fhir_check_completeness** — Gap report: compare the facts that the conversion targets require (profile-required plus target-implied elements) with what the record states, and return the missing items, the record lines that state absence, a template clarification question and a ready insufficient_information object. Deterministic, no LLM.
- **fhir_get_resource_skeleton** — Get a blanked, annotated fill-form for authoring a resource against a profile (paths, cardinality, types, candidate codes, examples). Each field's `required` is the element's own min>=1; `effectiveRequired` also requires every ancestor to be required. For the complete required list (slices, invariants, where each value comes from) call fhir_get_profile_required_elements.
- **fhir_finalize_resource** — Finalize a draft resource you wrote as FHIR JSON against a profile, then validate it. Never invents content: sets meta.profile; pins fixed / pattern values only where the draft already has the parent node, including slice members the slicing discriminators identify (a component whose code is the systolic LOINC gets the slice's unit system / code, an identifier whose type matches gets the slice's system / use) and items tagged `_slice: <name>` at any depth (the tag is always removed, also when it names no slice); fills Coding.system when the bound ValueSet has a single system; rewrites references written as {reference: <key>} to the context's urn:uuid (context_id + key); generates the narrative; validates like fhir_validate_resource (issues carry suggestions). repair="content" (default; "ids" = off) first applies the same uniquely-determined content repairs as fhir_finalize_bundle — display of the SAME concept only (a display naming another concept is kept and reported with the codes it denotes), UCUM codes from unit text fitted to the profile, ROC (民國) dates, the site timezone (`timezone` / site_config) for date-times without an offset, Coding.system names / unknown URLs, lossless shape fixes, empty elements, required fixed coding slices, required-binding code spellings — listed in `changes`, undecidable ones in `repair_issues` (and on the validator issue as `repair`). Returns {resource, validation, changes, repair_issues, coerced, narrated, pinned, pinnedSlices, contextId, reference}; numbers keep the spelling you wrote. Does not auto-loop. Prefer fhir_author_resources when you have field VALUES rather than a drafted resource: it composes the resource for you (no raw FHIR JSON) and keeps it in a context for fhir_assemble_bundle.
- **fhir_get_authoring_fields** — The WRITING form of a profile: which fields to give fhir_author_resources, how, and which ones the MCP fills itself. Returns `fields` (required / expected / commonly used in the IG's own examples — see `why`), `more` ({field, kind} of the remaining mustSupport fields; include_more=false omits it) and `omitted` (fields dropped for size, never silent). Each field: `field` = FHIR element path relative to the resource ('identifier:mrn' = slice, 'value[x]' = choice, 'component:SystolicBP' = one component); `kind` + `format` say how to write the value; `source` says where it comes from (record / facility / code / fixed / default / derived); `binding.codes` lists small code sets (larger ones: fhir_normalize_code / fhir_expand_valueset); `targets` = reference types; `children` = sub-fields of components / dosage / names / backbones. Record links are listed too: a backbone that links another resource of the IG (Encounter.diagnosis {condition, use, rank}) is a field with its children and an example such as {condition: {ref: 'dx1'}}; a plain reference to one (Encounter.reasonReference, Condition.encounter) is in `more` with its `targets`. The whole response stays within 6,000 characters (`response_chars`); what does not fit moves to `more` / is counted in `omitted`. Fields with `auto: true` (fixed, default, derived) need NOT be filled — the MCP supplies them (`value` shows what); `pins` shows the parts the profile fixes inside a field you still fill (identifier system, component code, unit). Defaults are auto only on REQUIRED elements (e.g. Observation.status → final); an optional element with a conventional value (Patient.active, Immunization.primarySource …) is listed as a normal optional field whose `format` / `example` show that value — give it only when the record states it (fhir_author_resources never fills it; apply_defaults="none" turns the required ones off too). `source: 'derived'` WITHOUT `auto` = a value the record determines without writing it literally (Condition.verificationStatus: confirmed when the diagnosis field — Dx / Impression / A: / 診斷 — states it without hedging, provisional / differential when hedged; Observation.interpretation from the value's H / L / HH / LL / ↑ / ↓ flag or its reference range, N inside it; MedicationRequest.category from 出院帶藥 / 門診 / 住院): it IS a record fact — write it whenever the record carries the cue (`format` says how); the content checks report it missing.A display you write for a code is checked and replaced by the code's own display when the terminology rejects it; a single object where a field repeats is wrapped into an array (fhir_author_resources results[].notes). Never invent values: give only what the record states; a missing required value is reported as `missing`, not guessed. Value grammar (fields object of fhir_author_resources): scalars as JSON; codeableConcept/coding {system, code, display?} or [{...}] or {text}; quantity {value, unit} or '95 mg/dL'; date/dateTime ISO (2026-06-15, 2026-06-15T06:00) or ROC (115/06/15); period {start, end?}; identifier {value, system?}; reference {ref: '<key of another resource in the context>'} or {reference: 'Type/id'}; choice value[x] → give `value`, its shape picks the type; component:<slice> {value: ...}; humanName {text} or {family, given[]}; dosage {text?, route?, dose?, frequency?, period?, asNeeded?}. Example: {"profile": "Observation-bloodPressure-twcore"} → fields such as {field: 'component:SystolicBP', kind: 'component', required: true, source: 'record', example: {value: {value: 12.5, unit: 'mm[Hg]'}}}. Examples illustrate the shape only. profile = id or canonical (|version honoured); package_id / version pick the IG as in the other fhir_* tools.
- **fhir_author_resources** — Author FHIR resources from FIELD VALUES — you give {key, profile, fields}, the MCP composes each resource for its profile (meta.profile, fixed / pattern values, displays, UCUM units, ROC dates → ISO), validates it and stores it in a per-task context so fhir_assemble_bundle can build the Bundle later. Never write raw FHIR JSON yourself; never invent values: anything the record does not give is reported in data.results[].missing. WORKFLOW: (1) plan one key per resource (patient-1, enc-1, cond-1, obs-bp …); (2) call fhir_get_authoring_fields(profile) once per profile to see the fields, kinds, bindings and value grammar; (3) call this tool WITHOUT context_id for the first batch — up to 8+ resources per call — and keep data.context_id; (4) cross references are {ref: "<key>"} (another key of the same context, even one not authored yet: status refs_pending, resolved at assembly; cycles such as Encounter.diagnosis ↔ Condition.encounter are fine); (5) fix a result with status invalid by resending ONLY the changed fields with the same key and merge=true — the issues carry key, field (your field name), path (FHIR path) and suggestions; (6) fhir_assemble_bundle(context_id, keys, bundle_type). VALUE GRAMMAR: scalars as JSON; code / coding / codeableConcept as {system, code, display?} (array for several; {text} when no required binding); quantity as {value, unit} or "95 mg/dL"; dates ISO 2026-06-15 / 2026-06-15T06:00 or ROC 115/06/15; period {start, end?}; identifier {value, system?, type?}; reference {ref: "key"} or {reference: "Patient/123"} for external; value[x] as `value` (the kind follows the shape); component as [{code, value}]; dosage {text?, route?, dose?, timing?}. Example: {"resources": [{"key": "patient-1", "profile": "Patient-twcore", "fields": {"identifier": {"value": "A123456789", "type": "NNxxx"}, "name": {"text": "王小明"}, "gender": "male", "birthDate": "80/03/15"}}, {"key": "obs-glucose", "profile": "Observation-laboratory-result-twcore", "fields": {"status": "final", "code": {"system": "http://loinc.org", "code": "2345-7"}, "subject": {"ref": "patient-1"}, "effectiveDateTime": "2026-06-15T06:00", "value": "95 mg/dL"}}]} → {context_id, storage, results: [{key, status: valid | invalid | refs_pending, resource (full), provenance (path → model | fixed | default | derived | lookup), missing: [{field, why}], refs: {resolved, pending}, issues: [{key, field, path, severity, message, suggestions?}], notes: [string]}], summary, settings: {timezone, apply_defaults, site_config_lines}}. Contexts expire after 60 min idle (every call refreshes); an unknown / expired context_id returns error.code CONTEXT_EXPIRED — then start over without context_id and re-author everything. storage="memory" means Redis is unavailable and a server restart loses the context. A time without a UTC offset (2026-06-15T06:00) is an error unless `timezone` (e.g. "+08:00", the facility's offset — remembered on the context) is given; an offset is never guessed. Numbers keep the spelling you wrote (12.50 stays 12.50). CORRECTIONS (listed in results[].notes; the same shared rules as fhir_finalize_bundle / fhir_finalize_resource repair=content): a display you wrote that the terminology rejects for a known code is replaced by the code's display ONLY when it is the same concept written differently — it equals a valid display / designation after normalising case, punctuation, word order, plural, roman numerals or initialism, or searching your display in the code's system finds that code first (exact, or sharing ≥ half its words); your wording moves to CodeableConcept.text when that is empty; the code is kept. A display that names ANOTHER concept (another code ranks first) is kept: a warning lists the codes it denotes — fix the code or the display. UCUM codes come from unit text (mmHg → mm[Hg], 次/分 → /min) fitted to the profile's fixed code / required UCUM ValueSet; a Coding.system written as a name (ICD-10-CM, LOINC) or an unknown URL gets the one CodeSystem it names that holds the code; a repair that would add a validation error is withdrawn and reported. A Coding.system that is a ValueSet URL (e.g. …/ValueSet/loinc-type-doc-code, or its /CodeSystem/ twin) gets the CodeSystem the code has in that ValueSet (http://loinc.org) when it is exactly one — several → an error with candidates; a system URL that resolves to nothing (e.g. http://terminology.hl7.org/CodeSystem/route) gets the one CodeSystem of the element's bound ValueSets (slices / additional bindings included) that holds the code (exact, else case-insensitive, else an exact display) — ambiguous or not found → left as written, the validation error carries suggestions; never guessed (provenance lookup, note "system corrected for …"); a single object / value given where FHIR repeats (e.g. code: {coding: {system, code}}) is wrapped into an array. DEFAULTS: apply_defaults="required" (default) fills the conventional value (Observation.status final, Encounter.status finished …) or the profile's defaultValue only for elements the profile REQUIRES; optional ones (Patient.active, Immunization.primarySource …) are never auto-filled — give them when the record states them; apply_defaults="none" fills no default (required ones then show in missing). Remembered on the context. site_config: the facility settings text (the same text fhir_check_grounding takes, e.g. "病歷號 system: https://hospital.example.tw/mrn\n機構: 範例醫院 醫事機構代碼 0123456789"): every http(s) URL in it is an accepted identifier system and its lines ground organisation / practitioner identifier values; stored on the context (passing it again adds new lines) and used by fhir_assemble_bundle's grounding (source_text). Never logged, never echoed. Read-only apart from the context; the profile is resolved like every other fhir_* tool (package_id / version optional).
- **fhir_context** — Inspect or trim the per-task authoring context that fhir_author_resources fills (context_id from its response). action=list → every stored key with resourceType, profile, status (valid | invalid | refs_pending), refs, counts of missing / errors / warnings — use it before fhir_assemble_bundle to check that every referenced key exists and nothing is invalid. action=get + key → that resource's full result (resource, provenance, missing, refs, issues) exactly as fhir_author_resources returned it. action=delete + key → remove one resource (e.g. authored under a wrong key); action=delete without key → discard the whole context when the task is finished. Every call refreshes the context's 60-min idle TTL; an unknown or expired context_id returns error.code CONTEXT_EXPIRED (start over with fhir_author_resources without context_id). Never changes a resource — fix values with fhir_author_resources(merge=true).
- **fhir_assemble_bundle** — Build the final Bundle from resources authored with fhir_author_resources: pass the context_id and the keys in the entry order you want. Each entry gets fullUrl = the deterministic urn:uuid of its key (the same urn the stored references already use), the Bundle is finalised like fhir_finalize_bundle with repair="content" (ids, references, document → Composition first, a Bundle.type fixed by bundle_profile wins, plus the uniquely-determined content repairs — listed in changes, undecidable ones in repair_issues) and validated like fhir_validate_bundle; with source_text it is also grounded against the record (fhir_check_grounding rules). With bundle_profile, entries are placed into the profile's entry slices BEFORE validation (meta.profile completed for a resource authored for its slice's profile; slice order when the slicing is ordered) and bundle_slices reports the placement, `missing` required slices (author them — never invented), `excess` and `unmatched` (closed slicing). Same context + same keys → byte-identical Bundle. REFUSES (ok=false, no Bundle) when: a key is not stored (KEY_NOT_FOUND); a stored resource references a key that is not in keys or not in the context (UNRESOLVED_REFERENCE — error.refused lists key, field, ref_key); a stored resource is invalid (INVALID_RESOURCE — error.refused lists key + field + error; fix with fhir_author_resources merge=true, or pass allow_invalid=true only if the user accepts an invalid Bundle); bundle_type=document without an authored Composition (MISSING_COMPOSITION — error.missing.fields lists what the Composition needs; author it, it is never invented). A document also needs Bundle.identifier and Bundle.timestamp (bdl-9 / bdl-10): pass `identifier` {system, value} and `timestamp` from the record — never invented. site_config (facility settings text, as fhir_check_grounding / fhir_author_resources take it) is merged with the context's and used by the grounding (with source_text): identifier systems named in it (e.g. "病歷號 system: https://hospital.example.tw/mrn") and organisation values stated in it are grounded as site_config instead of being flagged. Never logged. Returns {context_id, bundle, keys (final entry order), bundle_slices?, validation: {valid, issues: [{key, field, path, severity, message, suggestions?}], checked_fully …}, changes, unresolved, notes, included_invalid}. Example: {"context_id": "<id>", "keys": ["composition-1", "patient-1", "enc-1", "cond-1"], "bundle_type": "document", "bundle_profile": "Bundle-twcore"}. Fix validation issues by resending only the changed fields of the named key with fhir_author_resources(merge=true), then assemble again. An unknown / expired context_id (60-min idle TTL) returns CONTEXT_EXPIRED: start over with fhir_author_resources without context_id.
- **fhir_get_bundle_blueprint** — STEP 1 for writing a Bundle that must conform to a Bundle profile (e.g. a prior-authorization / claim / document Bundle of an IG): the profile's BLUEPRINT in <= 4,000 characters. Returns `slices` (every entry slice: name, min..max, the resource profile it requires — the profile canonical is profile_base + the name shown), `entry.slicing` (discriminator and whether slicing is CLOSED — then an entry matching no slice is an error — or open / ordered), `type` (Bundle.type when fixed), `references` (the references between slices the slice profiles require, also inside extensions and sliced backbones, e.g. 'claim: extension:encounter.valueReference -> encounter', 'coverage: payor -> organizationOrg'; 'if X used' = required when that optional part is present) and `recipe` (how to write it: set every entry's resource.meta.profile to its slice's profile, include every required slice, fullUrl = urn:uuid, references = the target entry's fullUrl). view='references' lists every reference line when `omitted.references` > 0. FLOW: blueprint -> fhir_get_minimal_skeleton(profile, package_id) for each slice profile you need (which required values come from the record and which do not) -> write the resources (your own JSON, or fhir_author_resources + fhir_assemble_bundle) -> fhir_finalize_bundle / fhir_validate_bundle with bundle_profile. bundle_profile = id or canonical (|version honoured); package_id / version pick the IG as in the other fhir_* tools.
- **fhir_get_minimal_skeleton** — The MINIMAL LEGAL instance of a profile plus WHERE EACH REQUIRED VALUE COMES FROM — call it before writing a resource, especially for profiles with many required elements. Returns `skeleton` (JSON with every required element, recursively: required slices, extensions (url + value), fixed / pattern values already filled in, meta.profile set; replace each <...> placeholder) and `table` rows [path, value_source, how]. value_source: ig-constant = fixed / pattern of the profile, or a value IDENTICAL in every one of the IG's own example instances (>= 2): a workflow status the IG always uses, or the identity of a NATIONAL payer / authority organization (an Organization profile the IG's payor / insurer references target, or typed govt / pay / ins) — copy it; an example hospital, clinic, lab, practitioner or patient is never ig-constant (its name / identifier / telecom / address are `record`); code-lookup = pick a code (small bindings list their codes, larger ones name the ValueSet: fhir_normalize_code / fhir_expand_valueset); text-allowed = {text} alone is valid (the binding is not required and coding is optional); derivable = computed without a record fact (a reference = the target entry's fullUrl, 1-2-3 numbering, a workflow default, a derivation rule, the date a request was written = the record's date for it, else the visit / document date) — or a value the record determines without writing it ('derive from the record: …' rows: Condition.verificationStatus from the diagnosis field, Observation.interpretation from the value's H / L flag or reference range, MedicationRequest.category from 出院帶藥 / 門診 / 住院: write it from that cue); record = a fact the record must state. ONLY `record` rows need the record: a missing ig-constant / code-lookup / text-allowed / derivable value is never a reason to refuse. `conditional` rows are required when the profile rule in `conditions` applies (e.g. 'sequence=1 implies ...'); `rules` / `more_rules` are the profile's other invariants. Elements not in the skeleton are optional. <= 6,000 characters (`omitted` counts rows dropped for size). FLOW: fhir_get_bundle_blueprint (for a Bundle) -> this tool per profile -> write the resource -> fhir_finalize_resource / fhir_validate_resource (or fhir_finalize_bundle for the Bundle). profile = id or canonical (|version honoured); pass the package_id of the IG you write for (its examples are the basis of the example constants).
- **fhir_get_bundle_form** — A PREFILLED FORM of a Bundle profile: a skeleton Bundle whose STRUCTURE IS ALREADY CORRECT — fill the values, do not restructure. Holds every required entry slice plus your planned `entries` (profile id / canonical, `count`), each entry a complete resource (meta.profile, required elements, fixed / pattern values, required extensions and slices), Bundle.type / meta.profile, fullUrls (urn:uuid) and every internal reference wired (also inside extensions; entries a required reference needs are added); a document Bundle has the Composition first, its required sections (+ the section a planned entry belongs to) and section.entry wired, and identifier / timestamp. Every value the record (or a code lookup) must give is a token "<<P<n>:<value_source>>>" at placeholders[n].pointer (RFC 6901 into `bundle`) with `type` (FHIR datatype: replace the token with a JSON value of it; Reference = {"reference": an entry fullUrl}), `what`, `value_source` (record | code-lookup | text-allowed | derivable), `required`, optional `allowed` (pick one; a code: also its system), `target`, `example` (an IG example value / a code of the binding — never copy it as a record fact), `format` (regex), `rules` (profile rules the value triggers; an allowed code with `triggers` needs more content). required=false = delete it when the record has no value (see if_empty). `prefilled` = defaults already set (change only if the record says otherwise). Then fhir_finalize_bundle / fhir_validate_bundle with bundle_profile. bundle_profile = id or canonical; package_id / version pick the IG as in the other fhir_* tools; bundle_type only when the profile does not fix Bundle.type.
- **query_fhir_condition** — Generate a FHIR R4 Condition resource from an ICD-10-CM code or a diagnosis keyword. Provide exactly one of icd_code (Path A — full field support) or diagnosis_keyword (Path B — search-first; only patient_id/clinical_status/verification_status/severity applied).
- **validate_fhir_condition** — Validate a FHIR R4 Condition resource for required fields (resourceType/code/subject) and status presence. Basic structural validation only.
- **query_fhir_medication** — Generate a FHIR R4 Medication or MedicationKnowledge resource for a TFDA drug. Provide exactly one of license_id (Path A — direct) or keyword (Path B — search-first). Derived from normalized TFDA data only (no RxNorm).
- **validate_fhir_medication** — Validate structure and core field semantics of FHIR Medication / MedicationKnowledge resources (resourceType, code.coding, ingredient items). Basic validation only.

## Claude Desktop Quick Installation
Remote MCP endpoint (confidence: high). Install path detected from listing signals. Add as a URL/SSE server in your client:

```json
"mcpServers": {
  "taiwan-health-mcp": {
    "url": "https://tw-health-mcp.healthymind-tech.com/mcp"
  }
}
```

## Documentation

## What Taiwan-Health-MCP does

Taiwan-Health-MCP provides MCP tools for working with healthcare data and terminology used in Taiwan and in FHIR-based systems. Its coverage includes ICD-10-CM and ICD-10-PCS, SNOMED CT International, LOINC, RxNorm, FHIR R4, Taiwan FDA drug records, and Taiwan-specific BMI thresholds. It also includes tools for risk scores, disease activity measures, laboratory interpretation, and FHIR resource workflows.

The repository describes 73 tools across terminology, FHIR, drug and nutrition data, clinical calculators, FHIR server administration, and system health. Some module tools are registered only when their source data is loaded.

## How it works

The project is a Node.js and TypeScript server built with the official MCP SDK. Clients can connect through the hosted streamable-HTTP endpoint or run the stack locally with Docker Compose. Terminology searches can combine BM25 keyword retrieval with vector-based ranking; when embeddings are unavailable or incomplete, searches fall back to keyword behavior.

FHIR connectivity is controlled through administrator-configured server entries. Agents can list configured servers, inspect their stored status, and use standard resource paths for controlled REST operations. Write operations require both an allowed operation and `confirm_write=true`; arbitrary URLs are not accepted.

## Setup and configuration

For hosted use, configure an MCP client with:

`https://tw-health-mcp.healthymind-tech.com/mcp`

The repository names Cursor, VS Code, Claude Code, and Claude Desktop as connection options. Claude Code can be configured with the HTTP transport, while Claude Desktop uses its custom connector settings. Other clients supporting MCP streamable HTTP can use the same endpoint.

For self-hosting, clone the repository, copy `.env.example` to `.env`, set deployment values such as the database password and administrator settings, then start the services with Docker Compose:

```bash
git clone https://github.com/healthymind-tech/Taiwan-Health-MCP.git
cd Taiwan-Health-MCP
cp .env.example .env
docker compose up -d
```

A local deployment exposes MCP at `http://<host>:8080/mcp` and provides an administrator interface at `http://<host>:8080/admin`. Data imports and embedding jobs are handled by the background worker.

## Tools and capabilities

- Search ICD-10-CM, ICD-10-PCS, FHIR Implementation Guide CodeSystems, LOINC, and SNOMED CT concepts.
- Browse ICD-10-CM categories, inspect hierarchy neighbors, compare diagnosis and procedure metadata, and map ICD-10-CM to SNOMED CT in both directions.
- Look up LOINC details, interpret individual results, or process a panel against age- and gender-stratified reference ranges.
- Query SNOMED CT hierarchies and non-IS-A clinical relationships.
- Search Taiwan FDA drug records and identify pills from appearance keywords such as color, shape, and imprint-related terms.
- List and inspect configured FHIR servers, then perform controlled FHIR REST operations against permitted resources.
- Validate, normalize, assemble, and inspect FHIR resources using the project’s FHIR Implementation Guide tooling.
- Calculate CHA₂DS₂-VASc, Wells PE and DVT, DAS28, CDAI, BMI, eGFR, HAS-BLED, CURB-65, qSOFA, and GCS scores.
- Run `health_check` before workflows to verify runtime and module-backed service readiness.

## Limitations and notes

Clinical calculators are decision-support utilities, not substitutes for clinical judgment. Reference ranges from laboratory interpretation are general guidance. The calculator inputs use specific units and scales: for example, BMI expects height in centimeters, eGFR accepts creatinine in mg/dL, and DAS28 distinguishes ESR from CRP formulas.

FHIR server access is limited to servers registered by an administrator, and secrets are excluded from server discovery and status responses. Most tools are read-only; `crud_fhir_server` is the exception and applies allow-list and confirmation requirements.

Tool availability depends on loaded module data. An available search tool does not guarantee that embeddings are complete, and responses may indicate keyword-only search. The server contains healthcare information and coding utilities, but its calculator and interpretation outputs should be reviewed in context before use.

_Full upstream README: https://allmcps.com/mcp/taiwan-health-mcp/readme_

