# Use Guardry Secrets with Claude Code

> Give Claude Code its own scoped, expiring Guardry credential so it can run your programs with the secrets they need and every read is recorded.

Claude Code can use the API keys in your Guardry vault without you pasting them into a conversation. It works through its own agent credential, limited to the scope, permissions and lifetime you choose, and every value it reads is written to the audit log. Setup is short: one credential in the dashboard, one install command and one login.

## 1. Create an agent credential

You do this once, in the dashboard. [Request an invite](https://guardry.ai/invite/) if you have no account yet, and add the secrets Claude Code will need.

Open **Agent access** and choose **Connect agent**. Pick a scope (one environment, or every environment in the organization), the permissions and a lifetime of 1 hour, 4 hours, 7 days or 30 days. The credential is shown once, so copy it now.

## 2. Install the CLI and the skill

```sh
curl -fsSL https://app.guardry.ai/install.sh | sh
```

The installer sets up the `guardry` CLI and the `guardry-secrets` skill. The skill goes in the shared agent-skills directory and in the Claude Code directory when one is detected. To install the skill for Claude Code explicitly:

```sh
guardry skill install --agent claude
```

Start a new agent session so Claude Code discovers the skill. Installing the skill grants no access.

## 3. Sign the CLI in

```sh
guardry login --profile coding-agent
guardry --profile coding-agent whoami
```

Paste the credential at the hidden prompt, never into the conversation or a command argument. From here on you refer to the profile by name.

## 4. Give Claude Code its first task

A good first instruction is: "Use Guardry profile coding-agent to run this application with API_KEY. Do not print the value."

The command behind it is `guardry secrets run`, which puts the named values into the environment of the program it starts. Nothing is written to disk.

```sh
guardry --profile coding-agent secrets run --secret API_KEY --secret DATABASE_URL -- python agent.py
```

## 5. Or connect over MCP

The CLI also contains an MCP server. Print its configuration:

```sh
guardry --profile coding-agent mcp config
```

Add the printed configuration to your MCP client's server settings. It holds an executable path and a profile name, and no credential. See [the MCP server page](https://guardry.ai/agents/mcp.md).

## What the agent can and cannot do

- It can search entry names and descriptions without reading any value.
- It can read secret values if you allowed that, or only after you approve each request.
- It can create new entries if you allowed that.
- It can never edit, rotate or delete an existing entry, including one it created.
- It cannot see members, manage credentials or approve anything.
- Variables are visible to every agent credential that covers their environment, without approval.

## Questions

### Does Claude Code see my secret values?

With `guardry secrets run`, the value goes into the environment of the program Claude Code starts, and nowhere else. A credential that may read secret values can also read one as plain text with `guardry secrets read`, and an agent that can read a secret can copy it. For a sensitive secret, require your approval for each read.

### Do I have to paste the credential into the conversation?

No, and you should not. Run `guardry login --profile coding-agent` yourself and paste the credential at its hidden prompt. In the conversation you only mention the profile name.

### How do I stop Claude Code reading secrets?

Revoke its credential in the dashboard. Future requests are refused, and "Revoke all agents" stops every agent in the organization at once. A value Claude Code already received stays with it.

---

Source: https://guardry.ai/agents/claude-code/ · Updated 2026-11-27 · Guardry for language models: https://guardry.ai/llms.txt
