ForgeCode AI — Production AI-Powered Web IDE
A production-oriented, browser-based cloud AI development environment inspired by Visual Studio Code and Cursor. ForgeCode AI integrates Monaco Editor, official Model Context Protocol (MCP) server, an advanced line-by-line patch & diff review engine, and Voroa Managed PostgreSQL.
Node.js PostgreSQL MCP License: MIT
Architecture Overview
+-------------------------------------------------------------------------+
| Top Command Bar: Project Selector | File Search | Layout | User Profile |
+---+----------------------+---------------------------------+------------+
| A | File Explorer | Central Editor Workspace | AI Agent |
| c | (Hierarchical Tree) | (Monaco Editor / Diff Editor) | Panel |
| t | | Multi-tab header with dirty dots | (Chat, |
| i | - src/ | | Context, |
| v | - index.ts | | Proposals, |
| i | - patchEngine.ts | | Hunks) |
| t | - package.json | | |
| y | - .env | | |
| | +---------------------------------+ |
| B | | Bottom Panel: Terminal | Output | |
| a | | Diagnostics | Execution Logs | |
| r | | | |
+---+----------------------+---------------------------------+------------+
| Status Bar: Branch | Error/Warn | Line/Col | Encoding | MCP: Connected |
+-------------------------------------------------------------------------+
Key Capabilities
-
Monaco Editor & Monaco Diff Viewer:
- Custom dark developer theme (
#18181b/#1f1f23). - IntelliSense, bracket pair colorization, multi-cursor, and minimap.
- Side-by-side and inline diff inspection with floating hunk controls (
[✓] Accept,[✗] Reject,Apply Selected).
- Custom dark developer theme (
-
Line-by-Line Patch & Diff Engine:
- Surgical hunk modifications instead of rewriting 1,000-line files for a 3-line change.
- Myers diff algorithm with sliding-window fuzzy fallback matching.
- Optimistic concurrency conflict detection (
baseSha256). - Snapshot rollback history (
undo_change) for bit-for-bit reversion.
-
Native Model Context Protocol (MCP) Server:
- Implements
@modelcontextprotocol/sdkStreamable HTTP / Server-Sent Events (SSE) on/mcp. - Bearer token authentication with granular scopes (
files:read,files:write,patch:propose,patch:apply,git:read,git:write,terminal:execute). - 28 standard-compliant tools including project tree discovery, regex code search, file operations, diff proposals, git version control, and direct GitHub push (git_push).
- 1-click configuration snippet export for Claude Desktop, Cursor, and Antigravity.
- Implements
-
Multi-Provider AI Architecture:
- Streaming SSE chat with sliding-window context engine.
- Adapters for OpenAI (GPT-4o, o3-mini), Anthropic (Claude 3.5 Sonnet), Google Gemini (Gemini 2.5 Flash), and custom OpenAI-compatible endpoints (Ollama, LM Studio).
- Server-side AES-256-GCM encryption of user API keys.
- Automatic secret scrubbing of environment variables and private tokens before sending prompts to LLMs.
-
Sandboxed Terminal & Git Integration:
- Real-time
xterm.jsweb terminal connected over WebSockets (/ws/terminal). - Parameterized Git version control (
simple-git) for staging, committing, diffing, and branch switching.
- Real-time
-
Voroa.com Deployment & Persistent Storage:
- Zero-dependency built-in PostgreSQL blob storage driver (
FileContentpartitioned byproject_id). - Configurable S3 / Cloudflare R2 object storage driver.
- Persistent volume local mount driver.
- Automated Prisma migrations and
/healthzhealth check endpoint.
- Zero-dependency built-in PostgreSQL blob storage driver (
Model Context Protocol (MCP) Integration
ForgeCode AI exposes a compliant MCP server at:
https://<your-voroa-app-or-host>/mcp
Claude Desktop Configuration (claude_desktop_config.json)
{
"mcpServers": {
"forgecode": {
"url": "https://your-app.voroa.app/mcp",
"headers": {
"Authorization": "Bearer mcp_live_YOUR_TOKEN_HERE"
}
}
}
}
Registered MCP Tools Catalog
| Category | Tools |
|---|---|
| Project Discovery | list_projects, get_project_tree, list_files |
| Reading & Search | read_file, read_lines, search_code, search_files, get_diagnostics |
| File Operations | create_file, create_directory, rename_file, delete_file, write_file |
| Safe Code Editing | propose_patch, preview_diff, get_patch_status, accept_patch, accept_patch_hunk, reject_patch, undo_change |
| Version Control (Inspection) | git_status, git_diff, git_history |
| Version Control (Smart Sync & Write) | git_sync, git_commit, git_push, git_fetch, git_pull |
| Branch Management | git_branch_list, git_branch_create, git_branch_switch, git_branch_delete, git_set_upstream |
| GitHub Integration | clone_repository, github_repo_info, github_list_pull_requests, github_create_pull_request, github_compare, github_check_auth |
| Execution & Tests | run_tests, get_execution_status, get_execution_output |
Smart Git Sync & GitHub Integration
ForgeCode AI features a production-ready, pure-JS Git engine powered by isomorphic-git and authenticated GitHub REST API integrations. It requires zero external Git CLI binaries installed on the server container and operates seamlessly across serverless and isolated container environments like Voroa.com.
1. Smart Git Sync Engine (git_sync)
The git_sync tool safely reconciles changes between your local project workspace and a configured remote repository.
Workflow Steps
- Validates project ID and resolves workspace working directory.
- Synchronizes database storage (
WorkspaceStorageAdapter) to disk working tree. - Inspects index state, working-tree modifications, staged files, and untracked files.
- Detects whether any Git operation (
merge,rebase,cherry-pick,revert) is currently in progress. - Acquires per-repository exclusive lock via
GitLockManagerto prevent race conditions. - Fetches latest refs from the configured remote repository.
- Computes merge base (
findMergeBase) and calculates ahead / behind commit distance. - Safely fast-forwards or reconciles histories via explicit strategy (
safe,ff-only,merge,rebase). - Never automatically discards, resets, or stashes user changes without explicit instructions.
- If merge conflicts occur, preserves conflict markers, aborts destructive steps, and returns structured conflict details.
- Pushes to remote only when explicitly requested (
push: true), requiringforce: truefor non-fast-forward pushes. - Synchronizes disk changes back to database storage (
WorkspaceStorageAdapter.syncDiskToStorage). - Returns structured status report with commit hashes, ahead/behind counts, and operation summaries.
Parameters
git_sync({
projectId?: string; // Project UUID (defaults to active workspace)
remoteName?: string; // Remote name (default: "origin")
branch?: string; // Target branch (default: current branch or upstream)
strategy?: 'safe' | 'ff-only' | 'merge' | 'rebase'; // Sync strategy (default: "safe")
push?: boolean; // Push local commits to remote after reconciliation (default: false)
commitMessage?: string; // Commit message to safely auto-stage & commit changes before syncing
force?: boolean; // Explicit opt-in required for force-pushing (warning: may overwrite remote history)
dryRun?: boolean; // Preview analysis without mutating working tree or remote (default: false)
token?: string; // GitHub Personal Access Token (defaults to GITHUB_TOKEN environment variable)
})
Structured Response Fields
{
success: boolean;
projectId: string;
remote: string;
branch: string;
initialHead: string;
localHead: string;
remoteHead?: string;
ahead: number;
behind: number;
workingTreeClean: boolean;
strategy: string;
fetchCompleted: boolean;
mergeCompleted: boolean;
rebaseCompleted: boolean;
pushAttempted: boolean;
pushCompleted: boolean;
conflicts?: string[];
warnings?: string[];
message: string;
}
2. Complete Git Status, Diff & History Access
git_status
Returns full structured porcelain repository status:
currentBranch: Active branch nameheadCommit: Current commit SHAupstreamBranch: Tracking branch (e.g.origin/main)ahead/behind: Commit distance between local and remotestaged: Staged file pathsunstaged: Modified but unstaged file pathsuntracked: New untracked filesdeleted: Deleted file pathsconflicted: Conflicted file paths (e.g. unmerged files)workingTreeClean: Boolean indicating zero uncommitted or untracked changesoperationInProgress:null | 'merge' | 'rebase' | 'cherry-pick' | 'revert'
git_diff
Generates comprehensive unified diffs with:
- Staged diff (
staged: true) or unstaged working tree diff (staged: false) - Revision range comparison (
fromRevisionandtoRevision) - File path filter (
filePath) - Line limit pagination (
maxLines, default 1000) - Insertion & deletion file statistics
- Automatic secret scrubbing: All GitHub PATs (
ghp_...,github_pat_...), API keys (sk-...), and passwords are redacted ([REDACTED_SECRET]) before diff is returned.
git_history
Retrieves commit log with commit SHA, commit message, author name & email, ISO timestamp, parent commit hashes, and file paths.
3. Full GitHub Repository Synchronization
| Tool | Purpose | Required Scope |
|---|---|---|
clone_repository | Clones public/private remote repo into workspace and syncs to DB | git:write |
git_fetch | Fetches remote branches and tags without merging | git:read |
git_pull | Fetches and integrates remote changes into working branch | git:write |
git_push | Pushes local commits to remote GitHub repository | git:write or git:commit |
git_branch_list | Lists local and remote-tracking branches with current indicator | git:read |
git_branch_create | Creates new branch at revision point and optionally checks out | git:write |
git_branch_switch | Switches branches (safely protects uncommitted changes) | git:write |
git_branch_delete | Deletes local branch (protects current checked-out branch) | git:write |
git_set_upstream | Configures remote tracking upstream branch | git:write |
github_repo_info | Inspects GitHub repository metadata via GitHub REST API | git:read |
github_list_pull_requests | Lists open/closed pull requests from GitHub API | git:read |
github_create_pull_request | Creates pull request between branches on GitHub | git:write |
github_compare | Compares two branches or commits on GitHub | git:read |
github_check_auth | Verifies GitHub token, user identity, scopes, and API rate limits | git:read |
4. OAuth Scopes & Authorization Model
ForgeCode AI enforces granular OAuth 2.1 scopes for all tools:
| Scope | Description | Allowed Tools |
|---|---|---|
git:read | Read-only inspection of repository state, history, diffs, and GitHub metadata | git_status, git_diff, git_history, git_fetch, git_branch_list, github_repo_info, github_list_pull_requests, github_compare, github_check_auth |
git:write | Write operations including sync, pull, clone, and branch management | git_sync, clone_repository, git_pull, git_branch_create, git_branch_switch, git_branch_delete, git_set_upstream, github_create_pull_request |
git:commit | Creating local commits and pushing to remote repositories | git_commit, git_push, git_sync |
Handling Missing Scopes & Reauthorization
If your client token lacks a required scope, the server returns an actionable structured error:
{
"isError": true,
"errorCode": "AUTH_SCOPE_MISSING",
"message": "Permission denied: Missing required MCP scope 'git:read'"
}
To grant missing scopes:
- Re-run OAuth authorization flow at
https://<your-host>/oauth/authorize. - Request
git:read git:write git:commitalong with base scopes (files:read files:write). - Or generate an MCP access token in the ForgeCode AI Web UI under Settings → MCP Tokens with full Git permissions.
5. Error Code Reference
The server returns stable, machine-readable error codes in JSON responses:
| Error Code | Description | Recommended Action |
|---|---|---|
PROJECT_NOT_FOUND | Project UUID not found or access denied | Verify project ID or select an accessible workspace |
NOT_A_GIT_REPOSITORY | Working tree does not have a valid .git structure | Run ensureRepo or clone into workspace |
GIT_PERMISSION_DENIED | GitHub API or remote Git HTTP returned 401/403 | Verify GITHUB_TOKEN credentials and PAT scopes (repo) |
AUTH_SCOPE_MISSING | MCP token lacks git:read or git:write scope | Re-authenticate requesting the required scope |
REMOTE_NOT_FOUND | Remote (e.g. origin) not configured on repository | Configure remote via setRemote or git_push |
BRANCH_NOT_FOUND | Target branch ref does not exist locally or on remote | Create branch or check branch name spelling |
WORKING_TREE_DIRTY | Uncommitted modifications prevent safe operation | Commit or stage changes, or pass commitMessage to sync |
NON_FAST_FORWARD | Push rejected or ff-only pull failed due to divergence | Fetch and run git_sync(strategy: 'merge') |
MERGE_CONFLICT | Conflict detected during pull or sync | Review conflicted files, resolve markers, and commit |
OPERATION_IN_PROGRESS | Another operation holds lock or Git merge/rebase active | Complete/abort in-progress Git operation |
INVALID_PARAMETER | Malformed branch name, path traversal, or invalid revision | Check parameter formatting |
GIT_OPERATION_FAILED | Underlying Git execution error | Review error message details |
6. Workflow Examples
A. Checking Detailed Status
// Tool: git_status
{}
B. Previewing Synchronization Safely (dryRun)
// Tool: git_sync
{
"dryRun": true,
"strategy": "safe"
}
C. Synchronizing with Remote & Auto-Staging
// Tool: git_sync
{
"strategy": "merge",
"commitMessage": "Auto-staged local updates before sync",
"push": true
}
D. Pushing New Commits
// Tool: git_push
{
"branch": "main",
"commitMessage": "feat: add user authentication controller"
}
E. Recovering from Merge Conflicts
If git_sync reports MERGE_CONFLICT:
- Inspect conflicting files using
git_status: checkconflicted: [...]. - Inspect conflict markers (
<<<<<<<,=======,>>>>>>>) usingread_fileorgit_diff. - Edit files to resolve conflicts using
write_fileor patch tools. - Stage resolved files:
git_commit(message: "fix: resolve sync merge conflicts"). - Run
git_sync(push: true)to finish synchronization.
Quick Start & Local Development
Prerequisites
- Node.js 20+ LTS or 22 LTS
- PostgreSQL database (or Voroa / Neon PostgreSQL instance)
1. Clone & Install Dependencies
git clone https://github.com/abhinavstechdev/ForgeCodebynodejs.git
cd ForgeCodebynodejs
npm install
2. Configure Environment
Copy .env.example to .env and fill in your database credentials:
cp .env.example .env
3. Initialize PostgreSQL Database
npx prisma generate
npx prisma db push
4. Run Development Servers
npm run dev
- Frontend (Vite):
http://localhost:5173 - Backend API & Healthcheck:
http://localhost:3000/healthz - MCP Endpoint:
http://localhost:3000/mcp
Deploying on Voroa.com
- In Voroa Dashboard, create a Managed PostgreSQL database (PostgreSQL 18).
- Create a Web Service pointing to this GitHub repository.
- Set the following environment variables:
NODE_ENV:productionPORT:3000HOST:0.0.0.0DATABASE_URL:[Linked Voroa Database URL]APP_SECRET_KEY:[Generated 64-char hex key]STORAGE_DRIVER:postgres
- Set Build & Start commands:
- Build Command:
npm ci && npm run build && npx prisma migrate deploy - Start Command:
npm run start
- Build Command:
- Deploy service and verify via
/healthz.
License
MIT © ForgeCode AI