# Secrets and API keys in goose: keep credentials out of the agent's reach

Source: https://botpassword.com/agents/goose
Last checked: 2026-10-25

goose is Block's open-source agent, available as a desktop app and a CLI. It treats MCP servers as "extensions" over stdio or streamable HTTP, stored in `~/.config/goose/config.yaml` and added with `goose configure`. It reads `AGENTS.md` and `.goosehints`, and a `.gooseignore` file limits the Developer extension's file tools.

## MCP support

Yes. Transports: stdio, http.

- user: `~/.config/goose/config.yaml`

Add a server with `goose configure (Add Extension)  |  goose session --with-extension "VAR=value command arg1 arg2" (session only)`.

## Environment variables and .env files

Stdio extensions take an `envs` map in `config.yaml` (the docs' GitHub example places a token placeholder there) and the CLI accepts `VAR=value` before the command in `--with-extension`. For OAuth, `client_secret_key` names a secret resolved from the environment or goose's secret store, and the docs say the secret value itself never goes in the config file. The pages reviewed do not describe `.env` loading.

## File access

Block's documentation says goose runs autonomously by default and, with the Developer extension, can run commands and modify files without approval; goose permission mode and tool permissions add control. A `.gooseignore` file, global in `~/.config/goose` or local at a directory root, lists paths goose should not touch, but per secondary sources it currently affects only the Developer extension's tools.

Deny or ignore files with: .gooseignore.

## Credential risks

- **Autonomous by default.** goose's extension documentation states it can run commands and change files without approval when the Developer extension is on, so a poisoned instruction has direct access to anything the shell can reach, including environment variables.
- **Operation Pale Fire.** Block's own red team hid invisible Unicode instructions in a shared goose recipe and got code execution and an info-stealer payload running on an employee laptop; existing controls detected the payload. Block added zero-width character stripping, recipe warnings and prompt-injection detection.
- **Token placeholders in `config.yaml`.** The documented stdio example stores `GITHUB_PERSONAL_ACCESS_TOKEN` under `envs` in the config file, while the same page says an OAuth client secret's value never goes in the config file.

## FAQ

### Where does goose store MCP extension settings?

In `~/.config/goose/config.yaml`. Add extensions with `goose configure`, the desktop app's Extensions page, or a `goose://extension` deeplink.

### What transports does goose support for MCP?

Stdio (a local `cmd` such as `npx`, `uvx` or `docker`) and streamable HTTP (`uri`), with OAuth for remote servers.

### How do I keep goose from reading certain files?

Add them to a `.gooseignore` file, either global in `~/.config/goose` or at a directory root. It currently affects the Developer extension's tools only, so other extensions are not restricted.

### How do I give goose an API key without it seeing the key?

Don't put the key in the prompt, in a file goose can read, or in an environment variable it can print. Give it a tool that performs the authenticated step instead: a credential broker exposed over MCP or a CLI that injects the key into the command or HTTP request and returns only the result. BotPassword is that broker, through `bpw mcp` and the `bpw` CLI.

## Sources

- https://goose-docs.ai/docs/getting-started/using-extensions
- https://goose-docs.ai/docs/guides/context-engineering/using-goosehints
- https://engineering.block.xyz/blog/how-we-red-teamed-our-own-ai-agent-
