What a connector does#
A connector is a small program that runs on one of your hosts, next to services bastn cannot reach on its own: an MCP server on a private network, an internal REST API, or a laptop.
It dials out to the bastn connector hub over mutual TLS: on the hosted service that is hub.bastn.ai:18093, and on an Enterprise install it is your own gateway's connector hub. No inbound port is opened on your side. Once it is connected, it tells bastn which capabilities it offers, and bastn sends it the tool calls that agents make. Every call still goes through identity, policy, approvals and the audit log first. See How bastn works.
The connector runs on Linux (amd64 and arm64) and as the Docker image ghcr.io/dflux-io/bastn-connector. There are no native macOS or Windows builds; run the Docker image there.
Add a connector#
You need to be a team admin of the team that will own the connector.
- In the dashboard at app.bastn.ai, open Tools, then the Connectors tab, and choose New connector.
- Enter a name (letters, digits,
.,_and-, starting with a letter or digit). If you administer several teams, pick the team too. To change how long the join token stays valid, open More options. - Choose Create join token. The dashboard shows a single-use join token, with the commands that use it. Copy the command for the way you install, under Install with: Linux, Docker, or Already installed.
The token and commands are shown once. bastn keeps only a hash of the token. A token enrolls exactly one connector, with that name, into that team. It expires after 1 hour unless you chose a longer lifetime (at most 7 days).
Tip
The commands pass the token in the BASTN_CONNECTOR_TOKEN environment variable, not as a command-line argument, so it does not show up in the process list.
Linux, one line#
Run the Linux command on the host. It needs sudo, curl or wget, and OpenSSL 3. On the hosted service it looks like this:
curl -fsSL https://dl.bastn.ai/install.sh | sudo BASTN_CONNECTOR_TOKEN='wpj_…' sh -s -- --hub hub.bastn.ai:18093 --name web-01 --version v0.7.0The dashboard fills in your token and connector name. --version pins the connector release that matches bastn's own version. The installer:
- Downloads the connector release for the machine from dl.bastn.ai.
- Checks the Ed25519 signature of the release's
SHA256SUMSagainst the release keys it carries, then the binary's SHA-256, and that the binary runs. - Installs
/usr/local/bin/bastn-connector(the previous binary is kept asbastn-connector.prev) and creates thebastn-connectorsystem user and/var/lib/bastn-connector, so the service does not run as root. - Enrolls the host. The connector's private key is generated on the host and never leaves it.
- Writes a starter
/etc/bastn-connector/connector.yamlwith no capabilities yet, installs thebastn-connectorsystemd service and starts it.
To check on it:
systemctl status bastn-connector
journalctl -u bastn-connector -f
sudo systemctl restart bastn-connector # after editing /etc/bastn-connector/connector.yamlIf sudo does not pass the token through, the installer asks for it on the terminal instead. Put local changes to the service in a drop-in (sudo systemctl edit bastn-connector), not in the unit file: the installer rewrites the unit when it upgrades.
Docker#
The Docker command has three lines. On the hosted service:
BASTN_CONNECTOR_TOKEN='wpj_…' docker run --rm -e BASTN_CONNECTOR_TOKEN -v bastn-connector:/var/lib/bastn-connector ghcr.io/dflux-io/bastn-connector:0.7.0 \
enroll --hub hub.bastn.ai:18093 --name web-01 --state-dir /var/lib/bastn-connector
[ -e connector.yaml ] || { printf 'name: web-01\nhubs: hub.bastn.ai:18093\nstate_dir: /var/lib/bastn-connector\ncapabilities: []\n' > connector.yaml; chmod 644 connector.yaml; }
docker run -d --name bastn-connector --restart unless-stopped -v bastn-connector:/var/lib/bastn-connector \
-v "$PWD/connector.yaml:/etc/bastn-connector/connector.yaml:ro" ghcr.io/dflux-io/bastn-connector:0.7.0- Enroll into the named volume
bastn-connector. The key is generated there. - Write a starting
connector.yamlin the current directory, only if there is none, readable by the image's user. - Start the container with that file mounted.
The image tag follows bastn's version. The container only dials out, and runs as a non-root user (uid 10001). To add capabilities, edit connector.yaml and run docker restart bastn-connector; docker logs -f bastn-connector follows its log.
Already installed#
If the connector binary is already on the host, Already installed shows the plain enroll command:
BASTN_CONNECTOR_TOKEN='wpj_…' bastn-connector enroll --hub hub.bastn.ai:18093 --name web-01Then start it with bastn-connector run --config connector.yaml, or under your own service manager.
Moving a connector to a new host#
To move an enrolled connector, make a new join token for the same name. The form says the name is taken and offers Replace it; tick it (it is also under More options as Replace existing connector) and run the install on the new host. The connector keeps its name and its servers.
Configure capabilities#
A new connector shows as online with no capabilities. You list what it offers in connector.yaml (/etc/bastn-connector/connector.yaml for the Linux install; for Docker, the file in the directory where you ran the commands), then restart the connector.
Unknown keys are rejected. Values in env and headers can refer to the connector's environment as ${VAR}; an unset variable stops the connector at startup with an error.
name: web-01 # must match the enrolled name
hubs: hub.bastn.ai:18093 # as the installer wrote it
state_dir: /var/lib/bastn-connector
capabilities:
# An MCP server the connector starts as a child process (stdio).
- name: jira
kind: mcp_upstream
command: [npx, -y, "@example/jira-mcp"]
env:
JIRA_TOKEN: ${JIRA_TOKEN}
# An MCP server reachable over HTTP from the host.
- name: wiki
kind: mcp_upstream
url: http://wiki.internal.example.com:8080/mcp
headers:
Authorization: Bearer ${WIKI_TOKEN}
# A REST API from its OpenAPI spec: every included operation becomes a tool.
- name: billing
kind: openapi
spec: https://billing.internal.example.com/openapi.json
base_url: https://billing.internal.example.com/api
include:
tags: [invoices]
methods: [GET, POST]
credential:
header: Authorization
value_file: /path/to/billing.tokenKeep the name, hubs and state_dir lines the installer wrote.
mcp_upstream#
An MCP server, either started by the connector as a child process (command) or reached over HTTP (url). The connector re-reads the server's tool list every minute, and at once when the server announces a change.
A child process gets a minimal environment plus the env you set. It never inherits the connector's whole environment.
openapi#
A REST API described by an OpenAPI 3.0 or 3.1 spec (JSON or YAML, or Swagger 2.0, which is converted). Each operation the connector includes becomes a tool, with no MCP server to write.
spec(a URL) orspec_file(an absolute path) is the spec. It is read again every 5 minutes by default.base_urlis where every request goes. The spec's ownserversare ignored, so a spec cannot choose where requests go.includeis the ceiling:tags,methodsandpaths(globs). An operation outside it has no tool and cannot be called, whatever bastn sends.allowed_hostslists the only hosts a request may reach. It defaults to thebase_urlhost.
Tool effects follow the method: GET and HEAD are read, POST, PUT and PATCH are write, DELETE is destructive. See Policies and tool access.
http_upstream#
One REST call, mapped by hand, exposed as a one-tool server. Use it when there is no OpenAPI spec. You set the method, base_url, path (with {arg} placeholders), which arguments go in the query or body, and an args_schema that every call is checked against before any request is built.
commands#
A commands capability runs allowlisted programs on the host through reviewed command specs. It is off unless enabled: true. It needs a run_as user, which can be neither root nor the connector's own user, so the connector itself must run as root to switch to it. The built-in profile linux-readonly allows a set of read-only Linux tools (service status, logs, disk, memory, network). The connector's Commands view in the dashboard shows its labels, allowlisted binaries and which command specs run there.
You set it up yourself: the host's allowlist, the team's commands server, spec review by a second admin, pins and approvals. Commands and scripts walks through each step, and covers reviewed scripts too.
Credentials stay on the host#
For openapi and http_upstream, the credential is read on the connector, from value_env (an environment variable) or value_file (a file). It is added to the request on the host and never sent to bastn. The connector also removes the secret values it holds from every result before sending it back, so a service that echoes a credential cannot leak it.
Expose a capability to agents#
A capability is not available to agents until it is exposed as a server. Exposing it is what puts it under policy.
- Open Tools, Connectors, then the connector.
- On a capability, choose Expose as MCP server, name the server and choose Create server.
- The new server belongs to the connector's team and appears on the Servers tab, shown as
via <connector>with the connector's online state.
Like every server created in the dashboard, it starts with new tools denied: no tool is visible to agents until you enable its tools in the server's drawer or pin them on the All tools tab. Agents then call its tools on https://mcp.bastn.ai/mcp as <server>__<tool>. See Add servers and tools and Policies and tool access.
A team's servers can use only that team's connectors.
Relays#
A relay is a connector that carries the other connectors at a site. Only the relay dials out to bastn, over mutual TLS. The connectors at the site dial the relay inside your network, and need no certificate of their own and no route to the internet. Use a relay when a site's firewall lets only one machine out, or to have one place to watch and cut a site's link.
Relays and the connectors behind them must run connector v0.4.0 or later.
1. Install the relay#
- On the Connectors tab, choose New connector, open More options and set Kind to Relay.
- Enter the relay's name and a Site: a short name you choose for the network it serves, such as
ams-dc1. A relay belongs to one team and one site. - Run the Linux command on the machine that may reach bastn. On the hosted service it looks like this:
curl -fsSL https://dl.bastn.ai/install.sh | sudo BASTN_CONNECTOR_TOKEN='wpj_…' sh -s -- --hub hub.bastn.ai:18093 --name relay-a --version v0.7.0 --as-relayThis enrolls the relay, writes a connector.yaml with a relay: block and runs the bastn-connector service as a relay. It listens for the site's connectors on port 18095. A relay has no Docker command, because its port must be published, which is your choice.
2. Install each connector through the relay#
- On the Connectors tab, choose New connector with the same team, open More options and tick Connect through a relay.
- Enter the Relay address, the relay's
host:port, such asrelay-a.internal.example.com:18095. Optionally fill in Bind to site: the token then works only through that site's relays. - Run the command the dashboard shows. The Linux one looks like this:
curl -fsSL https://dl.bastn.ai/install.sh | sudo BASTN_CONNECTOR_TOKEN='wpj_…' sh -s -- --relay relay-a.internal.example.com:18095 --name billing-east --version v0.7.0Docker and Already installed commands are shown too; they use enroll --relay in place of --hub. The connector gets a secret instead of a certificate, kept in its state directory, and is bound to the relay's site: it is let in only through a relay of that site. To fail over, list more than one relay of the site under hubs: in its connector.yaml.
You configure capabilities and expose them exactly as for any other connector. A relay itself has no capabilities and cannot be exposed as a server: it only carries connections.
Encrypt the hop to the relay#
By default the hop between a connector and its relay is plain gRPC. Keep the relay's port on a trusted network, and let only the site's machines reach it.
To encrypt it, tick TLS between the connectors and the relay (under More options) on the relay's token and on each connector's token. The relay then serves TLS with a certificate bastn issues for your org and its site, and each connector accepts only a relay certificate for its own site, so another machine on the network cannot pose as the relay. The commands gain --relay-tls. A connector with TLS cannot use a relay without it.
Running a relay#
- The Connectors tab shows a relay as relay · site, and each connector behind one as via the relay that carries it now.
- Each call through a relay is recorded in the audit log with the relay that carried it.
- Disabling or revoking the relay disconnects every connector behind it. Disabling one connector disconnects only that one.
- The relay renews its certificate and upgrades like any connector. It keeps the connector releases it downloads, so the site fetches each version once. Each connector still checks the release signature itself.
Status in the dashboard#
The Connectors tab of Tools lists each connector with its status, version, capabilities, certificate expiry and when it was last seen. A connector's drawer leads with its status, recent calls and capabilities. Under Danger there you can disable it (it disconnects now and can be enabled again), revoke it, or delete it.
The connector's certificate lasts 30 days and the connector renews it on its own while it runs. If it was down long enough for the certificate to expire, enroll it again with a new join token.
A connector that bastn refuses for good (revoked or deleted) stops itself after about 2 minutes with exit status 3, rather than retrying forever. Enroll it again with a new join token to bring it back.
Updates#
bastn checks for new connector releases and tells each connector the latest release and the minimum version it serves.
Update policy#
Each connector has an update policy, set under Updates in its drawer:
| Policy | What happens with a new release |
|---|---|
| Manual | No update notices. It is upgraded only when someone does it. The minimum version still applies. |
| Notify (default) | Flagged in the dashboard and in the connector's log. Upgraded when someone does it. |
| Auto | bastn upgrades it on its own, between 30 seconds and 5 minutes after it sees the new release. Only for connectors installed with the one-line Linux installer. |
A release that failed or rolled back on a connector is not retried automatically.
Upgrade now#
A connector behind the latest release shows an update badge, and its drawer shows the upgrade.
- Installed with the Linux installer: choose Upgrade now. The connector downloads the release through bastn, verifies its signature, and a small helper swaps the binary and restarts the service. If the new version does not reconnect within 2 minutes, the helper puts the previous binary back.
- By hand on Linux: run the installer again without a token (below). It keeps the identity and the config, and restarts the service if it was running.
- Docker: pull the newer tag of
ghcr.io/dflux-io/bastn-connectorand recreate the container with the same volume andconnector.yaml. The drawer shows the exact commands.
curl -fsSL https://dl.bastn.ai/install.sh | sudo sh # the latest release
curl -fsSL https://dl.bastn.ai/install.sh | sudo sh -s -- --version v0.7.0 # a given releaseThe drawer shows each step of an upgrade, and upgrades are recorded in the audit log.
Supported versions#
By default bastn serves connectors up to two minor versions behind its own release: bastn v0.7.0 serves connectors from v0.5.0 on. A connector below that minimum shows upgrade needed. It stays connected, so you can still upgrade it, but its calls fail with a message asking you to upgrade the connector. See the release notes for what changed in each version.
Some features need a recent connector. Relays need v0.4.0 on the relay and on every connector behind it. For long calls, a v0.4.0 connector also reports progress, stops a call when the client cancels it, and keeps a call running when its connection to bastn drops for a moment; an older connector still runs long calls, without these.