Prerequisites
Before installing, ensure you have:- Node.js 18+ - Download Node.js
- Package manager - npm, yarn, or pnpm
- Storage Backend (optional, defaults to in-memory):
- Redis — Production distributed storage
- File System — Local JSON persistence
- Supabase — Cloud-native PostgreSQL
- SQLite — Native persistent database
Install the Package
Choose your preferred package manager:npm2yarn
Configure Storage Backend
The library automatically selects a storage backend based on your environment variables. Choose the option that best fits your needs:Option 1: Redis (Production)
Recommended for production and serverless deployments.Local Redis Setup
Environment Configuration
Option 2: File System (Development)
Perfect for local development with persistent sessions across restarts.Option 3: In-Memory (Testing)
Fast ephemeral storage, ideal for testing. Sessions are lost on restart.Storage Selection Logic
The library uses the following priority:- Explicit: If
MCP_TS_STORAGE_TYPEis set, use that backend - Auto-detect Redis: If
REDIS_URLis present, use Redis - Auto-detect Supabase: If
SUPABASE_URLis present, use Supabase - Auto-detect File: If
MCP_TS_STORAGE_FILEis present, use File - Auto-detect SQLite: If
MCP_TS_STORAGE_SQLITE_PATHis present, use SQLite - Default: Fall back to In-Memory storage
Verify Installation
Test your setup with a simple script:TypeScript Configuration
If using TypeScript, ensure yourtsconfig.json includes:
Next Steps
- Storage Overvew - Detailed backend comparison
- Next.js Integration - Set up with Next.js
- React Hook - Use the React hook
- API Reference - Explore the API