mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-24 22:28:10 +09:00
## 🔒 Security Fixes - CRITICAL: Removed vulnerable pkg dependency (GHSA-22r3-9w55-cj54) - Replaced with secure @vercel/ncc alternative - Security score improved from 55/100 to 75/100 - All npm audit vulnerabilities resolved (0 vulnerabilities) ## 🚀 Infrastructure Improvements - Re-enabled ALL CI/CD security gates with strict enforcement - Fixed Jest configuration and test infrastructure - Fixed 18 TypeScript test files with import issues - Created comprehensive test utilities ## 🛠️ Code Quality - Fixed 145 ESLint errors (16% reduction) - Fixed 15 critical TypeScript errors - Added development tooling configs ## 📚 Documentation - Created security audit report - Created fix summary documentation - Created functionality review - Updated GitHub issue #362 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
121 lines
3.8 KiB
TypeScript
121 lines
3.8 KiB
TypeScript
/**
|
|
* Simple MCP command implementation for Node.js compatibility
|
|
*/
|
|
|
|
import { Command } from 'commander';
|
|
import http from 'http';
|
|
|
|
function printSuccess(message: string) {
|
|
console.log(`✅ ${message}`);
|
|
}
|
|
|
|
function printError(message: string) {
|
|
console.error(`❌ Error: ${message}`);
|
|
}
|
|
|
|
// Check if MCP server is running
|
|
async function checkMCPStatus(host: string, port: number): Promise<boolean> {
|
|
return new Promise((resolve) => {
|
|
const options = {
|
|
hostname: host,
|
|
port: port,
|
|
path: '/health',
|
|
method: 'GET',
|
|
timeout: 2000,
|
|
};
|
|
|
|
const req = http.request(options, (res) => {
|
|
resolve(res.statusCode === 200 || res.statusCode === 404);
|
|
});
|
|
|
|
req.on('error', () => {
|
|
resolve(false);
|
|
});
|
|
|
|
req.on('timeout', () => {
|
|
req.destroy();
|
|
resolve(false);
|
|
});
|
|
|
|
req.end();
|
|
});
|
|
}
|
|
|
|
export function createMCPCommand() {
|
|
const mcpCmd = new Command('mcp').description('Manage MCP server and tools').action(() => {
|
|
printSuccess('MCP Server Management');
|
|
console.log('\n🌐 Available MCP commands:');
|
|
console.log(' • mcp start - Start the MCP server');
|
|
console.log(' • mcp status - Show MCP server status');
|
|
console.log(' • mcp tools - List available MCP tools');
|
|
console.log(' • mcp stop - Stop the MCP server');
|
|
console.log('\n💡 Use "mcp start --port 3001" to use a different port');
|
|
});
|
|
|
|
mcpCmd
|
|
.command('start')
|
|
.description('Start the MCP server')
|
|
.option('--port <port>', 'Port for MCP server', '3000')
|
|
.option('--host <host>', 'Host for MCP server', 'localhost')
|
|
.option('--transport <transport>', 'Transport type (stdio, http)', 'http')
|
|
.action(async (options) => {
|
|
// This is handled by the actual MCP implementation
|
|
console.log('Starting MCP server...');
|
|
console.log('(This command is handled by the MCP module)');
|
|
});
|
|
|
|
mcpCmd
|
|
.command('status')
|
|
.description('Show MCP server status')
|
|
.option('--port <port>', 'Port to check', '3000')
|
|
.option('--host <host>', 'Host to check', 'localhost')
|
|
.action(async (options) => {
|
|
printSuccess('MCP Server Status:');
|
|
|
|
const host = options.host || 'localhost';
|
|
const port = parseInt(options.port) || 3000;
|
|
|
|
// Check if server is actually running
|
|
const isRunning = await checkMCPStatus(host, port);
|
|
|
|
if (isRunning) {
|
|
console.log('🟢 Status: Running');
|
|
console.log(`📍 Address: ${host}:${port}`);
|
|
console.log('🔐 Authentication: Disabled');
|
|
console.log('🔧 Tools: System, Health, Tools');
|
|
console.log('📡 Transport: http');
|
|
console.log('\n💡 Use "mcp tools" to see available tools');
|
|
} else {
|
|
console.log('🟡 Status: Not running (use "mcp start" to start)');
|
|
console.log(`📍 Checked address: ${host}:${port}`);
|
|
console.log('🔐 Authentication: Disabled');
|
|
console.log('🔧 Tools: System, Health, Tools (when running)');
|
|
}
|
|
});
|
|
|
|
mcpCmd
|
|
.command('tools')
|
|
.description('List available MCP tools')
|
|
.action(() => {
|
|
printSuccess('Available MCP Tools:');
|
|
console.log('\n📊 System Tools:');
|
|
console.log(' • system/info - Get system information');
|
|
console.log(' • system/health - Get system health status');
|
|
console.log('\n🔧 Tool Management:');
|
|
console.log(' • tools/list - List all available tools');
|
|
console.log(' • tools/schema - Get schema for a specific tool');
|
|
console.log('\n💡 Note: Additional tools available when orchestrator is running');
|
|
});
|
|
|
|
mcpCmd
|
|
.command('stop')
|
|
.description('Stop the MCP server')
|
|
.action(() => {
|
|
printSuccess('Stopping MCP server...');
|
|
console.log('🛑 MCP server stop requested');
|
|
console.log('💡 Use Ctrl+C in the terminal running "mcp start" to stop');
|
|
});
|
|
|
|
return mcpCmd;
|
|
}
|