// Test script for sending commands to our running MCP server
const fs = require('fs');
// Initialize message sequence
const messages = [
// Initialize request
{
jsonrpc: '2.0',
method: 'initialize',
id: 1
},
// List tools request
{
jsonrpc: '2.0',
method: 'tools.list',
id: 2
},
// Get figmamind.info tool
{
jsonrpc: '2.0',
method: 'tools.get',
params: {
name: 'figmamind.info'
},
id: 3
},
// Run figmamind.info tool
{
jsonrpc: '2.0',
method: 'tools.run',
params: {
name: 'figmamind.info',
arguments: {}
},
id: 4
}
];
// Log the test we're going to perform
console.log('Testing MCP server with the following messages:');
messages.forEach((msg, i) => {
console.log(`\nMessage ${i+1}:`);
console.log(JSON.stringify(msg, null, 2));
});
// Function to send messages to the MCP server
async function sendMessages() {
for (let i = 0; i < messages.length; i++) {
console.log(`\n*** Sending message ${i+1} ***`);
// Use console.log to send the message to stdout
// The MCP server should be reading from stdin
console.log(JSON.stringify(messages[i]));
// Wait for 2 seconds between messages
if (i < messages.length - 1) {
console.log('Waiting 2 seconds...');
await new Promise(resolve => setTimeout(resolve, 2000));
}
}
}
// Start sending messages
sendMessages();