Skip to main content
Glama

哨兵代理(SENTINEL AGENT)—— 一个代理式运维应用构建器

用于 Foundry 风格运维本体论的 AI 指令层:一个通过 MCP 连接的 LLM 代理,能够用真实查询数据回答自然语言问题,提出人工批准的操作,并按需生成运维仪表盘 —— 一个自构建的、帕兰提尔 AIP 风格的运维工具。

脉络: 本项目是我为 Locari(我的潜在客户生成 SaaS —— 已上线生产环境;私有仓库)构建的 AI 网站生成代理的演进,从“LLM 生成网站”发展为“LLM 在具有治理机制的企业本体上操作”:相同的代理循环 DNA,但每一项能力现在都是类型化、白名单化、可预览、人工批准且可审计的。它与 PACIFIC SENTINEL(项目 1)配对,后者基于 FastAPI 的本体可由该代理直接消费。

完整演示:问答、批准操作、生成仪表盘

3 条提示词演示

全部可离线运行(无需 API 密钥):

.venv/bin/python scripts/demo.py

或者直接在 Web 应用中输入以下提示词:

#

提示词

你将看到的内容

1

哪些单位严重缺水?

代理基于本体模式进行 grounding,运行过滤查询,并以表格形式回答 —— 每次工具调用都会在右侧面板实时流式显示。

2

从 DEP-1 向 UNIT-1 发送 500 单位水

代理提出建议;预览卡片显示变更前后状态 + 约束检查。在你自己点击批准并执行之前,什么都不会改变。之后可以重新查询仓库库存以查看状态变更,并调用 GET /audit 查看审计追踪。

3

为仓库构建一个仪表盘

代理查询实时数据并发布 JSON 仪表盘规范;画布渲染统计磁贴、表格和柱状图。

问答

操作预览

已执行

仪表盘

Related MCP server: Enterprise Architecture MCP Server

什么是 MCP,以及它如何镜像帕兰提尔 AIP

MCP(模型上下文协议) 是一个开放协议,它为 LLM 提供了一个类型化、可发现、有界的工具表面,用于连接外部系统。服务器暴露工具(名称 + 描述 + JSON Schema);任何客户端 —— 代理、IDE、聊天应用 —— 都可以连接、列出并调用这些工具。协议边界就是治理边界:模型只能做服务器暴露的事情。

本项目是帕兰提尔 AIP 架构的微型版本:

本项目

帕兰提尔 AIP / Foundry 对应物

本体后端(StubOntologyHttpOntology → 项目 1 的 FastAPI)—— 类型化对象(SupplyDepotDeployedUnitForwardOperatingBase

Foundry 本体:原始数据之上的语义对象,一个中心被所有下游表面消费

MCP 读取工具(list_object_typesquery_objects

AIP 代理用于 grounding 的本体 API / 对象查询

propose_action → 带约束检查的预览 → 人工批准 → execute_action

AIP 操作类型,带有提交条件 + 人工审批工作流 —— 写入是受治理、经过验证的操作,绝非原始表编辑

操作员密钥门控的批准 + 一次性令牌 + 代理工具白名单

AIP 将代理能力与人类权限相分离

仅追加的审计日志,记录每一次提议/批准/执行/拒绝

AIP 评估与审计追踪

publish_dashboard JSON 规范 → 固定 React 渲染器

基于本体数据构建的 Workshop 风格运维应用(声明式配置,而非任意代码)

代理循环(Claude + MCP 工具 + 事件流)

AIP Agent Studio 中具有工具访问权限 + 流式推理的代理

人机协同如何工作

 user ──ask──▶ Agent (LLM)                 MCP server                FastAPI (operator)
                │  propose_action(...) ──▶ validate params
                │                          run constraint checks
                │                          build before/after PREVIEW   (no mutation)
                │ ◀── proposal + action_id ─┘
 UI shows preview card ──── human clicks Approve ──▶ approve_action(operator_key)
                                                     └─ mints SINGLE-USE token
                                                   execute_action(token)
                                                     ├─ re-validates vs CURRENT state
                                                     ├─ applies the change
                                                     └─ audit log: proposed→approved→executed

三个强制执行层使代理仅能提议:

  1. 白名单 —— approve_action / reject_action / execute_action 从 LLM 的工具列表中移除;代理循环拒绝任何对未授权工具的调用。

  2. 能力门控 —— 批准需要 OPERATOR_KEY,该密钥仅存在于编排服务器进程中(注入到 MCP 子进程环境)。LLM 上下文中从未包含它,因此代理原则上无法生成批准令牌。

  3. 令牌机制 —— 令牌是一次性的(secrets.compare_digest,首次使用即销毁),并且执行时会针对当前状态重新验证所有约束,因此过期的批准无法导致仓库超支。

仪表盘也遵循相同理念:代理生成一个严格验证的 JSON 规范extra="forbid",3 种小部件类型,有界大小),由固定 React 组件解释 —— 绝不生成 HTML、JSX 或可执行代码。

架构

 React 18 + Vite + TS + Tailwind          FastAPI (port 8100)              MCP server (stdio subprocess)
 ┌──────────────┬───────────────┐   WS    ┌──────────────────────┐  MCP    ┌─────────────────────────┐
 │ Chat panel   │ Actions cards │ ◀─────▶ │ /ws  agent events    │ ◀─────▶ │ 9 tools over ontology   │
 │ (markdown)   │ Live trace    │  HTTP   │ /actions/{id}/approve│  stdio  │ ┌─ StubOntology (dflt)  │
 │              │ Dashboard     │ ◀─────▶ │ /actions/{id}/reject │         │ └─ HttpOntology ──▶ Project 1
 │              │ canvas        │         │ /audit  /health      │         │    (pacific-sentinel)
 └──────────────┴───────────────┘         │ OpsAgent loop + LLM  │         └─────────────────────────┘
                                          │ (Claude ⟷ MockLLM)  │
                                          └──────────────────────┘

运行它

# Backend
python3.11 -m venv .venv && .venv/bin/pip install -e ".[dev]"
.venv/bin/python -m pytest                  # 60 tests, fully offline
.venv/bin/python scripts/demo.py            # scripted 3-prompt demo (mock LLM)
.venv/bin/python scripts/smoke_mcp.py       # raw MCP stdio smoke run

# CLI
.venv/bin/python -m ops_agent.cli --llm mock "Which units are critically low on water?"

# Web app: API on :8100, frontend on :5174
LLM_MODE=mock .venv/bin/python -m uvicorn ops_agent.server:app --port 8100
cd frontend && npm install && npm run dev   # open http://localhost:5174
npm test                                    # 8 Vitest component tests

# Real LLM (claude-opus-4-8; key read from env, never hardcoded)
export ANTHROPIC_API_KEY=sk-ant-...
.venv/bin/python -m ops_agent.cli "Which units are critically low on water?"

# Against Project 1's live ontology instead of the stub
ONTOLOGY_BACKEND=http ONTOLOGY_API_URL=http://localhost:8000 ...

LLM 模式 —— LLM_MODE=auto(默认:如果设置了 ANTHROPIC_API_KEY 则为 live,否则为 mock)/ mock / liveMockLLM 的行为类似于工具调用模型(grounding 查询 → 过滤查询 → 回答;操作解析;仪表盘构建),因此所有流程(包括测试和演示)均可离线且确定性地运行。

里程碑

  • M1 MCP 服务器:基于可切换后端的只读本体工具 + 测试

  • M2 代理循环:通过 MCP 的 LLM 工具调用、白名单、审计事件、CLI

  • M3 FastAPI WebSocket 流式传输 + React 聊天/追踪 UI

  • M4 提议 → 人工批准(操作员密钥 + 一次性令牌)→ 执行 → 审计

  • M5 仪表盘规范生成(安全 JSON)+ React 渲染器(recharts)

  • M6 演示脚本、截图、本 README

F
license - not found
-
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    -
    quality
    B
    maintenance
    Turns warehouse/lakehouse tables into a governed entity-relationship knowledge graph exposed through MCP, enabling AI agents to answer multi-table business questions without hard-coded SQL or large schema prompts.
    Apache 2.0
  • F
    license
    -
    quality
    C
    maintenance
    Enables engineers and plant managers to interact with manufacturing systems using natural language, providing machine health analysis, KPI dashboards, predictive maintenance, and automated workflow execution via MCP.
  • A
    license
    -
    quality
    B
    maintenance
    Enables governed, agent-agnostic data exploration by allowing users to ask natural language questions through MCP-compatible agents, executing safe, permission-scoped queries against data sources and returning interactive charts.
    48
    Apache 2.0

View all related MCP servers

Related MCP Connectors

  • An AI concierge that turns static forms into adaptive AI conversations. From any MCP client.

  • GibsonAI MCP server: manage your databases with natural language

  • Official Microsoft MCP Server to query Microsoft Entra data using natural language

View all MCP Connectors

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/aryanpatel27/sentinel-agent'

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