<!-- source: https://docs.dreamlake.ai/agents/apps @ 0.1.192 b2f973b1 -->
# Connected agent apps

Connect a personal Slack or Plaud account, explicitly grant DreamLake's built-in agent access, and enable **Apps** in the composer for the turns that should use it. Existing project access and the general tool-write switch do not grant access to these accounts.

This feature requires the Connection v1 backend and configured provider OAuth clients. Until operator setup and a successful provider sign-in, the Apps screen shows **setup required**. Implementation tests use synthetic accounts and MCP fixtures; they are not evidence of a completed live provider connection.

## Connect in the app

1. Use `/go My connections` to open **Assistant connections**, then find **Apps for your agent**. The canonical route is `/<personal-namespace>/builtin-agent/connections`.
2. Choose Slack or Plaud, review the access description and sign in through the provider.
3. Select **Allow agent reads**, then **Check connection**. A successful check verifies sign-in and supported tool discovery; it reads no account content.
4. Enable **Apps** in the composer and ask a question, such as “Summarize my recent Plaud meeting and find related Slack discussion.”

Slack read consent includes accessible public/private conversations, direct messages and files. This version has no channel allowlist: use an account whose provider permissions match the intended scope. Plaud reads synced recordings, transcripts and existing summaries; recordings need Plaud cloud sync. No Plaud editing or deletion is exposed.

For Slack messages, separately select **Authorize Slack sending** and **Enable reviewed sends**. The agent can then prepare a proposal. Review the account, exact destination, thread and message in Apps, and select **Send this exact message**. Preparing a proposal does not send it. Sending consent is separate from read access.

## CLI and tools

The CLI reuses server-owned Connection OAuth. It never receives provider access or refresh tokens.

```bash
dl connection oauth create --connector slack-mcp --label "Work Slack" --access read
dl connection oauth create --connector plaud-mcp --label "My Plaud" --access read
dl apps list --json
dl apps grant <connection-id>
dl apps check <connection-id> --json
dl apps tools <connection-id> --json
dl apps read <connection-id> <read-tool> --input-file query.json --json
```

Use a personal `--namespace` if the active namespace is an organization. Discover current tool argument schemas before constructing the JSON object. Inputs are limited to 16 KiB.

```bash
dl connection oauth reconnect <connection-id> --connector slack-mcp --access read-write
dl apps grant <connection-id> --send
dl apps prepare <connection-id> slack_send_message --input-file message.json --json
dl apps receipt <action-id> --json
dl apps confirm <action-id>
dl apps cancel <action-id> --json
dl apps revoke <connection-id>
```

CLI confirmation displays the exact action and defaults to declining. It requires an interactive terminal and rejects `--json`; there is no unattended `--yes`. The TypeScript client exposes the same app APIs for callers that obtain human authorization themselves. See the [CLI app reference](https://cli.dreamlake.ai/apps) for the command contract.

The model receives four tools:

| Tool | Behavior |
| --- | --- |
| `dreamlake_apps_list` | List personal app connections and explicit grants. |
| `dreamlake_apps_tools` | Discover reviewed tool names and argument schemas. |
| `dreamlake_apps_read` | Execute an allowed read tool. |
| `dreamlake_apps_prepare_action` | Save an encrypted Slack proposal and return its review link. |

There is no model tool to grant access, sign in, or confirm sending. Generic resource tools exclude the `/agent` API family, so they cannot invoke app confirmation indirectly. App content and provider descriptions are untrusted data, not instructions or authorization.

## Receipts, revocation and recovery

A proposal expires after ten minutes. Confirmation is bound to its owner, namespace, connection, grant revision, connection revision, credential version, tool schema and payload hash. A database claim allows at most one dispatch. Changed access or schema invalidates the proposal.

A timeout, provider error after dispatch, or lost completion record produces an **uncertain** outcome. Check the saved receipt and Slack before preparing another proposal. There is no automatic write retry. An interrupted process can leave a sending record; after a minute the review interface reports it as uncertain. Terminal receipts remain durable and are stored encrypted; no automatic receipt retention cleanup is configured in this version.

Revoking a grant stops future access and suppresses a read result if access changes while the request runs. Disable/delete the underlying account through Connections to stop all its consumers. Content already saved in a conversation or memo remains there. The catalog displays up to 100 accounts and the 20 most recent actions; known action IDs remain reviewable directly.

## Operator setup

Use the existing Connection v1 OAuth, encryption keyring, secret store, callback configuration and renewal infrastructure. Configure clients through deployment environment secrets, not a UI text field or command-line token argument. Both deployment workflows pass the four `*_MCP_CLIENT_*` secrets to the server. Missing configuration keeps that provider in **setup required**. These clients are separate from the native Slack login client; do not reuse its tokens or assume its registered callback covers MCP.

| Provider | Fixed MCP endpoint | Required deployment configuration |
| --- | --- | --- |
| Slack | `https://mcp.slack.com/mcp` | `SLACK_MCP_CLIENT_ID`, `SLACK_MCP_CLIENT_SECRET` |
| Plaud | `https://mcp.plaud.ai/mcp` | `PLAUD_MCP_CLIENT_ID`; `PLAUD_MCP_CLIENT_SECRET` if issued for the registered client |

Register each exact callback under the deployment's configured public API origin:

- `/api/connections/oauth/slack-mcp/callback`
- `/api/connections/oauth/plaud-mcp/callback`

Slack requires an eligible registered application; it does not support dynamic client registration for this MCP flow. Plaud advertises registration metadata, but this implementation expects an operator-registered client and does not auto-register one for each user. Clients must support S256 PKCE and the configured callback. Plaud clients must accept `client_secret_post` or public-client token requests; `client_secret_basic`-only clients are not supported here.

Consult [Slack's official MCP documentation](https://docs.slack.dev/ai/slack-mcp-server/) and [Plaud's official MCP documentation](https://docs.plaud.ai/plaud-mcp-cli/mcp) for provider eligibility and registration. Provider configuration and current accounts must be verified before claiming live readiness.

Slack read authorization requests `search:read.public`, `search:read.private`, `search:read.im`, `search:read.mpim`, `search:read.files`, `search:read.users`, `channels:history`, `groups:history`, `im:history`, `mpim:history`, `channels:read`, `groups:read`, `im:read`, `mpim:read`, `files:read`, `users:read`, and `canvases:read`. The `read-write` profile adds `chat:write`. Actual returned consent is checked again before writes. If a refresh response omits scope, sending fails closed and requires renewed consent.

Deploy the backend before UI/CLI consumers. Generate the Prisma client during the build. In production, use the reviewed-main **Schema indexes (manual, scoped)** workflow with scope `builtin-agent`: inspect its read-only plan, then apply its exact database-bound plan hash. This scope includes the unique `AgentAppGrant(userId, connectionId)` index, the `AgentAppGrant(namespaceId, userId)` lookup index, the `AgentAppAction(userId, createdAt)` receipt index, and existing built-in-agent indexes. Review every proposed addition before applying. Production deployment refuses to create missing indexes as a side effect; the Connection startup gate also verifies them before serving traffic. `pnpm db:ensure-indexes` is for a separately verified local/development database, not a substitute for the production plan/apply workflow.

Supported transport is Streamable HTTP to the fixed provider endpoint, with redirects rejected, a 25-second session budget, bounded pagination, and a 256-KiB response cap. Tool names are statically reviewed. Provider schemas with remote references, regular-expression validation, excessive depth or size are excluded. Unknown tools do not become available merely because discovery returns them.

The live acceptance sequence is: provision clients and callbacks; sign in to a test account; verify discovery; run one read; revoke and confirm refusal; reconnect with explicit Slack sending consent; prepare and inspect one message in an authorized test channel; confirm once and verify its receipt and provider result. These final provider checks require the registered clients and consenting accounts.
