Skip to main content
Glama
Warden
by Delwalt
README.md
<p align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="public/brand/warden-mark-light.svg" />
    <img src="public/brand/warden-mark-dark.svg" width="64" alt="" />
  </picture>
</p>

<h1 align="center">Warden</h1>

<p align="center">
  Let AI agents use your accounts — and decide, call by call, what they may do.
</p>

<p align="center">
  <a href="#run-it-on-your-computer">Run it</a> ·
  <a href="docs/connect.md">Connect Claude, ChatGPT, Cursor</a> ·
  <a href="docs/apps.md">Add your own apps</a> ·
  <a href="SECURITY.md">Security</a>
</p>

![The Warden console: four calls held for approval, each showing the agent, the app and the exact arguments](docs/screenshot.png)

## The problem

AI agents are most useful when they can act: read your inbox, file the issue,
post the update. To let them, you hand over an API token or sign them in to
your account — and from then on they can do **anything** that account can, with
no record of what they did and no way to say "yes to reading, ask me before
sending".

Every tool that wants access asks for its own copy of your credentials, so they
end up in config files across your machines, each one a full key to the account.

## How Warden solves it

![AI agents send requests to Warden with individual keys. Warden applies your policy to allow, deny, rate-limit, or hold each request for approval. Allowed and approved requests reach connected apps using credentials stored in Warden.](docs/warden-flow.svg)

- **Agents never hold your credentials.** Each gets its own Warden key. Your
  real tokens stay encrypted on your machine, and revoking an agent is one click.
- **Every call is checked against rules you write**: allow, deny with a reason,
  limit per day, or **ask you first**.
- **You approve from your phone.** A held call arrives as a notification showing
  exactly what the agent wants to do. One tap runs it — once — or refuses it.
- **Agents see only what you grant.** An app an agent was not given is not just
  refused; it never appears in its tool list.
- **Everything is recorded** in an audit log, with sensitive arguments redacted.

Warden speaks [MCP](https://modelcontextprotocol.io), so anything that supports
MCP servers can use it: Claude, ChatGPT, Cursor, VS Code, Codex and your own
code.

**Built-in apps:** Gmail, Google Calendar, Slack, GitHub, Gitea and X. **Add
your own** from the console: paste any MCP server's address and Warden imports
its tools, or describe an HTTP API in one JSON file.

## Run it on your computer

The quickest way to try Warden, with nothing to host. You need
[Node.js 22](https://nodejs.org) (or Docker).

```bash
git clone https://github.com/Delwalt/warden.git
cd warden
npm run setup        # creates .env: keys and your console password
npm ci
npm run build
npm start
```

Open <http://localhost:3000> and sign in. Then:

1. **Apps → Add app.** Connect Gmail, GitHub or another app, or **Add a custom
   app** for an MCP server.
2. **Agents → New agent.** Copy the key it shows once, choose which apps it may
   use, and write its rules.
3. **Connect your AI tool** to `http://localhost:3000/mcp` with that key — see
   [Connect your AI tools](docs/connect.md) for Claude Code, Claude Desktop,
   Cursor and others.

Prefer Docker? After `npm run setup`, run `docker compose up -d` instead of the
last three commands.

On your own computer, Warden runs only while the computer is on, and phone
approvals need HTTPS (below). Everything else works from the console in your
browser.

## Self-host it

To approve from your phone, reach Warden from other devices, or connect
ChatGPT and Claude.ai, run it on an always-on machine — a home server, a NAS or
a small VPS — with HTTPS.

```bash
git clone https://github.com/Delwalt/warden.git && cd warden
node scripts/setup.mjs      # enter the https:// address you will use
docker compose up -d
```

For HTTPS, pick one:

- **Your own domain** — point DNS at the machine, then
  `docker compose --profile https up -d`. The bundled Caddy gets the
  certificate. Answer yes to the Caddy question in `setup.mjs` and it fills in
  `WARDEN_DOMAIN` and `WARDEN_TRUSTED_PROXY` for you.
- **Tailscale** — `tailscale serve --bg 3000` gives Warden an HTTPS address on
  your tailnet, reachable from your phone and nobody else.
- **Your own reverse proxy** — forward to port 3000 and set
  `WARDEN_TRUSTED_PROXY=true` only if it overwrites `X-Real-IP` with the client address.

Then open Warden on your phone, add it to the home screen, and choose **Devices
→ Enable approvals**.

Warden holds live credentials. Keep it on a private network (Tailscale is the
simplest) unless you need ChatGPT or Claude.ai to reach it; see
[SECURITY.md](SECURITY.md).

**Back up** the `.env` file and the data volume together. The encryption key in
`.env` is the only way to read the credentials in the database.

## Write rules

Each agent has one rule document. Anything no rule allows is denied.

```json
{
  "rules": [
    { "tool": "gmail_search", "decision": "allow" },
    { "tool": "gmail_send", "decision": "require-approval" },
    { "tool": "github_*", "decision": "rate-limit", "limit": 200 },
    {
      "tool": "slack_post_message",
      "decision": "deny",
      "reason": "Ask in chat first."
    }
  ]
}
```

The **Agents** page builds these for you: pick an app, then Allow, Ask, Limit or
Deny per tool. A rule can name a `connection` to apply to one account of an
app. Tools that publish or delete (posting to X, for example) always ask,
whatever the rules say.

## Settings

Settings live in `.env`; `npm run setup` writes the required ones. Restart
Warden after changing them.

| Setting                          | Default                           |                                                                                  |
| -------------------------------- | --------------------------------- | -------------------------------------------------------------------------------- |
| `WARDEN_PUBLIC_URL`              | `http://localhost:3000`           | Where you open Warden. OAuth callbacks are `<this>/api/oauth/callback`.          |
| `WARDEN_APPROVAL_WINDOW_HOURS`   | `24`                              | How long a held call can be approved. Up to 168.                                 |
| `WARDEN_SESSION_HOURS`           | `12`                              | How long a console sign-in lasts. Up to 720.                                     |
| `WARDEN_KEY_IN_URL`              | off                               | `true` allows `/mcp/<key>`, for ChatGPT. See [docs/connect.md](docs/connect.md). |
| `WARDEN_TRUSTED_PROXY`           | off                               | `true` only behind a proxy that overwrites `X-Real-IP` with the client address.  |
| `DATABASE_URL`                   | `./data/warden.db`                | The SQLite file (`setup` writes this). `/data/warden.db` in Docker.              |
| `WARDEN_CUSTOM_APPS_DIR`         | `custom-apps` beside the database | Where apps added in the console are saved.                                       |
| `WARDEN_ENCRYPTION_KEY`          | generated                         | Encrypts stored credentials. Never change it on a running install.               |
| `WARDEN_DASHBOARD_PASSWORD_HASH` | generated                         | Console password. Change it with `npm run auth:hash`.                            |
| `WARDEN_VAPID_*`                 | generated                         | Keys for push notifications to your phone.                                       |

## Updates

Warden uses [semantic versioning](https://semver.org). Each release is a
[GitHub release](https://github.com/Delwalt/warden/releases) with notes from
[CHANGELOG.md](CHANGELOG.md); choose **Watch → Custom → Releases** on GitHub to
hear about new ones. The console shows the running version at the bottom.

```bash
git pull
docker compose up -d --build     # or: npm ci && npm run build && npm start
```

Database migrations run on start.

Every release is also published as a multi-arch image,
`ghcr.io/delwalt/warden:<version>` (and `:latest`). To use it instead of
building, replace `build: .` with `image: ghcr.io/delwalt/warden:0.1` in
`docker-compose.yml`, then `docker compose pull && docker compose up -d`.

## Contributing

Warden is a Next.js app with a SQLite database. [AGENTS.md](AGENTS.md) maps the
code and its conventions, for people and for the AI tools you use to change it.

```bash
npm ci
npm run setup
npm run db:migrate
npm run dev
```

`npm run check` runs what CI runs: lint, format, typecheck, tests and the
build. `npm run test:e2e` runs the browser tests (port 3100; set `WARDEN_E2E_PORT` to change it).

## License

[MIT](LICENSE)