How to Keep Sensitive Data Out of an MCP Server’s Model Context
When you build a server with the Model Context Protocol (MCP), your tools let a model pull data from services like databases…
When a tool from a Model Context Protocol (MCP) server returns data to Claude Code, you might want to see less tool activity on screen, keep less data in the conversation, or both. You need different controls for those goals. Transcript views change how much tool activity Claude Code displays, while MAX_MCP_OUTPUT_TOKENS controls when Claude Code moves certain large results out of the conversation. Neither control summarizes every result.
To cut down on visual clutter, switch Claude Code Desktop to Normal transcript view. To get smaller results in the first place, ask the MCP tool to return only the data you need or to paginate its response. If you lower MAX_MCP_OUTPUT_TOKENS, Claude Code switches eligible oversized results to a file reference sooner, without shortening the underlying data.
In Claude Code Desktop’s Code tab, Normal view collapses tool calls into summaries while keeping full text responses in the transcript. You can select Normal under the session menu’s Transcript view option, or press Ctrl+O on macOS or Windows to cycle through the view modes.
Verbose view shows every tool call, file read, and intermediate step, which helps when you want to see why Claude took a particular action. Thinking view collapses tool calls into summaries while also displaying Claude’s thinking. Current Desktop documentation lists Normal, Thinking, and Verbose; Desktop versions before 1.46388.1 also included a Summary view. Claude Code Desktop documentation
Claude Code’s terminal command-line interface (CLI) uses Ctrl+O differently. Pressing it opens or toggles a detailed transcript viewer that expands summarized entries, such as an MCP call shown as “Called slack 3 times.” You can open this viewer when you want to inspect tool activity in detail, rather than to hide it. In the classic terminal renderer, Ctrl+E toggles whether all content appears, though that shortcut is unavailable in fullscreen rendering. Claude Code interactive mode documentation
When Claude Code collapses a transcript entry, it only changes what you see on screen. That visual collapse does not mean Claude Code shortened the tool result or removed it from the conversation context.
Claude Code documents a default maximum of 25,000 tokens for some MCP tool results, along with a separate 10,000-token warning threshold. When a tool returns a successful result with no image content that exceeds the applicable maximum, Claude Code saves the result in the session’s tool-results directory and replaces it in the conversation with a file reference. Claude can read that file when it needs the data. This rule applies to tools that do not set their own limit for text results. MCP output limit documentation
To change that maximum, set the MAX_MCP_OUTPUT_TOKENS environment variable before you launch Claude Code.
claude
If you set a lower value, Claude Code replaces eligible results with file references at a lower token count. If you set a higher value, Claude Code keeps larger results in the conversation longer before replacing them. The setting does not change the fixed 10,000-token warning threshold, and it does not make a result any more concise.
The MCP documentation also describes an independent rule for unannotated text. Successful text results longer than 50,000 characters are saved to disk regardless of token count. Even if you change MAX_MCP_OUTPUT_TOKENS, that character threshold stays the same. The token maximum, warning threshold, and character threshold each govern different behavior.
If you want Claude to receive a shorter result instead of a file reference, change what the MCP tool returns. Ask the server to filter for relevant fields, provide a concise summary, or return results in pages. Anthropic recommends reducing the data in HTTP or SSE responses, including by paginating large results. MCP output guidance
When the server returns less data, it shrinks the payload itself. By contrast, a transcript view only changes what appears on screen, and MAX_MCP_OUTPUT_TOKENS only controls when Claude Code moves an eligible oversized result to a file reference. For broader strategies to cut down on context use, see how to reduce Claude Code token usage.
MCP server authors also have a separate option. A tool can declare _meta["anthropic/maxResultSizeChars"] in its tools/list entry, up to a documented ceiling of 500,000 characters. That annotation raises the character allowance for the tool’s text content, so it does not hide or shorten output. Image content still remains subject to the token limit.
Switch to Normal view when the transcript looks noisy and you still want full text responses visible. Open the CLI transcript viewer or switch Desktop to Verbose when you need to investigate tool activity. Lower MAX_MCP_OUTPUT_TOKENS when you want Claude Code to turn eligible oversized results into file references sooner. Ask the MCP server to filter, summarize, or paginate when you need the returned data itself to be smaller.
Give Vroni a GitHub issue, bug report, spec, or rough idea. It reads the repo, plans the change, writes code, runs checks, and works toward a review-ready pull request.
Take a look at vroni.com