Skip to main content

CTMS MCP Server

The CTMS MCP Server enables AI assistants to query clinical trial data using the Model Context Protocol. Connect your AI agent to explore cubes, run semantic queries, and get clinical trial KPIs with natural language.

Server Capabilities

With the MCP server, your agent can:

  • Execute semantic queries against your clinical trial data warehouse
  • Explore cubes, measures, and dimensions
  • Get pre-defined clinical KPIs (enrollment, safety, compliance)
  • Generate SQL for queries without execution

Example prompts:

  • "Show me enrollment counts by study"
  • "How many serious adverse events have been reported?"
  • "Compare subject counts across all sites"
  • "What cubes are available in the semantic layer?"
Enterprise Feature

MCP Server integration is available in Enterprise editions.


Quick Start

Add to .vscode/mcp.json:

{
"servers": {
"ctms-cube": {
"command": "node",
"args": ["${workspaceFolder}/ctms-mcp-server/index.js"],
"env": {
"CUBE_API_URL": "https://cube.yourdomain.com/cubejs-api/v1"
}
}
}
}

Available Tools

The MCP server provides the following tools for AI assistants:

📁 list_entities

List all available data entities in your data warehouse

📁 describe_entity

Get detailed structure of a specific entity with measures and dimensions

📁 get_schema

Retrieve full semantic layer metadata including segments and joins

📁 analytics_query

Execute analytics queries with measures, dimensions, and filters

📁 preview_sql

Generate SQL for a query without executing it

📁 get_dashboard_kpis

Get pre-defined dashboard KPIs for reporting


Architecture

AI Assistant → MCP Server (Node.js) → Cube.dev API → PostgreSQL

For web clients, the Agent Service provides a REST bridge:

Web Client → Agent Service (REST) → MCP Server → Cube.dev