# Developer quickstart

## Run from source

```bash
npm install
npm run dev        # restarts on file changes
```

## Test

```bash
npm test           # unit and end-to-end tests
npm run typecheck
```

The end-to-end tests start a real gate on a random port and drive it with the MCP TypeScript SDK: authentication, tool listing, trifecta blocking, per-session isolation, approvals, the admin API, leads and the public demo. The Cloud tests add a local MCP server behind a test OAuth server, and cover sign-in, labels, conditional rules, teams, workspaces and CSV export.

## Project layout

| Path | What's in it |
| --- | --- |
| `src/main.ts` | HTTP server: `/mcp`, admin API, public endpoints, pages and docs |
| `src/gate.ts` | Sessions, the call pipeline and the per-session MCP server |
| `src/policy.ts` | Decision order, trifecta check and labels |
| `src/upstream.ts` | Connections to MCP servers, tool pinning and quarantine |
| `src/scanner.ts` | Tool-description scanner and fingerprints |
| `src/approvals.ts` | Pending approvals and timeouts |
| `src/accounts.ts` | Cloud accounts, workspaces, sign-in sessions and API keys |
| `src/workspaces.ts` | One gate per workspace, built on first use and changed in place |
| `src/catalog.ts` | The catalog of remote MCP servers |
| `src/oauth.ts` | OAuth sign-in to workspace servers |
| `src/google.ts` | Sign in with Google |
| `src/sso.ts`, `src/scim.ts` | Enterprise SSO (OIDC, SAML), domain verification and SCIM |
| `src/dlp.ts` | Secret and personal-data detection |
| `src/telemetry.ts` | OpenTelemetry export and Prometheus metrics |
| `src/openapi.ts` | REST APIs from OpenAPI documents |
| `src/isolation.ts` | Docker and microVM isolation for local servers |
| `src/llm.ts`, `src/chat.ts` | LLM proxy, cost tracking and the Chat agent |
| `src/netguard.ts` | Refuses private and internal addresses for Cloud servers |
| `src/secrets.ts` | Encryption of stored credentials |
| `src/store.ts` | SQLite audit log, tool pins, leads and redaction |
| `src/config.ts` | Config schema and loading |
| `src/demo.ts` | The built-in demo server |
| `src/docs.ts` | This documentation site |
| `public/` | Landing page, sign-up and sign-in, dashboard and images |
| `docs/` | Documentation pages in Markdown |
| `test/` | Tests |

## Writing docs

Each page is a Markdown file in `docs/` with a short header:

```markdown
---
title: Page title
description: One sentence for search and link previews.
---
```

Add the page to the sidebar in `src/docs.ts`. Every page is also available as Markdown at `/docs/<page>.md`, and all pages together at `/docs/llms-full.txt`.
