Skip to main content
Glama
sudhakaren

FastMCP Patient Information Server

by sudhakaren

FastMCP 患者信息服务器

一个通过 get_patient 工具提供患者信息检索功能的 FastMCP 服务器。

功能

  • get_patient 工具:检索全面的患者信息,包括:

    • 个人详细信息(姓名、出生日期、联系方式)

    • 保险计划(医疗、牙科、视力)

    • 员工信息

先决条件

  • 在您的 Ubuntu 服务器上安装 Docker 和 Docker Compose

  • 从 Watson Orchestrate 到服务器的网络访问权限

安装与部署

1. 将文件传输到 Ubuntu 服务器

将整个 fastmcp-server 目录复制到您的 Ubuntu 服务器:

scp -r fastmcp-server/ user@your-ubuntu-server:/path/to/deployment/

2. 使用 Docker Compose 构建并运行

通过 SSH 连接到您的 Ubuntu 服务器并导航到该目录:

ssh user@your-ubuntu-server
cd /path/to/deployment/fastmcp-server

构建并启动容器:

docker-compose up -d --build

3. 验证服务器是否正在运行

检查容器状态:

docker-compose ps

查看日志:

docker-compose logs -f

4. 在本地测试服务器

curl http://localhost:8002/health

连接到 Watson Orchestrate

第 1 步:获取您的服务器 URL

您的 MCP 服务器访问地址为:

http://your-ubuntu-server-ip:8002

或者如果您有域名:

https://your-domain.com:8002

重要提示:在生产环境中,请使用带有有效 SSL 证书的 HTTPS。

第 2 步:访问 Watson Orchestrate 工具页面

  1. 登录您的 Watson Orchestrate 实例

  2. 导航到 技能 (Skills)工具 (Tools) 部分

  3. 点击 添加工具 (Add Tool)连接工具 (Connect Tool)

第 3 步:配置 MCP 连接

  1. 连接类型:选择 "MCP Server" 或 "Custom API"

  2. 服务器 URL:输入您的服务器端点

    http://your-ubuntu-server-ip:8002
  3. 身份验证(如果需要):

    • 类型:无(用于基础设置)

    • 对于生产环境,请实现 OAuth2 或 API 密钥身份验证

  4. 连接名称Patient Information MCP Server

  5. 描述Provides patient information retrieval capabilities

第 4 步:发现工具

  1. 点击 发现工具 (Discover Tools)测试连接 (Test Connection)

  2. Watson Orchestrate 将向 MCP 服务器查询可用工具

  3. 您应该会看到 get_patient 工具出现

第 5 步:配置 get_patient 工具

该工具将自动配置为:

  • 工具名称get_patient

  • 描述:通过联系人 ID 检索患者信息

  • 参数

    • contact_id(可选字符串):唯一的联系人标识符

第 6 步:测试工具

  1. 在 Watson Orchestrate 中,选择 get_patient 工具

  2. 使用示例联系人 ID 进行测试:7c50f84d-62af-f011-bbd3-000d3a9b6dcb

  3. 或者在不带参数的情况下进行测试以获取默认患者数据

  4. 验证响应是否符合预期格式

第 7 步:使用该工具创建技能

  1. 在 Watson Orchestrate 中导航到 技能构建器 (Skills Builder)

  2. 创建一个使用 get_patient 工具的新技能

  3. 配置技能流程和参数

  4. 测试并发布技能

Watson Orchestrate 连接 YAML 示例

如果 Watson Orchestrate 支持 YAML 配置,请创建一个连接文件:

apiVersion: v1
kind: Connection
metadata:
  name: patient-mcp-server
spec:
  type: mcp
  endpoint: http://your-ubuntu-server-ip:8002
  authentication:
    type: none
  tools:
    - name: get_patient
      enabled: true

生产环境的安全注意事项

1. 启用 HTTPS

使用带有 SSL 的反向代理 (nginx):

# Install nginx
sudo apt-get update
sudo apt-get install nginx certbot python3-certbot-nginx

# Configure SSL
sudo certbot --nginx -d your-domain.com

2. 添加身份验证

更新 server.py 以包含 API 密钥身份验证:

from fastapi import Header, HTTPException

@mcp.tool()
def get_patient(contact_id: str = None, api_key: str = Header(None)) -> Dict[str, Any]:
    if api_key != "your-secret-api-key":
        raise HTTPException(status_code=401, detail="Invalid API key")
    # ... rest of the function

3. 网络安全

  • 使用防火墙规则限制访问

  • 考虑使用 VPN 或私有网络连接

  • 实施速率限制

4. 为生产环境更新 docker-compose.yml

version: '3.8'

services:
  fastmcp-server:
    build: .
    container_name: patient-mcp-server
    ports:
      - "127.0.0.1:8002:8002"  # Only bind to localhost
    environment:
      - PYTHONUNBUFFERED=1
      - API_KEY=${API_KEY}  # Use environment variable
    restart: unless-stopped
    networks:
      - mcp-network

networks:
  mcp-network:
    driver: bridge

故障排除

服务器无法启动

# Check logs
docker-compose logs

# Rebuild container
docker-compose down
docker-compose up -d --build

Watson Orchestrate 连接被拒绝

  1. 验证防火墙是否允许 8002 端口

  2. 检查服务器是否在 0.0.0.0 上监听,而不是 127.0.0.1

  3. 从另一台机器使用 curl 进行测试

工具未在 Watson Orchestrate 中显示

  1. 验证 MCP 服务器是否响应工具发现请求

  2. 检查 Watson Orchestrate 日志以查找连接错误

  3. 确保服务器 URL 正确且可访问

管理命令

# Start the server
docker-compose up -d

# Stop the server
docker-compose down

# View logs
docker-compose logs -f

# Restart the server
docker-compose restart

# Update the server
git pull  # or copy new files
docker-compose up -d --build

扩展服务器

要添加更多工具,请编辑 server.py

@mcp.tool()
def get_patient_appointments(patient_id: str) -> Dict[str, Any]:
    """Get patient appointments"""
    # Implementation here
    pass

@mcp.tool()
def get_patient_claims(patient_id: str) -> Dict[str, Any]:
    """Get patient insurance claims"""
    # Implementation here
    pass

然后重新构建并重启:

docker-compose up -d --build

支持

如有问题或疑问:

许可证

[在此处填写您的许可证]

-
security - not tested
F
license - not found
-
quality - not tested

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/sudhakaren/healthnav'

If you have feedback or need assistance with the MCP directory API, please join our Discord server