Skip to main content
Glama

GxP MDM MCP Server - 面向 Claude / ChatGPT / Cursor 的 Cypher 工具

该 MCP 服务器通过 Cypher 查询,将您的计算机化系统清单构建为知识图谱。任何 Claude/ChatGPT 代理现在都可以查询 GxP 主数据,而不会产生幻觉。

架构

Claude / ChatGPT / Cursor
        |
        | MCP (stdio)
        v
  mcp_server.py (14 tools)
        |
        | Cypher queries
        v
  Neo4j (or MOCK mode: NetworkX + JSON) <- your MDM golden record

为什么选择 Cypher?

  • 影响范围(Blast radius) 是一种图遍历:MATCH (start)-[:SENDS_VIA*1..3]->(downstream) — 这在 SQL 中无法实现

  • 用于 ALCOA+ 调查的数据血缘

  • 法规真值 — 代理只能引用 Cypher 返回的条款,从而防止幻觉

Related MCP server: NOMIK

提供的 14 个工具

工具

Cypher

功能说明

cypher_query

自定义 Cypher

用于探索的安全只读 Cypher

list_all_systems

MATCH (s:ComputerizedSystem) RETURN

完整清单 - 审计员会首先询问这个

get_system_details

完整子图

系统 + 功能 + 电子记录 + 供应商 + 接口

get_blast_radius

MATCH (start)-[:SENDS_VIA*1..$depth]->(downstream)

杀手级应用:变更会影响到哪些下游 GxP 系统?

get_upstream_lineage

反向遍历

数据来自哪里?

get_applicable_regulations

(s)-[:HAS_FUNCTION]->(f)-[:REGULATED_BY]->(reg)

防幻觉:只能引用这些条款

get_system_interfaces

(s)-[flow:SENDS_VIA]->(target)

带 GxP 标志的 API/文件/手动接口

find_validation_gaps

WHERE validation_status <> 'Validated'

未验证的 GxP Direct 系统

find_periodic_review_overdue

WHERE next_review < date()

逾期的定期评审

find_high_risk_functions

WHERE is_gxp_critical AND risk=High

电子签名、批放行、效价(高风险功能)

get_supplier_risk

(s)-[:SUPPLIED_BY]->(sup)

供应商审计状态、SOC2

get_data_lineage

MATCH (s)-[:GENERATES]->(e:ElectronicRecord)

针对某类记录的数据血缘

get_gxp_inventory

WHERE gxp_impact='Direct'

GxP Direct 清单

assess_change_impact

综合查询

编排 3 组 Cypher 查询,并按 GAMP 5 / CSA 生成影响评估

快速开始(无需 Neo4j - 模拟模式)

cd gxp_mdm_mcp_server
pip install -r requirements.txt

# Mock mode: uses JSON + NetworkX, no Neo4j required
python scripts/test_tools.py

# Should show:
# - List 4 systems
# - Veeva QMS details with downstream SAP
# - Blast radius: Veeva -> SAP
# - REJECT for audit trail purge
# - Minor for version upgrade

模拟模式非常适合 POC 和 Claude Desktop 测试。

使用 Neo4j 的生产模式

# .env - set Neo4j creds
cp .env.example .env
# Edit .env with your Neo4j URI

# Start Neo4j
docker-compose up -d neo4j

# Load sample data + schema
python scripts/load_sample_data.py

# Test with Neo4j
python scripts/test_tools.py

# Start API harness (optional)
uvicorn src.api_server:app --reload --port 8000
# http://localhost:8000/cypher/list_all_systems
# http://localhost:8000/cypher/blast_radius?system_id=SYS-VEEVA-QMS-001

Claude Desktop 配置

  1. 找到您的 Claude 配置文件:~/Library/Application Support/Claude/claude_desktop_config.json(Mac)或 %APPDATA%/Claude/claude_desktop_config.json(Win)

  2. 添加以下内容(请使用绝对路径):

{
  "mcpServers": {
    "gxp-mdm-cypher": {
      "command": "python",
      "args": ["/absolute/path/to/gxp_mdm_mcp_server/src/mcp_server.py"],
      "env": {
        "NEO4J_URI": "",
        "NEO4J_USERNAME": "neo4j",
        "NEO4J_PASSWORD": "password"
      }
    }
  }
}

模拟模式下请将 NEO4J_URI 留空。使用 Neo4j 时,请设置为 bolt://localhost:7687。

  1. 重新启动 Claude Desktop。您应该会在 🔌 下看到 14 个工具。

  2. 尝试以下提示:

List all GxP Direct systems in my inventory
> calls list_all_systems(gxp_impact="Direct")

What happens if I change Veeva QMS? Show blast radius
> calls get_blast_radius(system_id="SYS-VEEVA-QMS-001")

Assess this change: Enable audit trail purge after 7 years for Veeva QMS
> calls assess_change_impact -> should REJECT per 21CFR11.10(e)

Assess Veeva upgrade from 24R1 to 24R2 with no e-sig change
> calls assess_change_impact -> should be Minor per CSA low risk

Cursor 配置

请参阅 config/cursor_config.json.example — 将其添加到 .cursor/mcp.json

ChatGPT(支持 MCP)

如果为 ChatGPT 自定义 GPT 使用 MCP,请参考 config/chatgpt_mcp_config.json。ChatGPT 将通过 stdio 调用工具。

Cypher 查询 - 事实依据

所有查询均位于 src/cypher_tools.py。关键查询如下:

影响范围(护城河):

MATCH (start:ComputerizedSystem {system_id: $system_id})
MATCH path = (start)-[:SENDS_VIA*1..$depth]->(downstream:ComputerizedSystem)
WHERE downstream.gxp_impact IN ['Direct', 'GxP Relevant']
RETURN downstream.system_id, length(path) as distance

法规防幻觉:

MATCH (s:ComputerizedSystem {system_id: $system_id})
OPTIONAL MATCH (s)-[:HAS_FUNCTION]->(f)-[:REGULATED_BY]->(reg)
RETURN collect(DISTINCT reg) as regulations

智能体只能引用这里返回的 clause_ids。

从 POC 到生产

  1. 将 data/*.json 替换为真实的 Veeva Vault API + ServiceNow CMDB + Okta

  2. 添加用于更新 validation_status 的写入工具(含审批工作流)

  3. 添加面向法规 RAG 的向量搜索工具(引入 GAMP 5 第 2 版)

  4. 添加按计划调用 find_periodic_review_overdue 的定期评审智能体

您现在拥有每个 CSV 自动化智能体都必须查询的那一层。

故障排除

  • No module named mcp:运行 pip install mcp

  • Claude 看不到工具:检查配置中的绝对路径,重启 Claude,并查看日志 ~/Library/Logs/Claude/mcp*.log

  • Neo4j 连接失败:会自动回退到模拟模式 — 请检查 NEO4J_URI

祝您好运,独占市场。

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    C
    maintenance
    Transforms code repositories and development documentation into a queryable Neo4j knowledge graph, enabling AI assistants to perform intelligent code analysis, dependency mapping, impact assessment, and automated documentation generation across 15+ programming languages.
    7
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    AI-native code intelligence graph that builds a persistent knowledge graph of your codebase in Neo4j and exposes it to AI assistants via MCP, enabling contextual code analysis, impact analysis, and dependency tracking.
    23
    -
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables AI agents to query architecture context, data contracts, and blast radius to prevent cross-repo architectural breakage before merging.
    24
    Apache 2.0