Reuben_OS / test-mcp-local.js
Reubencf's picture
testing mcp
3ed6d7f
raw
history blame
1.77 kB
// test-mcp-local.js - Test MCP server locally
// This simulates what Claude would do
import { spawn } from 'child_process';
import readline from 'readline';
console.log('πŸš€ Starting MCP Server Test...\n');
// Start the MCP server
const mcp = spawn('node', ['mcp-server.js'], {
env: {
...process.env,
REUBENOS_URL: 'https://huggingface.co/spaces/MCP-1st-Birthday/Reuben_OS'
}
});
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
// Handle MCP output
mcp.stderr.on('data', (data) => {
console.log('MCP:', data.toString());
});
mcp.stdout.on('data', (data) => {
console.log('MCP Output:', data.toString());
});
// Send test commands
async function testCommands() {
const sessionId = 'session_1763722877048_527d6bb8b7473568';
// Test manage_files tool
const testFileCommand = {
jsonrpc: '2.0',
id: 1,
method: 'tools/call',
params: {
name: 'manage_files',
arguments: {
sessionId: sessionId,
action: 'save',
fileName: 'test_from_mcp.txt',
content: 'This is a test from the MCP server'
}
}
};
console.log('πŸ“ Testing file save...');
console.log('Command:', JSON.stringify(testFileCommand, null, 2));
// Note: This would need proper JSON-RPC communication
// For now, this just shows what would be sent
}
console.log('πŸ“Œ Session ID for testing:', 'session_1763722877048_527d6bb8b7473568');
console.log('\nTo test manually:');
console.log('1. Restart Claude Desktop');
console.log('2. Tell Claude: "My session is session_1763722877048_527d6bb8b7473568"');
console.log('3. Ask Claude to save a file or deploy a quiz\n');
rl.question('Press Enter to exit...', () => {
mcp.kill();
rl.close();
});
testCommands();