# How Claude Manages Multi-Turn Conversation State in MCP Flows

> Discover how Claude handles multi-turn conversation state in MCP flows. Learn that Claude is stateless and requires clients to send full conversation history for context management. Get insights into system prompt leaks.

- Repository: [Ásgeir Thor Johnson/system_prompts_leaks](https://github.com/asgeirtj/system_prompts_leaks)
- Tags: internals
- Published: 2026-02-16

---

**Claude is a stateless LLM that requires clients to send the complete conversation history with every API request to maintain context across multi-turn MCP flows.**

The `asgeirtj/system_prompts_leaks` repository reveals the internal architecture behind Claude's approach to Model Context Protocol (MCP) integrations. Unlike stateful systems that retain server-side memory, Claude multi-turn conversation state in MCP flows depends entirely on explicit client-side history management.

## The Stateless Architecture Behind Claude

Claude does not retain any memory between API completions. According to the system prompts in [`Anthropic/claude-opus-4.6.md`](https://github.com/asgeirtj/system_prompts_leaks/blob/main/Anthropic/claude-opus-4.6.md), the model explicitly operates under this constraint:

> "Claude has no memory between completions. **Always include all relevant state in each request**" — lines 27-28

For MCP integrations specifically, the requirements are even more explicit:

> "For **MCP or multi-turn flows, send the full conversation history each time**" — lines 30-31

This architectural decision means that every interaction with Claude through MCP tools requires the client to reconstruct the entire dialogue context, including any previous tool results or external data fetched from services like Slack, Gmail, or Asana.

## Implementing MCP Flows: The Five-Step State Management Pattern

To maintain coherent Claude multi-turn conversation state in MCP flows, implement the following pattern:

1. **Gather the full history** — Retrieve every previous message (both user and assistant) belonging to the current session from your database or in-memory cache.

2. **Serialize the history into the `messages` array** — Format each entry following the OpenAI-style structure `{role: "user"|"assistant", content: "<text>"}`.

3. **Append the new user message** — Add the fresh turn as the last element of the array.

4. **Send the complete array in the API payload** — The server receives the whole dialogue and can reason over past context, including data returned from prior MCP tool calls.

5. **Process MCP tool results** — When Claude invokes an MCP tool, the response contains structured blocks (`type: "mcp_tool_result"`). Parse these blocks and add the extracted information back into the conversation history for the next turn.

## Code Example: Building Conversation History for MCP Requests

The following JavaScript implementation demonstrates the exact pattern prescribed in the system prompts:

```javascript
// 1️⃣ Retrieve stored history for the session (e.g., from a DB or in-memory cache)
const history = [
  { role: "user",      content: "Hello" },
  { role: "assistant", content: "Hi! How can I help?" },
  { role: "user",      content: "Create a task in Asana" }
];

// 2️⃣ New user turn
const newMsg = { role: "user", content: "Use the Engineering workspace" };

// 3️⃣ Build the full messages payload
const messages = [...history, newMsg];

// 4️⃣ Send to Claude (using the official endpoint)
await fetch("https://api.anthropic.com/v1/messages", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    // Authorization handled by the platform – no secret shown here
  },
  body: JSON.stringify({
    model: "claude-sonnet-4-20250514",
    max_tokens: 1000,
    messages,
    // If MCP tools are needed:
    mcp_servers: [{ type: "url", url: "https://mcp.slack.com/mcp", name: "slack-mcp" }]
  })
});

```

This pattern (`messages: [...history, newMsg]`) directly implements the system prompt requirement to include the entire conversation history for each request.

## Handling MCP Tool Results in Multi-Turn Flows

When Claude invokes an MCP tool during a conversation, the response includes structured result blocks that must be parsed and preserved for subsequent turns:

```javascript
function extractMcpResults(response) {
  // response.content is an array of blocks
  const toolResults = response.content
    .filter(b => b.type === "mcp_tool_result")
    .map(b => b.content?.[0]?.text ?? "");

  // Concatenate or further process as needed
  return toolResults.join("\n");
}

// Example use after a Claude call
const data = await claudeResponse.json();
const mcpData = extractMcpResults(data);
// Add the extracted data to the next turn's history if required
history.push({ role: "assistant", content: mcpData });

```

This handling follows the guidance in [`Anthropic/claude-opus-4.6.md`](https://github.com/asgeirtj/system_prompts_leaks/blob/main/Anthropic/claude-opus-4.6.md) lines 595-599 regarding MCP tool use responses.

## Why Full History Matters for MCP Integrations

MCP tools interact with external stateful systems such as Slack workspaces, Gmail inboxes, or Asana projects. The data they return becomes part of the dialogue context. Without resending this information, Claude loses the connection between tool results and subsequent user instructions.

By always forwarding the complete message list, Claude can:

* **Reference earlier tool outputs** — Including `mcp_tool_result` blocks from previous API calls.
* **Track stateful information** — Such as which browser tab group is open, which document was fetched, or which workspace is active.
* **Produce coherent multi-step instructions** — Building on prior actions to complete complex workflows across multiple turns.

## Key Source Files in system_prompts_leaks

The following files in the `asgeirtj/system_prompts_leaks` repository contain the definitive implementation details:

| File | Significance |
|------|--------------|
| [`Anthropic/claude-opus-4.6.md`](https://github.com/asgeirtj/system_prompts_leaks/blob/main/Anthropic/claude-opus-4.6.md) | Contains the definitive system-prompt rules for conversation management, context windows, and MCP handling (lines 27-31, 595-599). |
| [`Anthropic/claude-4.5-sonnet.md`](https://github.com/asgeirtj/system_prompts_leaks/blob/main/Anthropic/claude-4.5-sonnet.md) | Older version confirming the same requirement to include the entire conversation history for each API call (lines 680-710). |
| [`Anthropic/claude-code.md`](https://github.com/asgeirtj/system_prompts_leaks/blob/main/Anthropic/claude-code.md) | Mentions the preference for MCP-provided web-fetch tools and reinforces state handling requirements. |
| [`Misc/Fellou-browser.md`](https://github.com/asgeirtj/system_prompts_leaks/blob/main/Misc/Fellou-browser.md) | Lists MCP agents needed for multi-turn tasks, illustrating real-world MCP usage patterns. |

These files can be inspected directly on GitHub:

* [[`claude-opus-4.6.md`](https://github.com/asgeirtj/system_prompts_leaks/blob/main/claude-opus-4.6.md)](https://github.com/asgeirtj/system_prompts_leaks/blob/main/Anthropic/claude-opus-4.6.md)
* [[`claude-4.5-sonnet.md`](https://github.com/asgeirtj/system_prompts_leaks/blob/main/claude-4.5-sonnet.md)](https://github.com/asgeirtj/system_prompts_leaks/blob/main/Anthropic/old/claude-4.5-sonnet.md)

## Summary

* Claude is **stateless** and retains no memory between API calls.
* **Client-side history management** is mandatory — the complete conversation must be sent with every request.
* The `messages` array must include all previous turns plus any **MCP tool results** to maintain context across multi-turn flows.
* Implementation requires parsing `mcp_tool_result` blocks and appending them to subsequent request payloads.
* Source files in `asgeirtj/system_prompts_leaks` confirm these patterns are enforced by system prompts in [`Anthropic/claude-opus-4.6.md`](https://github.com/asgeirtj/system_prompts_leaks/blob/main/Anthropic/claude-opus-4.6.md).

## Frequently Asked Questions

### Does Claude store conversation history server-side for MCP flows?

No. According to the system prompts in [`Anthropic/claude-opus-4.6.md`](https://github.com/asgeirtj/system_prompts_leaks/blob/main/Anthropic/claude-opus-4.6.md), Claude has no memory between completions. The client must explicitly supply the entire conversation history with each API request, including any previous MCP tool results, to maintain continuity across multi-turn interactions.

### What happens if I don't send the full conversation history in an MCP request?

If the full history is omitted, Claude loses access to previous context, including earlier MCP tool outputs and user instructions. This breaks the logical flow of multi-turn tasks — for example, Claude would not know which Asana workspace was previously selected or what data was retrieved from Slack in the previous turn.

### How should MCP tool results be formatted when adding them to conversation history?

MCP tool results appear as structured blocks with `type: "mcp_tool_result"` in the API response. Extract the text content from these blocks and append them to the `messages` array with `role: "assistant"` (or as part of the assistant's content) before sending the next user turn. This ensures the tool output is available as context for subsequent reasoning.

### Which Claude models require full history management for MCP?

All Claude models follow the same stateless architecture. The system prompts in both [`Anthropic/claude-opus-4.6.md`](https://github.com/asgeirtj/system_prompts_leaks/blob/main/Anthropic/claude-opus-4.6.md) and the older [`Anthropic/claude-4.5-sonnet.md`](https://github.com/asgeirtj/system_prompts_leaks/blob/main/Anthropic/claude-4.5-sonnet.md) (lines 680-710) enforce the requirement to send the full conversation history for each API call when using MCP tools or conducting multi-turn conversations.