Skip to main content
Glama
FIXES_AND_SETUP.mdβ€’6.28 kB
# MCPM v5.0 - Fixes and Setup Guide ## πŸ”§ Code Review Fixes Applied ### Critical Bug Fixes 1. **GUI Crashes Fixed** βœ… - Added comprehensive error handling throughout `gui_main_pro.py` - Implemented missing methods: `approve_edit()`, `reject_edit()`, `on_file_click()` - Added error logging to `mcpm_gui.log` - Console window now stays open on error with "Press Enter to close..." 2. **Gitignore Matching Fixed** βœ… - Replaced broken `Path.match()` implementation - Now uses `fnmatch` with proper gitignore semantics - Handles directory patterns, wildcards, and nested paths correctly 3. **Git Operations Hardened** βœ… - Added `_check_git_available()` validation before all git commands - Checks if git is installed - Checks if directory is a git repository - Added timeouts to prevent hanging - Better error messages 4. **CLI Bridge Fixed** βœ… - Now handles file paths with spaces using `shlex` - Proper error handling for all operations - Interactive help system - Better UX with clear command syntax 5. **Error Handling** βœ… - Replaced all bare `except:` clauses with specific exceptions - Added logging throughout - User-friendly error messages 6. **Config File** βœ… - Changed from Windows-specific path to generic example --- ## πŸ“¦ Installation & Setup ### 1. Install Dependencies **Required:** ```bash pip install PyQt6 pyyaml watchdog aiohttp python-dotenv mcp ``` **Verify Installation:** ```bash python test_setup.py ``` ### 2. Set Up API Keys Create a `.env` file in the project directory: ```bash # For Grok (xAI) XAI_API_KEY=your_xai_key_here # For OpenAI (optional) OPENAI_API_KEY=your_openai_key_here # For Anthropic Claude (optional) ANTHROPIC_API_KEY=your_anthropic_key_here ``` ### 3. Configure Your Project Copy the example config: ```bash cp config.example.yaml fgd_config.yaml ``` Edit `fgd_config.yaml` and set your project directory: ```yaml watch_dir: "/path/to/your/project" # Change this! ``` --- ## πŸš€ Running MCPM ### Option 1: GUI (Recommended) ```bash python gui_main_pro.py ``` **Features:** - Visual file browser - Live log viewer with filtering - Diff preview - Backup management - Dark mode UI **If it crashes:** - Check `mcpm_gui.log` for details - Console will show error and wait for Enter key - Run `python test_setup.py` to check dependencies ### Option 2: CLI Bridge ```bash python claude_bridge.py ``` **Commands:** - `read <file>` - Read a file (supports quoted paths with spaces) - `list [path]` - List directory contents - `diff` - Show git diff - `commit <message>` - Commit changes - `help` - Show help - `exit` - Quit **Examples:** ``` You: read main.py You: read "path with spaces/file.py" You: list src You: diff You: commit Added new feature ``` --- ## πŸ› Troubleshooting ### GUI won't start 1. Run `python test_setup.py` - check for missing dependencies 2. Check `mcpm_gui.log` for error details 3. Make sure PyQt6 is installed: `pip install PyQt6` ### "Git not available" error - Install git: https://git-scm.com/ - Make sure `git` is in your system PATH - Run `git --version` to verify ### "Not a git repository" error - Initialize git in your project: `git init` - Or use a directory that's already a git repo ### Import errors Run the dependency checker: ```bash python test_setup.py ``` ### File paths with spaces - In CLI: Use quotes: `read "my folder/file.txt"` - In GUI: Paths are handled automatically --- ## πŸ“ What Was Fixed From Your Upload ### Before (Issues): - ❌ GUI crashed immediately - ❌ Missing `approve_edit()` and `reject_edit()` methods - ❌ Broken gitignore pattern matching - ❌ No git validation (would crash if git not installed) - ❌ CLI couldn't handle paths with spaces - ❌ Bare `except:` clauses hiding errors - ❌ No error logging - ❌ Console window closed too fast to see errors ### After (Fixed): - βœ… GUI has comprehensive error handling - βœ… All methods implemented - βœ… Proper gitignore matching with fnmatch - βœ… Git availability checked before operations - βœ… CLI uses shlex for proper path parsing - βœ… Specific exception handling everywhere - βœ… Detailed logging to files - βœ… Console stays open on error --- ## 🎯 Key Improvements 1. **Stability**: No more crashes - errors are caught and logged 2. **User Experience**: Clear error messages, helpful prompts 3. **Reliability**: Git operations validated before execution 4. **Logging**: All issues logged to `mcpm_gui.log` 5. **File Handling**: Proper support for paths with spaces 6. **Error Recovery**: Console doesn't close immediately, shows errors --- ## πŸ“š Architecture ``` MCPM v5.0/ β”œβ”€β”€ gui_main_pro.py - PyQt6 GUI (1200x800 dark mode) β”œβ”€β”€ mcp_backend.py - MCP server with all tools β”œβ”€β”€ claude_bridge.py - CLI interface β”œβ”€β”€ config.example.yaml - Configuration template β”œβ”€β”€ test_setup.py - Dependency checker └── .env - API keys (create this) ``` --- ## πŸ” File Locations Reference **Critical Methods Fixed:** - `gui_main_pro.py:275-300` - approve_edit(), reject_edit() - `gui_main_pro.py:178-193` - on_file_click() - `mcp_backend.py:212-237` - _matches_gitignore() - `mcp_backend.py:243-261` - _check_git_available() - `mcp_backend.py:393-473` - Git tool handlers with validation - `claude_bridge.py:34-41` - parse_command() for quoted paths **Error Handling:** - `gui_main_pro.py:52-56` - GUI initialization error handler - `gui_main_pro.py:321-331` - Main error handler with console pause - `mcp_backend.py:176-191` - File watcher error handling --- ## ✨ Next Steps (Optional Enhancements) 1. **Implement remaining LLM providers** (OpenAI, Claude, Ollama) 2. **Add backup cleanup** - automatic .bak file rotation 3. **Reference directories** - currently configured but unused 4. **GUI logging** - connect to actual backend logs 5. **Memory size limits** - prevent .fgd_memory.json from growing indefinitely --- ## πŸ“ž Support If you encounter issues: 1. Check logs: `mcpm_gui.log` 2. Run diagnostics: `python test_setup.py` 3. Verify config: Check `fgd_config.yaml` paths 4. Check environment: Verify `.env` has API keys All errors now produce helpful messages instead of silent crashes!

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mikeychann-hash/MCPM'

If you have feedback or need assistance with the MCP directory API, please join our Discord server