# Attach a local folder

> Let a remote Computer send agent commands to a folder on your local machine. Files sync both ways while you keep the attachment running.

Want a remote Agent to work in your local project folder? Attach that folder on
your laptop or server to one of your Team's Computers. The Computer's files and
the folder sync both ways. Agents and Apps allowed to run commands on that
Computer can run them on your machine, as your operating-system user, starting
in that folder. Commands routed through this attachment run locally, not on the
remote Computer. Use a folder and user account you trust with that access. You
need [Shiitake](/install/).

1. Open the Team's MCP connection settings in your Team dashboard and copy the
   MCP address from its `fungi login --fungi-mcp` command. Use that same address
   for login and folder attachment. Its path is `/api/teams/<team-id>/mcp`; the
   page supplies your Team host and ID.

   Illustrative: copy the full URL from your Team's MCP connection settings; the
   placeholders below stand for that Team's host and ID. This signs the CLI in
   to your Team in a browser.

   ```sh
   TEAM_MCP_URL='https://<team-host>/api/teams/<team-id>/mcp'
   fungi login --fungi-mcp "$TEAM_MCP_URL"
   ```

2. Attach a folder to a Computer, using the Computer's name.

   Illustrative: replace the Computer name, folder and Team ID with your own;
   copy `TEAM_MCP_URL` from the Team's MCP connection settings; the command
   keeps running while the folder is connected.

   ```sh
   fungi computer attach my-computer ~/projects/garden \
     --fungi-mcp "$TEAM_MCP_URL"
   ```

   Fungi shows what the Computer will be able to do on your machine and asks you
   to confirm. Pass `--host-label` to choose the name your Team sees for this
   machine.

3. Keep the command running. While it runs, the folder stays online. Press
   Ctrl-C to stop serving it; the attachment remains registered but offline. Run
   the same command again to reconnect, or detach it to remove access.

## How it behaves

- **Files sync both ways.** Before each command the Computer sends its changes
  to your folder, and afterwards it brings your folder's changes back.
- **The Computer wins.** When the folder reconnects, the Computer's version of a
  file replaces any change made to the same file while the folder was offline.
  Avoid editing an attached folder while it is disconnected.
- **Commands run as you.** A command routed to your machine starts in that
  folder with your operating-system user's access. The folder is not a security
  sandbox. Commands prefer an online attachment; when it is offline, they may
  run on the hosted Computer instead.
- **Attachment metadata omits your full path.** The attachment records the
  folder's name and your machine's label, not the full local path. Commands and
  their output can still reveal that path to the Agent or Team members who can
  see the run.
- **No Computer time is charged** for commands that run on your machine.

Only the member who attached a folder can detach it. Detach with
`fungi computer detach my-computer --fungi-mcp <address>` (replace the name and
address), or from the Computer's page in your Team. Fungi logout also attempts
detach before removing your saved login and device keys. If it cannot confirm
detach, it names the Computer: detach on its Hub page or press Ctrl-C in the
terminal running `fungi computer attach`. Ctrl-C leaves the registered
attachment offline; detach removes it. Local retries unfinished cleanup after
your next successful sign-in to the same account. See
[Local sign-out](/account/sign-in/#sign-out-of-local). Leaving the Team detaches
it too. `fungi computer status` lists your attached folders. If attach reports
an uncertain result, rerun the same command: it reuses the saved request. If the
CLI reports **offline**, check the connection and keep it running; it retries.
Detach rather than merely stopping the CLI when you want to revoke access.

Each attachment has its own device key. The private key stays on your machine;
the Hub keeps its public key. Treat the saved credentials as secrets. Browser
sign-out and revoking a Connected login do not detach a running backend: use the
detach controls above to remove its device-key authority.

Attached folders suit project-sized work, not very large repositories.

**Next:** [Use the attached Computer](/guides/use-computers/).
