Skip to main content
Glama
COMMON_ISSUES.md•6.38 kB
# Common Issues - Quick Reference A quick cheat sheet for the most common MCPhy issues and their solutions. ## 🚨 Top 5 Initialization Issues ### 1. No API Spec Found āŒ **Error:** ``` No API specification files found in project root ``` **Quick Fix:** ```bash mcphy init -f path/to/your/swagger.yaml ``` --- ### 2. File Not Found āŒ **Error:** ``` File not found: /path/to/file ``` **Quick Fixes:** ```bash # Check file exists ls swagger.yaml # Use current directory mcphy init -f ./swagger.yaml # Use absolute path mcphy init -f /full/path/to/swagger.yaml ``` --- ### 3. Invalid API Specification āŒ **Error:** ``` Failed to parse API specification ``` **Quick Fixes:** ```bash # Step 1: Validate first mcphy validate swagger.yaml # Step 2: Check syntax # YAML: https://www.yamllint.com/ # JSON: https://jsonlint.com/ # Step 3: Ensure it's OpenAPI/Swagger # Check first line has: openapi: 3.0.0 or swagger: "2.0" ``` **Common Causes:** - āŒ Wrong file format (GraphQL, RAML, etc.) - āŒ YAML/JSON syntax errors - āŒ Missing required fields (info, paths) - āŒ Invalid $ref references - āŒ Postman Collection v1 (use v2 instead) --- ### 4. Invalid OpenAI Key āš ļø **Warning:** ``` Warning: OpenAI API key should start with "sk-" ``` **Quick Fix:** ```bash # Option 1: Get valid key from # https://platform.openai.com/api-keys # Option 2: Skip it (press Enter) # MCPhy works without it using basic pattern matching # Option 3: Set environment variable export OPENAI_API_KEY=sk-your-key-here mcphy init ``` --- ### 5. Config File Not Found āŒ **Error:** ``` Config file not found: .mcphy.json ``` **Quick Fix:** ```bash # You need to initialize first! mcphy init # Then serve mcphy serve ``` --- ## šŸ†• Postman Collection Issues ### 1. Invalid Postman Collection āŒ **Error:** ``` Invalid Postman collection format ``` **Quick Fixes:** ```bash # Ensure you exported Collection v2.x # In Postman: Collection → Export → v2.1 # Validate JSON cat postman_collection.json | jq # Check required fields (info, item) ``` --- ### 2. LLM Enhancement Failed āš ļø **Warning:** ``` LLM enhancement failed, using basic parsing ``` **Quick Fix:** ```bash # Basic parsing still works! But for better results: # Add OpenAI key export OPENAI_API_KEY=sk-your-key-here # Re-initialize mcphy init -f postman_collection.json ``` **Note:** OpenAI key is HIGHLY RECOMMENDED for Postman collections. --- ### 3. No Base URL Detected āš ļø **Issue:** Postman collection doesn't have base URL **Quick Fixes:** ```bash # Option 1: Add to Postman collection # Variables → Add: baseUrl = https://api.example.com # Option 2: Enter when prompted during init # Option 3: Edit .mcphy.json later { "apiBaseUrl": "https://api.example.com" } ``` --- ## 🚨 Top 3 Server Issues ### 1. Port Already in Use āŒ **Error:** ``` Error: listen EADDRINUSE :::3000 ``` **Quick Fixes:** ```bash # Option 1: Use different port mcphy serve -p 3001 # Option 2: Kill process on port 3000 lsof -i :3000 kill -9 <PID> # Option 3: Change default in config # Edit .mcphy.json: "port": 3001 ``` --- ### 2. API Not Reachable 🌐 **Problem:** Server runs but can't reach your API **Quick Fixes:** ```bash # Check your API is running curl http://localhost:8000 # Update base URL in .mcphy.json { "apiBaseUrl": "http://localhost:8000" } # Or use correct URL { "apiBaseUrl": "https://api.example.com" } ``` --- ### 3. Permission Denied āŒ **Error:** ``` EACCES: permission denied ``` **Quick Fixes:** ```bash # For port < 1024, use higher port mcphy serve -p 3000 # For file permissions chmod u+w .mcphy.json # Run from writable directory cd ~/your-project mcphy init ``` --- ## šŸ”§ Quick Diagnostic Commands ```bash # Check Node.js version (need >= 18) node --version # Check if mcphy is installed mcphy --help # Validate your spec before init mcphy validate swagger.yaml # Check current directory pwd ls -la *.yaml *.json # Check if config exists ls -la .mcphy.json # Check port availability lsof -i :3000 # Test API connectivity curl http://localhost:8000 ``` --- ## šŸ“‹ Pre-flight Checklist Before running `mcphy init`: - [ ] Node.js >= 18 installed (`node --version`) - [ ] API spec file exists (`ls swagger.yaml`) - [ ] File is valid OpenAPI/Swagger (`mcphy validate swagger.yaml`) - [ ] In correct directory (`pwd`) - [ ] Have write permissions (`ls -la`) Before running `mcphy serve`: - [ ] Initialized successfully (`ls .mcphy.json`) - [ ] Port is available (`lsof -i :3000`) - [ ] API backend is running (if needed) --- ## šŸŽÆ Quick Command Reference ```bash # Validate spec mcphy validate <file> # Initialize with spec mcphy init -f <file> # Start server mcphy serve # Use different port mcphy serve -p 3001 # Use different config mcphy serve -c custom.json # Export mcphy export -o my-export ``` --- ## šŸ†˜ Still Stuck? ### Try These Steps in Order: 1. **Validate your spec:** ```bash mcphy validate swagger.yaml ``` 2. **Check file path:** ```bash ls -la swagger.yaml ``` 3. **Use absolute path:** ```bash mcphy init -f /full/path/to/swagger.yaml ``` 4. **Check permissions:** ```bash ls -la chmod u+w . ``` 5. **Test with example:** ```bash git clone https://github.com/sehmim/mcphy.git cd mcphy/examples mcphy init -f sample-swagger.yaml mcphy serve ``` ### Get Help: - šŸ“– [Full Troubleshooting Guide](./troubleshooting.md) - šŸ“š [Quick Start Guide](./quick-start.md) - šŸ› [GitHub Issues](https://github.com/sehmim/mcphy/issues) - šŸ’¬ [Discussions](https://github.com/sehmim/mcphy/discussions) --- ## šŸ’” Pro Tips 1. **Always validate first:** `mcphy validate` before `mcphy init` 2. **Use absolute paths:** Avoid path resolution issues 3. **Check examples:** Test with `examples/sample-swagger.yaml` 4. **Read error messages:** They tell you exactly what's wrong 5. **Check logs:** MCPhy provides detailed logging --- ## šŸ“Š Error Severity Guide | Symbol | Severity | Action | |--------|----------|--------| | āŒ | Error | Must fix to proceed | | āš ļø | Warning | Can continue but may have issues | | šŸ’” | Info | Helpful suggestion | | āœ… | Success | All good! | --- **Remember:** Most issues are quick to fix! Check the error message, follow the suggestions, and you'll be up and running in no time. šŸš€

Latest Blog Posts

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/sehmim/mcphy'

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