ClinicalTrials.gov

by cyanheads

Not rated
GitHub

About

Search and retrieve clinical trial data from the official ClinicalTrials.gov API.

Details

Author
cyanheads
Categories
Search, Knowledge Base, Other

Setup

Install ClinicalTrials.gov in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/cyanheads/clinicaltrialsgov-mcp-server

Follow the installation instructions in the repository README, then restart your MCP client.

Search ClinicalTrials.gov trials, retrieve study details and results, and match patients to eligible trials via MCP. STDIO or Streamable HTTP.

Public Hosted Server:https://clinicaltrials.caseyjhand.com/mcp

Seven tools for searching, discovering, analyzing, and matching clinical trials:

Primary search tool with full ClinicalTrials.gov query capabilities.

- Full-text and field-specific queries (condition, intervention, sponsor, location, title, outcome)
- Status and phase filters with typed enum values
- Geographic proximity filtering by coordinates and distance
- Advanced AREA
[] Essie expression support for complex queries
- Compact index results by default; passfieldsfor a full-fidelity projection of specific leaves (a full single record is ~70KB — fetch one withget_study_record)
- Pagination with cursor tokens, sorting by any field

Fetch posted results data for completed studies.

- Outcome measures with statistics, adverse events, participant flow, baseline characteristics
- Section-level filtering (request only the data you need)
- Optional summary mode condenses full results (~200KB) to essential metadata (~5KB per study)
- Batch multiple NCT IDs per call with partial-success reporting
- Separate tracking of studies without results and fetch errors

Match a patient profile to eligible recruiting trials.

- Takes age, sex, conditions, and location as patient demographics
- Builds optimized API queries with demographic filters (age range, sex, healthy volunteers)
- Re-ranks results so studies whose own condition matches a requested condition surface above tangential matches from the upstream fuzzy condition search
- Returns studies with eligibility and location fields for the caller to evaluate
- Bounds each candidate to the sites matching the requested location (capped bylocationLimit) rather than every site the study registers worldwide, adds the nearest recruiting site when none of the matched ones is open, and discloses what was omitted
- Provides actionable hints when no studies match (broaden conditions, adjust filters)

- Declarative tool/resource/prompt definitions with Zod schemas and format functions
- Unified error handling — handlers throw, framework catches and classifies
- Dual transport: stdio and Streamable HTTP from the same codebase
- Pluggable auth (none,jwt,oauth) for HTTP transport
- Structured logging with optional OpenTelemetry tracing

- Type-safe client for theClinicalTrials.gov REST API v2
- Public API — no authentication or API keys required
- Retry with exponential backoff (3 attempts) and rate limiting (~1 req/sec)
- HTML error detection and structured error factories

A public instance is available athttps://clinicaltrials.caseyjhand.com/mcp— no installation required. Point any MCP client at it via Streamable HTTP:

{ "mcpServers": { "clinicaltrialsgov-mcp-server": { "type": "streamable-http", "url": "https://clinicaltrials.caseyjhand.com/mcp" } } }

Add to your MCP client config (e.g.,claude_desktop_config.json):

{ "mcpServers": { "clinicaltrialsgov-mcp-server": { "type": "stdio", "command": "bunx", "args": ["clinicaltrialsgov-mcp-server@latest"], "env": { "MCP_TRANSPORT_TYPE": "stdio" } } } }
MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010

- Bun v1.3.0or higher (or Node.js >= 24.0.0)

git clone https://github.com/cyanheads/clinicaltrialsgov-mcp-server.git

All configuration is optional — the server works with defaults and no API keys.

bun run build bun run start:http # or start:stdio
bun run devcheck # Lints, formats, type-checks bun run test # Runs test suite
docker build -t clinicaltrialsgov-mcp-server . docker run -p 3010:3010 clinicaltrialsgov-mcp-server

SeeCLAUDE.mdfor development guidelines and architectural rules. The short version:

- Handlers throw, framework catches — notry/catchin tool logic
- Usectx.logfor request-scoped logging, noconsolecalls
- Register new tools and resources in theindex.tsbarrel files

Issues and pull requests are welcome. Run checks before submitting:

Search global news using natural language. Webz.io News Search API returns the most relevant articles and content, with filters for source, country, language, date, sentiment, and category.

Fetch, convert, and search AWS documentation pages, with recommendations for related content.

Search campgrounds around the world on campertunity, check availability, and provide booking links.

The Ferryhopper MCP Server exposes ferry routes, schedules and booking redirects so an AI assistant can discover connections across Europe and the Mediterranean and send users to Ferryhopper to complete bookings.

All-in-One SEO & Web Intelligence Toolkit API from FetchSERP.

MCP server that provides read-only access to HyperKitty, the web-based email archive component of Mailman 3.

At Sunrise Apps, we believe AI agents should be limitless, especially when it comes to visual data. We created ImageSorcery to bridge the critical gap in AI's ability to interact with and manipulate images directly, all while upholding the highest standards of privacy and security.

Just Domain is the domain registrar for businesses built with AI. Its remote MCP server checks availability and returns first-year and renewal pricing, plus a link to register on justdomain.ai, with DNS and WHOIS privacy in the same place. No account, no API key, read only. Endpoint: https://mcp.justdomain.ai/

Research tools, including a Sqlite-backed document stash

Semantic search over 9 free-license stock photo sources. Hosted remote server with OAuth — no API key to paste.

SerpApi MCP Server for Google and other search engine results

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.