searchloinc
SearchLOINC is an MCP server that enables LLMs to search and retrieve LOINC (Logical Observation Identifiers Names and Codes) medical terminology data, designed around a search-then-drill-down workflow.
Search capabilities:
LOINC terms (
search_loincs): Free-text, relevance-ranked search across lab tests, vital signs, clinical measurements, panels, and surveys (e.g., "hemoglobin", "sodium serum").Answer lists (
search_answerlists): Look up enumerated answer sets attached to survey/nominal LOINC terms (e.g., smoking-status choices).LOINC parts (
search_parts): Search LP-coded building blocks (components, systems, methods, properties) that compose LOINC terms.LOINC groups (
search_groups): Discover curated collections of related LOINC terms (e.g., all glucose measurements).
Drill-down:
Get a specific term (
get_loinc): Retrieve the full record for a single LOINC code, including all populated fields (names, six-axis parts, related names, example units, status/change history) and a link to loinc.org.
General features:
All search tools support pagination (
rows,offset), sorting, language filtering, and optional facet counts.Results are returned in a compact TOON tabular format, capped at ~9500 characters, with a
truncatedflag when results exceed the budget.Detailed single-term records are returned as JSON with null/empty fields omitted.
Provides LOINC search capabilities (lab tests, vitals, measurements, panels, surveys) and can be deployed as a Databricks app with secure credential management via Databricks secrets and inference via AI Gateway.
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., "@searchloinc search for loinc terms related to hemoglobin A1c"
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.
SearchLOINC
A thin MCP server wrapping the
LOINC Search API so LLMs can search LOINC the same
way a human does via loinc.org/search — free-text,
relevance-ranked, faceted. It targets the documented Search API
(https://loinc.regenstrief.org/searchapi/), not the FHIR terminology service.
Setup
uv sync --extra dev
cp .env.example .env # then fill in your LOINC credentialsCredentials come from a free registration on loinc.org. Set
LOINC_USERNAME and LOINC_PASSWORD in the environment (never commit them).
Related MCP server: OMOPHub MCP Server
Run
From a checkout (development):
uv run python -m searchloincOr install it as a standalone command and run it from anywhere:
uv tool install . # puts a `searchloinc` executable on PATH
searchloinc # starts the stdio serverBoth run the server over stdio (the transport MCP clients expect). Point your client at
the command, or add it to your client's MCP server config. When you use the installed command,
supply credentials through the client's env block (sourced from your secret store / shell —
never committed):
{
"mcpServers": {
"searchloinc": {
"command": "searchloinc",
"env": {
"LOINC_USERNAME": "your-loinc-username",
"LOINC_PASSWORD": "your-loinc-password"
}
}
}
}The checked-in .mcp.json uses the dev form (uv run --env-file .env) so a local
checkout picks up credentials from .env automatically.
Tools
Two-tier design — cheap compact search for triage, explicit drill-in for detail:
search_loincs— LOINC terms (lab tests, vitals, measurements, panels, surveys). The main table.search_answerlists— enumerated answer sets attached to survey/nominal terms.search_parts— the LP-coded building blocks (components, systems, methods, properties).search_groups— curated collections of related terms.get_loinc(code)— drill into one term by exact code; returns the full flat record.
Each search tool takes query (required), rows, offset, sortorder, language, and
include_facets. Pick the scope that matches what you're after; results are
relevance-ranked, so if the top hits miss, reformulate rather than deep-page. Triage with
a search tool, then get_loinc the code you want.
Output shape
Search responses are a JSON envelope plus a result table:
The table is serialized as TOON — a compact tabular format that pays the column-name cost once, so wide uniform tables stay small. Columns are fixed per scope; empty fields render as
""to preserve row uniformity. Tab-delimited (LOINC display values contain commas but never tabs).The envelope reports
requested,returned,total,offset, andtruncated.
Character budget & pagination. The whole serialized payload is capped at 9500 characters
(a cushion under the ~10K downstream tool-result limit). The row-packing loop encodes and
measures the full payload incrementally and stops before the cap; when results don't all fit,
truncated is true — page forward with offset. include_facets (filter counts) is off by
default and opt-in; facet payloads still respect the budget.
get_loinc returns a single JSON object — the flat search-API record with null/empty fields
dropped (always keeping Link), so the field set adapts to the term type. Page-only content
(part LP hierarchy, language variants, curated part descriptions) is not in the flat
record — follow Link to loinc.org for it.
There is a debug-only raw-JSON path toggled by the SEARCHLOINC_RAW_JSON env var; it is never
exposed as an agent-facing tool parameter.
Development
uv run ruff check searchloinc # lint
uv run pytest # tests (no network; API stubbed with fixtures)The /loinc-search skill drives the live API to
validate wrapper output against ground truth.
Status
Wrapper is implemented and validated against the live API. Eventual deployment target is a Databricks app (credentials via secret scope, inference via AI Gateway).
License & attribution
The SearchLOINC code is licensed under the MIT License.
This project wraps the LOINC Search API and includes sample LOINC API responses as test fixtures. That LOINC (and referenced SNOMED CT) content is not covered by the MIT license and remains under its own terms — see NOTICE for the required attributions.
This material contains content from LOINC (http://loinc.org). LOINC is copyright © Regenstrief Institute, Inc. and the Logical Observation Identifiers Names and Codes (LOINC) Committee and is available at no cost under the license at http://loinc.org/license. LOINC® is a registered United States trademark of Regenstrief Institute, Inc.
Available Tools
5 toolsget_loincA
Drill into one LOINC term by its exact code (e.g. '783-1') and return the full flat record — all populated fields (names, the six-axis parts, related names, ranks, example units, status/change history) plus Link to loinc.org. This is tier-2 of the search→detail workflow: triage with search_loincs, then get_loinc the code you want. Null/empty fields are dropped, so the field set adapts to the term type. Content that lives only on the loinc.org page (part LP hierarchy, language variants, curated part descriptions) is not in this record — follow Link for it.
Inputs: code (required).
search_answerlistsA
Search LOINC answer lists (the enumerated answer sets attached to survey/nominal terms, e.g. smoking-status choices). Use when you need the allowed answers for a term rather than the term itself. Results are relevance-ranked by the LOINC Search API (same ranking as the loinc.org/search UI); if the top hits miss, reformulate the query rather than deep-paging. Rows are compact for triage — call get_loinc(code) to drill into the full record for a specific LOINC. Output is a TOON table capped to a character budget; when truncated, page with offset.
Inputs: query (required), rows, offset, language, +2 more.
search_groupsA
Search LOINC groups (curated collections of related terms — e.g. all glucose measurements, or a molecular-conversion group). Use when you want a pre-grouped set of related LOINCs rather than individual terms. Results are relevance-ranked by the LOINC Search API (same ranking as the loinc.org/search UI); if the top hits miss, reformulate the query rather than deep-paging. Rows are compact for triage — call get_loinc(code) to drill into the full record for a specific LOINC. Output is a TOON table capped to a character budget; when truncated, page with offset.
Inputs: query (required), rows, offset, language, +2 more.
search_loincsA
Search LOINC terms (observations/measurements — the main LOINC table). Use this for lab tests, vital signs, clinical measurements, panels, and surveys — anything you'd look up by a test name like 'hemoglobin', 'sodium serum', or a LOINC number. Results are relevance-ranked by the LOINC Search API (same ranking as the loinc.org/search UI); if the top hits miss, reformulate the query rather than deep-paging. Rows are compact for triage — call get_loinc(code) to drill into the full record for a specific LOINC. Output is a TOON table capped to a character budget; when truncated, page with offset.
Inputs: query (required), rows, offset, language, +2 more.
search_partsA
Search LOINC parts (the LP-coded building blocks — components, systems, methods, properties — that compose LOINC terms). Use when you need the canonical part behind a concept, or to explore the axis vocabulary. Results are relevance-ranked by the LOINC Search API (same ranking as the loinc.org/search UI); if the top hits miss, reformulate the query rather than deep-paging. Rows are compact for triage — call get_loinc(code) to drill into the full record for a specific LOINC. Output is a TOON table capped to a character budget; when truncated, page with offset.
Inputs: query (required), rows, offset, language, +2 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool targets a distinct entity (LOINC term, answer list, group, part) or action (search vs. detail). Descriptions clearly differentiate between them, leaving no ambiguity about which tool to use for a given task.
Tool names follow a consistent verb_noun pattern: 'search_' for searching different entities and 'get_loinc' for fetching details. All names use lowercase and underscores, maintaining a uniform style.
Five tools cover the core functionalities of searching and retrieving LOINC-related data without being excessive. The count is well-scoped for a focused LOINC search server.
The set covers searching for terms, answer lists, groups, and parts, plus detailed term retrieval. However, there is no dedicated detail tool for answer lists or groups; the workflow directs to get_loinc, which may not fully address those entities. This minor gap prevents a perfect score.
Related MCP Connectors
Diagnoses, drugs & lab codes: ICD-11, LOINC, RxNorm, MeSH, ATC, CID-10. 33 tools, MIT.
Search US grants + federal contracts (Grants.gov + SAM.gov) from any LLM.
Read-only search and discovery for the international llms.txt directory maintained by llmsmap.me.
Ingest and search LogsLoom logs from coding agents.
Related MCP Servers
- AlicenseCqualityDmaintenanceAllows AI assistants to search the Library of Congress Subject Headings (LCSH) through a simple API interface, making it easy to query and retrieve official subject headings and related terms.13MIT

OMOPHub MCP Serverofficial
AlicenseAqualityBmaintenanceProvides AI agents with instant access to 10M+ OMOP medical vocabulary concepts for searching, mapping, and navigating clinical codes across SNOMED, ICD-10, RxNorm, LOINC, and more.11118 npm6MIT- AlicenseAqualityDmaintenanceEnables LLMs to search FDA drug labels and adverse event data via the OpenFDA API, supporting natural language queries for drug safety information.2MIT
- AlicenseAqualityDmaintenanceEnables searching LOINC codes and retrieving detailed information including panel members and answer options via the LOINC Search API.21MIT