ACP server

Run fx as an Agent Client Protocol (ACP) server to use the fx agent from compatible editors and clients.

Configure an ACP client

Start the server from the project that should be the primary workspace:

$cd /absolute/path/to/project && fx acp

Configure the client to launch the absolute binary path when possible:

{
  "command": "/absolute/path/to/fx",
  "args": ["acp"]
}

The client process working directory becomes the primary workspace. Launch a separate server process for each primary workspace.

fx acp accepts two options:

OptionBehavior
--model <id>Override the model for the server process, including loaded sessions.
--log-file <path>Write ACP diagnostics to an absolute file path.

Global workspace flags such as --add-dir, --no-additional-dirs, and --context-limit must appear before acp.

Authentication and fx settings

ACP uses the existing fx authentication and configuration. Complete Authentication before the client starts the server. Initialization fails when no usable AI Gateway credential is available.

The server uses the same settings, project instructions, skills, sessions, permissions, sandbox, and tools as interactive fx.

Supported ACP methods

The client must call initialize first. fx responds with ACP protocol version 1 and supports these methods:

MethodBehavior
initializeNegotiate protocol capabilities and initialize the connection.
session/newCreate and activate a saved session.
session/loadLoad an exact session ID and replay its history.
session/resumeReconnect to a saved session without replaying its history.
session/closeClose the active session.
session/listList sessions for the primary workspace.
session/promptRun one turn in the active session.
session/cancelCancel the active prompt.
session/set_config_optionChange the active model or mode.
session/set_modeChange the active mode.

Each connection has one active session and one active prompt.

Sessions, models, and permissions

New and loaded sessions expose model and mode selectors. Model changes are saved to the active session, while a process-level --model override takes precedence over the model stored in a loaded session.

ModePermission behavior
askRequest approval for unresolved sensitive tool calls.
codeAutomatically review unresolved sensitive tool calls.

Both modes expose the available runtime tools. Before the client selects a mode, fx uses the permission mode from the active configuration.

An Allow for this session approval remains active only for the current session. It is not written to settings or restored when the session is loaded again.

Prompt and MCP support

session/prompt accepts text and embedded resource blocks. ACP does not accept image or audio blocks; use interactive fx or fx ask --image for visual input.

Clients receive streamed user and agent messages, tool status updates, and permission requests.

ACP sessions use only the mcpServers supplied by the client. They do not inherit servers from ~/.fx/mcp.json; omitting mcpServers starts the session without MCP servers. Clients can provide stdio, HTTP, or SSE servers.

Protocol limits

ACP uses newline-delimited JSON-RPC 2.0 over stdin and stdout. Each input message is limited to 8 MiB.

Protect the protocol stream

Stdout is reserved for ACP messages. Write diagnostics to --log-file or FX_TRACE_LOG instead.