UNPKG

fusion-mcp-cli

Version:

CLI tool for Fusion MCP Hub - Manage custom and community MCP servers. Web App: https://fusion-mcp-hub.vercel.app (General) | https://fusion-mcp-prod.isc-code-connect.dal.app.cirrus.ibm.com (IBM)

189 lines (141 loc) 4.85 kB
# Fusion MCP CLI - Implementation Summary ## Phase 1: Setup & Authentication ✅ COMPLETE ### What We Built #### 1. **CLI Package Structure** ``` fusion-mcp-cli/ ├── src/ │ ├── commands/ │ │ ├── auth.ts # ✅ Authentication commands │ │ ├── workspace.ts # ✅ Workspace operations │ │ └── server.ts # ✅ Server operations │ ├── api/ │ │ └── client.ts # ✅ API client for backend │ ├── utils/ │ │ └── config.ts # ✅ Local config management │ └── index.ts # ✅ CLI entry point ├── package.json ├── tsconfig.json ├── .gitignore └── README.md ``` #### 2. **Implemented Commands** **Authentication (`fmcp auth`)** -`login` - Authenticate with API token -`logout` - Clear authentication -`status` - Check authentication status and token validity **Workspace (`fmcp workspace`)** -`list` - List all workspaces -`use <id>` - Switch to a workspace -`current` - Show current workspace **Server (`fmcp server`)** -`list` - List all servers in workspace -`info <id>` - Show server details -`pull <id>` - Download server to local (download URL) -`push <id>` - Push local changes (placeholder) -`status <id>` - Check sync status -`history <id>` - View change history -`rollback <id> <version>` - Rollback to previous version #### 3. **Core Features** **Configuration Management** - Stores config in `~/.fusion-mcp/config.json` - Tracks: API URL, API token, current workspace - Auto-creates config directory - Read/write/update/clear operations **API Client** - Axios-based HTTP client - Bearer token authentication - Error handling with interceptors - Type-safe response interfaces - Methods for all server operations **User Experience** - Colorful terminal output (chalk) - Loading spinners (ora) - Interactive prompts (inquirer) - Data tables (console-table-printer) - Confirmation dialogs for destructive operations #### 4. **Technology Stack** - **Language**: TypeScript - **CLI Framework**: Commander.js - **HTTP Client**: Axios - **UI Libraries**: - chalk (colors) - ora (spinners) - inquirer (prompts) - console-table-printer (tables) ## Next Steps (Phase 2 & 3) ### Phase 2: Backend Integration (REQUIRED) Before the CLI can be fully functional, we need to implement: #### 1. **API Token System in Web UI** (HIGH PRIORITY) - [ ] Add API tokens collection to MongoDB - [ ] Create Settings page in web UI - [ ] Token generation endpoint - [ ] Token verification endpoint - [ ] Token revocation endpoint #### 2. **API Endpoints** (Update existing endpoints) - [ ] `/api/auth/verify-token` - Verify CLI token - [ ] `/api/auth/verify` - Check token validity - [ ] `/api/workspaces` - List user workspaces - [ ] `/api/custom-servers` - List servers (already exists) - [ ] `/api/custom-servers/:id` - Get server (already exists) - [ ] `/api/custom-servers/:id/download` - Get download URL (already exists) - [ ] `/api/custom-servers/:id/rollback` - Rollback (already exists ✅) ### Phase 3: Advanced Features (Week 3) - [ ] Local file management (pull creates local directory) - [ ] Diff algorithms (compare local vs remote) - [ ] Interactive merge - [ ] Conflict detection - [ ] Push with file upload ## Installation & Usage ### For Development ```bash cd fusion-mcp-cli # Install dependencies npm install # Build npm run build # Link globally npm link # Now use the CLI fmcp --help ``` ### Current Status **Working Commands** (after backend integration): - ✅ All auth commands - ✅ Workspace list/use/current - ✅ Server list/info/history/rollback **Placeholder Commands** (need more work): - ⚠️ Server pull (needs file download implementation) - ⚠️ Server push (needs file upload implementation) - ⚠️ Server status (needs local file comparison) ## Priority Implementation Order 1. **✅ DONE**: CLI package structure and commands 2. **NEXT**: API Token system in web UI 3. **NEXT**: Backend API endpoints for CLI 4. **NEXT**: Test authentication flow 5. **NEXT**: Test workspace and server operations 6. **LATER**: File download/upload for pull/push 7. **LATER**: Diff and merge functionality ## Dependencies ```json { "dependencies": { "commander": "^11.1.0", "chalk": "^4.1.2", "inquirer": "^8.2.6", "axios": "^1.6.2", "ora": "^5.4.1", "console-table-printer": "^2.11.2", "dotenv": "^16.3.1", "js-yaml": "^4.1.0", "diff": "^5.1.0" } } ``` ## Notes - CLI is separate from main Next.js app - No monorepo complexity - Easy to distribute via npm or git - Can be used globally after `npm link` - Configuration stored in user home directory - All errors handled gracefully with helpful messages