`sqlctx server postgres` starts a PostgreSQL-compatible server that rewrites semantic queries into warehouse SQL.

Install the required extra with `uv tool install "sqlctx[serve]"`, or use the `uvx --from` command below.

For the browser UI, HTTP API, and MCP on one port, use `uvx --from "sqlctx[api,mcp]" sqlctx serve ./models` (default port 4400). This guide covers the separate PostgreSQL wire interface.

## Basic

```bash doc-validate=lint
sqlctx server postgres ./models --port 5433
```

```bash doc-test
uvx --from "sqlctx[serve]" sqlctx server postgres --help
```

```text doc-expected-contains
Usage: sqlctx server postgres
```

## Authentication

```bash doc-validate=lint
sqlctx server postgres ./models --username admin --password-file .secrets/pg-password
```

## Network Boundaries and TLS

SQLCtx’s server is intended to run:
- locally for development, or
- behind a reverse proxy / tunnel that terminates TLS and controls network access.

## Debugging

- Start with `--demo` to validate connectivity:
  ```bash doc-validate=lint
  sqlctx server postgres --demo
  ```
- If BI tools behave oddly, capture:
  - the semantic query
  - the compiled SQL
  - the client’s connection settings