Skip to main content
Glama
Sessvault MCP

Sessvault MCP

README.md
<div align="center">

# `sessvault`

**Authenticated, read-safe web session access for AI agents.**

[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![Built With Rust](https://img.shields.io/badge/built_with-Rust-CE422B.svg)](https://rust-lang.org)
[![MCP Compatible](https://img.shields.io/badge/MCP-compatible-8A2BE2.svg)](https://modelcontextprotocol.io)
[![AES-256-GCM](https://img.shields.io/badge/crypto-AES--256--GCM-4B5563.svg)](src/vault/crypto.rs)

[Quickstart](#quickstart) • [MCP Server Setup](#mcp-server-setup) • [CLI](#cli) • [MCP Tools](#mcp-tools) • [Security](#security-notes)

</div>

MCP Registry: `mcp-name: io.github.bigwalkdoe/sessvault`

---

`sessvault` captures browser login sessions (cookies + localStorage) into an encrypted local vault, then exposes domain-locked MCP tools over stdio so AI agents can fetch authenticated pages as clean Markdown without handling raw credentials.

## Why sessvault?

Agents often need to read authenticated pages (dashboards, issues, PRs, settings) but shouldn't handle raw cookies or tokens. `sessvault` keeps the session in an encrypted local vault and hands the agent only cleaned Markdown/links/metadata:

- **Encrypted local vault** — AES-256-GCM at rest; master key in the OS keyring (or `SESSVAULT_MASTER_KEY_HEX` override).
- **Domain-locked fetches** — allowlist enforced before navigation, on requests/redirects, subresources, iframes, auth challenges, and the final URL.
- **Read-safe by default** — MCP returns Markdown/links/metadata, never raw cookies/localStorage. `run_session_steps` is only exposed with `--write`.
- **Ephemeral browser contexts** — headless fetches use isolated temp user-data dirs and hard timeouts.
- **Secret redaction** — MCP errors are scrubbed of headers, Bearer tokens, sensitive key/value pairs, and long hex/token strings.

## Quickstart

### Prerequisites

- **Chrome/Chromium** on `PATH` (or set `SESSVAULT_BROWSER_PATH`)
- **`SESSVAULT_MASTER_KEY_HEX`** (64 hex chars) if the OS keyring is unavailable

### Install

**From source:**
```bash
cargo install --path .
```

**From GitHub releases:**
Download the archive for your platform from [Releases](https://github.com/bigwalkdoe/sessvault/releases), extract it, and put `sessvault` on your `PATH`.

**Build locally:**
```bash
cargo build --release
cargo test -q
```

### 1. Capture a session (opens a visible browser)

```bash
sessvault auth github --url https://github.com/login --allow github.com,*.github.com
```

### 2. Verify the environment

```bash
sessvault doctor
```

### 3. List profiles (no secrets)

```bash
sessvault list
```

### 4. Start the MCP server (read-only by default)

```bash
sessvault serve
```

## CLI

```bash
sessvault auth <profile> [--url <login-url>] [--allow <domain,...>]
sessvault list
sessvault serve [--read-only] [--write]
sessvault rm <profile>
sessvault doctor
```

- `auth` — opens a headed browser, waits for login, captures cookies/localStorage on window close or Ctrl+C. For existing profiles, `--url` and `--allow` default to stored values.
- `list` — shows profiles, allowed domains, expiry/status, last used. No secrets.
- `serve` — stdio MCP server. Read-only by default; pass `--write` to expose `run_session_steps`.
- `rm` — deletes profile metadata and the encrypted vault file.
- `doctor` — checks browser, data dir, keyring/master key, profiles, and CDP headless launch smoke.

## MCP Server Setup

`sessvault serve` speaks stdio JSON-RPC 2.0 with no background daemons and no API keys.

### OpenCode (`opencode.json`)

```json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "sessvault": {
      "type": "local",
      "command": ["sessvault", "serve"],
      "enabled": true
    }
  }
}
```

For development from this repo:

```json
{
  "mcp": {
    "sessvault": {
      "type": "local",
      "command": ["cargo", "run", "--quiet", "--", "serve"],
      "enabled": true
    }
  }
}
```

### Claude Desktop / generic stdio MCP config

```json
{
  "mcpServers": {
    "sessvault": {
      "command": "sessvault",
      "args": ["serve"]
    }
  }
}
```

### Cursor (`.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "sessvault": {
      "command": "sessvault",
      "args": ["serve"]
    }
  }
}
```

This repo also includes an OpenCode command at `.opencode/commands/sessvault.md`.

## MCP Tools

| Tool | Description | Write-gated |
|------|-------------|-------------|
| `list_sessions` | List profiles/domains/expiry. No secrets. | No |
| `fetch_session_page` | Fetch an authenticated page as Markdown/links. | No |
| `run_session_steps` | Click/fill/press/wait, then snapshot. | Yes (`--write`) |

## Environment

| Variable | Purpose |
|----------|---------|
| `SESSVAULT_BROWSER_PATH` | Override the Chrome/Chromium binary |
| `SESSVAULT_DATA_DIR` | Override the vault data directory |
| `SESSVAULT_MASTER_KEY_HEX` | 64 hex chars (32-byte) master key override for CI/testing |

## Security notes

- Vault files are encrypted at rest with AES-256-GCM; master key stored in the OS keyring by default and never written to disk.
- Domain allowlist is enforced before navigation and on request/redirect checks.
- MCP tools never return raw cookies/localStorage values; errors are sanitized.
- `run_session_steps` is disabled unless `--write` is passed.
- Auth challenges are canceled in read-safe fetch mode.

## Troubleshooting

- **Keyring unavailable**: set `SESSVAULT_MASTER_KEY_HEX` (64 hex chars).
- **No browser found**: set `SESSVAULT_BROWSER_PATH` or install Chrome/Chromium.
- **Headed auth on Wayland**: ensure `DISPLAY`/`WAYLAND_DISPLAY` is available; close the browser window to save.
- **Capture hangs**: press Ctrl+C in `sessvault auth`; capture has snapshot timeouts and failure detection.
- **Expired profile**: re-run `sessvault auth <profile>` (uses stored URL/allowlist) or provide `--url`/`--allow` explicitly.

## Development

```bash
cargo fmt --all -- --check
cargo clippy --all-targets --all-features -- -D warnings
cargo test -q
# Real Chrome e2e (ignored by default)
cargo test -- --ignored --nocapture
```

See [`docs/SMOKE.md`](docs/SMOKE.md) for local and manual third-party OpenCode smoke procedures.

## License

MIT