UCSFOMOPAgent
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
UCSFOMOPAgent
Current version: 0.4.1. Small queries stay on MCP; long queries and full exports run as monitored local jobs without tying up an MCP request.
Install in BioRouter
Download ucsfomopagent.brxt from Releases. The same current bundle is committed under extensions/.
In BioRouter, open Extensions → Add extension, select the BRXT and install. BioRouter creates the Python environment;
uvand Python 3.11+ are required.Enter credentials in BioRouter's own configuration dialog, never in chat.
Enable the extension in your chat. Verify a small query before a larger export.
Terminal installation uses the same installer:
biorouter extension install ./extensions/ucsfomopagent.brxt
biorouter extension configure ucsfomopagentConfigure CLINICAL_RECORDS_USERNAME and CLINICAL_RECORDS_PASSWORD. Host defaults to the UCSF SQL Server; database defaults to OMOP_DEID. Optional CLINICAL_RECORDS_SERVER / CLINICAL_RECORDS_DATABASE overrides are declared in the manifest. UCSF network/VPN access and database read permission are required.
The Desktop installer discovers bundled skills/*/SKILL.md. If using a BioRouter
CLI version that does not copy bundled skills, the MCP server still provides the
job-routing instructions; the skill folders can also be installed separately.
Related MCP server: OMOP MCP Server
Long queries, CLI and progress
Use omop-submit_query_job for an export or a query that could exceed the
interactive timeout. Call omop-query_job_capacity first; submission returns a
job ID immediately and atomically checks the two-job limit. Use
omop-wait_for_query_job for native waits of up to 30 seconds, or
omop-query_job_status for an immediate snapshot. Use omop-cancel_query_job
to stop. Only completed means the file is complete. Read bounded UTF-8 chunks
with omop-read_query_job_result using the job ID and next_offset; do not pass
result_path to generic filesystem tools. The secure reader requires POSIX;
unsupported platforms retain the local CLI file. See job boundaries and the
credential-free app fixture.
Status includes rows, bytes, elapsed time, phase and an advisory ETA when known.
Set mode="explain" to obtain a plan without running the query.
From a source checkout, or BioRouter's installed extension directory:
uv sync --locked
# Standalone CLI only: configure its OS-keyring profile interactively once.
# BioRouter MCP jobs already receive credentials and do not need this command.
uv run ucsfomopagent auth
uv run ucsfomopagent submit --query-file query.sql --format jsonl --timeout-seconds 3600
uv run ucsfomopagent watch JOB_IDNo-argument uv run ucsfomopagent continues to start the MCP server. status, watch,
list, cancel and purge need no database credentials. Results remain in the
local private job directory. The bounded result reader can return requested chunks
to chat; keep controlled data local and share only appropriate summaries. Database/server limits can
still fail a query; jobs report those failures instead of silently truncating.
Large fact-table studies
Background jobs avoid MCP request timeouts, but expensive database plans can still take too long. For large OMOP studies, freeze a minimal seed cohort or candidate superset, then extract required facts in bounded, parameterized batches. Replace repeated eligibility CTEs across large fact tables with staged extraction that preserves the complete clinical definition.
Keep identifiers, parameter files, outputs and the batch manifest private and local. Pilot batches, monitor at most two concurrent jobs, and reconcile all required outputs before applying final eligibility rules or reporting completion. A heartbeat is not query progress; zero streamed rows is not an empty cohort. ETA is provisional, and separate connections do not provide a shared database snapshot. The bundled phenotype and query-job skills describe the full workflow.
See architecture, storage, security and release details.
To rebuild the tracked bundle: uv run python scripts/build_brxt.py.
An MCP (Model Context Protocol) server for querying the UCSF OMOP de-identified electronic health records database (OMOP CDM v5.4 on Microsoft SQL Server) for fast, robust clinical data retrieval.
v0.2.0 is a major upgrade focused on getting the LLM to the right data faster and more reliably, while staying robust to database changes. See
benchmark/CHANGELOG.mdfor the full engineering log andbenchmark/for the reproducible evaluation harness.
Database-specific behavior
The server supplies T-SQL and OMOP conventions, cached live schema discovery,
concept resolution and a lab/vital finder. find_measurement now examines bounded
numeric samples per candidate and unit. These are nonrandom samples, not complete
coverage counts or population estimates. It returns a full profiling query for a
monitored job when exact statistics are needed. Never mix units without an
explicit conversion plan. Live schema takes precedence over historical counts.
Interactive queries use a serialized reusable connection, autocommit, a short preview timeout, valid CSV quoting and result caps. Full exports use independent job connections and do not inherit preview caps. Failed connections are discarded.
Features
Query UCSF OMOP: read-only T-SQL on the de-identified OMOP CDM.
Concept & lab resolution: built-in vocabulary search and a lab finder so the model stops guessing concept_ids.
Schema introspection: live, drift-resistant.
Pre-configured: server/database baked in — just provide credentials.
Installation
From GitHub (using uvx)
uvx --from git+https://github.com/BaranziniLab/UCSFOMOPAgent ucsfomopagentEvaluation
benchmark/ contains the reproducible evaluation used to drive these
improvements: a harness that drives the real MCP server (over stdio) with a
fixed neutral system prompt, a 100-question bench across four difficulty tiers,
and an LLM-judge grader. Absolute patient counts are redacted (this repo is
public); the methodology, relative improvements, and efficiency metrics
(iterations / tool calls / tokens / latency) are included. See
benchmark/README.md.
Security
User SQL must parse as one read-only SELECT/WITH query, and unsafe operations are rejected. Use a database account restricted to SELECT; validation supplements server permissions. Credentials are provided via environment variables (stored in the OS keyring by BioRouter) and are never logged or committed.
Provenance and credits
Made by the Baranzini Lab (Wanjun Gu, UCSF).
Original work of the Baranzini Lab.
Sources
Source | Version or commit | Licence | Credit and people | Use and what |
version 25.7.0 | MIT | Kang Zhang and Jason R. Coombs | installed as a dependency: Python dependency: the operating system keyring the standalone command line keeps its credential profile in | |
version 4.0.10 | Apache-2.0 | Prefect | installed as a dependency: Python dependency: the MCP server framework the extension runs on | |
version 2.13.5 | MIT | Pydantic Services Inc. and individual contributors | installed as a dependency: Python dependency: the schemas of the tools' arguments | |
version 2.2.0 | MIT | Anthropic, PBC | installed as a dependency: Python dependency: the MCP types (mcp.types) the tools return and annotate; FastMCP installs it | |
version 2.4.2 | LGPL-2.1-or-later | Joon-cheol Park, Damien Churchill and Mikhail Terekhov | installed as a dependency: Python dependency: the Microsoft SQL Server client the queries run through | |
version 3.32.7 | MIT | Bernát Gábor and contributors | installed as a dependency: Python dependency: the file locks of the query jobs | |
version 28.10.1 | MIT | Toby Mao | installed as a dependency: Python dependency: the SQL parser the read-only query check uses |
Data and services
Data or service | Kind | Provider | Terms | How it is used | Citation |
UCSF OMOP_DEID (OMOP CDM v5.4 on Microsoft SQL Server, schema omop) | dataset | University of California, San Francisco (UCSF DEID OMOP) | Access is subject to UCSF Information Commons terms and authorization for the specific data and use (UCSF Clinical Data page, reviewed 2026-11-27) | read at run time | |
dataset | OHDSI (Observational Health Data Sciences and Informatics) | OHDSI Standardized Vocabularies content is Apache-2.0, except a few commercial source vocabularies (for example CPT4) that need EULA documentation or proof of a licence through Athena (HL7 Terminology page for OMOP, https://terminology.hl7.org/6.5.0/CodeSystem-OMOP.html, read 2026-11-27) | read at run time |
Contributors
Wanjun Gu, Baranzini Lab, UCSF: author
Gianmarco Bellucci, Baranzini Lab, UCSF: author
The copyright lines and licences of the components above are in NOTICE.
Curated and organized by Wanjun Gu, Baranzini Lab, UCSF.
License
Apache-2.0. See LICENSE and NOTICE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Query Clinical.ly clinical-research data via read-only API tools using your OAuth permissions.
PREPROD VERSION. Query Clinical.ly research data via read-only OAuth API tools.
UAT VERSION. Query Clinical.ly research data via read-only OAuth API tools.
Read-only U.S. lab-test catalog, collection-site search, and reference-range context.
Related MCP Servers
- AlicenseAqualityBmaintenanceSQL Server MCP server with AST-based query validation, read-only safety, schema exploration, ER diagram generation, and DBA toolkit integration (First Responder Kit, DarlingData, sp_WhoIsActive).128MIT
- AlicenseNot gradedqualityDmaintenanceEnables natural language exploration of OMOP CDM databases for concept discovery, patient count queries, and cohort SQL generation with support for multiple database backends.1MIT
- FlicenseNot gradedqualityCmaintenanceLocal MCP server for running ad hoc T-SQL queries against SQL Server databases, read-only by default with security safeguards.-
- AlicenseAqualityCmaintenanceEnables safe read-only interaction with SQL Server and Azure SQL databases, providing schema exploration, query linting and analysis, query plan insights, write previews as SELECTs, and a versioned library of .sql queries via MCP.29MIT