# MCP

Run the local MCP server to list secret names and request personal details. Use the CLI to pass approved values to a command.

## Add it

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

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

`asecret mcp` runs the same server, and `asecret mcp --print` prints this entry. With `--print --host claude`, `--host gemini` or `--host opencode` it prints the shape that host's settings take. In Claude Code, you can also run `claude mcp add asecret -- asecret-mcp`.

## Its tools

| Tool | What it does |
| --- | --- |
| `list_secrets` | List the names of the secrets this agent keeps. Never a value |
| `use_detail` | Ask your user to share a detail for a task, with an optional `purpose` and `secret_name`. Returns a link to show them |
| `check_detail` | Read a `use_detail` ask. Once it's shared, keeps it as one of this agent's secrets and returns that secret's name |
| `request_save` | Ask your user to save a detail, such as `postal_address` or `email` |
| `request_setup` | Ask your user to set up several details |
| `check_request` | Read where an ask stands |
| `cancel_request` | Cancel an ask that still waits |

Your user answers the asks at asecret.sh. `request_save` and `request_setup` work once the agent is linked (`asecret link`). With your user's own aSecret server, more tools work: deliveries to merchants and order status. [Asking your user](https://asecret.sh/docs/person)

## Use a detail

`use_detail` takes a `detail_type`: `postal_address`, `email`, `phone`, `membership`, `secure_note`, `api_key`, `password`, `id_number` or `card` (with a `purpose` naming the purchase; it's kept for one `asecret run`, then deleted). If the agent isn't linked yet, it returns a link for that first; call it again once your user approves, and the ask opens for them on the same page. Your user chooses which one to share, in their browser, and it arrives encrypted for this agent alone.

Call `check_detail` with the `request_id` until it says `shared`. It returns the secret's name and its parts, never the value. Then the agent uses it in a command, as it uses any secret:

```sh
asecret run --secret POSTAL_ADDRESS -- node checkout.js
```

The command gets `POSTAL_ADDRESS`, and each part, such as `POSTAL_ADDRESS_CITY`, in its environment. [Use a detail](https://asecret.sh/docs/person#use)

## Why no tool returns a value

Whatever a tool returns goes into the model's conversation, and from there into logs and transcripts. So there's no tool that reads a secret. To use one, the agent runs a command with it in that command's environment: `asecret run --secret NAME -- <command>`. [Keeping secrets](https://asecret.sh/docs/secrets#run)
