# Credential helpers reference

Source: https://botpassword.com/docs/credential-helpers

The credential helpers let a tool fetch its login from BotPassword at the moment it needs it, instead of keeping a token in its own config. They cover git over HTTPS, Docker and OCI registries, the AWS CLI and SDKs, and kubectl. They are clients of the agent endpoint of the daemon, so they follow the same grants and policy as every other surface. For a walk-through of the whole flow, see the [Credential helpers guide](/docs/guides/credential-helpers).

## What is built?

One binary, `bpw`, speaks each tool's own helper protocol:

| Tool | Helper | How the tool is pointed at it |
|---|---|---|
| git, over HTTPS | `bpw git-credential [--credential ID] get\|store\|erase`, also run as `git-credential-bpw` through a link | `credential.helper` in git config |
| Docker and OCI registries | `docker-credential-bpw get\|store\|erase\|list`, a link named `docker-credential-bpw` that points at `bpw` | `credHelpers` in Docker's `config.json` |
| AWS CLI and SDKs | `bpw aws-creds --credential ID` | `credential_process` in the AWS config |
| kubectl | `bpw kube-creds [--credential ID]`, an exec credential plugin | an `exec` user in the kubeconfig |

The `cli_login` intent is built too. Over MCP it is the `cli_login` tool, with `tool` (git, docker, aws or kubectl), `site` (the host) and `credential` (an item ID). `aws` takes no `site` and needs a `credential`. From a shell it is `bpw agent cli_login --tool T --site HOST [--credential ID]`. It returns the tool, the credential, the canonical site and `setup` lines saying how to point the tool at its helper. It never returns a value itself. If it cannot proceed it returns a typed outcome: `scope_denied`, `disclosure_not_granted`, `session_required`, `vault_locked`, `grant_expired`, or `needs_human` when two granted credentials match.

`bpw login <tool>` prints the grant command and the setup for git, docker, aws and kubectl. For `gh`, `wrangler` and `npm` it prints the `run_with` route instead. `bpw login git --host HOST --apply` writes the repository-local git config after a y/N answer at a terminal.

## How do I grant it?

You make the grant yourself, in BotPassword, with `bpw grant add`. Each grant names the exact tools and hosts it covers:

```sh
bpw grant add ITEM --intent cli_login \
  --login git=github.com \
  --login docker=ghcr.io \
  --login kubectl=k8s.example.com:6443 \
  --login aws \
  --allow-disclosure
```

A host is a name or `host:port`. Private and loopback IP addresses cannot be granted yet, so use a DNS name. An agent cannot ask for this grant through `request_access` yet (planned); you add it with `bpw grant add`.

## Is it always disclosing?

Yes. The helper hands the value to the tool, and the agent, or code the agent runs, can read it there. So every `cli_login` grant needs `--allow-disclosure`, and BotPassword says so when you make it. No intent returns a value in its own result, but this delivery is not sealed. See [Security model](/docs/security-model).

## How do I set up git?

```sh
bpw login git --host github.com --credential ITEM --apply
```

That writes these two lines in the current repository, after you answer y at a terminal. The empty helper first stops other helpers from answering. The second line names the full path of the `bpw` you ran, shown here as `/path/to/bpw`:

```sh
git config --local credential.https://github.com.helper ''
git config --local --add credential.https://github.com.helper "!'/path/to/bpw' git-credential --credential ITEM"
```

Without `--credential`, the helper uses the one credential granted for that host.

For one command only, use `git -c credential.helper= -c 'credential.helper=!bpw git-credential --credential ITEM' <command>`.

## How do I set up Docker?

Put a link named `docker-credential-bpw` on your `PATH`, then name the registry in Docker's `config.json`:

```sh
ln -s "$(command -v bpw)" ~/.local/bin/docker-credential-bpw
```

```json
{ "credHelpers": { "ghcr.io": "bpw" } }
```

You do not need `docker login`. `bpw` refuses `store`, which is what `docker login` calls, and never keeps what it sends.

## How do I set up the AWS CLI?

The item's username is the access key ID and its secret is the secret access key. In `~/.aws/config`:

```ini
[profile example]
credential_process = bpw aws-creds --credential ITEM
```

The profile name is a placeholder. There is no `--profile` flag on the helper. It returns the stored long-lived key. Short-lived STS credentials are planned, not built yet.

## How do I set up kubectl?

In the kubeconfig, give the cluster's user an `exec` entry. The kubeconfig must set `provideClusterInfo: true`, because the grant is checked against the cluster's host. `apiVersion` can be `client.authentication.k8s.io/v1` or `v1beta1`:

```yaml
users:
- name: example
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1
      command: bpw
      args: [kube-creds, --credential, ITEM]
      provideClusterInfo: true
      interactiveMode: Never
```

## What happens outside an agent session?

The helpers answer only inside an agent session, which you start with `bpw agent run -- <harness or shell>`. Outside one they fail closed: git gets no answer, Docker answers "not found", and `bpw aws-creds` and `bpw kube-creds` exit non-zero.

`store` and `erase` never write or delete a vault item.

## What about gh, Wrangler, npm and Terraform?

These have no helper. Use `run_with`, which injects the token as an environment variable for one command: `GH_TOKEN`, `CLOUDFLARE_API_TOKEN` or `NPM_TOKEN`. `gh auth login --with-token` is deliberately not used, because `gh` would keep its own copy after the grant ends. `bpw login gh`, `bpw login wrangler` and `bpw login npm` print the `bpw grant add` line for this route. See the [Claude Code guide](/docs/guides/claude-code).

## What is still planned?

- A `gh` helper. Planned, not built yet.
- OAuth device and browser logins through `cli_login`. Planned, not built yet.
- Short-lived AWS STS credentials. Planned, not built yet.
- A `request_access` request for a `cli_login` grant. Planned.
- `bpw run`, a CLI form of `run_with`. Planned, not built yet.
- Windows helpers are untested.

## What are the limits?

- A helper hands the token to the tool that asked for it, so the tool holds it while it runs, and code the agent runs can read it from there.
- A grant covers only the tools and hosts it names. A tool or host outside it gets `scope_denied`.
- Redaction applies to output that BotPassword relays. It does not govern what a tool does with its own credentials.

## Where do I go from here?

- [Credential helpers guide](/docs/guides/credential-helpers) for the full flow.
- [CLI reference](/docs/cli) for the command list.
- [Intent catalog](/docs/intents) for `cli_login` and `run_with`.
- [Grants and approvals](/docs/grants-and-approvals) and [Typed outcomes](/docs/typed-outcomes).
- [/keys](/keys) for where each provider's tokens come from.
