Try it: Claude Code drives a session
Claude Code runs on your machine, launches a Kasm session and uses the session’s browser through kcli’s MCP server. You see every call it makes in the sidebar’s Activity tab. No model runs in the session.
What you need
Section titled “What you need”- The Kasm toolkit installed and added to Claude Code. See Install the toolkit.
- A Chrome workspace with the runtime enabled. See Enable the runtime on a workspace.
1. Launch a session
Section titled “1. Launch a session”Start Claude Code and ask for a session by the workspace’s name as Kasm shows it, with the sidebar:
Launch a session on the Chrome workspace with the sidebar.Claude Code calls launch_session. kcli requests the session and opens it in your browser. When the call returns, the session’s methods are available to Claude Code as tools. The sidebar is off unless you ask for it.
To launch the session for another Kasm user, name them: Launch a session on Chrome for alice@example.com.
2. Check the connection
Section titled “2. Check the connection”Ask Claude Code to call dom.targets. The reply lists the session’s Chrome and its pages, each with a page reference.
3. Give it a task
Section titled “3. Give it a task”A task that needs only a browser and no model in the session:
Open https://example.com in the session's Chrome. Read the page heading,click the link on the page, and tell me which page you land on.The session starts on a blank tab, so opening the page is part of the task and Claude Code’s dom.navigate call is recorded like any other. The tools it reaches for:
| Method | Use |
|---|---|
dom.targets |
Find the application and the page to act on |
dom.navigate |
Open a URL and report where the page landed |
dom.query |
Check one element and read its text |
dom.list_interactive |
List the page’s buttons and links with a handle each |
dom.click |
Click one element by handle |
dom.wait |
Wait for a JavaScript condition, such as the address changing |
dom.url |
Read where the page is now |
A click returns as soon as it is delivered, before the next page has loaded. A run that clicks a link therefore waits with dom.wait before it reads dom.url. Web pages explains handles and what each result carries.
If Claude Code wants a look at the page, screen.capture returns a screenshot and needs no model. screen.judge, screen.ground and screen.ask need a vision endpoint or a signed-in Claude Code agent in the workspace; see Screen and input.
4. Watch the Activity tab
Section titled “4. Watch the Activity tab”The sidebar’s Activity tab, beside the desktop in the session’s browser tab, lists each call Claude Code makes with its result, as it happens. Anyone who opens the session later, while it is up, sees the run from the start.
5. End the session
Section titled “5. End the session”Ask Claude Code to end the session when you are done, whether the task succeeded or not. It calls end_session. A session left running keeps a container and a seat.
session_info shows the attached session, and connect_session with a session_id attaches Claude Code to a session launched earlier.
Without kcli
Section titled “Without kcli”An MCP client can also call a session’s runtime directly. Request the session through Kasm with KASM_RUNTIME_SESSION_TOKEN set in its environment to a value you choose, then register the session’s MCP route with two headers:
claude mcp add --transport http kasm-session "https://<host>/desktop/<kasm_id>/runtime/mcp" \ --header "X-Kasm-Runtime-Session-Token: <token>" \ --header "Cookie: session_token=<kasm login cookie>; username=<kasm username>"The registration then holds a Kasm login cookie. Remove it with claude mcp remove kasm-session when the session ends. Any MCP client that sends custom headers can use the same URL and headers. Your agent or script explains both credentials.