| 1234567891011121314151617181920212223242526272829303132 |
- #!/usr/bin/env node
- import assert from "node:assert/strict";
- import { dirname, resolve } from "node:path";
- import { fileURLToPath } from "node:url";
- import { Client } from "@modelcontextprotocol/sdk/client/index.js";
- import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
- const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
- export async function smokeMcp() {
- const client = new Client({ name: "fmode-image-set-smoke", version: "0.1.0" });
- const transport = new StdioClientTransport({
- command: process.execPath,
- args: [resolve(root, "mcp", "src", "server.mjs")],
- cwd: root,
- stderr: "pipe",
- });
- await client.connect(transport);
- try {
- const result = await client.listTools();
- const names = result.tools.map((tool) => tool.name);
- assert.ok(names.includes("fmode_image_set_run"));
- assert.ok(names.includes("fmode_image_set_validate"));
- return { status: "ok", tools: names, toolDefinitions: result.tools };
- } finally {
- await client.close();
- }
- }
- if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
- console.log(JSON.stringify(await smokeMcp(), null, 2));
- }
|