What CLAUDE_MCP_LENT_TO=cloud_session Means in Claude Code#
Published by Alex Sorokoletov
CLAUDE_MCP_LENT_TO=cloud_session is an environment variable Claude Code adds to a local MCP server's environment when it starts that server. You do not set it. Claude Code adds it only when the machine's stored login is pinned for remote tools, and a server that reads it can tell it is running for a cloud session rather than a direct local session. It arrived in v2.1.335, with no release-notes entry.[1]
Where you see it#
Claude Code adds CLAUDE_MCP_LENT_TO to the child-process environment of a stdio MCP server, the kind it launches as a local subprocess (a command/args entry in .mcp.json or settings). The server, and anything it logs, then sees CLAUDE_MCP_LENT_TO=cloud_session alongside the other variables Claude Code passes down, such as CLAUDE_PROJECT_DIR, CLAUDE_CODE_SESSION_ID and CLAUDECODE=1.
The in-process Chrome MCP server does not run as a separate process, so it does not go through this step.
When Claude Code sets it#
Claude Code adds the variable only when the stored login is pinned for remote tools. That state is read once per session: from CLAUDE_CODE_REMOTE_TOOLS_PIN_STORED_LOGIN=true the first time it is needed, then kept for the rest of the session. When the login is not pinned, Claude Code does not add the variable.
A cloud session here is a remote Claude Code session that runs tools through this machine. Pinning the stored login lets those remote tools reuse the login already on the machine, and CLAUDE_MCP_LENT_TO marks each local MCP server Claude Code starts in that state.
| Variable | What it means |
|---|---|
CLAUDE_MCP_LENT_TO | Claude Code sets this to cloud_session in a local stdio MCP server's environment when the machine's stored login is pinned for remote tools, so a server that reads it can tell it is running for a cloud session rather than a direct local session. Added in v2.1.335. |
The value is always the literal string cloud_session. It has no other values.
When it is removed#
Before Claude Code decides whether to add the variable, it strips any CLAUDE_MCP_LENT_TO already present in the environment it is building, matching the name without regard to case. So when the login is not pinned, a stale or inherited CLAUDE_MCP_LENT_TO from the parent shell does not pass through to the MCP server. The variable is present only when Claude Code itself adds it for a pinned remote-tools session.
How to read it in an MCP server#
A stdio MCP server can branch on the variable to change what it does for a cloud session:
if [ "$CLAUDE_MCP_LENT_TO" = "cloud_session" ]; then
echo "running for a cloud session"
fi
There is no setting to rename or suppress the variable on the client side. It follows the pinned-login state: pin the stored login and it is set, leave it unpinned and it is absent.
Timeline#
| Version | Published | Change |
|---|---|---|
| v2.1.334 | 2026-12-01 | No CLAUDE_MCP_LENT_TO. |
| v2.1.335 | 2026-12-02 | CLAUDE_MCP_LENT_TO=cloud_session is added to a stdio MCP server's environment for a pinned remote-tools session. The release notes do not mention it. |
Should you do anything about it#
No, for most setups. The variable is a read-only signal Claude Code passes to a local MCP server; it does not change how the server is launched or what it may do. Act on it only if you run your own MCP server and want it to behave differently for a cloud session, in which case read CLAUDE_MCP_LENT_TO as shown above. If you never pin the stored login for remote tools, you will not see it at all.
FAQ#
Q: What is CLAUDE_MCP_LENT_TO in Claude Code?
A: An environment variable Claude Code adds to a local stdio MCP server's environment when the machine's stored login is pinned for remote tools. Its only value is cloud_session. It tells a server that reads it that it is running for a cloud session rather than a direct local session.
Q: Why does my MCP server see CLAUDE_MCP_LENT_TO=cloud_session?
A: Claude Code added it because the stored login is pinned for remote tools, and it starts your stdio MCP server with that marker in its environment. It is expected, not an error.
Q: Do I set CLAUDE_MCP_LENT_TO myself?
A: No. Claude Code adds it, and it removes any inherited CLAUDE_MCP_LENT_TO from the parent environment first, so a value you set by hand does not pass through. It is present only when Claude Code adds it for a pinned remote-tools session.
Q: Which version added CLAUDE_MCP_LENT_TO?
A: v2.1.335, published December 2, 2026. It is not in v2.1.334, and the release notes do not mention it.
Q: How do I stop CLAUDE_MCP_LENT_TO from being set?
A: Do not pin the stored login for remote tools. The variable follows that state: without a pinned login (CLAUDE_CODE_REMOTE_TOOLS_PIN_STORED_LOGIN unset), Claude Code does not add it.
Sources: [1] Claude Code changelog
Related: CLAUDE_MCP_LENT_TO in the env-var glossary | CLAUDE_CODE_REMOTE_TOOLS_PIN_STORED_LOGIN in the env-var glossary | Claude Code v2.1.335 analysis