MCP server for coding agents (F22) - #2
Merged
Merged
Conversation
Add an opt-in, loopback-only HTTP MCP server so coding agents manage dev servers through DevHarbor instead of spawning npm/yarn/pnpm in a shell they lose track of. 22 tools: list/add/update/remove apps, add/remove tasks, start/stop/restart apps and individual tasks, read/search logs, inspect ports, env vars, run history, node versions, scan folders, and configure readiness probes. Highlights: - Security: binds 127.0.0.1 only, validates Host/Origin on every request, bearer token by default (sha256 + timingSafeEqual), secret env values masked in responses and redacted from log output. Optional HTTPS with a self-signed localhost certificate generated on first use. - Honest readiness: probe-less tasks report ready: null instead of a vacuous true; a factual listening flag is separate from verified ready; start results carry readinessVerified plus recent output; a new http readiness kind polls /health until a service can actually serve; set_readiness lets an agent configure a probe. Ports are labeled with their owning process and the start path waits for the port set to stabilize. - Monorepos: add_app with workspaceTasks: true registers a repo once with one task per workspace package (shared detection with the UI); add_task / remove_task shape the task set with per-task working dir, dependsOn ordering, and oneShot for migrations/builds. - Live UI: MCP mutations push state:invalidate so the desktop reflects them without a manual reload. Shared AppOps de-duplicates the create/update/remove/scan/search flows between IPC and MCP. Settings gains mcp_enabled/mcp_port/mcp_require_auth/ mcp_https with a Settings -> MCP server section (status, token, client config). Tests: gate, hygiene, resolver, TLS, HTTP readiness, and the full 22-tool catalog under vitest, plus a live Electron E2E harness. Bumps to 1.2.0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an opt-in, loopback-only HTTP MCP server so coding agents (Claude Code, Cursor, anything that speaks MCP) manage the user's dev servers through DevHarbor instead of spawning
npm run devin a shell they then lose track of. Processes started this way outlive the agent's session, stay visible in the app, and get logs, port tracking, readiness checks, and clean shutdown for free.22 tools: list / add / update / remove apps · add / remove tasks · start / stop / restart apps and individual tasks · read / search logs · inspect ports, env vars, run history, node versions · scan folders · configure readiness probes.
Off by default. Enable under Settings → MCP server (status, port, token, copy-paste client config). Version bumped to 1.2.0.
Highlights
127.0.0.1only (not configurable), validatesHost/Originon every request, requires a bearer token by default (sha256 +timingSafeEqual, never logged). Secret env values are masked in responses and redacted from log output. Optional HTTPS via a self-signed localhost certificate generated on first use.ready: nullinstead of a vacuoustrue; a factuallisteningflag is reported separately from verifiedready; start results carryreadinessVerifiedplus recent output so an agent can judge for itself; a newhttpreadiness kind polls/healthuntil a service can actually serve;set_readinesslets an agent configure a probe. Each detected port is labeled with its owning process, and the start path waits for the port set to stabilize so slow-binding monorepo siblings are captured inline.add_appwithworkspaceTasks: trueregisters a repo once with one task per workspace package (pnpm/yarn/npm, same detection as the UI);add_task/remove_taskshape the task set with per-task working directory,dependsOnordering (migrate → api → web), andoneShotfor migrations/builds. Workspace globs that escape the repo root are rejected so a task can never run an unrelated sibling project.state:invalidateevent so the desktop reflects add/remove/start/stop without a manual reload.Implementation notes
src/main/mcp/module: stateless Streamable HTTP transport (@modelcontextprotocol/sdk, per-request server), puregate.ts(Host/Origin/bearer),hygiene.ts(ANSI strip + secret redaction),token.ts,tls.ts.AppOpsde-duplicates the create/update/remove/scan/search flows between the existing IPC handlers and MCP.mcp_enabled/mcp_port/mcp_require_auth/mcp_https.specs/07-mcp-server.md.Testing
oneShot, an http probe verifying a slow-boot API, guard rejections) — all 25 checks pass against the built binary.Release notes
The local build is signed with a Developer ID but not notarized (no Apple creds in the build env). The real release should go through the
v1.2.0tag → CI workflow, which notarizes and publishes.