CodeWeaver

CodeWeaver

An MCP server that reads a clinical note and returns ranked ICD-10-CM diagnosis code candidates with clinical reasoning, validated against official CMS coding constraints.

Category
访问服务器

README

CodeWeaver

An MCP server that reads a clinical note and returns ranked ICD-10-CM diagnosis code candidates with clinical reasoning, validated against official CMS coding constraints (Excludes1/2 relationships, specificity rules).

Built by Team EternalBlue for the Amrita MCP Hackathon 2026 — HealthTech track.

CodeWeaver is a coding/documentation assistance tool, not a diagnostic tool. It does not make or suggest clinical/diagnostic decisions. All output must be reviewed by a qualified medical coder.

What it does

Given free-text clinical note, CodeWeaver:

  1. Segments the note into sentences and detects negation/rule-out language ("denies", "no evidence of", "r/o", etc.) so ruled-out conditions aren't coded.
  2. Fuzzy-matches affirmed segments against ICD-10-CM descriptions and inclusion terms (token-overlap / Dice coefficient — no ML, no external NLP APIs).
  3. Runs candidates through a constraint engine:
    • Excludes1 (mutually exclusive diagnoses) → hard-blocked, flagged for provider clarification.
    • Excludes2 (can co-occur but distinct) → soft-flagged for combination code review.
    • Unspecified/NOS codes → deprioritised when a more specific code is also a valid match.
    • 7th-character extensions (e.g. initial/subsequent/sequela) → flagged with the valid options when a matched code requires one; CodeWeaver does not infer which character applies.
  4. Returns each candidate with a plain-English reasoning string explaining the match and any constraint outcome.

Low-confidence matches (score < 0.5) are never presented as suggestions, even as a fallback — if nothing clears that bar, CodeWeaver says so explicitly and recommends provider clarification instead of guessing. In that case it also live-queries the NLM Clinical Tables ICD-10-CM API (full official code set, U.S. National Library of Medicine, free/no key) as a best-effort, explicitly unvalidated fallback — those results skip the Excludes1/2 engine entirely and are labeled as such.

Scope

Four clinical categories, 1,934 real CMS FY2026 ICD-10-CM codes:

Category Code range Codes
Cardiac I20-I25 119
Diabetes E08-E13 322
Respiratory J00-J99 471
Musculoskeletal (curated) M15-M19, M25, M54, M70-M81 1,022

Musculoskeletal is a deliberately curated slice — arthritis, joint pain, back pain/sciatica, soft tissue disorders, and osteoporosis — not the full M00-M99 chapter (~7,100 codes in the source XML), which would have been far too large and far too thin on local synonym coverage to add responsibly in one pass.

This is not full ICD-10-CM coverage and CodeWeaver does not claim to be.

Data

  • ICD-10-CM codes: real CMS FY2026 data, parsed from the official icd10cm-tabular-2026.xml tabular index (src/data/parse-icd10-xml.ts). Inclusion terms are supplemented for codes with sparse official terms, using lay/clinical synonyms derived strictly from the official descriptions — not fabricated clinical claims. Final dataset: src/data/icd10-final.json (_dataSource: "cms-fy26-supplemented").
  • Clinical notes: synthetic (not real patient records), covering single-condition, multi-condition, negation, and deliberate Excludes1 conflict scenarios built around real CMS Excludes1 pairs (e.g. E10.9 ↔ E11 for T1DM vs T2DM, I22.0 ↔ I21 for subsequent MI).

Tools, resources, and prompts

Tools

Name Input Returns
code_clinical_note note_text (string), max_results (int, default 10) Ranked candidates split into suggested / flagged / blocked, each with a reasoning string, plus a confidence advisory and externalSuggestions (unvalidated NLM fallback) if nothing scores highly enough
lookup_icd10_code code (string, e.g. "E11.9") Full detail for one code — description, inclusion terms, Excludes1/2 relationships. Normalizes case, whitespace, and missing decimals

Resources

URI Returns
icd10://codes Summary of all 1,934 in-scope codes
icd10://codes/cardiac Full detail, cardiac codes
icd10://codes/diabetes Full detail, diabetes codes
icd10://codes/respiratory Full detail, respiratory codes
icd10://codes/musculoskeletal Full detail, musculoskeletal codes (curated slice)

Prompts

Name What it does
explain_decision Takes code_clinical_note output and produces a structured coding-rationale prompt for an LLM, for either a coder or clinician audience, with the required non-diagnostic disclaimer

Quick start

npm install
npm run dev          # start in development mode
npm run build         # compile + copy data files into dist/
npm start              # build, then start
npm run start:prod    # start an existing production build

Use NitroStudio to connect to the running server and call the tools interactively.

Testing

Rule-based pipeline logic is covered by lightweight script tests (no test framework — run directly with tsx):

npx tsx src/modules/icd10/segmentation.test.ts
npx tsx src/modules/icd10/matcher.test.ts
npx tsx src/modules/icd10/constraints.test.ts
npx tsx src/modules/icd10/pipeline.test.ts

51/51 assertions passing across all four files, exercising all 15 synthetic notes end-to-end. Or run npm test to execute all four in sequence.

Architecture

Built on NitroStack (@nitrostack/core), using its decorator-based @Tool / @Resource / @Prompt pattern with Zod schema validation. The coding pipeline itself is plain TypeScript, no ML training and no external NLP APIs — intentionally simple and explainable for a time-boxed hackathon build:

src/modules/icd10/
├── segmentation.ts   # sentence split + negation detection
├── matcher.ts         # Dice-coefficient fuzzy matching + word-form normalization
├── constraints.ts     # Excludes1/2 constraint engine + specificity ranking
├── pipeline.ts        # orchestrates the above end-to-end
├── external-lookup.ts # NLM Clinical Tables fallback (used only when no local match is confident)
├── icd10.tools.ts     # @Tool: code_clinical_note, lookup_icd10_code
├── icd10.resources.ts # @Resource: icd10://codes/*
├── icd10.prompts.ts   # @Prompt: explain_decision
└── icd10.module.ts    # module registration

Known limitations

  • Fuzzy matching is pure token-overlap with no term-importance weighting, so generic shared words (e.g. "diabetes mellitus", "acute") can produce low-score noise across many codes in a category. Excludes1/2 gating and the 0.5 suggestion threshold contain this but don't eliminate it.
  • A curated set of clinical word-form equivalences (e.g. "diabetic" ↔ "diabetes", "coughing" ↔ "cough") narrows — but doesn't eliminate — the gap from having no general stemmer.
  • Negation detection is sentence-level; a negation cue can't reach into an adjacent sentence.
  • ~85% of in-scope codes have no supplemented inclusion terms and rely on matching the raw official CMS description text, which is often too terse or formal for how notes are actually phrased — most pronounced in the musculoskeletal slice (94% unsupplemented) since it was added last.
  • 7th-character code requirements are flagged in a code's reasoning string with the valid extension characters, but CodeWeaver does not infer which one applies (e.g. initial vs. subsequent encounter) — that's left to the coder.
  • externalSuggestions (the NLM Clinical Tables fallback) only fires when no local match clears the confidence threshold, is not run through the Excludes1/2 engine, and depends on NLM's own word-prefix search semantics — it can miss valid codes on word-form mismatches (e.g. "femoral" vs. "femur").

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选