Skip to content

Connecting an agent

Tandem runs a Model Context Protocol server on your PC. Any MCP client that supports the streamable HTTP transport can connect to it.

Address http://127.0.0.1:7440/mcp
Header Authorization: Bearer <token>
Token the contents of %LOCALAPPDATA%\SharedSSH\token

Tandem creates the token the first time it runs. It only works for the MCP server. The viewer uses a different one, which agents never get (see Security).

Claude Code

claude mcp add tandem --transport http http://127.0.0.1:7440/mcp --header "Authorization: Bearer <token>"

Or read the token straight from the file in PowerShell:

$t = Get-Content "$env:LOCALAPPDATA\SharedSSH\token"
claude mcp add tandem --transport http http://127.0.0.1:7440/mcp --header "Authorization: Bearer $t"

Other clients

Add Tandem as a remote (HTTP) MCP server using the address and header above. If a client can only start local stdio servers, you can put a bridge such as mcp-remote in between.

Tools

Tool What it does
host_list, host_add, host_remove, host_import_ssh_config Look at and change the saved hosts
session_create, session_list, session_kill Open, list and close sessions. Sessions an agent opens show up in your viewer like any other.
screen_read The current screen as plain text, with scrollback if asked for
run_command Runs a command and returns its output and exit code. It won’t run if the terminal isn’t sitting at a prompt.
send_input Sends keys as-is, for interactive programs and control keys
wait_for Waits until some output matches a pattern, or until the terminal has been quiet for a while
sftp_list, sftp_read, sftp_write Browse and transfer files over the session’s connection
sftp_mkdir, sftp_remove, sftp_rename Change files on the server

Session tools take the session’s id as sid. That’s the id session_create and session_list return.

Things agents can’t do

  • See password or 2FA prompts. Those only show up in the viewer.
  • See sessions marked private.
  • Accept a changed host key.
  • Change guardrail modes, approve their own requests, open the vault, or read recordings.

Watching

Leave the viewer open and you’ll see an agent’s session appear as soon as it opens one, with every command as it’s typed. You can type into it yourself at any point.

Next: Sessions