Connects Claude to the ClinicalTrials.gov v2 REST API with seven tools covering the full research workflow: search studies with complex queries and filters, pull full protocol records by NCT ID, extract posted results from completed trials, and match patient profiles to recruiting studies based on demographics and eligibility criteria. The find_eligible tool is especially practical if you're building patient navigation flows or referral systems. Results can run large (70KB per study), so field selection and the summary mode for outcomes data help keep token usage reasonable. Includes field discovery tools to explore valid values and the API's data model. Public hosted instance available at clinicaltrials.caseyjhand.com/mcp if you want to try it without installing anything locally.
claude mcp add --transport http clinicaltrialsgov https://clinicaltrials.caseyjhand.com/mcpRun in your terminal. Add --scope user to make it available in every project.
Review the command, arguments, and environment values before installing — MCP servers run with your local permissions.
Verified live against the running server on Jun 10, 2026.
clinicaltrials_search_studiesSearch for clinical trial studies from ClinicalTrials.gov. Supports full-text and field-specific queries, status/phase/geographic filters, pagination, sorting, and field selection. Use the fields parameter to reduce payload size — full study records are ~70KB each.18 paramsSearch for clinical trial studies from ClinicalTrials.gov. Supports full-text and field-specific queries, status/phase/geographic filters, pagination, sorting, and field selection. Use the fields parameter to reduce payload size — full study records are ~70KB each.
sortstringquerystringfieldsarraynctIdsvaluepageSizeintegergeoFilterstringpageTokenstringcountTotalbooleantitleQuerystringphaseFiltervalueoutcomeQuerystringsponsorQuerystringstatusFiltervaluelocationQuerystringadvancedFilterstringconditionQuerystringinterventionQuerystringincludeUnknownEnrollmentbooleanclinicaltrials_get_study_recordFetch a single clinical trial study by NCT ID from ClinicalTrials.gov. Returns the full study record including protocol details, eligibility criteria, outcomes, arms, interventions, contacts, and locations. Optional locationLimit / outcomeLimit / nearLocation parameters trim l...4 paramsFetch a single clinical trial study by NCT ID from ClinicalTrials.gov. Returns the full study record including protocol details, eligibility criteria, outcomes, arms, interventions, contacts, and locations. Optional locationLimit / outcomeLimit / nearLocation parameters trim l...
nctId*stringnearLocationobjectoutcomeLimitintegerlocationLimitintegerclinicaltrials_get_study_countGet total clinical trial study count from ClinicalTrials.gov matching a query, without fetching study data. Fast and lightweight. Use for quick statistics or to build breakdowns by calling multiple times with different filters (e.g., count by phase, count by status, count recr...11 paramsGet total clinical trial study count from ClinicalTrials.gov matching a query, without fetching study data. Fast and lightweight. Use for quick statistics or to build breakdowns by calling multiple times with different filters (e.g., count by phase, count by status, count recr...
querystringtitleQuerystringphaseFiltervalueoutcomeQuerystringsponsorQuerystringstatusFiltervaluelocationQuerystringadvancedFilterstringconditionQuerystringinterventionQuerystringincludeUnknownEnrollmentbooleanclinicaltrials_get_field_valuesDiscover valid values for ClinicalTrials.gov fields with study counts per value. Use to explore available filter options before building a search — e.g., valid OverallStatus, Phase, InterventionType, StudyType, or LeadSponsorClass values.1 paramsDiscover valid values for ClinicalTrials.gov fields with study counts per value. Use to explore available filter options before building a search — e.g., valid OverallStatus, Phase, InterventionType, StudyType, or LeadSponsorClass values.
fields*valueclinicaltrials_get_field_definitionsResolve valid field names from the ClinicalTrials.gov data model — the canonical PascalCase identifiers (OverallStatus, EnrollmentCount, LeadSponsorName) accepted by the `fields`, `advancedFilter`, and `sort` parameters of other tools, and as input to clinicaltrials_get_field_...5 paramsResolve valid field names from the ClinicalTrials.gov data model — the canonical PascalCase identifiers (OverallStatus, EnrollmentCount, LeadSponsorName) accepted by the `fields`, `advancedFilter`, and `sort` parameters of other tools, and as input to clinicaltrials_get_field_...
mode*stringsearch · drill · overviewpathstringlimitintegerquerystringincludeIndexedOnlybooleanclinicaltrials_get_study_resultsFetch clinical trial results data from ClinicalTrials.gov for completed studies — outcome measures with statistics, adverse events, participant flow, baseline characteristics, and results metadata (limitations & caveats, certain-agreement disclosure restrictions, results point...3 paramsFetch clinical trial results data from ClinicalTrials.gov for completed studies — outcome measures with statistics, adverse events, participant flow, baseline characteristics, and results metadata (limitations & caveats, certain-agreement disclosure restrictions, results point...
nctIds*valuesummarybooleansectionsvalueclinicaltrials_find_eligibleMatch patient demographics and conditions to eligible recruiting clinical trials. Provide age, sex, conditions, and location to find studies with matching eligibility criteria, contact information, and recruiting locations.7 paramsMatch patient demographics and conditions to eligible recruiting clinical trials. Provide age, sex, conditions, and location to find studies with matching eligibility criteria, contact information, and recruiting locations.
age*integersex*stringFEMALE · MALE · ALLlocation*objectconditions*arraymaxResultsintegerrecruitingOnlybooleanhealthyVolunteerbooleanSearch 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:
| Tool Name | Description |
|---|---|
clinicaltrials_search_studies | Search studies with full-text queries, filters, pagination, sorting, and field selection. |
clinicaltrials_get_study_record | Fetch a single study by NCT ID. Returns the full record: protocol, eligibility, outcomes, arms, interventions, contacts, and locations. |
clinicaltrials_get_study_count | Get total study count for a query without fetching data. Fast statistics and breakdowns. |
clinicaltrials_get_field_values | Discover valid values for API fields (status, phase, study type, etc.) with per-value counts. |
clinicaltrials_get_field_definitions | Browse the study data model field tree — piece names, types, nesting. Supports subtree navigation and keyword search. |
clinicaltrials_get_study_results | Extract outcomes, adverse events, participant flow, and baseline from completed studies. Optional summary mode reduces ~200KB payloads to ~5KB. |
clinicaltrials_find_eligible | Match patient demographics and conditions to eligible recruiting trials. Provide age, sex, conditions, and location to find studies with matching eligibility criteria, contacts, and recruiting locations. |
| Resource | Description |
|---|---|
clinicaltrials://{nctId} | Fetch a single clinical trial study by NCT ID. Full JSON. |
| Prompt | Description |
|---|---|
analyze_trial_landscape | Adaptable workflow for data-driven trial landscape analysis using count + search tools. |
clinicaltrials_search_studiesPrimary search tool with full ClinicalTrials.gov query capabilities.
clinicaltrials_get_study_resultsFetch posted results data for completed studies.
clinicaltrials_find_eligibleMatch a patient profile to eligible recruiting trials.
Built on @cyanheads/mcp-ts-core:
none, jwt, oauth) for HTTP transportClinicalTrials.gov-specific:
A public instance is available at https://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"
}
}
}
}
Or for Streamable HTTP:
MCP_TRANSPORT_TYPE=http
MCP_HTTP_PORT=3010
Clone the repository:
git clone https://github.com/cyanheads/clinicaltrialsgov-mcp-server.git
Navigate into the directory:
cd clinicaltrialsgov-mcp-server
Install dependencies:
bun install
All configuration is optional — the server works with defaults and no API keys.
| Variable | Description | Default |
|---|---|---|
CT_API_BASE_URL | ClinicalTrials.gov API base URL. | https://clinicaltrials.gov/api/v2 |
CT_REQUEST_TIMEOUT_MS | Per-request timeout in milliseconds. | 30000 |
CT_MAX_PAGE_SIZE | Maximum page size cap. | 200 |
MCP_TRANSPORT_TYPE | Transport: stdio or http. | stdio |
MCP_HTTP_PORT | Port for HTTP server. | 3010 |
MCP_AUTH_MODE | Auth mode: none, jwt, or oauth. | none |
MCP_LOG_LEVEL | Log level (RFC 5424). | info |
LOGS_DIR | Directory for log files (Node.js only). | <project-root>/logs |
OTEL_ENABLED | Enable OpenTelemetry tracing. | false |
Build and run the production version:
bun run build
bun run start:http # or start:stdio
Run checks and tests:
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
| Directory | Purpose |
|---|---|
src/mcp-server/tools/ | Tool definitions (*.tool.ts). |
src/mcp-server/resources/ | Resource definitions (*.resource.ts). |
src/mcp-server/prompts/ | Prompt definitions (*.prompt.ts). |
src/services/clinical-trials/ | ClinicalTrials.gov API client and types. |
src/config/ | Environment variable parsing and validation with Zod. |
tests/ | Unit and integration tests. |
See CLAUDE.md for development guidelines and architectural rules. The short version:
try/catch in tool logicctx.log for request-scoped logging, no console callsindex.ts barrel filesIssues and pull requests are welcome. Run checks before submitting:
bun run devcheck
bun run test
Apache-2.0 — see LICENSE for details.
CT_API_BASE_URLdefault: https://clinicaltrials.gov/api/v2ClinicalTrials.gov API base URL.
CT_REQUEST_TIMEOUT_MSdefault: 30000Per-request timeout in milliseconds.
CT_MAX_PAGE_SIZEdefault: 200Maximum page size cap.
MCP_LOG_LEVELdefault: infoSets the minimum log level for output (e.g., 'debug', 'info', 'warn').
MCP_HTTP_HOSTdefault: 127.0.0.1The hostname for the HTTP server.
MCP_HTTP_PORTdefault: 3010The port to run the HTTP server on.
MCP_HTTP_ENDPOINT_PATHdefault: /mcpThe endpoint path for the MCP server.
MCP_AUTH_MODEdefault: noneAuthentication mode to use: 'none', 'jwt', or 'oauth'.
com.mcparmory/google-search
io.github.pipeworx-io/brave-search
marcopesani/mcp-server-serper
brave/brave-search-mcp-server
com.mcparmory/google-search-console
acamolese/google-search-console-mcp