Skip to main content
The library supports multiple storage backends for session persistence, allowing you to choose the best option for your deployment environment.

Automatic Backend Selection

The library automatically selects the appropriate storage backend using this priority: Priority Order:
  1. Explicit: If MCP_TS_STORAGE_TYPE is set, use that backend
  2. Auto-detect Redis: If REDIS_URL is present, use Redis
  3. Auto-detect Supabase: If SUPABASE_URL is present, use Supabase
  4. Auto-detect Neon: If NEON_DATABASE_URL is present, use Neon
  5. Auto-detect File: If MCP_TS_STORAGE_FILE is present, use File
  6. Auto-detect SQLite: If MCP_TS_STORAGE_SQLITE_PATH is present, use SQLite
  7. Default: Fall back to In-Memory storage

Backend Comparison

Custom Backend Implementation

You can use specific storage backends directly:

Session Data Structure

All backends store the same session data structure:
OAuth runtime credentials are stored separately from connection metadata in durable SQL backends such as Supabase and Neon.