---
url: /mcp-servers/methods.md
---
# Methods and replacements

## Choosing another execution method

The [MCP Registry](https://registry.modelcontextprotocol.io) is a public list of MCP servers. An agent's server can name an entry there, and the entry says how to run the server. An entry can list several ways, such as a remote endpoint and local packages on npm or PyPI. The agent's author picks the default, and `--method` chooses another one the entry offers:

```sh
pandra config secret set search-token --1password op://Work/Search/token
pandra config mcp set search-local --agent github.com/acme/researcher \
    --server search --method npm --secret token=search-token
```

The configuration file then holds:

```toml
[mcp.search-local]
method = "npm"
inputs.token = { secret = "search-token" }

[agents."github.com/acme/researcher"]
mcp.search = "search-local"
```

`--method` takes a method's identifier: `npm:<name>`, `pypi:<name>`, `oci:<name>`, or `remote:<url>`, with `#<transport>` after it for a transport that is not the usual one, such as `remote:<url>#sse`. When an entry has one method of a kind, the short form (`npm`, `pypi`, `oci`, `remote`) is enough. A run whose configuration names a method the entry does not offer fails with `mcp_method_unknown`, and one that names a method Pandra cannot run fails with `mcp_method_unsupported`, each with the reason.

Pandra never switches methods on its own, not even after a method fails to start, because two methods send your data to different places.

## Replacing a server

An MCP configuration can replace an agent's server with another implementation, such as an internal build of a public server or your own development build. `pandra config mcp set` writes the replacement and allows it in one step:

```sh
pandra config mcp set corp-slack --agent github.com/acme/reporter \
    --server slack --package npm:@acme/slack-mcp@2.1.0 \
    --server-env SLACK_BOT_TOKEN='{token}' --secret token=slack-token
pandra config mcp set github-dev --agent github.com/acme/reviewer \
    --server github --command /home/me/src/github-mcp/bin/server \
    --server-env GITHUB_PERSONAL_ACCESS_TOKEN='{token}' \
    --secret token=github-token -- stdio
```

In the file, a replacement is written like a server in `pandra.toml`, but declares no inputs: it refers to the MCP configuration's `inputs` with `{name}` placeholders.

```toml
[mcp.corp-slack]                      # an internal build, from npm
package = "npm"
name = "@acme/slack-mcp"
version = "2.1.0"
env.SLACK_BOT_TOKEN = "{token}"       # the variable this server reads its token from
inputs.token = { secret = "slack-token" }

[mcp.github-dev]                      # a local development build
command = "/home/me/src/github-mcp/bin/server"
args = ["stdio"]
env.GITHUB_PERSONAL_ACCESS_TOKEN = "{token}"
inputs.token = { secret = "github-token" }

[mcp.search-local-port]               # a server you started yourself on a local port
url = "http://127.0.0.1:8080/mcp"
headers.Authorization = "Bearer {token}"
inputs.token = { secret = "search-token" }
```

After you write a replacement by hand, assign and allow it with `pandra config mcp use corp-slack --agent github.com/acme/reporter --server slack`.

* A replacement is a package with an exact version (`--package`), a URL (`--url`, with `--header` and `--transport sse`), or a `command` (`--command`), which runs directly, never through a shell. Without a version, `--package` writes the newest exact one.
* A secret may appear only in `env` and headers, never in arguments or URLs.
* A replacement keeps the agent's `required` setting for the server.
* The configuration replaces servers but never adds them. To give an agent another server, make your own agent that builds on it, and add the server there ([building on another agent](/build/base.md)).

## Runners and what is pinned

Package servers start with a runner: `npx` for npm, `uvx` for PyPI, and `docker` for OCI images. Pandra checks that the runner is installed before the run starts, and does not install it. It looks runners up on `PATH`, or where `[runners]` in the configuration points:

```toml
[runners]
npx = "/opt/node/bin/npx"
```

Packages come only from each type's public registry (`registry.npmjs.org`, `pypi.org`, and Docker Hub). A package server starts in the workspace, so its runner reads runner configuration there, such as an `.npmrc` or `uv.toml` that names another package registry, as well as your own, such as `~/.npmrc`. To use a server that listens on a local port, start it yourself and point a replacement at its loopback URL, as `search-local-port` above does.

The agent pins each server's definition: a registry server's version and the digest of its entry, or a package server's exact version. Nothing pins what `npx`, `uvx`, or `docker` downloads when the server starts, such as an npm package's own dependencies.
