Use Connections in Steps
Experimental
Connections are experimental and off by default. Turn them on with experimental_connections: true in config.yaml, or DAGU_EXPERIMENTAL_CONNECTIONS=true. While they are off, a run that names a connection fails before its first step. See Turn Connections On.
A step names a connection in place of an Authorization header. Dagu takes a token that stays valid for at least 5 minutes, or for half its lifetime when the provider issues tokens that live under 10 minutes; a token without an expiry always serves. Dagu sends it only over HTTPS to the connection's bound hosts, refreshes it once when the server answers HTTP 401, never on a 403, and masks it in the step's logs, run status, and outputs. The run page shows the connection and account each step used.
Three places take a connection:
| Where | Field | Connection |
|---|---|---|
mcp.call | with.connection | mcp, or another with a url on its bound hosts |
http.request | with.connection | Any, with a url on its bound hosts |
| Token export | secrets with provider: connection | Any, when an admin allows export |
A connection name is a literal. connection: ${CONN} fails validation, since Dagu checks connections before the run starts and reads no connection record while it validates.
mcp.call
With an mcp connection, connection replaces url and the Authorization header. The step calls the connection's own MCP server:
labels:
- workspace=ops
steps:
- id: open_issues
action: mcp.call
with:
connection: tracker
tool: list_issues
arguments: { state: open }
output: ISSUES
- id: report
depends: open_issues
run: echo "${ISSUES.content[0].text}"With an oauth2 connection, set url to an MCP server on one of its bound hosts:
steps:
- id: search
action: mcp.call
with:
connection: work-api
url: https://api.example.com/mcp
tool: search
arguments: { query: dagu }url, when set, must be HTTPS on the connection's bound hosts. Anmcpconnection's only bound host is its server's host.servernames a service of a provider with presets. The generic providers have none: a run that setsserverbeside anmcporoauth2connection fails before its first step.headersmay still set other headers, but notAuthorization.- A 401 reports the token once, takes the token Dagu returns, refreshed only if the refused token was still the stored one, and sends the request again. A second 401 fails with kind
auth. - Redirects are never followed.
The output and the other fields are those of MCP Call.
http.request
With connection, the request carries the connection's token as Authorization: Bearer <token>:
labels:
- workspace=ops
steps:
- id: me
action: http.request
with:
connection: work-api
method: GET
url: https://api.example.com/v1/me
format: json
output: ME- The token goes only over HTTPS to one of the connection's bound hosts.
- A literal
urloff the bound hosts, or not HTTPS, fails the run before its first step. Aurlbuilt from a reference is checked when the step sends it, and fails the step before any request. - A redirect is followed only to HTTPS on the same host and port. Any other redirect fails the request, and its target receives no token.
- A 401 to the stored token refreshes it once and sends the request again. A 401 to that request is the step's response. A 401 after a redirect is not resent, since the server may have acted on the first request.
connectioncannot be combined withdebug: true,skip_tls_verify: true, anAuthorizationorHostheader, or acommandorargs. Validation fails.
The other fields are those of HTTP.
Checks Before the Run
Before its first step, and before its secrets resolve, a run checks every connection its DAG names:
- The name resolves in the run's workspace.
- A
serveris one of the connection's services. Anmcpconnection takes none. - A literal
http.requestURL is HTTPS and on the connection's bound hosts.
A failed check fails the run before its first step, naming the connection. The run reports every failed check together.
These checks read no tokens, so a pending or needs_reconnect connection passes them. Each step that uses it then fails. Steps that depend on that step do not run and are marked aborted. Steps that do not depend on it keep running. A provider: connection secret is the exception: secrets resolve once, before the first step, so such a connection fails the whole run.
Errors
| Error | Cause | Fix |
|---|---|---|
reconnect_required | The connection is pending or needs_reconnect, or its app is invalid. The step fails without calling the provider | Reconnect the connection. For an invalid app, an admin fixes the app's client ID or secret |
insufficient_scope | The server answered 403 with an insufficient_scope challenge. No refresh is tried | Add the missing scope to the connection, then reconnect |
rate_limited | The server answered HTTP 429 | Wait, or lower the request rate. See Rate Limits and Quotas |
confirmation_required | The MCP server asked a person to confirm the action | See Confirmation Requests |
In mcp.call, rate_limited and confirmation_required are error kinds. reconnect_required and insufficient_scope are the detail of an auth error, which also carries the connection's name and, for insufficient_scope, the missing scope:
{"error": {"kind": "auth", "message": "...", "connection": "tracker", "detail": "insufficient_scope", "scope": "issues:write"}}A rate_limited error carries the provider's message and, when the server sent one, retry_after as sent. Every mcp.call reports HTTP 429 as rate_limited, with or without a connection. A DAG that matched transport to catch rate limits must also match rate_limited.
In http.request, a connection that needs reconnecting fails the step before any request, with an error that names the connection. A 403 or 429 is the server's response: the step fails unless status_exit_codes maps the status.
A transient refresh failure, such as the provider's token endpoint returning HTTP 503, fails the call with the provider's error. The connection keeps its status, and the step's retry_policy applies.
Confirmation Requests
An MCP server may ask a person to confirm a sensitive action, such as sending a message or sharing a file, through MCP form elicitation. An MCP client that uses a connection advertises that it can show such forms. Dagu never accepts one on its own: only a person accepts one.
mcp.call has no person to ask. It declines the request at once and fails with kind confirmation_required. To let the action through:
- Approve it once with Try it on the connection page, or with
dagu connection callon a terminal. Both show the server's form and send your answer. Where the form offers to remember the approval, save it, so later calls pass. - Ask the MCP server's admin to change its confirmation rules.
- Call the provider's REST API with
http.requestand anoauth2connection, when the provider offers one. Confirmation requests belong to the MCP server.
Try it and dagu connection call call the tool anew. They do not resume the failed step, so check that call's result before you retry the run, or the action may happen twice.
Try It and Copy as Step
The Tools panel of the connection page lists each tool of an MCP connection, with its input schema. Developers of the workspace can:
- Try it: fill in a form built from the tool's input schema and call the tool once. A tool not marked read-only asks first. A confirmation request from the server is shown inline, and only the user who started the call can answer it.
- Copy as step: copy the tool as an
mcp.callstep that names the connection.
The CLI does the same:
dagu connection tools tracker --workspace ops
dagu connection call tracker --workspace ops --tool create_issue --args '{"title": "Disk full"}'dagu connection call prints the step's output as JSON. A tool not marked read-only is called only after a yes, or with --yes. --yes never answers the server's own form. Without a terminal, the command declines each form and fails with confirmation_required.
Limits of Try it and dagu connection call:
- Each request waits at most 50 seconds for the output or the next form. A slower tool fails with kind
timeout. - A call waiting for an answer is held for up to 10 minutes, by the server that took it. Behind several frontend replicas, an answer that reaches another replica fails with
call_not_found, and the page offers Call again. - A server holds at most 8 calls at once, 4 per user. Arguments or an answer over 64 KiB are refused. Output over 128 KiB, or responses over 192 KiB, fail with kind
too_large.
Tool lists are cached for 10 minutes per connection on each host, so the panel, dagu connection tools, and repeated reads cost the MCP server at most one listing per 10 minutes.
Starter DAG
After a sign-in, the connect dialog offers a starter DAG under Start from a template, and Create DAG saves it. The CLI prints it too: run dagu example to list the examples, find connection-mcp-call and its number, and pass that number with the connection's name:
dagu example # find the number of connection-mcp-call
dagu example <number> --connection trackerdagu example lists the starter DAG only when experimental_connections is on in the configuration it reads. Its number follows the built-in examples, so it changes when one is added.
The DAG takes the URL, tool, and arguments as parameters. For an mcp connection, URL is the MCP server's own URL, the one the connection was created with:
type: graph
params:
- name: URL
type: string
description: The MCP server's URL, on one of the connection's bound hosts
required: true
- name: TOOL
type: string
description: The tool to call. The connection page and dagu connection tools list them
required: true
- name: ARGUMENTS
type: string
description: The tool's arguments, as a JSON object
required: true
default: "{}"
steps:
- id: call
action: mcp.call
with:
connection: "tracker"
url: ${params.URL}
tool: ${params.TOOL}
arguments: ${params.ARGUMENTS}Rate Limits and Quotas
Providers limit requests per client or project, and often per account too. These docs state no provider's numbers: they differ per provider and change. Dagu reports the provider's errors as they come, and HTTP 429 as rate_limited. Check your provider's quota page and usage dashboard.
To estimate usage:
- A DAG that calls one tool every minute makes about 1,440 requests a day. Each
foreachitem and each retry is another request. - Listing an MCP server's tools costs one request per connection per 10 minutes on each host, and only while something reads the tool list.
- Token refreshes go to the provider's token endpoint, about once per token lifetime per connection on a host, however many runs use it.
To cap concurrent use of one account, put the DAGs that use the connection in a queue whose max_concurrency limits how many run at once. A per-account limit can be reached by many runs at once even within a daily quota.
queue: tracker-api
steps:
- id: open_issues
action: mcp.call
with:
connection: tracker
tool: list_issues
retry_policy:
limit: 3
interval_sec: 60Define the queue in config.yaml, as Queue Configuration shows. A retry_policy on mcp.call runs the tool again, so set one only for tools that are safe to call twice.

