Token导航 LogoToken导航TokenDH.com
Clinical Trial Site Selection Agent logo
数据服务stdio官方级别未说明来源级核验

Clinical Trial Site Selection Agent

MCP Server

AI驱动的临床试验选址系统,通过分析患者人口统计、疾病流行率和历史表现来优化选址。

工具数

0

提示词数

0

GitHub Stars

0

资源数

0
数据分析PythonAPI集成

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

ayshsandu

提供方

ayshsandu

最后核验

2026/5/17 20:20

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

pip install -r requirements.txt # or poetry install

详细介绍

临床试验选址试剂演示

使用LangGraph和模型上下文协议(MCP)服务器的AI驱动的临床试验选址系统。

概述

该演示系统通过分析以下内容来帮助确定最佳临床试验地点:

  • 患者人口统计和疾病患病率
  • 现场能力和认证
  • 历史招生表现

建筑

┌─────────────────────────────────┐
│         Interactive UI          │
│            (React)              │
└─┬──────────────┬──────────────┬─┘
  │              │              │
  │              ▼              │
  │     ┌─────────────────┐     │
  │     │ Trial Site Agent│     │
  │     │   (LangGraph)   │     │
  │     └────────┬────────┘     │
  │              │              │
  │       ┌──────┴──────┐       │
  │       │             │       │
  ▼       ▼             ▼       ▼
┌────────────┐   ┌──────────────┐
│ Patient    │   │    Site      │
│Demographics│   │ Performance  │
│MCP Server  │   │ MCP Server   │
└────────────┘   └──────────────┘

组件

  1. LangGraph代理 (Python)-使用Gemini编排网站选择。包括一个完整的身份验证SDK,用于安全访问API。
  2. 患者人口统计MCP服务器 (TypeScript)-提供具有OAuth保护的匿名患者数据
  3. 站点性能MCP服务器 (TypeScript)-提供带有身份验证的站点功能和历史记录
  4. 交互式用户界面 (React)-用于可视化代理进度和结果的Web界面,可直接访问MCP服务器

先决条件

  • Python 3.11+ -对于LangGraph代理(包括完整的身份验证SDK)
  • Node.js 18+ -适用于MCP服务器和React UI
  • Google Gemini API密钥 -用于人工智能驱动的网站选择
  • 认证服务器 (可选)-Asgardeo或OAuth的类似产品(演示不需要它)

身份服务器设置

如果使用像Asgardeo这样的身份验证服务器进行OAuth保护:

  1. 创建MCP客户端应用程序:

- 创建一个名为“临床指南针应用程序”的新应用程序 - 将回调URL设置为代理的重定向URI(例如。, http://localhost:8010/auth/callback) - 启用“应用程序本机身份验证” - 获取并记录客户端ID

  1. 创建代理:

- 创建一个名为“试用站点顾问代理”的新代理 - 获取代理ID和密钥

  1. 创建API资源:

- 创建一个新的API资源,将代理建模为资源并管理对它的访问 - 标识符: trial-site-advisor-agent - 显示名称:“Trial Site Advisor Agent API界面” - 范围: query_agent

  1. 为MCP客户端应用程序授权API资源:

- 在“临床指南应用程序”应用程序的“授权”设置下 - 授权“试用站点顾问代理API接口”API资源

  1. 配置应用程序角色:

- 在“临床指南应用程序”应用程序的“角色”设置中 - 将角色受众设置为“组织”

  1. 创建角色:

- 为组织受众创建一个名为“试验协调员”的新角色 - 授权具有范围的“试验站点顾问代理API接口”的角色 query_agent

  1. 为用户分配角色:

- 将“试验协调员”角色分配给需要查询代理服务的用户

快速开始

选项1:自动设置(推荐)

要获得简化的设置体验,请遵循各个组件指南:

  1. 启动MCP服务器 (参见 mcp-servers/*/QUICKSTART.md)
  2. 安装代理 (参见 agent/QUICKSTART.md)
  3. 启动UI (参见 interactive-ui/QUICKSTART.md)

选项2:手动设置

# 1. Configure environment variables
# Copy and update .env files for each component
cp .env.example .env  # Root config (optional)
cp agent/.env.example agent/.env
cp mcp-servers/patient-demographics/.env.example mcp-servers/patient-demographics/.env
cp mcp-servers/site-performance/.env.example mcp-servers/site-performance/.env
cp interactive-ui/.env.example interactive-ui/.env
# Edit the .env files with your actual configuration values

# 2. Start MCP Servers (in separate terminals)
cd mcp-servers/patient-demographics
npm install && npm run build && npm start &

cd ../site-performance
npm install && npm run build && npm start &

# 3. Start Agent (in new terminal)
cd ../../agent
pip install -r requirements.txt  # or poetry install
python main.py

# 4. Start Interactive UI (in new terminal)
cd ../interactive-ui
npm install && npm run dev

第一次测试

  1. 打开 http://localhost:3000 在浏览器中
  2. 尝试查询:“在美国东北部寻找III期糖尿病试验的地点”
  3. 结果应在30-60秒内显示

先决条件检查

# Python 3.11+
python --version

# Node.js 18+
node --version

# Check MCP servers (after starting)
curl http://localhost:4001/health
curl http://localhost:4002/health

📖 详细的设置指南:每个组件都有详细的设置说明:

  • agent/QUICKSTART.md -代理设置和使用
  • interactive-ui/QUICKSTART.md -UI设置
  • mcp-servers/*/QUICKSTART.md -MCP服务器快速启动

项目结构

clinical-trial-demo/
├── agent/                      # LangGraph agent (self-contained with auth SDK)
│   ├── src/
│   │   ├── agent.py           # Main agent graph
│   │   ├── auth_sdk/          # Local authentication SDK
│   │   │   ├── core.py        # AuthSDK main class
│   │   │   ├── agent_auth.py  # Agent OAuth provider
│   │   │   ├── validator.py   # Token validation
│   │   │   └── ...            # Other auth modules
│   │   ├── state.py           # State definitions
│   │   ├── nodes/             # Graph nodes
│   │   └── mcp_client.py      # MCP client wrapper
│   ├── pyproject.toml
│   ├── main.py
│   ├── QUICKSTART.md          # Agent setup guide
│   └── README.md
├── mcp-servers/
│   ├── patient-demographics/  # Demographics MCP server
│   │   ├── src/
│   │   ├── package.json
│   │   └── tsconfig.json
│   └── site-performance/      # Performance MCP server
│       ├── src/
│       ├── package.json
│       └── tsconfig.json
├── interactive-ui/            # React web interface
│   ├── src/
│   ├── package.json
│   ├── QUICKSTART.md          # UI setup guide
│   └── README.md
├── .env.example               # Root environment template
└── README.md

查询示例

"Find sites for a Phase III Type 2 Diabetes trial targeting 200 patients 
 in the Northeast US with strong endocrinology departments"

"I need 5 sites for a Phase II lung cancer trial in California, 
 preferably academic medical centers with PET imaging capabilities"

"Looking for sites with experience in rare metabolic disorders, 
 any US location, need at least 50 potential patients per site"

API终点

患者人口统计服务器(端口4001)

  • POST /mcp -MCP协议端点
  • GET /health -健康检查

站点性能服务器(端口4002)

  • POST /mcp -MCP协议端点
  • GET /health -健康检查

认证

该代理包含一个完整的身份验证SDK(agent/src/auth_sdk/)它处理:

  • OAuth 2.0代表(OBO)流
  • 使用JWKS验证JWT令牌
  • 代理身份验证
  • 会话管理
  • 基于范围的访问控制

这使得代理人 完全自给自足 -开发和测试不需要外部身份验证依赖关系。

MCP工具

患者人口统计服务器

搜索患者池

  • 按疾病和地区搜索患者群体
  • 回报:人口规模、人口统计数据、患病率

get_demographics_by_region

  • 获取详细的区域人口统计数据
  • 回报:医疗保健可及性、注册速度、社会经济数据

站点性能服务器

搜索_网站

  • 按地区和治疗区域查找地点
  • 返回:网站信息、容量、治疗专长

get_site_capabilities

  • 获得现场认证和设备
  • 退货:证书、成像/实验室设备、员工资格

get_rollment_历史

  • 获取历史试用表现
  • 回报:过去的试验、入组率、质量指标

配置

环境变量

从以下位置读取所有关键配置 .env 每个组件目录中的文件。复制提供的 .env.example 文件,并用您的实际值更新它们。

代理配置(agent/.env)

# Google API Key (required)
# Get your API key from: https://aistudio.google.com/app/apikey
GOOGLE_API_KEY=your-api-key-here

# MCP Server URLs
DEMOGRAPHICS_SERVER_URL=http://localhost:4001/mcp
PERFORMANCE_SERVER_URL=http://localhost:4002/mcp

# OAuth 2.0 JWKS URL (required for API mode)
JWKS_URL=https://your-auth-server/.well-known/jwks.json

# Logging
LOG_LEVEL=DEBUG

# Token Validation Configuration
TOKEN_AUDIENCE=your-audience
TOKEN_ISSUER=https://your-auth-server/oauth2/token
REQUIRED_SCOPE=query_agent

# OBO (On-Behalf-Of) Flow Configuration
AUTHORIZATION_ENDPOINT=https://your-auth-server/oauth2/authorize
TOKEN_ENDPOINT=https://your-auth-server/oauth2/token
AGENT_REDIRECT_URI=http://localhost:8010/auth/callback
REQUESTING_SCOPES=openid profile email

# Agent Authentication (for agent identity)
AGENT_CLIENT_ID=your-agent-client-id
AGENT_CLIENT_SECRET=your-agent-client-secret
AGENT_REDIRECT_URL=http://localhost:8080/callback
AGENT_ID=your-agent-id
AGENT_PASSWORD=your-agent-password

MCP服务器配置(mcp-servers/*/env)

# Auth Server URLs
AUTH_SERVER_BASE_URL=https://localhost:9443
ISSUER=https://localhost:9443/oauth2/token

# Server Ports
PORT=4001  # or 4002 for site-performance

# Logging
LOG_LEVEL=info

# For Development Only
NODE_TLS_REJECT_UNAUTHORIZED=0

交互式UI配置(interactive-ui/.env)

# MCP Server URLs
VITE_DEMOGRAPHICS_SERVER_URL=http://localhost:4001/mcp
VITE_PERFORMANCE_SERVER_URL=http://localhost:4002/mcp

# Agent Resource Server URLs
VITE_AGENT_URL=http://localhost:8010

# Authentication Configuration
VITE_AUTH_CLIENT_ID=your-client-id

# Auth Server Base URL, for Asgardeo use https://api.asgardeo.io/t/
VITE_AUTH_SERVER_BASE_URL=https://localhost:9443
VITE_AUTH_SIGN_IN_REDIRECT_URL=http://localhost:3000
VITE_AUTH_SIGN_OUT_REDIRECT_URL=http://localhost:3000
VITE_AUTH_SCOPE=openid,profile,email,query_agent
VITE_AUTH_RESOURCE_SERVER_URLS=[${VITE_DEMOGRAPHICS_SERVER_URL},${VITE_PERFORMANCE_SERVER_URL},${VITE_AGENT_URL}]

# Agent API Configuration
VITE_AGENT_URL=http://localhost:8010
AGENT_RESOURCE_URL=http://localhost:8010/api/query

安装说明

  1. 复制 .env.example 文件到 .env 在每个组件目录中:
   # Agent
   cp agent/.env.example agent/.env

   # MCP Servers
   cp mcp-servers/patient-demographics/.env.example mcp-servers/patient-demographics/.env
   cp mcp-servers/site-performance/.env.example mcp-servers/site-performance/.env

   # Interactive UI
   cp interactive-ui/.env.example interactive-ui/.env
  1. 更新 .env 包含实际配置值的文件。

发展

运行测试

# MCP Servers
cd mcp-servers/patient-demographics
npm test

# Agent
cd agent
poetry run pytest

建筑

# MCP Servers
npm run build

# Agent
poetry build

测试MCP服务器

注: MCP服务器需要身份验证。在请求中包含有效的JWT承载令牌。

# List available tools
curl -X POST http://localhost:4001/mcp \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN_HERE" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/list"
  }'

# Call a tool
curl -X POST http://localhost:4001/mcp \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN_HERE" \
  -d '{
    "jsonrpc": "2.0",
    "id": 2,
    "method": "tools/call",
    "params": {
      "name": "search_patient_pools",
      "arguments": {
        "disease": "Type 2 Diabetes",
        "region": "US-Northeast"
      }
    }
  }'

故障排除

MCP服务器未启动

  • 检查端口4001/4002是否可用
  • 验证Node.js版本(18+)

身份验证错误

  • 确保 .env 文件配置了正确的身份验证服务器URL
  • 验证JWT令牌是否有效且未过期
  • 检查令牌中是否存在所需的作用域
  • 对于直接的API测试,请从您的身份验证服务器获取有效的承载令牌

代理连接问题

  • 验证MCP服务器是否正在运行: curl http://localhost:4001/health
  • 检查.env中的环境变量
  • 确保GOOGLE_API_KEY有效
  • 验证是否配置了身份验证(JWKS_URL,客户端凭据)

导入错误

  • npm install 在MCP服务器目录中
  • poetry install 在代理目录中
  • 检查Python版本(3.11+)

安全说明

  • 所有患者数据都是匿名和汇总的
  • 未存储或传输PII/PHI
  • 审计跟踪捕获所有数据访问
  • 生产部署需要额外的安全措施

未来的增强功能

  • \[\]真正的数据库集成
  • \[x\] 身份验证和授权(包括SDK)
  • \[x\] Web UI仪表板
  • \[\]预算估算整合
  • \[\]基于机器学习的站点性能预测
  • \[\]实时注册跟踪

许可证

Apache许可证2.0

贡献

欢迎投稿!请打开问题或提交拉取请求。

支持

如有疑问或问题,请打开GitHub issue。

目录标签

目录标签

数据分析PythonAPI集成临床试验本地部署医疗AI选址优化LangGraph

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

oauth

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiooauth部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP