Version: 0.9.0-beta Scope: Local Development & Production Deployment
- Node.js: v20 or higher (LTS recommended)
- Package Manager: pnpm (v10+)
- Build Tool: Turborepo (global install optional, used via scripts)
- Database: SQLite (default for local) or PostgreSQL (production)
- Environment: Windows, Linux, or macOS
- Docker (optional): For containerized production deployment
Borg is designed to run locally as your personal AI Operating System.
# 1. Install dependencies
pnpm install
# 2. Start the Borg dev readiness launcher
pnpm run dev
# 3. Verify cross-service readiness
node scripts/verify_dev_readiness.mjs
# Optional machine-readable output
node scripts/verify_dev_readiness.mjs --json --softpnpm run dev launches Borg's readiness-aware development wrapper rather than a bare workspace watch. It brings up the core bridge, the dashboard, supporting package watchers, and reports a truthful ready summary once the live startup contract is satisfied.
- Dashboard:
http://127.0.0.1:<detected-port>/dashboard- the dev wrapper prefers the marked Next.js dev port and may fall back among
3000,3010,3020,3030, or3040
- the dev wrapper prefers the marked Next.js dev port and may fall back among
- Core bridge / core HTTP probe:
http://127.0.0.1:3001 - Core WebSocket bridge:
ws://127.0.0.1:3001 - Startup status probe:
http://127.0.0.1:3001/api/trpc/startupStatus?input=%7B%7D - MCP status probe:
http://127.0.0.1:3001/api/trpc/mcp.getStatus?input=%7B%7D - MCP server:
stdiovia the CLI entrypoint or the core bridge transport surface
Notes:
- The dashboard root redirects from
/to/dashboard. - The readiness wrapper can automatically open the detected dashboard URL unless
BORG_DEV_READY_OPEN_BROWSER=0is set. - If an existing Borg-owned core bridge is already healthy on port
3001, the wrapper reuses it instead of spawning a duplicate core process.
Borg ships with a multi-stage Dockerfile.prod that creates separate container targets for the core API and the web dashboard.
| Target | Base Image | Exposes | Purpose |
|---|---|---|---|
core-runner |
node:20-slim | 3000 | Borg Core API + WebSocket server |
web-runner |
node:20-slim | 8080 | Next.js standalone dashboard |
# Build the core API container
docker build -f Dockerfile.prod --target core-runner -t borg-core:latest .
# Build the web dashboard container
docker build -f Dockerfile.prod --target web-runner -t borg-web:latest .
# Run
docker run -d -p 3000:3000 --name borg-core borg-core:latest
docker run -d -p 8080:8080 --name borg-web borg-web:latestBoth containers include built-in healthchecks (30s interval, 5s timeout, 3 retries).
- Build:
pnpm install pnpm run build
- Environment Variables:
Create a
.envfile where your chosen deployment path expects it. For the current local control-plane defaults, the important values are:# Core PORT=3001 DATABASE_URL=file:./dev.db JWT_SECRET=your_secret_key # Web NEXT_PUBLIC_API_URL=http://localhost:3001
- Start:
pnpm run build
node packages/cli/dist/index.js start
---
## 4. MCP Server Integration
To use Borg as an MCP Server inside **Claude Desktop** or **Cursor**:
### Claude Desktop Config
Edit `%APPDATA%\Claude\claude_desktop_config.json`:
```json
{
"mcpServers": {
"borg-core": {
"command": "node",
"args": [
"C:/path/to/borg/packages/cli/dist/index.js",
"mcp",
"start"
]
}
}
}
Add via "Borg" extension or manual MCP settings using the same command tuple.
- Port 3001 In Use: The core server creates a WebSocket on 3001. Ensure no other instance is running.
- Dashboard on an unexpected port:
pnpm run devmay move the dashboard off3000if that port is occupied. Use the ready summary from the launcher or rerunnode scripts/verify_dev_readiness.mjsto discover the active dashboard URL. - Circular Dependencies: If
pnpm buildfails, checkpackages/corefor circular imports (Ref: Phase 63 fix). - Database Locks: SQLite may lock if multiple processes access
dev.dbin write mode. - Docker Build Fails: Ensure
turbocan prune the workspace. Runpnpm dlx turbo prune @borg/web @borg/core --dockerlocally first to validate.
Normal pnpm run dev keeps packages/core/src/MCPServer.ts boot logging quiet unless you opt in.
Use either flag when you want verbose startup/import tracing:
$env:BORG_MCP_SERVER_DEBUG='1'; pnpm run dev$env:DEBUG='borg:mcp-server'; pnpm run devTo clear them again in the current PowerShell session:
Remove-Item Env:BORG_MCP_SERVER_DEBUG -ErrorAction SilentlyContinue
Remove-Item Env:DEBUG -ErrorAction SilentlyContinue"Assimilate your infrastructure."