Metadata-Version: 2.4
Name: medxpert-ortho-mcp
Version: 0.1.0
Summary: Orthopedic device testing connector MCP server: lab matching, quotations, UDI, dual-temporal standards lookup, judgment trees, region routes, timelines, gap reports. Offline, zero dependencies, illustrative sample data.
Author-email: "Zhao Xinghua (Steven Zhao)" <zhaoxinghua09@gmail.com>
License:                                  Apache License
                                   Version 2.0, January 2004
                                http://www.apache.org/licenses/
        
           TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
        
           1. Definitions.
        
              "License" shall mean the terms and conditions for use, reproduction,
              and distribution as defined by Sections 1 through 9 of this document.
        
              "Licensor" shall mean the copyright owner or entity authorized by
              the copyright owner that is granting the License.
        
              "Legal Entity" shall mean the union of the acting entity and all
              other entities that control, are controlled by, or are under common
              control with that entity. For the purposes of this definition,
              "control" means (i) the power, direct or indirect, to cause the
              direction or management of such entity, whether by contract or
              otherwise, or (ii) ownership of fifty percent (50%) or more of the
              outstanding shares, or (iii) beneficial ownership of such entity.
        
              "You" (or "Your") shall mean an individual or Legal Entity
              exercising permissions granted by this License.
        
              "Source" form shall mean the preferred form for making modifications,
              including but not limited to software source code, documentation
              source, and configuration files.
        
              "Object" form shall mean any form resulting from mechanical
              transformation or translation of a Source form, including but
              not limited to compiled object code, generated documentation,
              and conversions to other media types.
        
              "Work" shall mean the work of authorship, whether in Source or
              Object form, made available under the License, as indicated by a
              copyright notice that is included in or attached to the work
              (an example is provided in the Appendix below).
        
              "Derivative Works" shall mean any work, whether in Source or Object
              form, that is based on (or derived from) the Work and for which the
              editorial revisions, annotations, elaborations, or other modifications
              represent, as a whole, an original work of authorship. For the purposes
              of this License, Derivative Works shall not include works that remain
              separable from, or merely link (or bind by name) to the interfaces of,
              the Work and Derivative Works thereof.
        
              "Contribution" shall mean any work of authorship, including the
              original version of the Work and any modifications or additions
              to that Work or Derivative Works thereof, that is intentionally
              submitted to Licensor for inclusion in the Work by the copyright owner
              or by an individual or Legal Entity authorized to submit on behalf of
              the copyright owner. For the purposes of this definition, "submitted"
              means any form of electronic, verbal, or written communication sent
              to the Licensor or its representatives, including but not limited to
              communication on electronic mailing lists, source code control systems,
              and issue tracking systems that are managed by, or on behalf of, the
              Licensor for the purpose of discussing and improving the Work, but
              excluding communication that is conspicuously marked or otherwise
              designated in writing by the copyright owner as "Not a Contribution."
        
              "Contributor" shall mean Licensor and any individual or Legal Entity
              on behalf of whom a Contribution has been received by Licensor and
              subsequently incorporated within the Work.
        
           2. Grant of Copyright License. Subject to the terms and conditions of
              this License, each Contributor hereby grants to You a perpetual,
              worldwide, non-exclusive, no-charge, royalty-free, irrevocable
              copyright license to reproduce, prepare Derivative Works of,
              publicly display, publicly perform, sublicense, and distribute the
              Work and such Derivative Works in Source or Object form.
        
           3. Grant of Patent License. Subject to the terms and conditions of
              this License, each Contributor hereby grants to You a perpetual,
              worldwide, non-exclusive, no-charge, royalty-free, irrevocable
              (except as stated in this section) patent license to make, have made,
              use, offer to sell, sell, import, and otherwise transfer the Work,
              where such license applies only to those patent claims licensable
              by such Contributor that are necessarily infringed by their
              Contribution(s) alone or by combination of their Contribution(s)
              with the Work to which such Contribution(s) was submitted. If You
              institute patent litigation against any entity (including a
              cross-claim or counterclaim in a lawsuit) alleging that the Work
              or a Contribution incorporated within the Work constitutes direct
              or contributory patent infringement, then any patent licenses
              granted to You under this License for that Work shall terminate
              as of the date such litigation is filed.
        
           4. Redistribution. You may reproduce and distribute copies of the
              Work or Derivative Works thereof in any medium, with or without
              modifications, and in Source or Object form, provided that You
              meet the following conditions:
        
              (a) You must give any other recipients of the Work or Derivative
                  Works a copy of this License; and
        
              (b) You must cause any modified files to carry prominent notices
                  stating that You changed the files; and
        
              (c) You must retain, in the Source form of any Derivative Works
                  that You distribute, all copyright, patent, trademark, and
                  attribution notices from the Source form of the Work; and
        
              (d) If the Work includes a "NOTICE" text file as part of its
                  distribution, then any Derivative Works that You distribute must
                  include a readable copy of the attribution notices contained
                  within such NOTICE file.
        
           5. Submission of Contributions. Unless You explicitly state otherwise,
              any Contribution intentionally submitted for inclusion in the Work
              by You to the Licensor shall be under the terms and conditions of
              this License, without any additional terms or conditions.
        
           6. Trademarks. This License does not grant permission to use the trade
              names, trademarks, service marks, or product names of the Licensor.
        
           7. Disclaimer of Warranty. Unless required by applicable law or agreed
              to in writing, Licensor provides the Work (and each Contributor
              provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES
              OR CONDITIONS OF ANY KIND, either express or implied.
        
           8. Limitation of Liability. In no event and under no legal theory shall
              any Contributor be liable to You for damages, including any direct,
              indirect, special, incidental, or consequential damages of any
              character arising as a result of this License or out of the use or
              inability to use the Work.
        
           9. Accepting Warranty or Additional Liability. While redistributing the
              Work or Derivative Works thereof, You may choose to offer, and charge
              a fee for, acceptance of support, warranty, indemnity, or other
              liability obligations and/or rights consistent with this License.
        
           END OF TERMS AND CONDITIONS
        
           APPENDIX: How to apply the Apache License to your work.
        
              To apply the Apache License to your work, attach the following
              boilerplate notice, with the fields enclosed by brackets "[]"
              replaced with your own identifying information.
        
           Copyright 2026 赵兴华 / Steven Zhao·China（ORCID 0009-0001-0512-1237）
        
           Licensed under the Apache License, Version 2.0 (the "License");
           you may not use this file except in compliance with the License.
           You may obtain a copy of the License at
        
               http://www.apache.org/licenses/LICENSE-2.0
        
           Unless required by applicable law or agreed to in writing, software
           distributed under the License is distributed on an "AS IS" BASIS,
           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
           See the License for the specific language governing permissions and
           limitations under the License.
        
        ------------------------------------------------------------------------------
        CONTENT NOTICE
        ------------------------------------------------------------------------------
        The source code of this repository is licensed under the Apache License 2.0
        above. No proprietary knowledge base is bundled; any sample or user-supplied
        content remains the property of its original owner.
        
        Brand status: MedXpert / SynomosAI / LGD are project identifiers only; none
        is a registered legal entity and none has a registered trademark. Their
        appearance is for source identification only and does not constitute any
        claim to a legal entity or trademark right.
        
        Disclaimer: content is not regulatory, legal, or medical advice. Always rely
        on the latest official publication of the competent authority.
        
Project-URL: Homepage, https://medxpert.cn
Project-URL: Repository, https://github.com/zhaoxinghua09-cell/medxpert-ortho-mcp
Project-URL: Issues, https://github.com/zhaoxinghua09-cell/medxpert-ortho-mcp/issues
Keywords: mcp,model-context-protocol,medical-device,orthopedic,udi,standards,offline
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Healthcare Industry
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# medxpert-ortho-mcp · Orthopedic device testing connector

**English first, Chinese below.**

An MCP server with 8 tools for orthopedic device testing work: lab matching, quotation estimation,
UDI checks, dual-temporal standards lookup, class/path judgment trees, region routes,
registration timelines and gap reports. Offline, standard library only, zero dependencies.

It exists because four MedXpert expert packs (`medxpert-standards`, `medical-device-reg-translator`,
`medical-device-testing-link`, `med-device-compliance-toolkit`) had been referencing a connector called
`medxpert-ortho-mcp` that was never built. This is that connector, built.

## What is real and what is sample

| Aspect | Status |
|---|---|
| The server, the 8 tools, the protocol layer | **Real.** Implemented, unit-tested, published to PyPI and to the official MCP Registry |
| The datasets shipped in `datasets/` | **Sample.** Invented labs, invented prices, invented UDI-DIs. Illustrative only |
| Every tool result | Carries `sample_data: true` until you set `ORTHO_DATA_DIR` |

The bundled data is **not** an accreditation directory, **not** a price commitment, and **not**
a regulatory conclusion. Point `ORTHO_DATA_DIR` at your own JSON files to use real evidence.

## Run

```bash
uvx medxpert-ortho-mcp          # stdio MCP server
python -m medxpert_ortho.server --selftest   # offline self-test, no host needed
```

MCP host configuration:

```json
{"mcpServers": {"medxpert-ortho-mcp": {"command": "uvx", "args": ["medxpert-ortho-mcp"]}}}
```

Custom data directory:

```json
{"mcpServers": {"medxpert-ortho-mcp": {
  "command": "uvx", "args": ["medxpert-ortho-mcp"],
  "env": {"ORTHO_DATA_DIR": "/path/to/your/datasets"}}}}
```

## Tools

| Tool | What it does | Honest limit |
|---|---|---|
| `match_labs` | Ranks labs by capability keyword, region and device description | Sample data has 3 labs and a few capability items |
| `calc_quote` | Price range by lab and scope, total estimated by quantity (>included samples +12%) | Prices are illustrative; not a commercial offer |
| `check_udi` | 14-digit UDI-DI lookup, returns class / sterile / single-use | Misses are explained as sample-data scope, not proof of absence |
| `query_standard` | Keyword search with `as_of` dual-temporal judgement (in force? superseded?) | Status fields are demo logic; verify against the official current version |
| `find_judgment_tree` | Step-by-step classification / route questions | A demo tree, not a review decision |
| `get_region_path` | Authority, route note and required documents per region | Sample routes only for CN / CN-JS / CN-SH |
| `check_timeline` | Expands relative days into calendar dates, marks completed / in_progress / not_started, flags overdue | Durations are illustrative; official clocks start at acceptance |
| `report_gap` | Compares present documents against the required checklist | Checklist is sample data |

## Design notes

- **Zero dependencies.** JSON-RPC 2.0 over stdin/stdout, implemented with the standard library only.
  No network calls at runtime; nothing leaves the machine.
- **Provenance in every answer.** A tool that cannot say whether it answered from sample data or
  from your own data is a tool you cannot audit, so every result says which.
- **Mismatch is reported, not smoothed over.** A UDI miss says "sample scope", a tree miss lists what
  trees exist, an empty lab match returns a hint rather than an empty success.

## Gate

`.github/workflows/ci.yml` runs the unit tests and `tools/version_gate.py`, which checks
version consistency across `pyproject.toml`, `__init__.py`, `server.json` and the declared tool
count, and reports how many `uses:` references are pinned to full SHAs.

---

# medxpert-ortho-mcp · 骨科器械检测对接连接器

**先英后中。**

一个 8 工具的 MCP server，用于骨科器械检测对接：机构匹配、报价估算、UDI 校验、双时态标准检索、
分类/路径判定树、地区路径、注册时间轴、缺口报告。离线、仅标准库、零依赖。

它存在的理由：四个 MedXpert 专家包（`medxpert-standards`、`medical-device-reg-translator`、
`medical-device-testing-link`、`med-device-compliance-toolkit`）从 2026 年起一直引用一个叫
`medxpert-ortho-mcp` 的连接器，而那个连接器从未被造出来。这就是它，现在有了。

## 哪些是真的，哪些是示例

| 方面 | 状态 |
|---|---|
| 服务本身、8 个工具、协议层 | **真的。** 已实现、有单元测试、已发布到 PyPI 与官方 MCP Registry |
| `datasets/` 里的数据 | **示例。** 虚构机构、虚构价格、虚构 UDI-DI，仅供演示 |
| 每个工具返回值 | 只要没设 `ORTHO_DATA_DIR`，一律带 `sample_data: true` |

包内数据**不是**资质目录、**不是**报价承诺、**不是**法规结论。要用于真实工作，把
`ORTHO_DATA_DIR` 指向你自己的 JSON 数据目录。

## 运行

```bash
uvx medxpert-ortho-mcp                        # 起 stdio MCP 服务
python -m medxpert_ortho.server --selftest   # 离线自测，不需要宿主
```

## 工具与诚实的边界

| 工具 | 做什么 | 边界 |
|---|---|---|
| `match_labs` | 按能力关键词、地区、器械描述给机构打分 | 示例数据仅 3 家机构、少数能力项 |
| `calc_quote` | 按机构与能力项给价格区间，超出含样量 +12% | 价格为演示值，不构成商务报价 |
| `check_udi` | 14 位 UDI-DI 查表，回出分类/无菌/一次性 | 未命中会说明是示例范围，不是"不存在"的证据 |
| `query_standard` | 关键词检索 + `as_of` 双时态判定（是否生效、是否被替代） | 状态字段为演示逻辑，以官方现行版为准 |
| `find_judgment_tree` | 逐步问答式分类/路径判定 | 演示结构，不是审评结论 |
| `get_region_path` | 受理机关、路径说明、必备材料 | 仅 CN / CN-JS / CN-SH 三条示例路径 |
| `check_timeline` | 相对天数展开成日历，标 completed / in_progress / not_started 与逾期 | 天数为示例；官方时限自受理起算 |
| `report_gap` | 已具备材料对照必备清单，报缺口与完整度 | 清单为示例数据 |

## 门禁

`ci.yml` 跑单元测试 + `tools/version_gate.py`：核对 `pyproject.toml`、`__init__.py`、`server.json`
与声明的工具数是否一致，并自报 `uses:` 有多少处钉了完整 SHA。
