# Connections and integration onboarding

> How connections, credentials, the Git gateway and email are built.

Source: https://werker.cloud/docs/engineering/integrations (updated 2026-12-01)

What each connection gives a run, how far it is verified and what is
not built are in [connections](../connections.md).

## Email

One SMTP connection for the whole instance, kept in
`instance_settings`.

- The password is sealed to the install's public key, so only a worker
  can open it. Changing the server or username needs it again: a
  stored password is never sent to a server it was not entered for
  (`packages/db/sql/001_schema.sql`).
- Email is queued in Postgres (`emails`) and sent by a worker, which
  claims each one (`packages/runtime/src/loops/email.ts`). An email
  queued with more than one attempt is tried again after 1 minute,
  then after 10. Addresses are kept 30 days after it is sent or given
  up on; the words are removed at once.
- The connection is always encrypted (TLS or STARTTLS) and the
  server's certificate is checked.

Bounces reported after the server accepts an email are not read.

## Starting on a VPS

[Self-hosting](../self-hosting.md) creates the install's internal
secrets and takes the first administrator through account setup.
Connections belong to a workspace; they are not global provider
environment variables. `pnpm connect` is available for operator setup;
the web app needs no shell or `.env` edit.

Adding a connection, step by step, is in the
[site's docs](../connections.md#adding-one).

The catalogue is a fixed list in
`apps/app/src/lib/connections/catalog.ts`, not a hosted app directory.
Each entry is saved through an implemented adapter: a model provider,
`github`, `http` or `mcp`. Listed services are presets for those
adapters (for example Slack and GitLab as HTTP APIs; Linear, Stripe
and GitHub's MCP server as remote MCP). **HTTP API** and **Remote MCP
server** take any other endpoint. Context7, DeepWiki, Svelte and
Cloudflare Docs need no credential.

A connection check establishes only the access it tested. Checking a
TypeSafe connection makes a small classification request and can incur
provider usage.

### Models

A new provider needs a working adapter: a custom endpoint only changes
where one connects. Model keys stay on the server. The providers, and
which have been used, are in
[connections](../connections.md#model-providers). Model selection and
workspace model restrictions are in
[capabilities](capabilities.md#whats-built).

### GitHub

Two kinds of GitHub connection.

- **Token:** kept as any other sealed credential.
- **GitHub App:** Admin → Connections → GitHub App → Continue to
  GitHub registers a private App on the signed-in GitHub account from
  a manifest (`packages/connections/src/github-app.ts`): no webhook, a
  description saying what it is for, and permissions metadata, checks
  and statuses read, contents and pull requests write. GitHub returns
  a code to `/admin/github-app/created`, which exchanges it for the
  App's ID and private key; the web app seals the key at once and
  saves a `github` connection with `config.app`, then opens GitHub's
  install screen, where the repositories are chosen. GitHub returns to
  `/admin/github-app/installed`, and a worker checks the App. Both
  returns are browser redirects, so a local Werker needs no public
  address. The `installation_id` GitHub adds is not used: the worker
  finds the App's one installation itself.
- In the worker, an App's private key is swapped for an installation
  token (a JWT, then `POST /app/installations/<id>/access_tokens`),
  which Werker renews five minutes before it expires. A connection's
  repository names limit the token itself. `connection_request`, the
  gateway and hosted sandboxes' Git use it unchanged.

### HTTP APIs and MCP

A generic HTTP connection names its endpoint, authentication method
and optional test path. The HTTP check verifies the response status,
and fails when a JSON response body has `ok: false`. It does not read
other success fields or prove all action permissions.

Requests are relative to the saved endpoint. A remote MCP connection
adds protocol negotiation, tool discovery and tool calls. Service
credentials are resolved in the worker, not returned in tool schemas
or ordinary connection metadata.

## Credentials and sandbox access

Werker encrypts workspace credentials so that only a holder of the
installation master key can open them. The web app seals a credential
with the matching public key and cannot read it back; the worker holds
the master key, so it runs **Test connection** and every other use of
a stored credential. List, check and update responses never return
credentials, and replacing a key does not show the old one. A blank
key on edit keeps the existing credential, including when an
administrator changes its endpoint. Such an edit is saved first and
then checked by the worker, because the web app cannot open the
credential to check it beforehand; a failed check is reported and
recorded on the connection. Which service holds which key is in
[self-hosting](../self-hosting.md#which-service-holds-which-secret).
Instance-level sandbox keys are sealed the same way
([sandboxes](sandboxes.md)).

Endpoint URLs are visible metadata. The HTTP connector supports
credentials in headers, not in URL paths.

Sandbox Git operations go through a Git-aware gateway:

1. The worker grants a run access to a GitHub connection.
2. The sandbox receives its run-scoped gateway credential.
3. Git clone, fetch and push use the gateway's Git endpoint.
4. The gateway checks repository access and authenticates the upstream
   GitHub request. The GitHub token stays outside the sandbox.
5. Run cleanup removes the grant. Git entries also expire after 30
   seconds and are refreshed from current connection settings during
   lease renewal. Disconnecting or narrowing access therefore takes
   effect within that window even if a worker loses its connection. An
   already dispatched upstream operation may still finish.

Git smart HTTP has its own gateway endpoint. Redirects do not forward
a credential to another destination. The gateway is only on Docker
with gVisor ([sandboxes](sandboxes.md)). On Daytona and Docker Cloud
Sandboxes, the provider's own proxy adds a GitHub App connection's
installation token instead, and the sandbox holds a placeholder
([sandboxes](sandboxes.md)).

## Connection availability

Connections are workspace-wide. A task names the repository, account
or destination it needs. Factory member tool restrictions still apply.

The Code Mode tools are:

- `connections_list`: service connection IDs and metadata, no keys.
- `connection_request`: GitHub or HTTP requests with a method,
  relative path and optional JSON body.
- `mcp_list_tools` and `mcp_call_tool`: discover and call remote
  tools.
- `github_git`: command recipes for clone, fetch and push: through the
  gateway, or on Daytona and Docker Cloud Sandboxes through a GitHub
  App connection. Requires shell access; it does not install Git in
  the sandbox.

Mutating requests are not marked replay-safe.

Per-factory connection assignment is not built
([#15](https://github.com/werker-ai/werker/issues/15)).

## Notifications

Werker sending a message when a run finishes or needs an answer is not
built ([#39](https://github.com/werker-ai/werker/issues/39)). An agent
can send one through a connected service.

## Dependency-update factory

A daily dependency-update procedure (repo discovery, one parallel job
per repo, local checks, pushes, CI monitoring, repairs or reverts, a
grouped report) needs more than connections. One job per item is
built: a saved workflow's last step can run once per item the step
before lists, such as each open pull request, with jobs that read only
([once per item](agents-workflows-factories.md#once-per-item)). What
is missing: [#40](https://github.com/werker-ai/werker/issues/40).
