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?" "Show me the ADSL variables in ADaM IG 1.3" "List all available Controlled Terminology packages"
For full setup instructions, see the User Manual β
Quick Start
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.py
Web 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:8080
The 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_products | β | List all available CDISC standards and published versions |
| 2 | get_sdtm_domains | SDTM | List all datasets in a SDTM-IG version |
| 3 | get_sdtm_domain_variables | SDTM | List all variables in an SDTM domain/dataset |
| 4 | get_sdtm_variable | SDTM | Get full definition of a specific SDTM variable |
| 5 | get_adam_datastructures | ADaM | List all data structures in an ADaM-IG version |
| 6 | get_adam_variable | ADaM | Get definition of a specific ADaM variable |
| 7 | get_cdash_domains | CDASH | List all domains in a CDASH-IG version |
| 8 | get_cdash_domain_fields | CDASH | Get all data collection fields for a CDASH domain |
| 9 | list_ct_packages | CT | List all available Controlled Terminology packages |
| 10 | get_codelist | CT | Get definition and metadata of a CT codelist |
| 11 | get_codelist_terms | CT | List all valid terms in a CT codelist |
Version Reference
| Standard | Available Versions (use dashes) |
|---|---|
| SDTM-IG | 3-4 Β· 3-3 Β· 3-2 Β· 3-1-3 |
| ADaM-IG | 1-3 Β· 1-2 Β· 1-1 Β· 1-0 |
| CDASH-IG | 2-1 Β· 2-0 Β· 1-1-1 |
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"
}
}
}
}
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 API
Key design decisions:
CDISCClientis a singleton async HTTP client with 1-hour TTL in-memory cache- Only
429and5xxresponses are retried;4xxraise immediately - Tool functions are pure async β independently testable without patching
format_response()strips HAL_linksmetadata, extracts structured data for LLM consumption
Development
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 -v
Code Quality
ruff check src/ tests/ # Linting
mypy src/ # Type checking
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.py
License
MIT β see LICENSE
Built for clinical data professionals working with CDISC standards.
User Manual Β· CDISC Library Β· API Docs