Latch / Docs
guides

Connect an agent

Hand a latch to Claude, Cursor, or any MCP client.

Connect generates everything an agent needs to use a latch, for the latch you select. You should never be pasting a token into a config file by hand.

What it gives you

  • MCP configuration for Claude Code, Claude Desktop, Cursor, and OpenClaw, with the file path each one wants.
  • Environment variables: LATCH_URL, LATCH_TOKEN.
  • An agent prompt describing what this specific latch can do: its methods, its endpoints, its rate limits, its mounts, its budget. Drop it into the agent's instructions and it will stop guessing.
  • A capability preview: what the agent will and will not be able to do.
  • A test console to exercise the latch before you hand it over.

The tools an agent gets

Over MCP, a Latch-connected agent has:

Tool What it does
latch_capabilities "What am I allowed to do?" Returns this latch's scope.
latch_authorize Checks policy and, when allowed, executes the request server-side without releasing the credential.
latch_proxy Makes a raw governed HTTP request.
latch_mcp_tools Initializes an OAuth-backed remote MCP session and returns its tool schemas.
latch_mcp_call Invokes a discovered remote MCP tool while retaining the session and keeping OAuth inside Latch.

latch_capabilities is the one that changes agent behaviour. An agent that can ask what it is permitted to do will stop attempting things it cannot do, which turns a wall of denials into a short list of options.

Without MCP

Any HTTP client works. Set the base URL to https://onlatch.com/proxy and the bearer token to the lat_… token. Most SDKs let you override the base URL, which is the entire integration:

client = OpenAI(
    api_key="lat_9f3c…",                 # the latch, not your OpenAI key
    base_url="https://onlatch.com/proxy",
)

The well-behaved agent never knows Latch is there. It just has less power than it thinks.

Add hardware identity to inference traffic

For an Anthropic Latch with an Identity filter, the Connect page also shows the two environment variables needed for inference identity. Install Latch for Mac v1.3.0 or newer first. It runs a signer on 127.0.0.1:8766; Claude sends the existing lat_... token on each loopback request, and the service neither stores the token nor passes it to another local process. The signer assigns the logical Claude Code agent a stable K_a, signs the exact request, and forwards it to onlatch.com/proxy. Users continue to start Claude with plain claude.

Native, npm/Node, and modified clients have the same default behavior. Executable/CDHash checks remain available only through the optional strict binary-verification mode. The one-off CLI launcher continues to support OpenAI-compatible clients when their command is supplied explicitly.

Projects connected before v1.3.0 require a one-time refresh. Return to the Latch's Connect → Claude Code page, rerun step 1's curl command to replace the locally saved /latch-setup-… file, and then run the refreshed slash command from step 2. Fully quit Claude Code and VS Code before reopening them so their existing MCP processes stop. The refreshed configuration uses remote-mcp-2 and the stable claude-code subject; merely rerunning an older saved slash command can reinstall remote-mcp-1 and retain the legacy executable-based K_a instead of sharing the inference signer's identity.

This is additive: MCP configuration does not change, and users can continue to use the direct base-URL/token flow above when hardware identity is not required.