Skip to main content

Building a connector

A connector gives the agent the tools of another service, such as searching a team's documents or filing an issue in a tracker. Technically it is a remote tool server that speaks MCP (the Model Context Protocol) over HTTPS, outside the task's sandbox. The gateway calls it on the agent's behalf and adds the credential itself, so the agent never holds a key. This page is for whoever builds or registers such a server; the settings pages describe the form an administrator fills in (Connectors).

Not yet run on a real install. The commands and requests on this page are written from the code and the API's description and have not been run against an installation yet. Each block says so until it has been.

What exists, and what does not​

  • Static credentials only. The gateway sends no credential, a bearer token, or one header (Authorization, X-Api-Key or another X- header). There is no OAuth sign-in: a server that accepts only OAuth (an authorization-code flow with consent and refresh) cannot be connected.
  • Remote servers only. A connector is reached over HTTPS through the gateway. A program that runs inside the sandbox is a tool server, set up differently (Extensions).
  • Tools only. The gateway forwards initialize, notifications/initialized, ping, tools/list, tools/call and notifications/cancelled. Anything else a server offers (resources, prompts, sampling) is refused with the JSON-RPC error -32601.
  • No connector ships with the product, and there is no catalogue of tested connectors: the catalogue of tested extensions and its checker (tools/ext-check) cover tool servers that run in the sandbox (mcp stdio), not remote connectors.

What your server must do​

  • Speak MCP's streamable HTTP transport at one https:// address: POST for requests, an optional GET stream, and DELETE to end a session.
  • Answer within the connector's call timeout (60 seconds by default, at most 600). A longer call is cut with 504 connector_timeout, and the gateway sends your server notifications/cancelled.
  • Keep each JSON answer, or each server-sent event, at most 1 MiB. A larger answer fails with 502 connector_answer_too_large.
  • Answer where it is asked. The gateway never follows a redirect (502 connector_redirect).
  • Be reachable at a public address. The gateway resolves the host once and refuses a loopback, private, link-local or other reserved address, unless the address is written as an IP literal. A server on the installation's own network can be seeded from the file with plain http or a private certificate authority (below), never through the API.

What reaches your server, and what does not:

  • Only Content-Type, Accept, MCP-Protocol-Version and the session header go out to it, with the credential. The task's run token, cookies and the gateway's own headers never do.
  • Only Content-Type and the session header come back to the sandbox. Your Set-Cookie and authentication challenges are dropped.
  • The session id the sandbox sees is the gateway's own, mapped to yours: a task never sees your server's session id. The gateway keeps at most 8 sessions per task and drops one after 10 minutes idle. After a gateway restart, clients start a new session.

Credentials​

The gateway picks the credential for each call in this order: the task owner's own key for the connector, then the connector's shared key, then none.

  • A shared key is a secret an administrator stores under Keys › Shared and names in the connector (secret_ref). The key must also list the connector among the routes and connectors allowed to use it (Who may use a shared key).
  • A person's own key is added under Settings › Keys (Keys for connectors). It is bound to the connector's address: if the connector moves to another server, or is deleted and made again, the old key no longer applies.
  • A required credential: with A credential is required set, a call with no credential fails with 424 connector_credential_missing. When a person's own key is refused by your server (401 or 403), the task is told 424 connector_credential_rejected, so the person checks their key.
  • Values are read from the gateway's secret store for every call, so a rotation applies at once. They never appear in logs, events or errors.

What a connector can do is what its credential allows. The gateway does not ask before a call (there are no approvals, ADR-0035), so give a connector a least-privilege credential, and offer only the tools the agent needs with the tool filter.

Register it​

An administrator registers a connector on the Connectors settings page, or through the API with a signed-in session or an administrator's API token:

# Not yet run on a real install.
curl -sS -X PUT "$TQA_URL/api/v1/admin/connectors/tracker" \
-H "Authorization: Bearer $TQA_TOKEN" -H "Content-Type: application/json" -H "Idempotency-Key: $(uuidgen)" \
-d '{"display_name": "Issue tracker", "url": "https://mcp.tracker.example.com/mcp",
"auth": {"scheme": "bearer", "required": true}, "secret_ref": "secrets/tracker-token",
"tools": {"allow": ["search_issues", "create_issue"]}, "call_timeout_seconds": 60,
"enabled": true, "enabled_by_default": false}'
  • The name (tracker) is lowercase letters, digits and _, at most 16 characters, and is shared with the tool servers' names. It cannot be changed later.
  • The address is https, at most 2 KiB, with no user name, password, fragment or credential-like query key. Put a credential in a secret, never in the address.
  • A replace sends the version the last read returned.
  • Limits and audit: there are at most 64 connectors, and every change is audited without values.
  • Allowing the shared key (binding it to the connector) needs a signed-in browser session: PUT /api/v1/admin/secrets/{name}/consumers, or Allow it for … in the form.

The same fields can be seeded from gateway.toml. Two fields are allowed only there: insecure_http (plain http) and ca_file (a private certificate authority), for test and on-premises servers:

# Not yet run on a real install.
[[connectors]]
name = "tracker"
url = "https://mcp.tracker.example.com/mcp"
auth = { scheme = "bearer", required = true }
secret_ref = "secrets/tracker-token"
tools = { allow = ["search_issues", "create_issue"] }
call_timeout_seconds = 60
enabled = true
enabled_by_default = false

How tasks get it​

  • A task uses only the connectors in its own set. A new task starts with the enabled connectors marked Offer in new tasks, or those its agent profile names. A task has at most 8 connectors and tool servers together.
  • The gateway refuses a connector the task's set does not hold with 403 connector_not_allowed. It filters tools/list by the connector's allow or deny list, and refuses a call to a filtered tool with -32602.
  • Turning a connector off applies at once, also to running tasks. A deleted or disabled connector stays in a task's set but is left out of its next session.
  • The agent sees your tools as mcp__<connector>__<tool> (folded to lowercase letters, digits and _, at most 64 characters).
  • Everything your server returns reaches the model marked as untrusted content, so a tool's text can inform the agent but cannot pose as its instructions.

Limits on use​

The gateway counts every message it forwards against the person's limit, calls_per_minute under [mcp] in gateway.toml (60 by default, also on the Limits page). Beyond it a task is answered 429 rate_limited with Retry-After. Each task may have 4 calls in flight to one connector, and the gateway 256 in all (429 connector_busy).

When a call fails​

The task's tool result names the gateway's code first, such as connector_timeout: …. The codes are connector_not_allowed, connector_credential_missing, connector_credential_rejected, connector_busy, rate_limited, connector_unavailable, connector_redirect, connector_answer_too_large and connector_timeout. An error your server returns is passed on as it is, marked mcp_error. Administrators find a WARN line in the gateway's log for each failure, with the connector, the method and the reason, never the credential.