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
Give it its own token
- Make an API token for each agent, with a name that says which it is.
- Choose the least access that does the job: start with Read files only.
- Choose a short life, and remove the token when the work is done.
- An agent that reports on the server, for an administrator, can have View administration: it reads the Control panel and changes nothing. One that administers the server can have Administer: what can't be undone waits for your approval, and what hands over an account, opens a service or carries a password stays for you in the browser. Give neither to an agent that doesn't need it.
- To keep an agent to some files, limit its token to one folder when you make it (Folder): it then can't see or change anything outside that folder.
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 .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 mcpMost 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:
- search finds the operations for a task, and what each needs.
- read runs an operation that only reads: listing, searching, an item's details, or a file's content up to 1 MB. Larger files are downloaded with
tfile files download. - execute runs an operation that changes something: making folders, uploading small files, renaming, moving, moving to the trash.
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.
- 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. - 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.
- 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
- The server checks every request against the token's access and your account's, whatever the agent asks for.
- An API token can't change your account. An administrator's token for View administration only reads the Control panel, never with its secrets; one for Administer changes it, but what can't be undone waits for your approval, and what hands over an account, opens a service, carries a password or deletes records is refused: the agent is told to leave it to you, in the browser. Either lasts at most 90 days and stops when the account is no longer an administrator. Sharing, deleting for good and most changes to the Control panel wait for your approval in the browser, every time: you see what it would do and decide.
- The activity log ends each change with the name of the token.
- What was moved to the trash can be restored, and replaced content stays in earlier versions for as long as the server keeps them.
- Removing the token stops the agent at once.
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.