#629·obscura

Request: support --storage-dir in `obscura mcp` for persistent cookies/session

Author: ety001Created Aug 11, 2026Updated Sep 18, 2026

Feature Description

The obscura mcp subcommand (both stdio and --http transports) does not support --storage-dir, so cookies/localStorage live only in process memory and are lost on restart. Please consider adding --storage-dir support to obscura mcp (or confirm whether it's planned).

Motivation

MCP is the primary way agents (Claude Desktop, Claude Code, Codex, custom agent stacks) drive Obscura, and obscura mcp --http is the documented sidecar deployment pattern. In Docker/container deployments, persistent sessions matter:

  1. docker run + obscura mcp --http with a mounted volume — users expect --storage-dir to work like it does for serve/fetch so a login survives container restarts.
  2. The only current workaround is exporting/importing session state through the browser_storage_state / browser_set_storage_state MCP tools (agent-side JSON persistence), which works but is manual, fragile for large storage, and not what a volume mount implies.
  3. fetch, serve, and scrape all accept --storage-dir (confirmed in crates/obscura-cli/src/main.rs); obscura_mcp::run() / http::run() simply don't receive the parameter today.

Proposed Solution

Wire --storage-dir into the mcp subcommand and pass it through to the browser/cookie store, with the same semantics as serve: all sessions in the process read/write one directory (cookies.json + localStorage/<origin>.json), written on clean exit and after each navigation.

Alternatives Considered

  • Keeping agent-side browser_storage_state JSON round-trips (works, but manual and not volume-mount friendly).
  • An env var (e.g. OBSCURA_STORAGE_DIR) as an alternative to the flag — either is fine; the flag would match the other subcommands.