Skip to content

Connect an agent

Give an AI agent the forge's tools through the Model Context Protocol, as you or as an agent with its own identity, its own limits and its own record.

af mcp is a Model Context Protocol server. An agent that speaks MCP runs it, and gets the forge’s tools: a workspace of its own, changes, history, search, keys and the rest, each answering with structured data rather than text to parse. The agent never needs a shell to drive af.

As yourself

The quickest start runs af mcp with your own sign-in, so the agent acts as you. Add it to your agent’s MCP configuration; most clients take a server as a command and its arguments:

{
  "mcpServers": {
    "atoll-forge": {
      "command": "af",
      "args": ["mcp", "/home/you/agent-workspace"]
    }
  }
}

The directory is the agent’s workspace: af mcp creates it if it is missing, and keeps the files the agent works on in its files subdirectory. Every change the agent writes is then yours, as if you had typed it.

As an agent of its own

An agent that acts as you is hard to tell apart from you in the record. Give it an identity of its own instead: it is born from you, with no more roles, folders or keys than you have, and every change it writes names it and its line back to you. See People and agents.

The agent makes its own key, which never leaves its machine:

$ af-server --dev
...
$ source ~/af-dev/dev/env
$ af --credential ~/agent.key key
1f5c3ca8c34002fee37f6db5f392b7dca3e0811df82d0d4a55be3f7a24065b70

Its parent, you or another agent, starts it with the start_agent tool, giving that public key, what the agent is, and any limits: fewer folders, fewer roles, fewer keys. To start it as one of the organization’s agent kinds, name the kind: what you leave out is taken from the kind, and the forge refuses what is outside it. The tool answers with the agent’s ID. The agent then runs af mcp with its own key and that ID:

{
  "mcpServers": {
    "atoll-forge": {
      "command": "af",
      "args": ["--credential", "/home/you/agent.key", "--actor", "<AGENT_ID>", "mcp", "/home/you/agent-workspace"]
    }
  }
}

A birth expires with its parent, and stopping an agent with af stop stops every agent born from it.

How an agent works

A typical session uses a handful of tools:

  1. open_workspace with the paths the agent needs, such as ["src/**"]. The files are written to disk, where the agent edits them with its own file tools.
  2. start_change with a description. Every edit from then on belongs to the change; there is nothing to stage.
  3. status and diff to see the change, and log, search and read to look around the repository, including files outside its workspace.
  4. submit, then wait, which returns when something needs the agent: the change landed, a check failed, it met a conflict, the scan flagged it, or a person approved it. Its answer says what to do next.
  5. undo when a step went wrong: it takes back the agent’s last operation, and the workspace’s files follow; redo puts it forward again. An agent that may retry a call passes its own request_key, the same on every retry, so a retry is answered as the first call was and never takes back a second operation. An undo never overwrites anyone’s later work: see Undo a mistake.

Every tool reads and writes only what the agent may: a folder it may not read is as if it were not there, and a write to one is refused.

Next

Type to search…

↑↓ navigate↵ selectEsc close