Skip to content

Connecting AI agents (MCP)

Let Claude Code, Codex or another MCP agent see the tray you're in, read the file you have open and open files for you, only after you allow it.

Worktray for Mac can connect to a local AI agent such as Claude Code or Codex through MCP, the Model Context Protocol. A connected agent can see the tray you’re in, read the file you have open, and open files there for you to look at.

Your tray’s files are ordinary files on disk, so an agent could already read and edit them without Worktray. Connecting adds what’s on your screen. That’s why nothing is shared until you say so.

Agents connect by running worktray mcp, which comes with the worktray command. If you installed the command before this feature arrived, install it again from the command palette (Cmd+K, then > Install the “worktray” command line tool) so it knows mcp.

Terminal window
claude mcp add --scope user worktray -- worktray mcp

--scope user makes Worktray available in every project. Leave it out to add it to the current project only.

Add this to ~/.codex/config.toml:

[mcp_servers.worktray]
command = "worktray"
args = ["mcp"]

Configure a local (stdio) MCP server whose command is worktray with the argument mcp. If Worktray isn’t running when the agent starts, it opens in the background.

The first time an agent needs anything, a card appears at the top right of Worktray: “Claude Code wants to see your tray”, with what it will be able to do. The agent waits for your answer.

  • Allow for this session lets it see the tray you’re in now, for as long as that agent session stays connected. A new session asks again.
  • Deny refuses it, and that session won’t ask again.
  • If you don’t answer within about two minutes, the agent is told you didn’t allow it, and it can ask again.

There’s no “always allow”. The agent reports its own name, and Worktray can’t check it, so the card says the name is as reported.

  • A violet strip across the top of every window shows which agent is viewing, with a Stop button.
  • The window has a violet frame. It pulses when the agent reads something, and a short note says what it read.
  • Tabs the agent opened carry its icon.
  • In the tray picker, the tray’s card has a chip such as “Claude Code connected”.
Tool What it does
list_files Lists the tray’s files, or one folder of them.
get_active_file Reads the file you have open, including edits you haven’t saved yet.
open_file Opens a file in the tray, on its view or edit tab.

It can’t see your other trays, not even their names, and it can’t write files through Worktray. When it edits files on disk directly, Worktray shows those edits as outside changes, as it always does.

Switch to a different tray and the agent loses access: the frame goes away, the strip turns grey (“· other tray”), and its requests are refused until you switch back. The agent can’t move you between trays.

Stop disconnects the agent at once. If it asks again, you get a new card.

Open Preferences from the rail and turn off Enable MCP under Agents. Connected agents are disconnected, and new ones are refused without a card.

worktray mcp talks to the running app over a local socket that only your user account can open. There’s no network port, and nothing leaves your Mac.