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 { ... }
# 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许可证
麻省理工学院
