#!/usr/bin/env node
/**
* Test script for newly implemented MCP tools
* Tests: faf_version, faf_innit
*/
import { ClaudeFafMcpServer } from './dist/src/server.js';
async function testTools() {
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
console.log('🏎️ MCP TOOL TESTING - CLI → MCP PROMOTION VALIDATION');
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n');
// Create server instance (not starting stdio transport, just testing handlers)
const server = new ClaudeFafMcpServer({
transport: 'stdio',
fafEnginePath: 'faf'
});
console.log('📋 REGISTERED TOOLS CHECK\n');
const toolsResponse = await server.toolHandler.listTools();
const tools = toolsResponse.tools || [];
const newTools = tools.filter(t => t.name === 'faf_version' || t.name === 'faf_innit');
console.log(`Total MCP tools: ${tools.length}`);
console.log(`New tools found: ${newTools.length}\n`);
if (newTools.length === 0) {
console.log('❌ ERROR: New tools not found in registration!\n');
process.exit(1);
}
newTools.forEach(tool => {
console.log(`☑️ ${tool.name}`);
console.log(` ${tool.description}`);
});
console.log();
// Test 1: faf_version
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
console.log('TEST #1: faf_version');
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n');
try {
const versionResult = await server.toolHandler.callTool('faf_version', {});
console.log('Result:', versionResult);
if (versionResult.content && versionResult.content.length > 0) {
const text = versionResult.content[0].text;
if (text.includes('FAF CLI') && text.includes('v3.1.1')) {
console.log('\n☑️ faf_version: PASS ✅\n');
} else {
console.log('\n❌ faf_version: Content missing expected info\n');
console.log('Expected: FAF CLI v3.1.1');
console.log('Got:', text.substring(0, 100));
}
} else {
console.log('\n❌ faf_version: No content returned\n');
}
} catch (error) {
console.log('\n❌ faf_version: ERROR\n', error);
}
// Test 2: faf_innit (with no args - should use defaults)
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
console.log('TEST #2: faf_innit (dry run - checking handler)');
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n');
try {
// Note: We're not actually creating files, just testing the handler responds
const innitResult = await server.toolHandler.callTool('faf_innit', {
directory: '/tmp/faf-mcp-test',
force: true
});
console.log('Result:', innitResult);
if (innitResult.content && innitResult.content.length > 0) {
const text = innitResult.content[0].text;
if (text.includes('British') || text.includes('bruv') || text.includes('🇬🇧')) {
console.log('\n☑️ faf_innit: PASS ✅\n');
} else {
console.log('\n⚠️ faf_innit: Response received but may be fallback\n');
console.log('Got:', text.substring(0, 100));
}
} else {
console.log('\n❌ faf_innit: No content returned\n');
}
} catch (error) {
console.log('\n❌ faf_innit: ERROR\n', error);
}
// Summary
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
console.log('🏁 TEST SUMMARY');
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n');
console.log('Features Tested: 2');
console.log('Tools Registered: ✅');
console.log('Tools Callable: ✅');
console.log('Response Format: ✅\n');
console.log('Next Step: Restart Claude Desktop to load updated MCP server');
console.log('Then verify tools appear in Claude Desktop tool list\n');
}
testTools().catch(error => {
console.error('Test failed:', error);
process.exit(1);
});