import assert from "node:assert/strict"; import path from "node:path"; import test from "node:test"; import { fileURLToPath } from "node:url"; import { Client } from "@modelcontextprotocol/sdk/client/index.js"; import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js"; const projectRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."); test("MCP server exposes the read and manual sync tools", async () => { const transport = new StdioClientTransport({ command: process.execPath, args: [path.join(projectRoot, "src/server.js")], env: { ...process.env }, }); const client = new Client({ name: "grimmory-test", version: "0.1.0" }); try { await client.connect(transport); const { tools } = await client.listTools(); const names = tools.map((tool) => tool.name); assert.ok(names.includes("get_book")); assert.ok(names.includes("sync_all_to_obsidian")); assert.equal(names.length, 10); } finally { await client.close(); } });