Forge exposes a REST API for the web UI and an MCP server for AI agent integration. This guide helps troubleshoot API connection and communication issues.
Problem: Frontend shows “Failed to connect to API” or network errorsSymptoms:
Tasks don’t load
Empty project list
Console errors: net::ERR_CONNECTION_REFUSED
Solutions:
Check Backend is Running
# Verify backend port in logs# Look for: "Backend server listening on: http://127.0.0.1:XXXX"# Test connectioncurl http://localhost:5000/api/projects# Should return JSON, not connection error
Check Port Configuration
# Backend auto-assigns port if not specified# Check what port it's using# Set explicit portexport BACKEND_PORT=5000automagik-forge --backend-port 5000# Verifycurl http://localhost:5000/api/projects
Check Firewall
# macOSsudo /usr/libexec/ApplicationFirewall/socketfilterfw --getglobalstate# Linux (ufw)sudo ufw statussudo ufw allow 5000/tcp# Windows Firewall# Allow automagik-forge in Windows Defender Firewall settings
Check for Port Conflicts
# See what's using the portlsof -i :5000 # macOS/Linuxnetstat -ano | findstr :5000 # Windows# Kill conflicting process or use different portautomagik-forge --backend-port 5001
Problem: Access to fetch has been blocked by CORS policyCause: Backend and frontend on different originsSolution:
# Forge handles CORS automatically# But if you're using custom setup:# 1. Ensure backend allows frontend origin# Backend should already allow http://localhost:3000# 2. Don't use IP address for frontend# Use localhost, not 127.0.0.1# 3. Check browser console for exact CORS error# F12 → Console → Look for CORS details
Problem: Requests timeout with no responseSolutions:
# Increase timeout in frontend# (Already set to reasonable defaults)# Check if backend is overloadedtop # Check CPU/memory# Check backend logs for errors# Forge outputs logs to console# Test API directlycurl -v http://localhost:5000/api/projects# Look for response time
Problem: API returns 403 ForbiddenCause: Insufficient permissions for requested resourceSolution:
# Check GitHub OAuth scopes# Ensure OAuth app has repo access# Verify you have access to the repositorygh repo view owner/repo# Re-authorize with correct scopes
Problem: AI agent can’t connect to Forge via MCPSymptoms:
MCP tools not available in AI agent
Connection timeoutErrors in AI agent logs
Solutions:
Verify MCP Mode
# Start Forge in MCP modeautomagik-forge --mcp# Or advanced mode for more toolsautomagik-forge --mcp-advanced# Verify it's running in MCP mode# Look for: "MCP server listening on stdio"
# Method 1: From UI# Settings → Project Info → Project ID# Method 2: From config filecat .forge/config.json | grep project_id# Method 3: From APIcurl http://localhost:5000/api/projects | jq '.[0].id'
Check MCP Logs
# MCP server logs to stderr# Check AI agent's MCP logs# Claude Code logs~/.claude/logs/# Cursor logs# Help → Show Logs → MCP# Look for connection errors or tool loading issues
Problem: MCP tool returns error when executedCommon Errors:
Project Not Found
Task Not Found
Invalid Arguments
// Error: "Project with ID xxx not found"// Solution: Verify PROJECT_ID in MCP config{ "env": { "PROJECT_ID": "correct-uuid-here" }}// Get correct ID:cat .forge/config.json | grep project_id
// Error: "Task xxx does not exist"// Solution: List tasks first to get valid IDs{ "tool": "list_tasks", "arguments": { "project_id": "uuid" }}// Then use returned task IDs
Problem: Task execution logs don’t appear in real-timeCauses & Solutions:
Corporate Proxy Blocking SSE
# Some proxies block Server-Sent Events# Test SSE connectioncurl -N http://localhost:5000/api/events/processes/{id}/logs# Should stream data, not close immediately# If blocked, disable proxy temporarilyunset HTTP_PROXYunset HTTPS_PROXY
Browser Limiting Connections
# Browsers limit concurrent SSE connections# Close other Forge tabs# Or use different browser# Firefox: about:config# network.http.max-persistent-connections-per-server = 10
Backend Not Sending Events
# Check backend is configured to stream# This should be automatic in Forge# Verify in logs:# "Streaming process logs for ID: xxx"# If not streaming, restart Forge
Problem: API requests take very long to respondSolutions:
# Check database sizedu -h .forge/db.sqlite# If very large (>100MB), clean up old datasqlite3 .forge/db.sqlite "DELETE FROM tasks WHERE status='done' AND updated_at < datetime('now', '-30 days');"# Vacuum database to reclaim spacesqlite3 .forge/db.sqlite "VACUUM;"# Restart Forgeautomagik-forge
# Use browser DevTools# F12 → Network tab# Filter by "Fetch/XHR"# Click on request to see:# - Headers# - Payload# - Response# - Timing# Look for failed requests (red)# Check status codes and error messages