Connector reference
Connectors link a module to Slack, Google Workspace or an MCP server. The host owns the OAuth flows, token storage and refresh. A module declares what it needs and calls named operations. For the user-facing view, see Connectors.
In a module
Section titled “In a module”Declare each connector in the manifest (see defineModule), then use ctx.connectors in a stage:
codeStage('notify', async (ctx) => { const channel = ctx.config.slackChannel as string | undefined; if (!channel || !ctx.connectors.has('slack')) return { notified: false }; // optional connector await ctx.connectors.get('slack').call('chat.postMessage', { channel, text: 'Published.' }); return { notified: true };}, { requires: ['slack'] }),| Method | Behavior |
|---|---|
has(name) |
True when the connector is connected for this run’s user (or the workspace). Check it before using an optional connector. |
get(name).call(operation, params) |
Runs one operation. Throws ConnectorNotConnectedError if it is not connected. |
ConnectorUnavailableError (reason needs_reauth or missing_scopes) means the connection exists but cannot be used. The executor turns both into a blocked run rather than a failure.
Every call is recorded in the run timeline as connector.call, with the connector and operation. Arguments are not stored.
Blocking
Section titled “Blocking”Name connectors a stage needs in its requires list. Before each stage, the executor checks whether those connectors are usable. If not, the run goes to blocked with the reasons (not_connected, needs_reauth, missing_scopes) and continues by itself when the connection is fixed. A stage that fails because a connection died mid-call is blocked, not failed.
Operations
Section titled “Operations”Modules call a fixed set of operations. Each is checked against the granted scopes before the request. Adding an operation means a change to the connectors package.
Entering credentials in the dashboard
Section titled “Entering credentials in the dashboard”A connector that needs an OAuth app shows an App credentials panel on its page. An admin follows the steps listed there (they include this host’s redirect URL), pastes the Client ID and secret, and saves. Nothing is restarted: people can connect straight away, and runs that were waiting because the connector was not set up continue.
- Credentials are stored encrypted with the vault key (
KNETIK_SECRET_KEY), one sealed record per connector. The secret is never shown again; the page shows a mask, and saving with the mask left alone keeps the stored value. - If the server’s environment provides the credentials, those win and the page says so; they cannot be changed from the dashboard.
- Only an admin can save or remove them. Removing them does not disconnect anyone, but connections made with that app can no longer refresh.
- A connector declares its own fields and steps, so every connector added later gets the same panel.
| Operation | Needs one of |
|---|---|
chat.postMessage, chat.update |
chat:write |
reactions.add |
reactions:write |
conversations.list, conversations.info |
channels:read, groups:read, im:read, mpim:read |
users.lookupByEmail |
users:read.email |
users.info |
users:read |
auth.test |
no scope (used by Test connection) |
Google Workspace
Section titled “Google Workspace”Ten named operations, each with the scopes it accepts: drive.about.get and oauth.userinfo (used by Test connection), drive.files.list, drive.files.get, drive.files.create, drive.files.upload, Sheets values get and append, and Gmail list and send. Mail is assembled server-side so a module cannot inject headers, and path parameters are URL-encoded.
Modules call tools/list and tools/call on the server. Agents get the server’s tools mounted with useMcpConnector (see Agents).
Test connection
Section titled “Test connection”POST /api/connections/:id/test checks that a connection still works with one read-only call. It goes through the same call path stages use (ctx.connectors), so token refresh, vault decryption and needs_reauth handling are shared, not copied. See the API reference.
| Provider | Call | detail reads |
|---|---|---|
| Slack | auth.test (needs no scope) |
Acme workspace |
| Google Workspace | Drive about.get with fields=user (works under drive.metadata.readonly) |
the account email |
| MCP server | tools/list |
3 tools |
A Google connection with no Drive scope (Gmail or Sheets only) is tested with the OpenID userinfo endpoint instead, which needs only the identity scopes every connection requests.
Rules: a member may test their own connection and an admin any; one test per connection every 5 seconds (429 after that); only where connections exist (hosted, with a vault key). The result is { ok, checkedAt, latencyMs, detail, error? }, short text only: never a token, never the provider’s raw reply. The last result is stored (table knetik_connection_tests, migration core-007) and shown on the connection as lastTest.
Setting up a deployment
Section titled “Setting up a deployment”Connectors need a vault key and, per provider, an OAuth app. They also need sign-in to be enabled, so they are not available in local mode.
The vault key
Section titled “The vault key”node packages/cli/src/bin.ts keygenSet the printed KNETIK_SECRET_KEY. Tokens are encrypted with AES-256-GCM, and each secret is bound to its connection id, so a blob copied to another row will not decrypt. Back the key up: losing it means every connection must be authorized again. Without a key, connectors are off and nothing is ever stored in the clear.
To rotate, set a new KNETIK_SECRET_KEY and KNETIK_SECRET_KEY_ID, and keep the old one in KNETIK_SECRET_KEYS_PREVIOUS as id:base64 (comma separated). Old keys keep decrypting. There is no command to re-encrypt secrets under a new key yet.
Entering credentials in the dashboard
Section titled “Entering credentials in the dashboard”A connector that needs an OAuth app shows an App credentials panel on its page. An admin follows the steps listed there (they include this host’s redirect URL), pastes the Client ID and secret, and saves. Nothing is restarted: people can connect straight away, and runs that were waiting because the connector was not set up continue.
- Credentials are stored encrypted with the vault key (
KNETIK_SECRET_KEY), one sealed record per connector. The secret is never shown again; the page shows a mask, and saving with the mask left alone keeps the stored value. - If the server’s environment provides the credentials, those win and the page says so; they cannot be changed from the dashboard.
- Only an admin can save or remove them. Removing them does not disconnect anyone, but connections made with that app can no longer refresh.
- A connector declares its own fields and steps, so every connector added later gets the same panel.
The easiest way to create the Slack app is the manifest on the Slack page of the dashboard: in Slack choose Create New App, then Paste a manifest, and paste it. It already carries this host’s redirect URL (${KNETIK_BASE_URL}/connectors/slack/callback) and the bot scopes the installed modules ask for. (Slack no longer offers a “from scratch” option; Pick features works too, but then you add the redirect URL and scopes by hand.) If a module later asks for more scopes, copy the new manifest, update the app and reconnect.
Invite the bot to the channels it posts in. Slack does not let a bot post in a channel it has not joined: the post fails with not_in_channel. In each channel type /invite @Knetik (private channels always need this).
Give Knetik the app’s Client ID and secret either in the environment (SLACK_CLIENT_ID, SLACK_CLIENT_SECRET) or, as an admin, on the Slack page of the running dashboard (see below).
Create a Google OAuth client (web application) with redirect URI ${KNETIK_BASE_URL}/connectors/google/callback, and give Knetik its ID and secret (environment: GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET; or the dashboard, see below). Authorization uses the code flow with PKCE, offline access and consent.
An admin can only connect an MCP server that an installed module names. Knetik identifies itself to a server in one of three ways:
- Dynamic client registration. Servers that offer it need nothing from you.
- A pre-registered client, for servers without registration: set
KNETIK_MCP_CLIENTSto JSON keyed by server origin, such as{"https://mcp.example.com":{"clientId":"...","clientSecret":"..."}}. - A hosted client metadata document at
/.well-known/oauth-client/knetik, whenKNETIK_MCP_CIMD=1and the base URL is https.
MCP server URLs go through an SSRF guard: https only, no private, loopback or link-local addresses, no credentials in the URL.
Per user and per workspace
Section titled “Per user and per workspace”A connection belongs to a user, or to the whole workspace (admins only). A run uses its starter’s connection, else the workspace one.
Known limits
Section titled “Known limits”- No Slack interactivity (approvals or picks from Slack buttons), which needs a public endpoint and request signing.
- MCP servers cannot be added at runtime, only through a module manifest.
- A connection is shared by every module using the provider.
- No usage limits on connector calls; they are audited but not rate-limited.
- An MCP server that revokes an access token before it expires can leave an agent running without that server’s tools. Expiry and refresh-token revocation are handled by blocking the run.
- Connection state is mirrored in memory per instance; run one instance.