---
url: /configure/setup.md
---
# Setting up an agent

`pandra config setup` configures everything one agent needs, interactively: the values of its MCP servers, the variables it declares, and, when you have two or more [targets](/configure/targets.md), which one runs it. It writes nothing until you answer the last question, then prints what it set:

```text
$ pandra config setup changelog
changelog needs no MCP server values or variables.
Target: codex (this agent)
```

The agent is a name from `pandra agent list`, a project directory such as `.`, or a remote reference you pulled first with `pandra pull`. For each MCP server, it offers the MCP configurations you saved for that server, `New values`, or `Skip`, and then asks whether to allow the server to receive the values ([allowing servers](/mcp-servers/allowing.md)). For new values, it asks for the required inputs, then the optional ones, which `Leave it unset` skips. A secret value you type or give by its source becomes a new [logical secret](/secrets.md), whose name Pandra asks with a default in parentheses, such as `token: Secret name (notifier-slack-token):`. Escape goes back to the question before, and Pandra asks the questions after it again from there; at the first question, Escape cancels the setup.

| You | Use |
| --- | --- |
| are at a terminal | `pandra config setup AGENT` |
| have no terminal, want to review everything first, or are an AI agent | `pandra config setup AGENT --template`, then `--file FILE` |
| know the values for one server | [`pandra config mcp set`](/mcp-servers/allowing.md) |
| want to change only the agent's target | `pandra config target use NAME --agent AGENT` ([targets](/configure/targets.md)) |

## Set up from a template

Without a terminal, print a template, fill it in, and apply it:

```sh
pandra config setup github.com/acme/notifier@v1.0.0 \
    --template > notifier.toml
pandra config setup github.com/acme/notifier@v1.0.0 --file notifier.toml
```

The template is a fragment of `config.toml` with the agent's current values filled in, the missing ones empty, and comments that say what each value is and which saved names you can use:

```toml
# Settings for github.com/acme/notifier. Fill in, then run:
#   pandra config setup github.com/acme/notifier@v1.0.0 --file <this file>

[agents."github.com/acme/notifier"]
# MCP server "slack": com.slack/slack-mcp (MCP Registry), remote https://mcp.slack.com/mcp
#   Needs: tenant-id (required): Slack workspace ID
#          token (required, secret): Slack bot token
#   Saved MCP configurations for this server: slack-work (used by github.com/acme/reporter)
mcp.slack = "notifier-slack"

# Environment variables the agent declares
#   SLACK_CHANNEL (optional): channel to post to
# env.SLACK_CHANNEL = ""

[mcp.notifier-slack]
inputs.tenant-id = ""
inputs.token = { secret = "notifier-slack-token" }

[secrets.notifier-slack-token]
# keychain | 1password = "op://..." | bitwarden | aws-secrets-manager | command | env | file
```

Fill in the draft `[mcp.notifier-slack]`, or replace its name with a saved one, such as `mcp.slack = "slack-work"`, and delete the draft. [The template example](/examples/mcp-server-from-a-template.md) fills it in with a token read from a file and applies it:

```text
$ pandra config setup github.com/acme/notifier@v1.0.0 --file notifier.toml
applied 5 keys
Allowed MCP server "slack" of github.com/acme/notifier to receive its inputs
  Server:  com.slack/slack-mcp 2.0.0 (MCP Registry, registry.modelcontextprotocol.io)
  URL:     https://mcp.slack.com/mcp
  Inputs:  tenant-id  <- "T0123"
           token      <- secret notifier-slack-token (file /home/me/secrets/slack-token)
```

* Applying the file allows the servers without asking: running it is your consent.
* It applies only what a template can hold: the agent's `mcp.<server>` and declared `env.<VAR>`, and `[mcp.*]` and `[secrets.*]` tables. Anything else, such as `permission-mode` or a secret with a `command` source, fails before anything is written, naming each line.
* It never rewrites an existing target, secret, or MCP configuration unless the file defines it again, and then it lists the other agents that use it.
* A new keychain secret without a value is asked for on a terminal. Without one, the command writes nothing and prints the `pandra config secret set` command to run first. A secret in 1Password, Bitwarden, AWS Secrets Manager, or a command must already hold its value.
