// Test script to create a board using the FluentBoards MCP server
// Run this from the workspace root: npx ts-node tests/test-create-board.ts
import { spawn } from "child_process";
import { fileURLToPath } from "url";
import { dirname, join } from "path";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
// Test configuration
const testConfig = {
title: "Test Board from MCP Server",
description:
"This board was created using the FluentBoards MCP server for testing purposes",
type: "to-do" as const,
};
async function testCreateBoard() {
console.log("Starting MCP server test...");
// Path to the compiled server
const serverPath = join(__dirname, "../dist/index.js");
// Start the MCP server
const server = spawn("node", [serverPath], {
stdio: ["pipe", "pipe", "pipe"],
});
// Handle server output
server.stdout.on("data", (data) => {
console.log("Server output:", data.toString());
});
server.stderr.on("data", (data) => {
console.error("Server error:", data.toString());
});
// Test message to create a board
const testMessage = {
method: "tools/call",
params: {
name: "create_board",
arguments: testConfig,
},
};
// Send the test message
setTimeout(() => {
server.stdin.write(JSON.stringify(testMessage) + "\n");
// Close after a short delay
setTimeout(() => {
server.kill();
console.log("Test completed");
}, 2000);
}, 1000);
}
// Run the test
testCreateBoard().catch(console.error);