The Local Host (apps/local) is the primary distribution of Executor for local development and CLI usage. It provides a production-grade Bun server that hosts the React-based console, a local SQLite database, and a specialized MCP (Model Context Protocol) endpoint for local tool execution.
The Local Host is built on top of the Effect runtime and Bun. It orchestrates the lifecycle of the Executor instance, the SQLite storage layer, and the HTTP server.
Title: Local Host Request Flow
Sources: apps/local/src/serve.ts18-27 apps/local/src/executor.ts189-210 apps/local/src/mcp.ts167-177
The server is implemented in serve.ts using Bun.serve. It handles three distinct types of traffic:
/api/* requests to the ServerHandlers provided by the core API package apps/local/src/main.ts18-25/mcp and /mcp/toolkits/:slug routes for the Model Context Protocol apps/local/src/mcp.ts107-113Local Host uses a Bearer Token for all non-public routes.
~/.executor/server-control/auth.json with 0600 permissions apps/local/src/serve.test.ts134-142makeIsAuthorized function validates the Authorization header against this local token apps/local/src/serve-shared.ts127-133/api/health and the OAuth callback /api/oauth/callback (which is state-gated instead of bearer-gated) apps/local/src/serve.ts23-25The Local Host uses LibSQL (a SQLite fork) for persistence.
To prevent data corruption from multiple concurrent processes, the host implements a locking mechanism:
data.db.owner-lock) apps/local/src/db/data-dir-ownership.ts6-10The host manages two types of migrations:
localDataMigrations and tracked in the data_migration table apps/local/src/executor.ts169-180A significant part of the Local Host is the migration engine that converts legacy "v1" Executor databases to the modern "v2" FumaDB schema.
Title: v1-to-v2 Migration Logic
Sources: apps/local/src/db/v1-v2-migration.ts155-163 apps/local/src/db/v1-v2-migration.ts174-183 apps/local/src/db/v1-v2-migration.ts191-195
The migration includes:
auth.json into the new Credential Providers apps/local/src/db/v1-v2-migration.ts111-113source rows to integration rows and connection rows apps/local/src/db/v1-v2-migration.ts34-35During development (EXECUTOR_DEV=1), the Local Host provides a seamless developer experience by integrating with Vite.
EXECUTOR_DEV_VITE_PORT to the child process so the Vite HMR client can connect directly to the Vite port, bypassing the Bun proxy which does not support WebSockets apps/local/src/serve.ts151-154executorApiPlugin in vite.config.ts allows the Vite dev server to handle /api and /mcp requests by invoking the Effect handlers in-process apps/local/vite.config.ts66-72The local host configuration is defined in apps/local/executor.config.ts. It acts as the single source of truth for the plugins loaded into the local environment.
| Plugin Category | Specific Plugins |
|---|---|
| API Protocols | openApiHttpPlugin, graphqlHttpPlugin, mcpHttpPlugin |
| SaaS Presets | googleHttpPlugin, microsoftHttpPlugin |
| Secret Storage | keychainPlugin, fileSecretsPlugin, onepasswordHttpPlugin |
| Host Specific | desktopSettingsPlugin, toolkitsPlugin |
Sources: apps/local/executor.config.ts26-43
The local MCP implementation (mcp.ts) bridges the Model Context Protocol to the Executor's ExecutionEngine.
WebStandardStreamableHTTPServerTransport for long-running HTTP connections apps/local/src/mcp.ts126-130mcp-session-id headers to specific ExecutionEngine instances and McpServer states apps/local/src/mcp.ts170-174/mcp/toolkits/:slug to filter the available tool catalog based on a specific toolkit definition apps/local/src/mcp.ts107-113handleApprovalRequest apps/local/src/mcp.ts40-42Sources: apps/local/src/mcp.ts37-44 apps/local/src/mcp.ts105-113