asset-health-mcp
asset-health-mcp
一个 AI 代理,负责决定是否派遣现场技术人员——并且拒绝基于它无法信任的数据采取行动。
基于 Salesforce Data Cloud 的 Agentforce 代理,调用自定义的 MCP 服务器,用于数据质量验证(Great Expectations)和异常评分(Databricks),并通过受保护的 Apex 写回操作来创建 WorkOrder。
🎥 2 分钟演示视频 —— 观看代理如何验证、评分、创建工单,然后拒绝损坏的数据批次。
为什么会有这个项目
大多数代理演示都会让 LLM 对它拿到的任何数据直接行动。而在现场服务场景中,基于一条损坏的仪表读数去行动,意味着为了一次毫无意义的派工——甚至更糟,漏掉一个正出故障的资产。这个项目在每个代理决策之前加了一道数据信任闸门:
readings ──▶ Ingestion API ──▶ Data Cloud (zero-copy grounding)
│
▼
Agentforce agent
│ 1. check_reading_quality MCP / Great Expectations
│ 2. score_asset_anomaly MCP / Databricks
│ 3. create work order Apex (guarded write-back)
│
▼
Salesforce WorkOrderRelated MCP server: qc-validator-mcp
设计决策
两个精细挑选的 MCP 工具,而不是一次大量数据倾泻。 代理得到的是判断结果(信任 + 严重性);原始历史记录通过 Data Cloud 零拷贝(zero-copy)单独供其使用。这远未触及 Agentforce 的工具预算上限。
防护逻辑放在服务端。 即使代理主动请求,Apex action 也会拒绝不信任的数据和常规严重级别请求——代理指令不是安全边界(OWASP LLM07)。
写回操作幂等。 代理会重试;重复的现场派工花费的是真金白银。每个资源只对应一个未完成的 Asset Health WorkOrder,由 Apex 强制保证。
无需任何凭据即可运行。 确定性的 Databricks 模拟器 + GX 临时测试上下文,意味着在全新克隆的环境下无需任何外部服务,
pytest即可全部通过。
技术栈
Python 3.11 · FastMCP(mcp 1.x) · Great Expectations 1.18 · Databricks (Unity Catalog) · Salesforce Data Cloud(Ingestion API、DMO grounding) · Agentforce · Apex
仓库结构
src/asset_health_mcp/ FastMCP server: tools, GX validation, Databricks client
pipeline/ Ingestion API pipeline → Meter Reading DMO (fallback path)
force-app/ Apex write-back action + tests
databricks/ PySpark scoring job → Unity Catalog Delta table with
UniForm (Iceberg) — zero-copy File Federation ready
snowflake/ readings warehouse DDL + least-privilege key-pair
integration user for Query Federation
datacloud/ ZERO_COPY.md — federation-mode decisions and setup
docs/ AGENT_BUILD.md (Agentforce wiring), demo script
tests/ smoke suite, green with zero external services所有零拷贝设计都落实为一句话: 读数保留在 Snowflake(Query Federation,将 JDBC 下推到隔离的 XS 数据仓库),评分保留在 Databricks(使用 UniForm/Iceberg 的文件联合,零外部计算)——模式按成本、按数据表来选择, 而不是按默认配置。详见:datacloud/ZERO_COPY.md。
运行
pip install -e ".[dev]" && pytest # zero-credential smoke suite
python -m asset_health_mcp.server # stdio, for Claude Desktop
MCP_TRANSPORT=streamable-http \
python -m asset_health_mcp.server # HTTP, for Agentforce registry
sf project deploy start # Apex action + tests完整的构建手册:docs/SETUP.md(step-by-step,围绕抵御 license 约束的顺序编排)· 代理对接: docs/AGENT_BUILD.md · 哪些版本运行在哪个版本上、哪些 内容有文档但没有演示: docs/ENVIRONMENTS.md。
已知局限
Demo 级别认证(PAT,而非 OAuth service principal)、预计算评分(而非 实时模型服务)、单 org(single-org)。这个局限是刻意留下的——这个项目 关注的是方案架构 而不是生产环境加固。
作者:Yamyle —— Salesforce 高级架构师 & 数据/AI 工程师。 20+ Salesforce 认证 · 曾为公用事业和金融服务领域构建集成框架。
This server cannot be deployed
Maintenance
Related MCP Connectors
Paid deterministic data-quality and execution-verification tools for AI agents.
Verified AI-agent outcomes: secret scanning, JSON cleanup, dedupe, anomaly and schema checks.
Preflight QA for AI-agent deliverables with structured verdicts and repair guidance.
Deterministic validation for AI-generated artifacts: JSON Schema, OpenAPI response, SQL syntax.
Related MCP Servers
- AlicenseBqualityDmaintenanceAgentic data quality MCP server — runs structured validation rules against warehouses (DuckDB, BigQuery, Athena, Databricks, Postgres), diagnoses failures with LLM root cause analysis, and proposes SQL remediations. Full audit trail of every AI decision.64Apache 2.0
- AlicenseAqualityDmaintenanceRuntime quality validation for AI agent outputs. Detect hallucinations, enforce scope compliance, and score output quality — all via MCP.651 npmMIT
- AlicenseNot gradedqualityCmaintenanceMulti-dimensional data quality validation and statistical anomaly detection for LLM training data, with auto-fix pipeline and MCP tools for AI IDE integration.MIT
- AlicenseNot gradedqualityCmaintenanceProtects AI agents from bad tool outputs, schema mismatches, and tool poisoning by validating, sanitizing, and scoring reliability of tool responses.MIT