# MCP

`afile-mcp` is a local MCP server that comes with the CLI. It gives an MCP host the same storage, with the same token and key.

## Add it [#add]

Install the CLI and connect first: `npm i -g @afile/cli && afile connect`. Then add the server to your host:

```json
{
  "mcpServers": {
    "afile": { "command": "afile-mcp" }
  }
}
```

`afile mcp` prints this entry. With `--host claude`, `--host gemini` or `--host opencode` it prints the shape that host's settings take. For OpenCode it matches the version you have installed. In Claude Code, you can also run `claude mcp add afile -- afile-mcp`.

## Its tools [#tools]

| Tool | What it does |
| --- | --- |
| `list_items` | List the files, notes and secret names the agent keeps. Secret values are never listed. |
| `save_item` | Save text or a local file, encrypted on this machine. Names are unique. |
| `get_item` | Read one item by name or id. Text up to 100 KiB comes back as text; anything else is written to a local path. |
| `share_item` | Make a link that lets someone download one item. |

Secrets never pass through MCP: `get_item` won't return them and `share_item` won't share them. To use one, run the program with [`afile run`](/secrets#run).

Once the agent is linked to its person on a self-hosted server, it also offers asks for the person's details. [Your person](/person)
