Get the FREE Ultimate OpenClaw Setup Guide →

clinicaltrialsgov

MCP server for the ClinicalTrials.gov v2 API. Allow LLMs to search trials, retrieve study details, compare studies, analyze trends, and match patients to eligible trials.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio cyanheads-clinicaltrialsgov-mcp-server bunx clinicaltrialsgov-mcp

How to use

This MCP server provides a set of tools for working with the ClinicalTrials.gov v2 API. It includes facilities to search for trials, fetch detailed study data, retrieve trial results, obtain valid field values, analyze trends, compare multiple studies, and find eligible trials for a patient profile. The server supports running locally via stdio or via HTTP, and can also be deployed to Cloudflare Workers for edge hosting. Tools are exposed as individual commands that your MCP client can call, enabling structured, type-safe interactions with the ClinicalTrials.gov data model.

Common workflows include: using clinicaltrials_search_studies to locate trials by query terms and filters; clinicaltrials_get_study or clinicaltrials_get_study_results to fetch full trial details or outcomes; clinicaltrials_analyze_trends and clinicaltrials_compare_studies to perform analytics and comparisons across multiple studies; and clinicaltrials_find_eligible_studies to match patient profiles to eligible trials. Each tool is designed with a declarative definition and consistent error handling to streamline integration with MCP clients.

How to install

Prerequisites:

  • Node.js (recommended) or Bun environment for running Bun-based tooling
  • Access to npm registry (public or private as needed)

Installation steps:

  1. Install the package from npm (example shown assumes default npm registry and global install): npm i -g clinicaltrialsgov-mcp-server

  2. If you are using Bun tooling (recommended for stdio/HTTP runners):

    • Install Bun from https://bun.sh/ and ensure bunx is available in your PATH
    • Alternatively, install the package locally in your project and run via Bunx: bunx clinicaltrialsgov-mcp
  3. Run the server locally (stdio mode) using the self-hosted command example from the README: bunx clinicaltrialsgov-mcp

  4. If deploying to Cloudflare Workers or using HTTP streamable mode, configure the appropriate URL and environment as described in the MCP docs.

Notes:

  • The server can be consumed either via stdio (local development) or via HTTP for integration in a client-server setup.
  • Ensure your environment variables (if required by the deployment) are set according to your hosting provider and the MCP configuration.

Additional notes

Tips and common issues:

  • Ensure you are using a compatible MCP SDK version as indicated in the README (MCP Spec 2025-06-18 and MCP SDK ^1.27.1).
  • When running in Cloudflare Workers, verify that your bundling and deployment steps align with worker boundaries and runtime limits.
  • If you encounter authentication issues, verify that the auth strategy (none, jwt, oauth) is correctly configured in your MCP client and server setup.
  • For large analyses (e.g., analyze_trends on up to 5,000 studies), be mindful of rate limits and potential timeouts; consider batching requests where supported.
  • The public hosted instance provides a streamable-http endpoint; for private deployments, use stdio or self-hosted HTTP as appropriate.

Related MCP Servers

Sponsor this space

Reach thousands of developers