AI代理运行时治理工具

TrustScope是一个AI代理运行时治理工具,提供监控、检测和审计功能,并生成加密证据链。

  • by adam-trustscope
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 adam-trustscope/trustscope-mcp-server

使用说明

信任范围

AI代理的运行时治理。使用加密证据跟踪监视、检测和审计代理行为。

特性

  • 11 MCP工具 -人工智能代理的全面治理API
  • 18个检测引擎 -10个统计+8个基于模式的异常检测器
  • 证据库 -SQLite具有SHA-256哈希链,用于防篡改审计跟踪
  • 策略引擎 -具有可配置规则的默认策略包
  • 已连接模式 -与PII编辑、NL诊断和签名证明进行云同步
  • CLI命令 -监视、扫描、验证、导出、云连接

安装

npm install trustscope

快速开始

MCP服务器(克劳德桌面/IDE集成)

添加到您的Claude桌面配置(~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "trustscope": {
      "command": "npx",
      "args": ["trustscope", "mcp"]
    }
  }
}

监视模式(LLM代理)

拦截并监视LLM API调用:

# Start proxy on port 8081
npx trustscope watch --port 8081

# Point your LLM client at http://localhost:8081
# Proxy forwards to OpenAI/Anthropic with full monitoring

混合模式(MCP+手表)

使用共享证据存储运行MCP服务器和监视代理:

npx trustscope hybrid --port 8081

CLI命令

trustscope mcp          # Start MCP server (stdio)
trustscope watch        # Start LLM proxy monitor
trustscope hybrid       # Combined MCP + Watch mode
trustscope scan <dir>   # Scan codebase for security issues
trustscope verify       # Verify evidence chain integrity
trustscope export       # Export traces to CSV/JSON
trustscope cloud connect # Connect to TrustScope cloud
trustscope cloud status  # Check cloud connection status

MCP工具

工具 说明
trustscope_check_policy 检查策略是否允许操作
trustscope_check_detection 对操作运行异常检测
trustscope_log_action 将操作记录到证据存储中
trustscope_list_traces 查询证据库
trustscope_list_policies 获取有效策略
trustscope_list_approvals 获取待处理/已批准的操作
trustscope_approve 批准待处理的操作
trustscope_get_agent_dna 获取/更新代理行为基线
trustscope_get_compliance 生成合规报告
trustscope_explain_behavior 分析代理行为模式
trustscope_get_attestation 生成签名证明

检测引擎

统计引擎(10)

  • 速度尖峰检测
  • 熵分析
  • 时间异常
  • 会话长度漂移
  • 错误率峰值
  • 成本异常
  • 令牌使用模式
  • 工具集中度
  • 突发检测
  • 冷却违规

模式引擎(8)

  • 动作标签不匹配
  • 禁止工具访问
  • 权限提升
  • 数据泄露模式
  • 快速注射指示器
  • 凭证处理
  • 循环行为
  • HTTP方法不匹配

已连接模式

TrustScope可以选择连接到云端以增强功能:

# Connect to TrustScope cloud
trustscope cloud connect

# Check status
trustscope cloud status

按层划分的云功能

功能 监控 保护 保护+ 企业
本地证据库 ✓ ✓ ✓ ✓
18个检测引擎✓ ✓ ✓ ✓
云同步 ✓ ✓ ✓ ✓
策略检查 ✓ ✓ ✓ ✓
行为分析 - ✓ ✓ ✓
NL诊断 - - ✓ ✓
签名证明 - - ✓ ✓
SIEM集成 - -
自定义策略 - -

看 docs/CONNECTED_MODE.md 了解详情。

证明

生成可加密验证的代理行为证明:

# Via MCP tool
trustscope_get_attestation({ agent_id: "my-agent", sign: true })

# Verify signature
trustscope verify --signature attestation.json

看 docs/ATTESTATIONS.md 有关格式和验证的详细信息。

证据库

所有跟踪都以SHA-256哈希链本地存储在SQLite中:

.trustscope/
  evidence.db       # SQLite database
  keys/
    ed25519.key     # Private signing key (mode 0600)
    ed25519.pub     # Public key

验证链的完整性:

trustscope verify
trustscope verify --verbose  # Show details
trustscope verify --quick    # Last 100 traces only

隐私

  • PII在云同步之前会自动编辑
  • 原始请求/响应体从不离开本地存储
  • 检测并屏蔽秘密和凭据
  • 云同步是可选的,打开失败

许可证

麻省理工学院