8 мин чтенияИзменить на GitHub

Эта страница ещё не переведена. Текст ниже на английском языке.

AI agents

Home · Preferences · Configuration reference · CLI and diagnostics · FAQ

Tessera has a built-in Model Context Protocol (MCP) server. It lets an AI agent that you configure inspect your windows and, only if you allow it, arrange them. It is off by default.

Where it exists

System AI agents
Linux Linux ships both the server and the tessera mcp bridge. Under XFCE on X11, it passed a smoke test on a virtual screen. Under KWin, no MCP session ran yet, so KWin is not verified.
macOS The server and the bridge use the same kind of local socket ($TMPDIR/tessera/mcp.sock). Automated tests cover them, though they have not run against the app on a real Mac.
Windows No. Tessera creates no socket, and Preferences has no AI agents page. tessera mcp refuses with “the MCP bridge is not available on this operating system yet”.

Turn it on

In Preferences > AI agents, enable Allow AI agents to connect (help text: “Off by default. Only agents you set up yourself can connect.”), or set the keys below in tessera.yml. The status line under the switch says “The MCP server is running” or “The MCP server could not start”.

mcp-enabled: true        # the server accepts AI agents (default: false)
mcp-mode: read-only      # read-only (default) or control
mcp-allowed-tools: []    # exact tool names (or resource URIs) to expose; empty means all the mode allows

What agents can do

What agents can do has two modes:

  • Read only (default): exposes only the 7 read-only tools and permitted read-only resources.
  • Control: exposes the 17 control tools as well. These tools select and cycle layouts, resize the main pane, and move, focus, swap, float, and pin windows. They also send windows to workspaces or monitors and enable or disable organization.

Use Control only with agents you trust. The mode row appears only while the switch is on, and Tessera keeps the saved mode when you disable the switch.

Allowed tools (mcp-allowed-tools) narrows the list. Every tool the mode allows uses the empty list ([]). Only the ones I choose shows one box per tool, separating Read tools from Control tools. The list can never enable a tool the mode forbids. Preferences refuses unticking the last box because an empty list means every tool: disable agents with the switch instead.

Privacy: Tessera never sends window titles to agents. Agents identify windows by id, class, and instance. Tessera replaces title patterns in rules (window_titles / window-titles) with <redacted>.

Tools (24)

Every tool uses a closed JSON schema (additionalProperties: false). Tessera rejects unknown or missing arguments before they reach the daemon.

Read-only tools (7)

Available in both read-only and control modes. All 7 are idempotent and take no arguments.

Tool Description
get_tiling_state Current layout (the custom layout key while one is active), main pane ratio and count, tiling flag, and scope.
list_windows Managed windows with IDs, output, workspace, and frame. Titles are never exposed.
list_workspaces Workspaces known to the backend.
list_outputs Connected outputs with their IDs and geometry.
get_active_window The focused window, or null.
get_capabilities What the running backend can observe and apply (including custom_layouts).
get_reconciliation Whether observed window frames match what Tessera asked for.

Control tools (17)

Available only when you set mcp-mode: control.

Tool Arguments Idempotent Description
select_layout layout (enum: tall, tall-right, wide, two-pane, two-pane-right, 3column-left, middle-wide, 3column-right, 4column-left, 4column-right, fullscreen, column, row, floating, widescreen-tall, widescreen-tall-right, bsp, grid) Yes Select a built-in layout by key.
select_custom_layout key (string, 1–255 bytes, script filename without .js) Yes Select a custom JavaScript layout from custom_layouts in get_capabilities.
cycle_layout forward (optional boolean) No Advance to the next (default) or previous configured layout.
set_main_ratio ratio (number, 0.05–0.95) Yes Set the main pane ratio.
adjust_main_pane direction ("expand" | "shrink") No Grow or shrink the main pane by the configured step.
focus_direction direction ("up" | "down" | "left" | "right" | "clockwise" | "counter_clockwise") No Move focus to the neighbouring window in a direction.
swap_direction direction ("up" | "down" | "left" | "right" | "clockwise" | "counter_clockwise") No Swap the focused window with its neighbour in a direction.
focus_main — Yes Focus the main pane.
swap_main — No Swap the focused window with the main pane, or back.
swap_windows left (integer window ID ≥ 0), right (integer window ID ≥ 0) No Swap two windows by ID.
move_window_to_output window (integer window ID ≥ 0), output (integer output ID ≥ 0) Yes Move a window to an output.
throw_focused_to_workspace workspace ("left" | "right" | integer ≥ 0) No Throw the focused window to a workspace: left, right, or a zero-based index.
set_tiling enabled (boolean) Yes Enable or disable tiling globally.
focus_window window (integer window ID ≥ 0) Yes Focus one window by ID.
set_window_floating window (integer window ID ≥ 0), floating (boolean) Yes Set one window’s floating state.
set_window_sticky window (integer window ID ≥ 0), sticky (boolean) Yes Set one window’s sticky state (shown on all workspaces).
move_window_to_workspace window (integer window ID ≥ 0), workspace (integer ≥ 0) Yes Move one window to a workspace by zero-based index.

Resources (3)

The server exposes three read-only session resources:

URI Name Allow-list grant Description
tessera://session/state state get_tiling_state Layout, main pane, tiling flag, and counts of the live session.
tessera://session/rules rules tessera://session/rules Floating and workspace rules. Tessera redacts window title patterns to <redacted>.
tessera://config/current config tessera://config/current The typed preferences currently in effect (title patterns redacted).

When mcp-allowed-tools is non-empty, Tessera grants tessera://session/state whenever you allow get_tiling_state. Both tessera://session/rules and tessera://config/current require their own URI in mcp-allowed-tools.

The server also carries three read-only skills (tessera-layout-authoring, tessera-rules-and-troubleshooting, tessera-window-management) that an agent can read as documentation.

Connect an agent

In your MCP client configuration, add Tessera as a stdio server running tessera mcp (Preferences has a Copy button for the command):

{
  "mcpServers": {
    "tessera": {
      "command": "tessera",
      "args": ["mcp"]
    }
  }
}

On macOS, the app bundle does not place tessera on PATH. Use the full binary path instead:

{
  "mcpServers": {
    "tessera": {
      "command": "/Applications/Tessera.app/Contents/MacOS/tessera",
      "args": ["mcp"]
    }
  }
}

tessera mcp opens no window. It relays stdin and stdout to the running controller’s local Unix socket, so the controller must already be running.

tessera mcp stops with a diagnostic message when:

Reason Message
MCP is off the MCP server is turned off; set mcp-enabled: true in the configuration
The session has no backend that serves MCP the MCP server needs an active window-manager backend that serves this session
The system has no bridge the MCP bridge is not available on this operating system yet
The controller is not running, or its listener did not start the Tessera daemon is not running or its MCP listener did not start, so there is nothing to connect to
The controller closed the connection without answering (for example, all 4 slots are busy) the Tessera daemon closed the connection without answering; it may already serve its maximum number of MCP agents
The socket or its folder is not private to you the Tessera MCP socket is not trusted: its folder or the socket is not private to your user (owner or permissions), or another user's process answered; nothing was relayed

Limits and outcomes

Connection and rate limits

  • Concurrency: at most 4 agents may be connected at once. When all slots are full, Tessera can evict an idle connection once it passes the idle floor. Otherwise, Tessera refuses new connections.
  • Per-connection token buckets:
    • Reads: burst of 30, refilling at 30 reads per second.
    • Control mutations: burst of 10, refilling at 5 mutations per second.
  • Listener-wide ceiling: 2× a single connection’s budget shared across all connections. This ceiling persists across reconnects so one agent cannot starve others or bypass limits.
  • Notifications and live policy updates: when the number of connected agents changes, Tessera shows "AI agents connected: N" (at most once every 5 seconds). Changing mcp-enabled, mcp-mode, or mcp-allowed-tools applies immediately to already-connected agents. Tessera does not apply any queued mutation after revoking its permission.

Outcome codes

A mutation counts as applied only when Tessera observes the effect in the backend (up to a 2000 ms confirmation deadline). Every mutation returns an outcome:

Outcome Fields Meaning
confirmed basis: "backend" The backend snapshot confirmed the requested state change.
no_change — The session already satisfied the requested state.
rejected code, optional detail Refused before attempting any change.
unsupported facet The active backend lacks the requested capability.
unconfirmed reason ("timeout" | "divergence" | "connection_closed") The request reached the backend, but Tessera could not confirm it. Read the state before retrying.

When outcome is rejected, code is one of:

  • Policy / throttling / daemon state: policy_denied, rate_limited, resync_required, busy (job queue full, answered immediately), unavailable (daemon shutting down or did not answer).
  • Arguments & targets: invalid_argument, unknown_window, unknown_output, no_active_window, no_tiled_windows, no_window_in_direction, invalid_main_pane_count, empty_configured_layouts, invalid_resize_step, invalid_screen_index, no_outputs, workspace_topology_unavailable, invalid_workspace.
  • Execution: layout (the layout refused the request), backend_failed (the backend refused or failed the request).

Security model

Read this before you turn on Control.

  • User-private Unix socket only: there is no network port. On Linux, the socket lives at $XDG_RUNTIME_DIR/tessera/mcp.sock (on macOS, $TMPDIR/tessera/mcp.sock). Tessera creates the parent directory with 0700 permissions owned by your user ID, and the socket with 0600 permissions. The tessera mcp bridge re-verifies directory ownership, 0700 mode, and socket ownership before connecting.
  • Peer UID verification (SO_PEERCRED): on every accepted connection, the daemon confirms the peer’s effective user ID. It uses SO_PEERCRED on Linux or equivalent peer credentials on macOS. The daemon drops any connection from another user immediately before it takes a connection slot.
  • Same-user trust boundary: any process running as your user can connect directly to the socket without going through tessera mcp. This matches the rest of Tessera’s local IPC: any process running as you can already drive your windows through the window manager.
  • Mode and allow-list enforcement: mcp-mode and mcp-allowed-tools restrict what connected agents can do, not who can connect. Only in control mode can a connected process change your desktop.
  • Audit logging: each tool call and resource read writes one audit line to the log recording the tool/resource, outcome, caller PID, and duration. It never logs tool arguments or window titles.

If another process running under your own user account is part of your threat model, leave MCP disabled or keep mcp-mode: read-only.