端到端测试套件

nexus-toolkit是一个用于nexus-agents MCP工具的端到端测试套件,支持orchestrate、research_catalog_review和registry_import工具的测试。

  • by nexus-substrate
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 williamzujkowski/nexus-toolkit

使用说明

nexus工具包

E2E测试套件 关系代理 MCP工具: 精心安排, 研究目录,以及 注册表_导入.

它测试什么

工具 测试 安全
orchestrate 架构验证、适配器错误处理 未配置模型适配器时会优雅地跳过
research_catalog_review 列出/批准/取消/刷新操作、架构验证 只读 list 审计管道中的行动
registry_import 所有3个提供者(anthropic/google/openai),模式验证 始终 dryRun=true --永不坚持

工具包审计管道运行5个测试:1个编排+1个目录审查+3个注册表导入(每个提供者一个)。

快速开始

pnpm install
pnpm test        # Run 47 unit tests
pnpm typecheck   # TypeScript strict mode
pnpm build       # Compile to dist/

作为图书馆使用

import { runToolkitAudit, generateReport } from 'nexus-toolkit';
import type { ToolCaller } from 'nexus-toolkit';

// Provide your own MCP tool caller
const caller: ToolCaller = {
  call: async (tool, args) => {
    // Send to your MCP server
    return await mcpClient.callTool(tool, args);
  },
};

const audit = await runToolkitAudit(caller);
console.log(generateReport(audit, 'markdown'));
// Output: Markdown table with pass/fail/skip per tool

实时集成模式

在真实的nexus代理MCP服务器上运行:

# 1. Create src/live-bridge.ts with your MCP client:
#    export async function createMcpCaller(): Promise<ToolCaller> { ... }

# 2. Run:
NEXUS_LIVE=true npx tsx src/run-live.ts

# 3. With JSON output:
NEXUS_LIVE=true REPORT_FORMAT=json npx tsx src/run-live.ts

报表格式

# Markdown (default) — tables with summary + per-tool results
generateReport(audit, 'markdown')

# JSON — machine-readable audit object
generateReport(audit, 'json')

# Text — compact terminal output with PASS/FAIL/SKIP indicators
generateReport(audit, 'text')

项目结构

src/
  types.ts              # Zod schemas matching live MCP responses
  fixtures/
    mock-responses.ts   # Mock data for all tool responses
  pipeline.ts           # Toolkit audit pipeline (testOrchestrate, testCatalogReview, testRegistryImport)
  reporter.ts           # Report formatter (markdown/json/text)
  live-caller.ts        # Live mode ToolCaller bridge
  run-live.ts           # CLI entry point for live integration testing
  index.ts              # Public API exports

许可证

麻省理工学院