io.github.cyanheads/clinicaltrialsgov-mcp-server

平台与服务

by cyanheads

提供丰富工具,可从 ClinicalTrials.gov API v2 搜索、获取并分析临床试验数据,便于研究与数据探索。

什么是 io.github.cyanheads/clinicaltrialsgov-mcp-server

提供丰富工具,可从 ClinicalTrials.gov API v2 搜索、获取并分析临床试验数据,便于研究与数据探索。

README

<div align="center"> <h1>clinicaltrialsgov-mcp-server</h1> <p><b>Search ClinicalTrials.gov trials, retrieve study details and results, and match patients to eligible trials via MCP. STDIO or Streamable HTTP.</b> <div>7 Tools • 1 Resource • 1 Prompt</div> </p> </div> <div align="center">

npm Docker Version MCP SDK License TypeScript Bun

</div> <div align="center">

Install in Claude Desktop Install in Cursor Install in VS Code

Framework

</div> <div align="center">

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

</div>

Overview

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

Tool NameDescription
clinicaltrials_search_studiesSearch studies with full-text queries, filters, pagination, sorting, and field selection.
clinicaltrials_get_study_recordFetch a single study by NCT ID. Returns the full record: protocol, eligibility, outcomes, arms, interventions, contacts, and locations.
clinicaltrials_get_study_countGet total study count for a query without fetching data. Fast statistics and breakdowns.
clinicaltrials_get_field_valuesDiscover valid values for API fields (status, phase, study type, etc.) with per-value counts.
clinicaltrials_get_field_definitionsBrowse the study data model field tree — piece names, types, nesting. Supports subtree navigation and keyword search.
clinicaltrials_get_study_resultsExtract outcomes, adverse events, participant flow, and baseline from completed studies. Optional summary mode reduces ~200KB payloads to ~5KB.
clinicaltrials_find_eligibleMatch 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.
ResourceDescription
clinicaltrials://{nctId}Fetch a single clinical trial study by NCT ID. Full JSON.
PromptDescription
analyze_trial_landscapeAdaptable workflow for data-driven trial landscape analysis using count + search tools.

Tools

clinicaltrials_search_studies

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; pass fields for a full-fidelity projection of specific leaves (a full single record is ~70KB — fetch one with get_study_record)
  • Pagination with cursor tokens, sorting by any field

clinicaltrials_get_study_results

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

clinicaltrials_find_eligible

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
  • Provides actionable hints when no studies match (broaden conditions, adjust filters)

Features

Built on @cyanheads/mcp-ts-core:

  • 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

ClinicalTrials.gov-specific:

  • Type-safe client for the ClinicalTrials.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

Getting Started

Public Hosted Instance

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

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

Self-Hosted / Local

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

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

Or for Streamable HTTP:

sh
MCP_TRANSPORT_TYPE=http
MCP_HTTP_PORT=3010

Prerequisites

Installation

  1. Clone the repository:

    sh
    git clone https://github.com/cyanheads/clinicaltrialsgov-mcp-server.git
    
  2. Navigate into the directory:

    sh
    cd clinicaltrialsgov-mcp-server
    
  3. Install dependencies:

    sh
    bun install
    

Configuration

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

VariableDescriptionDefault
CT_API_BASE_URLClinicalTrials.gov API base URL.https://clinicaltrials.gov/api/v2
CT_REQUEST_TIMEOUT_MSPer-request timeout in milliseconds.30000
CT_MAX_PAGE_SIZEMaximum page size cap.200
MCP_TRANSPORT_TYPETransport: stdio or http.stdio
MCP_HTTP_PORTPort for HTTP server.3010
MCP_AUTH_MODEAuth mode: none, jwt, or oauth.none
MCP_LOG_LEVELLog level (RFC 5424).info
LOGS_DIRDirectory for log files (Node.js only).<project-root>/logs
OTEL_ENABLEDEnable OpenTelemetry tracing.false

Running the Server

Local Development

  • Build and run the production version:

    sh
    bun run build
    bun run start:http   # or start:stdio
    
  • Run checks and tests:

    sh
    bun run devcheck     # Lints, formats, type-checks
    bun run test         # Runs test suite
    

Docker

sh
docker build -t clinicaltrialsgov-mcp-server .
docker run -p 3010:3010 clinicaltrialsgov-mcp-server

Project Structure

DirectoryPurpose
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.

Development Guide

See CLAUDE.md for development guidelines and architectural rules. The short version:

  • Handlers throw, framework catches — no try/catch in tool logic
  • Use ctx.log for request-scoped logging, no console calls
  • Register new tools and resources in the index.ts barrel files

Contributing

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

sh
bun run devcheck
bun run test

License

Apache-2.0 — see LICENSE for details.

常见问题

io.github.cyanheads/clinicaltrialsgov-mcp-server 是什么?

提供丰富工具,可从 ClinicalTrials.gov API v2 搜索、获取并分析临床试验数据,便于研究与数据探索。

相关 Skills

Slack动图

by anthropics

Universal
热门

面向Slack的动图制作Skill,内置emoji/消息GIF的尺寸、帧率和色彩约束、校验与优化流程,适合把创意或上传图片快速做成可直接发送的Slack动画。

帮你快速做出适配 Slack 的动图,内置约束规则和校验工具,少踩上传与播放坑,做表情包和演示都更省心。

平台与服务
未扫描164.6k

MCP构建

by anthropics

Universal
热门

聚焦高质量 MCP Server 开发,覆盖协议研究、工具设计、错误处理与传输选型,适合用 FastMCP 或 MCP SDK 对接外部 API、封装服务能力。

想让 LLM 稳定调用外部 API,就用 MCP构建:从 Python 到 Node 都有成熟指引,帮你更快做出高质量 MCP 服务器。

平台与服务
未扫描164.6k

接口测试套件

by alirezarezvani

Universal
热门

扫描 Next.js、Express、FastAPI、Django REST 的 API 路由,自动生成覆盖鉴权、参数校验、错误码、分页、上传与限流场景的 Vitest 或 Pytest 测试套件。

帮你把API与集成测试自动化跑顺,减少回归漏测;能力全面,尤其适合复杂接口场景的QA团队。

平台与服务
未扫描23.3k

相关 MCP Server

Slack 消息

编辑精选

by Anthropic

热门

Slack 是让 AI 助手直接读写你的 Slack 频道和消息的 MCP 服务器。

这个服务器解决了团队协作中需要 AI 实时获取 Slack 信息的痛点,特别适合开发团队让 Claude 帮忙汇总频道讨论或发送通知。不过,它目前只是参考实现,文档有限,不建议在生产环境直接使用——更适合开发者学习 MCP 如何集成第三方服务。

平台与服务
89.0k

by netdata

热门

io.github.netdata/mcp-server 是让 AI 助手实时监控服务器指标和日志的 MCP 服务器。

这个工具解决了运维人员需要手动检查系统状态的痛点,最适合 DevOps 团队让 Claude 自动分析性能数据。不过,它依赖 NetData 的现有部署,如果你没用过这个监控平台,得先花时间配置。

平台与服务
79.5k

by d4vinci

热门

Scrapling MCP Server 是专为现代网页设计的智能爬虫工具,支持绕过 Cloudflare 等反爬机制。

这个工具解决了爬取动态网页和反爬网站时的头疼问题,特别适合需要批量采集电商价格或新闻数据的开发者。不过,它依赖外部浏览器引擎,资源消耗较大,不适合轻量级任务。

平台与服务
71.5k

评论