@build000r/mcp-mcp
Version:
Fast CLI tool to scan, view, park (JIT), and interactively manage MCP server configurations across all Claude projects
96 lines (84 loc) • 3.36 kB
JavaScript
const ColorUtils = require('../utils/ColorUtils');
class ArgParser {
static parseArgs() {
const args = process.argv.slice(2);
let mode = 'upstream';
let interactive = false;
let jit = false;
let unpark = null;
let unparkAll = false;
let status = false;
// Check for flags
if (args.includes('--a')) {
mode = 'all';
}
if (args.includes('--i')) {
interactive = true;
}
if (args.includes('--jit')) {
jit = true;
}
if (args.includes('--unpark-all')) {
unparkAll = true;
}
if (args.includes('--status')) {
status = true;
}
// Check for --unpark <server>
const unparkIndex = args.indexOf('--unpark');
if (unparkIndex !== -1 && args[unparkIndex + 1]) {
unpark = args[unparkIndex + 1];
}
// Remove flags from args
const filteredArgs = args.filter(arg =>
arg !== '--a' && arg !== '--i' && arg !== '--jit' &&
arg !== '--unpark-all' && arg !== '--status' &&
arg !== '--unpark' && arg !== unpark
);
const command = filteredArgs[0] || (interactive ? 'interactive' : 'scan');
return {
mode,
interactive,
jit,
unpark,
unparkAll,
status,
command,
args: filteredArgs
};
}
static showHelp() {
console.log(ColorUtils.colorText('MCP-MCP - Fast MCP Configuration Scanner\n', 'bold'));
console.log('Usage:');
console.log(' npx mcp-mcp Show MCP configs affecting current directory (upstream)');
console.log(' npx mcp-mcp --a Show all MCP configs on computer');
console.log(' npx mcp-mcp --i Interactive mode - select servers to uninstall');
console.log(' npx mcp-mcp --i --a Interactive mode for all servers');
console.log(' npx mcp-mcp stats Show statistics for upstream configs');
console.log(' npx mcp-mcp stats --a Show statistics for all configs');
console.log('');
console.log('JIT Mode (Just-in-Time):');
console.log(' npx mcp-mcp --jit Park all upstream MCP servers');
console.log(' npx mcp-mcp --status Show parked vs active servers');
console.log(' npx mcp-mcp --unpark <name> Restore specific parked server');
console.log(' npx mcp-mcp --unpark-all Restore all parked servers');
console.log('');
console.log('Modes:');
console.log(' upstream (default) Scans from current directory up to home + subdirs');
console.log(' all (--a) Scans entire computer for all MCP configurations');
console.log(' interactive (--i) Interactive mode to manage (uninstall) servers');
console.log(' jit (--jit) Park servers for just-in-time loading');
console.log('');
console.log('Examples:');
console.log(' npx mcp-mcp # Show configs affecting current project');
console.log(' npx mcp-mcp --a # Show all MCP configs on computer');
console.log(' npx mcp-mcp --i # Interactive uninstall for current project');
console.log(' npx mcp-mcp --jit # Park all servers for lighter Claude usage');
console.log(' npx mcp-mcp --status # Check what\'s parked vs active');
console.log(' npx mcp-mcp stats # Show statistics');
}
static showVersion() {
console.log('2.2.1');
}
}
module.exports = ArgParser;