1 Home
Virgil edited this page 2026-03-11 12:14:41 +00:00

IDE

Module: forge.lthn.ai/core/ide

Native desktop IDE built with Wails 3 (Go) and Angular 20 (TypeScript). Provides a system tray application with embedded MCP server, WebView bridge for browser automation, Claude Code WebSocket bridge, and 27+ webview manipulation tools exposed via HTTP. Supports headless mode for CLI-only operation.

Architecture

The application has three layers:

  1. Wails 3 shell — Native window management, system tray, embedded web assets.
  2. MCP Bridge — HTTP server (port 9877) exposing tool endpoints and WebSocket hub.
  3. Claude Bridge — WebSocket relay between GUI clients and MCP core.

Key Types

MCPBridge

Wails service that wires together WebView, WebSocket hub, and Claude bridge.

type MCPBridge struct {
    webview      *webview.Service
    wsHub        *ws.Hub
    claudeBridge *ClaudeBridge
    app          *application.App
    port         int
}
  • NewMCPBridge(port) *MCPBridge — creates bridge with all services.
  • ServiceStartup(ctx, options) error — Wails lifecycle hook. Wires app reference, starts HTTP server.

HTTP endpoints:

  • GET /health — health check.
  • GET /mcp — server info and capabilities.
  • GET /mcp/tools — list all 27 available tools.
  • POST /mcp/call — execute a tool by name with JSON params.
  • /ws — WebSocket endpoint for real-time events.

ClaudeBridge

WebSocket relay between GUI clients and MCP core WebSocket.

type ClaudeBridge struct {
    mcpConn   *websocket.Conn
    mcpURL    string
    clients   map[*websocket.Conn]bool
    broadcast chan []byte
}
  • Maintains persistent connection to MCP core.
  • Forwards claude_message type messages from GUI clients to MCP.
  • Broadcasts MCP responses to all connected GUI clients.
  • Auto-reconnects on connection loss.

GreetService

Demo Wails service for template testing.

Webview Tools (27)

Exposed via POST /mcp/call:

Tool Description
webview_list List windows
webview_eval Execute JavaScript
webview_console Get console messages
webview_console_clear Clear console buffer
webview_click Click element by selector
webview_type Type into element
webview_query Query DOM elements
webview_navigate Navigate to URL (http/https only)
webview_source Get page source
webview_url Get current URL
webview_title Get page title
webview_screenshot Capture page as base64 PNG
webview_screenshot_element Capture element as PNG
webview_scroll Scroll to element/position
webview_hover Hover over element
webview_select Select dropdown option
webview_check Check/uncheck checkbox
webview_element_info Detailed element info
webview_computed_style Computed CSS styles
webview_highlight Visually highlight element
webview_dom_tree DOM tree structure
webview_errors Captured error messages
webview_performance Performance metrics
webview_resources Loaded resources list
webview_network Network request log
webview_network_clear Clear network log
webview_network_inject Inject network interceptor
webview_pdf Export page as PDF
webview_print Open print dialog

Frontend

Angular 20 application in frontend/:

  • src/app/components/ — shared UI components.
  • src/app/pages/ — page components.
  • src/app/app.routes.ts — routing configuration.
  • Wails bindings generated in frontend/bindings/.

Headless Mode

Launch with --headless flag or when no display is detected. Starts MCP server and Claude bridge without Wails GUI.

Dependencies

Direct: core/go, core/go-process, core/gui (webview + ws packages), gorilla/websocket, wails/v3.

Build

core build   # requires .core/build.yaml (Wails project)