Skip to main content
KnowSQL

In development

Coming Soon

We're putting the finishing touches on the KnowSQL workspace. Check back shortly to start connecting your data.

Install

Run KnowSQL in your own cloud.

Clone the repository onto a Linux machine in your cloud account, build the image from the Dockerfile, and run the container. The same steps work on DigitalOcean, AWS, Azure, and Google Cloud. Only the machine and the firewall rule change.

Requires Docker and git on the machine. Wondering what it saves? Compare KnowSQL to your current tool.

Quick start

bash
git clone Coming sooncd midst-studiodocker build -t knowsql .docker volume create knowsql-datadocker run -d --name knowsql --restart unless-stopped \  -p 3000:3000 \  -e AUTH_COOKIE_SECURE=false \  -e STORAGE_PROVIDER=sqlite \  -e STORAGE_SQLITE_PATH=/app/data/libredb-storage.db \  -v knowsql-data:/app/data \  knowsqldocker logs knowsql

After the container starts

  • Sign in with the logged credentials

    docker logs knowsql prints the admin email and a password generated for that machine. Open http://<machine-ip>:3000 and sign in with those.

  • Your connections persist

    Saved connections live in the knowsql-data volume, so they survive container restarts and rebuilds.

  • Restrict port 3000

    AUTH_COOKIE_SECURE=false is required while the browser reaches the app over plain HTTP, so only allow port 3000 from your own network.

Pick your cloud

Set up the machine and firewall for your provider, then run the quick start commands.

DigitalOcean

Ubuntu 24.04 Droplet

  1. 1Create an Ubuntu 24.04 Droplet.
  2. 2Add a Cloud Firewall rule for TCP 3000 from your own addresses.
  3. 3SSH in, install Docker and git, and run the quick start commands.

Open in browser

http://<droplet-ip>:3000

Configuration

Additional config options

These settings are environment variables on the same container. Change them and start the container again. The image stays the one built from the repo.

Authentication

NEXT_PUBLIC_AUTH_PROVIDER

NEXT_PUBLIC_AUTH_PROVIDER chooses who can sign in. Any other value stops the server at boot.

Local email and password

This is the default. Leave the variable unset, or set it to local. The first start generates an admin password and prints it in docker logs. To choose the accounts yourself:

env
-e NEXT_PUBLIC_AUTH_PROVIDER=local \-e ADMIN_EMAIL=admin@example.com \-e ADMIN_PASSWORD='a long password' \-e JWT_SECRET="$(openssl rand -base64 32)" \-e AUTH_BOOTSTRAP=off

JWT_SECRET must be at least 32 characters. AUTH_BOOTSTRAP=off means a missing admin password or secret stops the server instead of generating one. A second account exists only when USER_PASSWORD is set. That account can run queries and does not get the admin tools.

With SQLite or PostgreSQL storage, the first start copies those accounts into the server. Later sign-ins use that table. Add or remove people under Admin, then Accounts. ADMIN_PASSWORD_RESET=true puts the admin password from the environment back in force on the next start. Remove that variable after the admin is back in.

An authenticator app is optional on local accounts. Set ADMIN_TOTP_SECRET to a base32 secret of at least 26 characters (openssl rand 20 | base32 | tr -d '='). That account then needs the 6-digit code after the password.

Single sign-on (OIDC)

Use an OpenID Connect provider such as Auth0, Keycloak, Okta, Microsoft Entra ID, or Zitadel:

env
-e NEXT_PUBLIC_AUTH_PROVIDER=oidc \-e OIDC_ISSUER=https://your-tenant.example.com \-e OIDC_CLIENT_ID=your_client_id \-e OIDC_CLIENT_SECRET=your_client_secret \-e JWT_SECRET="$(openssl rand -base64 32)"

In the identity provider, allow the callback https://<your-host>/api/auth/oidc/callback, the logout URL https://<your-host>/login, and the web origin https://<your-host>. The login page then offers Login with SSO.

OIDC_ROLE_CLAIM names the claim that carries roles, such as realm_access.roles on Keycloak. OIDC_ADMIN_ROLES defaults to admin. Anyone else signs in as a regular user unless OIDC_USER_ROLES lists the only other roles you accept. OIDC_ALLOWED_EMAIL_DOMAINS=example.com admits only those email domains.

OpenShift

The third value, openshift, signs people in through an OpenShift cluster's own OAuth server. A virtual machine on DigitalOcean, AWS, Azure, or Google Cloud uses local or oidc.

Where saved work is stored

STORAGE_PROVIDER

STORAGE_PROVIDER chooses where connections, saved queries, and settings live.

ValueWhat it does
localThe browser keeps the data. Nothing is written on the server. Clearing the browser or switching machines loses it.
sqliteOne file on the machine. Right for a single container.
postgresA PostgreSQL database you already run. Right when more than one copy of KnowSQL must share the same saved work.

SQLite (what the quick start already sets)

env
-e STORAGE_PROVIDER=sqlite \-e STORAGE_SQLITE_PATH=/app/data/libredb-storage.db \-v knowsql-data:/app/data

The volume has to stay. Without it, the file disappears when the container is replaced.

PostgreSQL

This needs a database that already exists. KnowSQL creates its tables on the first request.

env
-e STORAGE_PROVIDER=postgres \-e STORAGE_POSTGRES_URL='postgresql://knowsql:secret@db.internal:5432/knowsql?sslmode=require'

Check which mode is running with curl http://127.0.0.1:3000/api/storage/config. SQLite answers "provider":"sqlite". PostgreSQL answers "provider":"postgres".

MCP

LIBREDB_MCP_ENABLED

MCP is off until three variables are set. It lets an external AI client read schemas and run read-only queries at /api/mcp.

env
-e LIBREDB_MCP_ENABLED=true \-e LIBREDB_MCP_URL=https://studio.example.com/api/mcp \-e LIBREDB_MCP_TOKEN_LABEL=studio-mcp-1

LIBREDB_MCP_URL is the address the client uses. It must be an http or https URL ending in /api/mcp, with no user name, password, query, or fragment. Every token is bound to that exact URL. Changing the label revokes every token at once. LIBREDB_MCP_TOKEN_TTL_DAYS is how long a token lasts, from 1 to 365. Unset, it is 30 days.

Keep the data volume. The tokens are checked with JWT_SECRET, and a new container with an empty data directory generates a new secret. Existing tokens then stop working.

After sign-in, open the editor, then the user menu, then MCP, and choose Create token. The token is shown once.

Expose connections to MCP

An MCP client can see a database only when that connection is in the seed file with mcp: true:

seed-connections.yaml
connections:  - id: shop    name: Shop    type: postgres    host: db.internal    database: shop    roles: ["*"]    mcp: true

Mount that file and point at it:

env
-e SEED_CONFIG_PATH=/app/config/seed-connections.yaml \-v /path/on/the/vm/seed-connections.yaml:/app/config/seed-connections.yaml:ro

The sample connections that ship with KnowSQL are never offered to MCP. A connection whose database login can do more than read is refused for the engines that check this, including PostgreSQL, so the seed login for those engines should be a read-only account.

Answer your toughest questions.

(Even if you don't know SQL)

Free on your own cloud · Open source · Fully customizable

In development

Coming Soon

We're putting the finishing touches on the KnowSQL workspace. Check back shortly to start connecting your data.