Agents and MCP
Connect Claude Code, Cursor, Codex or any MCP client to Perafly, choose what an agent may do, and approve the changes that matter.
On this page
Ways to connect
Set up your agent
perafly setup agent finds Claude Code, Cursor and Codex on your machine, writes their MCP configuration and installs the perafly skill, which tells the agent how to work with Perafly safely. Sign in first.
perafly mcp install takes the same flags and writes only the MCP configuration. Claude Code is configured with claude mcp add, Cursor in ~/.cursor/mcp.json (or .cursor/mcp.json with --scope project) and Codex in ~/.codex/config.toml. To configure a client by hand, this is the server entry:
The credential is never written into these files: the local server and the bridge use your CLI sign-in, and the client handles OAuth itself.
MCP tools
The tools are generated from the open API and carry its operation names, such as listProjects or promoteProjectVersion. A credential only sees the operations its permissions allow. Three tools are added:
The local server only reads inside its workspace root (--workspace-root, PERAFLY_MCP_WORKSPACE_ROOT, the root the client reports, or the folder it started in). Paths outside it, symbolic links and credential-like files are refused, and files that are never published stay out.
Hosted MCP and OAuth
The hosted server at https://mcp.perafly.com speaks Streamable HTTP and answers in JSON. A request without credentials gets 401 with a WWW-Authenticate header that points to the protected resource metadata, so MCP clients start OAuth on their own.
- OAuth 2.1 with PKCE (
S256) and dynamic client registration; public clients only. - You approve the app on perafly.com: pick the team and the profile,
agentorread. The full profile is never given over OAuth. - Access tokens (
pfo_…) last one hour; refresh tokens (pfr_…) last 30 days and change on every use. - An access token can call the open API too, with the connection's profile and your current role.
API keys and profiles
Every credential acts for a person in a team and can never do more than that person's role allows. If the person leaves the team or their role changes, the key follows.
Profiles
Choose the profile with perafly login --access full|agent|read; with PERAFLY_AGENT=1 the CLI asks for agent. On the approval page you can narrow the profile and pick the team, never widen it.
Approvals
When a credential with the agent profile tries to change what's live, a teammate has to approve it first. New projects and previews never wait. A person's dashboard session, a full CLI sign-in and the key of a project published without an account don't wait either.
Teammates who can approve get a notification in the dashboard and on mobile. The request lasts 10 minutes; a declined or expired request can't be reused, and asking again for the same action returns the pending one. After approval, continue the action instead of starting it again:
The CLI waits for the decision by itself; with --no-wait it exits with approval_required and the execution id. A team owner or admin can turn approvals off on the Agents page ("Approval for live changes").
Handoff links
A handoff link gives a local agent an agent-profile key for one project, without your own sign-in on that machine. Create it on the Agents page; it works once and lasts 15 minutes. Pass it on stdin, never as an argument:
The key is stored in .perafly/state.json of that folder, lasts 30 days and lapses after 7 days without use.
Revoke access
The Agents page lists connected apps, agent sign-ins and agent keys; revoke them one by one or all at once with "Stop all agent access". That revokes every OAuth connection, every agent-profile key and unused handoff links, and declines waiting approval requests. Full CLI sign-ins and API keys made in the dashboard stay.