# MCP Is Going Stateless: How to Handle Conversation Persistence

> MCP is going stateless at the protocol layer. Here's what that changes for conversation history and how to add persistence without building it yourself.

Canonical: https://dialoguedb.com/blog/mcp-stateless-conversation-persistence
Published: 2026-06-20
Updated: 2026-09-16

MCP & Conversation Persistence

# MCP Is Going Stateless: How to Handle Conversation Persistence

June 20, 2026

![MCP Is Going Stateless: How to Handle Conversation Persistence](https://dialoguedb.com/images/mcp-stateless-conversation-persistence-feature-image.jpg)

[ Back to Blog](https://dialoguedb.com/blog)

The Model Context Protocol’s [July 28, 2026 release candidate](https://blog.modelcontextprotocol.io/posts/2026-07-28-release-candidate/) makes servers stateless at the protocol layer. Servers can no longer rely on the transport layer to carry state between tool calls. Every request will arrive with no built-in context, and your server will need to retrieve or reconstruct state on its own.

This transition started with the [March 26, 2025 specification revision](https://modelcontextprotocol.io/specification/2025-03-26), which introduced the Streamable HTTP transport and began moving away from persistent connections. Each subsequent draft in the [specification repository](https://github.com/modelcontextprotocol/specification) has moved further toward protocol-layer statelessness, with the July 28, 2026 release candidate removing `Mcp-Session-Id` and the `initialize` lifecycle entirely. Most MCP tutorials still assume stateful sessions. Here’s what actually changes, what breaks, and how to fix it without building and maintaining a persistence layer yourself.

## What MCP Stateless Servers Mean for Conversation History

Before this change, an MCP server could hold session context in memory between tool calls. A user asks a question, your server stores the conversation, and the next tool call can reference what came before. The transport layer maintained session identity, so the server process could keep state in memory across the session lifecycle.

After the change, the protocol no longer manages session state for you, but removing the protocol-level session doesn’t mean your application has to be stateless. Each tool call arrives without built-in context from previous calls, and your server carries state explicitly. The maintainers recommend [minting an explicit handle:](https://blog.modelcontextprotocol.io/posts/2026-07-28-release-candidate/) accept a session identifier as a tool argument and use it to look up and persist context in a durable backend. Multi-turn agent conversations, user preferences, and tool call history all move to that external store.

In-memory session state was never durable to begin with; a server restart always wiped it. Persisting conversation history to an external store is something well-built servers should already be doing. The spec change makes it unavoidable rather than optional.

The practical impact hits three areas:

- **Multi-turn conversations:** An agent that asks clarifying questions across multiple tool calls needs to retrieve the thread on each call rather than relying on the transport to maintain it.
- **User context:** Preferences, permissions, and identity that were stored in session memory need an external home.
- **Tool call chains:** Workflows where one tool call depends on the result of a previous one need a durable store to carry state forward, since server memory is no longer guaranteed to persist between calls.

## Filesystem, Redis, Postgres, and Vector DBs: Tradeoffs for MCP Persistence

**Filesystem (JSON or text files):** The simplest option; write each conversation to a file, one per session. No dependencies, no setup. But it doesn’t scale: concurrent writes risk corruption, there’s no way to search across sessions without scanning every file, and multi-tenant isolation comes down to careful path management. It works for local development or single-user tools, but becomes fragile the moment you need concurrency, durability guarantees, or queryability.

**Redis or in-memory cache:** Fast reads and writes, and Redis can persist data durably with RDB snapshots or AOF logging. But you still need to model conversations, build retrieval logic, and enforce tenant isolation yourself. Redis is optimized for caching and real-time data structures, not for the ordered, scoped, queryable history that conversation persistence requires. It’s a solid building block, but not a ready-made solution for this access pattern.

**PostgreSQL or MySQL with a custom schema:** This works, and many teams already run Postgres. But conversation persistence is ongoing infrastructure, not a one-time setup. You’ll write the initial schema, then maintain migrations as requirements evolve, build TTL and cleanup jobs, scope every query to the correct tenant, handle retries and connection health, and keep it all running. The initial code is straightforward, it’s the continuous maintenance that adds up.

**Vector databases:** Good for semantic search over content, but conversation history is ordered and structured. You need messages in sequence, scoped to sessions, with metadata filtering. A vector database solves a different problem. If you need both retrieval and persistence, you end up running two systems and keeping them in sync.

None of these are bad choices in the right context. But they’re either too fragile, too low-level, too much work, or the wrong shape for conversation persistence specifically.

## What MCP Servers Need for Conversation Storage

The requirements for MCP conversation persistence are specific:

- **Ordered message storage** scoped to a session, user, or agent
- **Full conversation retrieval** or a recent context window on demand
- **Multi-tenant isolation** so one user’s data never leaks into another’s context
- **A simple API** that takes a few lines to integrate, not a schema design project

These requirements describe a conversation database, not a cache, not a general-purpose relational database, and not a vector store.

## Persisting MCP Conversation History with DialogueDB

[DialogueDB](https://dialoguedb.com) is a managed conversation database built for exactly this access pattern. Instead of designing schemas and standing up infrastructure, you store and retrieve conversation history through an [API](https://docs.dialoguedb.com/sdk/overview.html) that already models the data the way your MCP server needs it.

Here’s a working MCP server in TypeScript that follows this pattern. The `sessionId` tool argument is the explicit handle the MCP spec recommends, and `tenantId` from the authenticated request context ensures each tenant’s data stays isolated. DialogueDB is the durable store behind both:

server.ts

TypeScript

```
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { DialogueDB } from "dialogue-db";
import { z } from "zod";

const db = new DialogueDB({ apiKey: process.env.DIALOGUE_DB_API_KEY });
const server = new McpServer({ name: "my-agent", version: "1.0.0" });

server.tool(
  "ask",
  { question: z.string(), sessionId: z.string() },
  async ({ question, sessionId }, { authInfo }) => {
    // tenantId comes from your authenticated context, never from the tool argument
    const tenantId = authInfo.tenantId;

    const dialogue = await db.getOrCreateDialogue({
      id: sessionId,
      namespace: tenantId,
    });

    const history = await dialogue.loadMessages({ limit: 50 });

    await dialogue.saveMessage({ role: "user", content: question });

    const answer = await generateResponse(history, question);

    await dialogue.saveMessage({ role: "assistant", content: answer });

    return { content: [{ type: "text", text: answer }] };
  }
);
```

Every tool call retrieves the recent conversation history from DialogueDB, processes the request with that context, and stores the result back. The server itself holds no state. Restart it, scale it horizontally, run it in a serverless function: the conversation persists regardless.

Notice what’s missing from that code: no schema definitions, no connection pooling, no session management logic, no TTL handling, no multi-tenant filtering queries. The [namespace parameter](https://docs.dialoguedb.com/guide/core-concepts#namespace) isolates tenants automatically.

## Custom Persistence vs. Managed Conversation Database

The contrast speaks for itself. First, what you build and maintain when rolling your own. Below it, the same functionality with DialogueDB.

Rolling your own (\~50 lines, plus tests and upkeep)

persistence.ts

TypeScript

```
import { Pool } from "pg";

const pool = new Pool({
  connectionString: process.env.DATABASE_URL,
  max: 20,
  idleTimeoutMillis: 30000,
  connectionTimeoutMillis: 2000,
});

// Migration: run before first use
// CREATE TABLE conversations (
//   id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
//   session_id TEXT NOT NULL,
//   tenant_id TEXT NOT NULL,
//   created_at TIMESTAMPTZ DEFAULT NOW(),
//   UNIQUE(session_id, tenant_id)
// );
// CREATE TABLE messages (
//   id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
//   conversation_id UUID REFERENCES conversations(id),
//   role TEXT NOT NULL,
//   content TEXT NOT NULL,
//   created_at TIMESTAMPTZ DEFAULT NOW()
// );
// CREATE INDEX idx_msgs ON messages(conversation_id, created_at);

async function getOrCreateConversation(
  sessionId: string, tenantId: string
) {
  const { rows } = await pool.query(
    `INSERT INTO conversations (session_id, tenant_id)
     VALUES ($1, $2)
     ON CONFLICT (session_id, tenant_id)
     DO UPDATE SET session_id = $1
     RETURNING id`,
    [sessionId, tenantId]
  );
  return rows[0].id;
}

async function saveMessage(
  convId: string, role: string, content: string
) {
  await pool.query(
    `INSERT INTO messages (conversation_id, role, content)
     VALUES ($1, $2, $3)`,
    [convId, role, content]
  );
}

async function loadMessages(convId: string, limit = 50) {
  const { rows } = await pool.query(
    `SELECT role, content FROM messages
     WHERE conversation_id = $1
     ORDER BY created_at DESC, id DESC LIMIT $2`,
    [convId, limit]
  );
  return rows.reverse();
}

// Plus: cleanup jobs, error handling, retries,
// connection health checks, migration runner...
```

With DialogueDB (3 calls, complete)

persistence.ts

TypeScript

```
import { DialogueDB } from "dialogue-db";

const db = new DialogueDB({
  apiKey: process.env.DIALOGUE_DB_API_KEY,
});

const dialogue = await db.getOrCreateDialogue({
  id: sessionId,
  namespace: tenantId,
});

const history = await dialogue.loadMessages({ limit: 50 });
await dialogue.saveMessage({ role: "user", content: question });
```

Three API calls replace the schema, the connection pool, the migration files, the cleanup jobs, and the tenant isolation logic. The conversation data is also [searchable across sessions](https://docs.dialoguedb.com/sdk/overview.html), which matters when agents need to reference past interactions.

## Getting Started with MCP Conversation Persistence

Servers built against the [current spec](https://modelcontextprotocol.io/specification/2025-03-26) continue to work; the transition supports both protocol versions, so existing servers won’t break when the [spec finalizes on July 28](https://blog.modelcontextprotocol.io/posts/2026-07-28-release-candidate/). But if you’re adopting the new spec or building new servers, conversation persistence is worth setting up now. Install the SDK, grab an API key from the [DialogueDB dashboard](https://app.dialoguedb.com), and add the lines above to your MCP server. The entire integration takes about five minutes.

For the full setup, start with the [quickstart guide](https://docs.dialoguedb.com/quickstart). For a broader look at conversation persistence options across frameworks, see [conversation persistence in TypeScript agent frameworks](https://dialoguedb.com/blog/conversation-persistence-typescript-agent-frameworks).

Your server’s persistence layer shouldn’t be the hard part.

## Frequently Asked Questions

What will change in the MCP July 28, 2026 release candidate?

The MCP July 28, 2026 spec will remove the protocol-level session, and the release candidate is already available for validation. Currently, MCP servers can rely on the transport layer to carry session context between tool calls. After this change, servers will use an explicit session handle passed as a tool argument and an external store to persist and retrieve context on each call. Multi-turn conversation history, user preferences, and tool call chains will be managed through this handle-plus-store pattern rather than in-memory server state.

How do I persist conversation history in a stateless MCP server?

To persist conversation history in a stateless MCP server, you need an external storage layer that saves and retrieves messages between tool calls. Options include the filesystem for simple single-user setups, Redis for fast key-value storage, PostgreSQL with a custom schema for durable storage, or a managed conversation database like DialogueDB that provides ordered message storage, multi-tenant isolation, and retrieval through a simple API without requiring schema design or infrastructure management.

Can I still use stateful MCP servers?

The new MCP spec removes the protocol-level session entirely; it is not an opt-in/opt-out toggle. Servers can no longer rely on the transport to carry state between calls, though servers built against the current spec keep working during the transition. However, you can still maintain conversational context by passing an explicit session handle as a tool argument and using a durable store to persist and retrieve state on each call. The MCP ecosystem is moving toward this stateless-plus-explicit-handle pattern, and new tooling and tutorials will increasingly assume it.

What's the difference between session caching and conversation persistence?

Session caching stores temporary working state in memory (like Redis used as a cache or in-process state) for the duration of a single session, and that state is treated as disposable. Conversation persistence durably stores the full message history in a database so it survives server restarts, scales across instances, and remains queryable across sessions. For stateless MCP servers, session caching alone is insufficient because there is no persistent session; each request is independent, so durable conversation persistence is required to maintain continuity.

When does the MCP stateless change take effect?

The MCP stateless change takes effect when the spec finalizes on July 28, 2026; the release candidate is available now for validation. This release removes protocol-level sessions entirely, so servers are stateless at the protocol layer rather than as a toggle you can opt out of. The transition began with the March 26, 2025 specification revision, which introduced the Streamable HTTP transport and began moving away from persistent connections. Each subsequent draft moved further toward protocol-layer statelessness.

### Ready to Build Better Conversations?

Get started with DialogueDB in minutes. Free tier included.

[Get Your API Key](https://app.dialoguedb.com/signup)

### Share

[](https://x.com/intent/tweet?url=https%3A%2F%2Fdialoguedb.com%2Fblog%2Fmcp-stateless-conversation-persistence&text=MCP%20Is%20Going%20Stateless%3A%20How%20to%20Handle%20Conversation%20Persistence) [](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fdialoguedb.com%2Fblog%2Fmcp-stateless-conversation-persistence) [](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fdialoguedb.com%2Fblog%2Fmcp-stateless-conversation-persistence)

MCP Conversation Persistence AI Agents TypeScript

### Latest Posts

- [Multi-Tenant Conversation Isolation with Postgres RLS and pgvector](https://dialoguedb.com/blog/postgres-rls-pgvector-multi-tenant-isolation)
- [Add Durable Session Storage to the OpenAI Agents SDK](https://dialoguedb.com/blog/durable-session-storage-openai-agents-sdk)
- [Add Persistent Chat History to the Vercel AI SDK](https://dialoguedb.com/blog/add-persistent-chat-history-vercel-ai-sdk)

[ Previous](https://dialoguedb.com/blog/add-persistent-chat-history-vercel-ai-sdk) [Next](https://dialoguedb.com/blog/multi-agent-memory-architecture)
