peppa/packages/mcp/scripts/smoke.ts
Асель 9824ce4c18 Add Peppa MCP server, core domain package and peppa CLI
- @peppa/core: projects, goals, tasks (atomic per-project numbering),
  PM questions, progress events, pg NOTIFY on peppa_events
- @peppa/mcp (peppa-mcp): get_task, list_tasks, list_goals, create_task,
  update_task, request_approval, ask_pm, report_progress
- @peppa/cli (peppa): project/goal/task/q commands
- questions/events now link to project and task; session is optional
- scripts/install-bins.sh; bootstrap-project.sh registers the project

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 19:18:35 +05:00

23 lines
1.1 KiB
TypeScript

// Smoke test: spawns peppa-mcp in the given project dir and calls a few tools.
// Usage: tsx packages/mcp/scripts/smoke.ts <project-dir> <task>
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
import { fileURLToPath } from "node:url";
const [dir = process.cwd(), task = "1"] = process.argv.slice(2);
const bin = fileURLToPath(new URL("../bin/peppa-mcp", import.meta.url));
const client = new Client({ name: "peppa-smoke", version: "0" });
await client.connect(new StdioClientTransport({ command: bin, cwd: dir, env: process.env as Record<string, string> }));
const { tools } = await client.listTools();
console.log("tools:", tools.map((t) => t.name).join(", "));
for (const [name, args] of [
["list_goals", {}],
["list_tasks", {}],
["get_task", { task }],
] as const) {
const r = await client.callTool({ name, arguments: args });
console.log(`\n── ${name}${r.isError ? " (error)" : ""}\n${(r.content as Array<{ text: string }>)[0]!.text}`);
}
await client.close();