Skip to main content
InMemorySessionStore stores session metadata in the server’s memory. This is the default storage provider when no custom sessionStore is provided.

Usage

import { MCPServer, InMemorySessionStore } from 'mcp-use/server';

const server = new MCPServer({
  name: 'my-server',
  version: '1.0.0',
  sessionStore: new InMemorySessionStore()  // Default, can be omitted
});

Characteristics

Advantages

  • Fast - No I/O overhead, all operations are in-memory
  • No dependencies - Works out of the box, no Redis or database needed
  • Simple - Zero configuration required
  • All features work - Notifications, sampling, subscriptions all work on a single server

Limitations

  • Sessions lost on restart - All session data is cleared when the server restarts
  • Not distributed - Cannot share sessions across multiple server instances
  • Memory bound - All sessions must fit in server memory

When to Upgrade

Upgrade to Redis Storage when you need:
  • Sessions to persist across server restarts
  • Multiple server instances behind a load balancer
  • Distributed notifications/sampling across servers