---
url: /examples/mcp-server-from-a-template.md
---
# Set up an MCP server from a template

Set up an agent without answering any prompts: you write the values it needs in a file, and one command, `pandra config setup --file`, applies them. Use it where nobody answers the questions of `pandra config setup`, such as in a provisioning script that sets up each new machine, or when an AI agent fills in the file for you to review. Here the agent is `github.com/acme/notifier@v1.0.0`, whose `slack` MCP server needs a secret `token` and a `tenant-id`. You end with the agent approved, the server allowed to receive both values, and the agent running.

## 1. Write a template

Pull the agent and print a template of everything it needs:

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

The pull shows the server and the secret it asks for, and says the agent needs approval (step 4):

```text
Pulled notifier 1.0.0
  Reference:             github.com/acme/notifier@v1.0.0
  Digest:                sha256:09388c1980578a9ac4547740f8425f71940fdc5cc866912d5387f93e575000bc
  ...
  MCP servers:
    slack
      Server:            com.slack/slack-mcp 2.0.0 (MCP Registry, registry.modelcontextprotocol.io)
                         the registry serves this entry (checked when fetched)
      URL:               https://mcp.slack.com/mcp
      Secrets:           token (Slack bot token)

Needs approval:
  ...
```

The template names the inputs the server needs and leaves their values empty; [setting up an agent](/configure/setup.md) shows it in full.

## 2. Fill it in

Say where each value comes from. Secret values never go in the file: here the token is read from a file.

```toml
# notifier.toml
[secrets.slack-token]
file = "/home/me/secrets/slack-token"

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

[agents."github.com/acme/notifier"]
mcp.slack = "slack-work"
env.SLACK_CHANNEL = "alerts"
```

A secret can come from other places too, such as the keychain or 1Password ([secret stores](/secrets/stores.md)).

## 3. Apply it

Applying the file adds the names to your configuration and allows the server to receive these values. It asks nothing: you reviewed the file, and running the command is your consent.

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

```text
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 slack-token (file /home/me/secrets/slack-token)
```

If the token file is not on this machine yet, Pandra applies the file and warns that the secret can be read where the file exists.

## 4. Approve it

`agent trust` shows the summary and approves the agent:

```sh
pandra agent trust github.com/acme/notifier@v1.0.0
```

An AI agent can do the first two steps for you. Applying the file and approving the agent are yours: they let a server receive your token and a new agent run. [Allowing servers](/mcp-servers/allowing.md) describes what the allowance covers.

## 5. Run it

```sh
pandra run github.com/acme/notifier@v1.0.0 \
    --prompt "Post today's deploy summary."
```

If an input still has no value, a run on a terminal asks for it. Without a terminal, the run fails before anything starts, naming each missing input with the `pandra config setup` commands that fill it; `--dry-run` shows the same check without starting anything.
