cdisc-mcp
The CDISC MCP server bridges AI assistants and Python tools to the CDISC Library API, enabling queries across clinical data standards (SDTM, ADaM, CDASH, and Controlled Terminology) via 12 structured tools.
Discover & Search
List all available CDISC standards and their published versions (
list_products)Keyword search across all CDISC standards, e.g., "adverse event" or "AEDECOD" (
search_cdisc)
SDTM (Study Data Tabulation Model)
List all domains for a specific SDTM-IG version (
get_sdtm_domains)Get all variables within an SDTM domain (
get_sdtm_domain_variables)Retrieve the full definition of a specific SDTM variable (
get_sdtm_variable)
ADaM (Analysis Data Model)
List all data structures for a given ADaM-IG version (
get_adam_datastructures)Get the definition of a specific ADaM variable (
get_adam_variable)
CDASH (Clinical Data Acquisition Standards Harmonization)
List all domains for a given CDASH-IG version (
get_cdash_domains)Get all data collection fields for a CDASH domain (
get_cdash_domain_fields)
Controlled Terminology (CT)
List all available CT packages with release dates (
list_ct_packages)Retrieve a specific CT codelist definition and metadata (
get_codelist)List all valid terms within a CT codelist, up to 100 at a time (
get_codelist_terms)
Note: Use dashes instead of dots for version numbers (e.g.,
3-4not3.4).
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@cdisc-mcpList the variables for the SDTM DM domain in version 3.4"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
CDISC Library MCP Server β Query clinical data standards (SDTM, ADaM, CDASH, CT) directly from AI assistants.
π Translations: δΈζ README Β· ζ₯ζ¬θͺ README
What is This?
The CDISC MCP Server connects AI assistants (Claude, VS Code Copilot, Cursor, etc.) to the CDISC Library REST API, exposing 11 structured tools for querying clinical trial data standards. Ask your AI assistant questions like:
"What variables are in the SDTM AE domain?"/m "Show me the ADSL variables in ADaM IG 1.3" "List all available Controlled Terminology packages"
For full setup instructions, see the User Manual β. See Examples β for real conversation samples.
Quick Start
0 Β· One-Line AI Install
Have an AI assistant install everything for you:
curl -fsSL https://raw.githubusercontent.com/Teninq/cdisc-mcp/main/install.mdPaste the output into Claude, Copilot, or any AI chat β it will read the guide and walk you through the full setup interactively.
1 Β· Get a CDISC Library API Key
Register at https://library.cdisc.org and obtain a personal API key.
2 Β· Install
# Runtime only
pip install -e .
# With dev dependencies
pip install -e ".[dev]"
# With web explorer
pip install -e ".[web]"3 Β· Set API Key
# Linux / macOS
export CDISC_API_KEY=your_key_here
# Windows β Command Prompt
set CDISC_API_KEY=your_key_here
# Windows β PowerShell
$env:CDISC_API_KEY = "your_key_here"4 Β· Run
# Start MCP server (for AI assistant integration)
cdisc-mcp
# OR: Start Web Explorer (quick interactive testing)
python web/app.pyWeb Explorer β Quick Interactive Testing
The fastest way to verify your setup and explore tools without any AI client.
# 1. Install web dependencies
pip install -e ".[web]"
# 2. Set your API key
export CDISC_API_KEY=your_key_here # Linux/macOS
set CDISC_API_KEY=your_key_here # Windows CMD
$env:CDISC_API_KEY = "your_key_here" # Windows PowerShell
# 3. Start the bridge server
python web/app.py
# 4. Open in browser
# β http://localhost:8080The explorer provides:
Sidebar navigation β all 11 tools organized by standard (SDTM / ADaM / CDASH / Terminology)
Auto-generated forms β dropdowns for versions and domains, text inputs for variables
Live JSON responses β syntax-highlighted, copyable output with response time
Bridge status indicator β confirms your API key and connectivity
Tip: Use version strings with dashes β
3-4not3.4,1-3not1.3. Example: SDTM-IG3-4, ADaM-IG1-3, CDASH-IG2-0
Available Tools
# | Tool | Standard | Description |
1 |
| β | List all available CDISC standards and published versions |
2 |
| SDTM | List all datasets in a SDTM-IG version |
3 |
| SDTM | List all variables in an SDTM domain/dataset |
4 |
| SDTM | Get full definition of a specific SDTM variable |
5 |
| ADaM | List all data structures in an ADaM-IG version |
6 |
| ADaM | Get definition of a specific ADaM variable |
7 |
| CDASH | List all domains in a CDASH-IG version |
8 |
| CDASH | Get all data collection fields for a CDASH domain |
9 |
| CT | List all available Controlled Terminology packages |
10 |
| CT | Get definition and metadata of a CT codelist |
11 |
| CT | List all valid terms in a CT codelist |
Version Reference
Standard | Available Versions (use dashes) |
SDTM-IG |
|
ADaM-IG |
|
CDASH-IG |
|
Connect to an AI Assistant
Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"cdisc": {
"command": "cdisc-mcp",
"env": {
"CDISC_API_KEY": "your_key_here"
}
}
}
}VS Code / Cursor
Add to .vscode/mcp.json or equivalent MCP config:
{
"servers": {
"cdisc": {
"command": "cdisc-mcp",
"env": {
"CDISC_API_KEY": "your_key_here"
}
}
}
}Claude Code (CLI)
Claude Code supports MCP servers at two scopes: user (global, all projects) and project (local, current project only).
Option A β CLI command (recommended)
# Add globally (available in all projects)
claude mcp add cdisc-mcp -e CDISC_API_KEY=your_key_here -- python -m cdisc_mcp.server
# Add for the current project only
claude mcp add cdisc-mcp --scope project -e CDISC_API_KEY=your_key_here -- python -m cdisc_mcp.server
# Verify the server was registered
claude mcp listOption B β Edit ~/.claude.json directly
{
"mcpServers": {
"cdisc-mcp": {
"command": "python",
"args": ["-m", "cdisc_mcp.server"],
"env": {
"CDISC_API_KEY": "your_key_here"
}
}
}
}Tip: If
CDISC_API_KEYis already in your system environment, omit theenvblock entirely β Claude Code inherits it automatically.
Once registered, confirm with /mcp in any Claude Code session, then use the tools conversationally:
User: What SDTM domains are defined in version 3.4?
Claude: [calls get_sdtm_domains with version="3-4"] ...Using in Your Own Python Tools
You can call CDISC MCP tools programmatically from any Python script using the official MCP client SDK.
Install the client
pip install mcpMinimal example
import asyncio
import os
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
SERVER = StdioServerParameters(
command="python",
args=["-m", "cdisc_mcp.server"],
env={"CDISC_API_KEY": os.environ["CDISC_API_KEY"]},
)
async def main():
async with stdio_client(SERVER) as (read, write):
async with ClientSession(read, write) as session:
await session.initialize()
# List all available tools
tools = await session.list_tools()
print([t.name for t in tools.tools])
# Call a tool
result = await session.call_tool(
"get_sdtm_domains",
arguments={"version": "3-4"},
)
print(result.content[0].text)
asyncio.run(main())Reusable helper
import asyncio, os, json
from contextlib import asynccontextmanager
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
_SERVER = StdioServerParameters(
command="python",
args=["-m", "cdisc_mcp.server"],
env={"CDISC_API_KEY": os.environ["CDISC_API_KEY"]},
)
@asynccontextmanager
async def cdisc_session():
"""Async context manager that yields an initialised MCP session."""
async with stdio_client(_SERVER) as (read, write):
async with ClientSession(read, write) as session:
await session.initialize()
yield session
async def call(tool: str, **kwargs) -> dict:
async with cdisc_session() as s:
result = await s.call_tool(tool, arguments=kwargs)
return json.loads(result.content[0].text)
# --- Usage examples ---
async def demo():
# Fetch SDTM domains
domains = await call("get_sdtm_domains", version="3-4")
# Fetch all variables in the AE domain
variables = await call("get_sdtm_domain_variables", version="3-4", domain="AE")
# Look up a single variable
aeterm = await call("get_sdtm_variable", version="3-4", domain="AE", variable="AETERM")
print(aeterm)
asyncio.run(demo())Available tool signatures (quick reference)
# Products / versions
await session.call_tool("list_products", {})
# SDTM
await session.call_tool("get_sdtm_domains", {"version": "3-4"})
await session.call_tool("get_sdtm_domain_variables", {"version": "3-4", "domain": "AE"})
await session.call_tool("get_sdtm_variable", {"version": "3-4", "domain": "AE", "variable": "AETERM"})
# ADaM
await session.call_tool("get_adam_datastructures", {"version": "1-3"})
await session.call_tool("get_adam_variable", {"version": "1-3", "data_structure": "ADSL", "variable": "USUBJID"})
# CDASH
await session.call_tool("get_cdash_domains", {"version": "2-0"})
await session.call_tool("get_cdash_domain_fields", {"version": "2-0", "domain": "AE"})
# Controlled Terminology
await session.call_tool("list_ct_packages", {})
await session.call_tool("get_codelist", {"package_id": "sdtmct-2024-03-29", "codelist_id": "C66781"})
await session.call_tool("get_codelist_terms", {"package_id": "sdtmct-2024-03-29", "codelist_id": "AGEU"})Version format: Always use dashes, not dots β
"3-4"not"3.4".
Architecture
MCP Client (Claude / VS Code / Cursor)
β
β MCP protocol (stdio)
βΌ
server.py ββββ FastMCP tool registration
β
βΌ
tools/ ββββββββ domain functions (sdtm, adam, cdash, terminology, search)
β
βΌ
client.py βββββ CDISCClient (async HTTP Β· TTL cache Β· retry)
β
β HTTPS
βΌ
library.cdisc.org/api ββββ CDISC Library REST APIKey design decisions:
CDISCClientis a singleton async HTTP client with 1-hour TTL in-memory cacheOnly
429and5xxresponses are retried;4xxraise immediatelyTool functions are pure async β independently testable without patching
format_response()strips HAL_linksmetadata, extracts structured data for LLM consumption
Development
Development workflow (devel-first, branch & merge SOP): See Contributing Guide.
Running Tests
# Full suite with coverage (β₯80% required)
pytest
# Specific modules
pytest tests/test_tools.py tests/test_client.py -v
# Single test
pytest tests/test_tools.py::test_list_products -vCode Quality
ruff check src/ tests/ # Linting
mypy src/ # Type checkingGitHub Branch Protection (Required Checks)
Configure main branch protection to require:
CI Tests / testsCI Lint / lintCI Types / types
Project Structure
src/cdisc_mcp/
βββ server.py # FastMCP server + tool registration
βββ client.py # Async HTTP client (cache, retry)
βββ config.py # Config dataclass + env loader
βββ errors.py # AuthenticationError, ResourceNotFoundError, RateLimitError
βββ response_formatter.py # HAL response normalization
βββ tools/
βββ search.py # list_products (product catalog)
βββ sdtm.py # SDTM domain/variable tools
βββ adam.py # ADaM datastructure/variable tools
βββ cdash.py # CDASH domain/field tools
βββ terminology.py # CT package/codelist tools
βββ _validators.py # Path traversal guards
web/
βββ app.py # FastAPI bridge server
βββ index.html # Single-file browser explorer
tests/
βββ test_config.py
βββ test_client.py
βββ test_response_formatter.py
βββ test_tools.py
βββ test_errors.py
βββ test_server.pyLicense
MIT license.
Built for clinical data professionals working with CDISC standards.
User Manual Β· Examples Β· CDISC Library Β· API Docs
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Teninq/cdisc-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server