AI agents

An AI agent can work with your files through tfile, by running its commands or over MCP. You choose what it may do, and you can see what it did.

On this page
  1. Give it its own token
  2. Set it up
  3. Tell the agent how
  4. Connect it as an MCP server
  5. Connect over the network
  6. What protects you
  7. Instructions hidden in files

Give it its own token

Set it up

Give the agent's environment the address and the token. Nothing is saved to disk:

export THIRTYFILE_URL=https://drive.example.com
export THIRTYFILE_TOKEN=tft_…

Or sign in once yourself and tie the profile to the folder the agent works in. The agent then runs tfile without seeing the token in the conversation:

tfile auth create assistant --server https://drive.example.com
tfile auth activate assistant .
Don't paste a token into a chat. A program that runs commands for the agent can read the files your user can, profile included: the token's own limits are what protect you.

Tell the agent how

The project has a skill file for tfile. Put it in your agent's skills folder, or add a line to its instructions:

Use the tfile command for files in ThirtyFile. Find commands with `tfile cli search`, describe them with `tfile schema`, and show changes with --dry-run first.

The agent finds the rest itself:

tfile cli search "move files into a folder"
tfile schema files move
tfile files move --help

Connect it as an MCP server

AI tools that speak MCP (the Model Context Protocol), such as Claude Code, Claude Desktop, Codex or Cursor, can start tfile mcp and work with your files through it, without running commands. It uses the profile in use, as every tfile command does: set it up as above first.

In Claude Code:

claude mcp add thirtyfile -- tfile mcp

Most other tools take a settings file in this form. --profile chooses a profile other than the default one:

{
  "mcpServers": {
    "thirtyfile": {
      "command": "tfile",
      "args": ["mcp", "--profile", "assistant"]
    }
  }
}

It offers three tools:

Because reading and changing are separate tools, you can let the AI tool use read freely and have it ask you before each execute. Over MCP, moving to the trash isn't confirmed again as it is on the command line with --force: the token's access is what limits the agent, as described below.

Connect over the network

An AI tool that can't run programs on your computer (one in a browser, or on another machine) can connect to the server itself, at https://your.server/mcp. An administrator turns this on first, under Control panel › Settings › Let AI agents connect with MCP; until then the address answers nothing.

  1. Add the address to the AI tool as a remote MCP server, for example claude mcp add --transport http thirtyfile https://drive.example.com/mcp.
  2. The tool opens your browser. Sign in as usual, check the tool's name and where it returns to, choose what it may do, in which folder and for how long, and approve with your password; or deny.
  3. The tool gets an API token: it is listed under API tokens in the account menu, and removing it disconnects the tool at once.

It offers the same three tools as tfile mcp, and the same rules hold: the token's access, its folder, and your approval for what can't be undone or opens access. The sign-in uses OAuth 2.1 with PKCE: the tool never sees your password.

What protects you

Instructions hidden in files

A file name or the text inside a file can be written to look like an instruction to the agent. No confirmation in a program reliably stops an agent that follows it. Give each agent only the access you would accept being misused: a token that only reads can't change anything, whatever a file says. Be careful with agents that can also send data elsewhere.