Cockpit Context — Overview & Quick Start
Self-hosted dependency investigation service over MCP that answers coding agent questions from real source at exact versions or Git refs.
Cockpit Context is a self-hosted Model Context Protocol (MCP) service that lets AI coding agents ask questions about software dependencies and receive answers grounded in real source code at the exact version or Git ref your project uses. Instead of relying on stale training data or guesswork, an investigation agent checks out the requested commit, searches and reads the source (optionally aided by confined TypeScript/JavaScript and Python language servers), and returns cited findings over MCP.
Deploy a single instance for your team or agent harness. Each user manages their own packages, credentials, and conversations in a React web dashboard where they can watch runs live, send steering guidance, stop investigations, or ask follow-up questions. Public HTTPS repository clones, checkouts, and generated overviews are shared across users to save work, while private SSH repositories and all conversations remain strictly owner-scoped.
Architecture
Cockpit Context runs as a single Node.js 26.13.1 application process backed by PostgreSQL 18 and a persistent /data volume. There is no Redis and no separate background worker process.
+-----------------------+ +------------------------------+
| Coding Agents (MCP) | | Web Browser (React 19 PWA) |
| Claude Code / Codex / | | Watch, steer, stop, manage |
| Streamable HTTP | | packages, SSH keys & tokens |
+-----------+-----------+ +--------------+---------------+
| POST /mcp (SSE) | HTTPS / oRPC / SSE
+----------------+----------------+
|
v
+----------------+----------------+
| Reverse Proxy (Traefik / Caddy |
| / Cloudflare Tunnel) |
+----------------+----------------+
| HTTP :3000 (unbuffered SSE)
v
+----------------------------+-------------------------------+
| Single Cockpit Context App Replica (Node.js 26.13.1) |
| |
| - Hono server: React web UI, oRPC API, OAuth 2.1, /mcp |
| - In-process investigation engine & background job runner |
| - Confined file search/read tools |
| - Landlock-confined TS/JS & Python LSPs (Linux ABI 4+) |
+-------+---------------------+---------------------+--------+
| | |
v v v
+---------------+ +-------------------+ +------------------+
| PostgreSQL 18 | | Persistent /data | | External Egress |
| (internal net)| | Bare clones & | | - OpenRouter API |
| Users, pkgs, | | detached worktree | | - Git/SSH hosts |
| runs, jobs | | checkouts | | - Optional SMTP |
+---------------+ +-------------------+ | - Optional OIDC |
+------------------+
- Frontend (
apps/web): React 19, TanStack Router, TanStack Query, Tailwind CSS v4, and installable PWA support with localized routes. - Server (
apps/server): Hono serving SSR pages, oRPC endpoints, Better Auth (with 2FA and optional OIDC SSO), and the stateless Streamable HTTP/mcpendpoint. - Storage: PostgreSQL 18 stores users, packages, proposals, encrypted SSH keys, conversations, runs, turns, and jobs.
/datastores bare Git repositories and detached commit checkouts.
Prerequisites
For local development you need:
- Git
- Node.js 26.13.1 (
.nvmrcis included; runnvm use) - Docker or Podman with Compose
- Free local ports:
5432(PostgreSQL),1025and8025(Mailpit SMTP sink and web UI) - Optional: user-managed
portless(npm install -g portless) for local HTTPS origins; without it, usepnpm dev:rawonhttp://localhost:3001 - Model access: an OpenRouter API key for real investigations, or the built-in
fake-openrouterserver for keyless local testing
Note: Node.js 26 does not ship Corepack. Use the repository’s SHA-512-verifying
scripts/install-pnpm.mjsinstaller to install the pinned pnpm 12 release.
Local Development Quick Start
Clone the repository, install the verified pnpm binary, install dependencies, and run the idempotent setup script:
git clone https://github.com/FlyCockpit/context.git
cd context
node scripts/install-pnpm.mjs package.json "$HOME/.local/bin" "$HOME/.local/share/cockpit-context"
export PATH="$HOME/.local/bin:$PATH"
pnpm install
pnpm setup:app
Tip:
pnpm installmay print a warning that Prisma does not list Node.js 26 as supported; this is expected. In a non-interactive terminal, pass--admin-email you@example.comtopnpm setup:app.
pnpm setup:app prepares local .env files, generates local secrets and encryption keys, starts local Docker services (waiting up to 2 minutes for a fresh Postgres volume to initialize), applies database migrations, records your bootstrap admin email, and installs Claude Code safety hooks in .claude/settings.json.
Start with a Real OpenRouter Model
Set OPENROUTER_API_KEY and COCKPIT_CONTEXT_MODEL (for example anthropic/claude-sonnet-4.5) in your local .env, then start the dev server:
# With portless (local HTTPS)
pnpm dev
# Without portless (plain HTTP on port 3001)
BETTER_AUTH_URL=http://localhost:3001 pnpm dev:raw
Next, bootstrap your first administrator account:
- Check the server boot output for the one-time
[bootstrap]token. - Open the local origin (
http://localhost:3001withdev:raw, or yourportlessURL) and sign up using your bootstrap admin email and the[bootstrap]token. - Open Mailpit at
http://localhost:8025to verify the email address when local SMTP is enabled. - Enroll administrator 2FA (required within the 24-hour grace period).
- Add a dependency under Packages, then connect an MCP client using the MCP & Investigations guide.
Keyless Local Development (fake-openrouter)
You can run the full web UI and MCP flow without an OpenRouter API key by starting the repository’s local fake OpenRouter server in one terminal and pointing the app at it in a second terminal:
# Terminal 1: start the local fake model server on http://localhost:4010
pnpm run fake-openrouter
# Terminal 2: run Cockpit Context against the fake model
BETTER_AUTH_URL=http://localhost:3001 \
COCKPIT_CONTEXT_OPENROUTER_BASE_URL=http://localhost:4010/api/v1 \
OPENROUTER_API_KEY=fake \
COCKPIT_CONTEXT_MODEL=fake/model \
pnpm dev:raw
Note:
fake-openrouterspeakschat-completionsonly (the defaultCOCKPIT_CONTEXT_MODEL_API). In production,COCKPIT_CONTEXT_OPENROUTER_BASE_URLrejects non-HTTPS URLs.
Known Limitations
Cockpit Context is intentionally focused and carries explicit architectural boundaries:
- Single app replica required: Concurrency limits, rate limiters, SSE live streams, and in-memory answer/version caches live inside one process. Run exactly one app container and use stop-first replacement on deploys.
- No organization workspaces or shared package catalogs: Roles are limited to
userandadmin. Every developer or dedicated harness account manages its own package list, notes, SSH keys, and conversations. - No dedicated service-account role or per-package token scopes: MCP API tokens act as the owning user on
/mcponly. For CI or an agent fleet, invite a dedicated ordinary user account and issue tokens under it. - No cross-user answer cache: Public repository clones, checkouts, repo maps, and generated overviews are shared across users, but investigation answers are only reused within the same user’s account.
- Language server scope: Built-in LSP support covers TypeScript/JavaScript and Python only. Go and Rust language servers, arbitrary dependency code execution, and embeddings/RAG search are not included.
- No per-user spend dashboards or storage quotas: Storage pruning (
COCKPIT_CONTEXT_MAX_STORAGE_GB) is instance-wide (LRU over unleased caches). Administrators cannot view individual user spend totals or revoke single tokens of another user (archiving a user revokes all of their credentials). - Snapshot backup responsibility: Private repositories cloned with a one-time SSH key cannot auto-refresh. Protecting their bytes under
/datarequires volume backups separate from PostgreSQL dumps.