# Task automation: the CLI, GraphQL API, or MCP

*Updated 2026-09-22 · Published 2026-07-24 · Matthew Blode*

Which Done Bear interface to use for cron jobs, CI, direct HTTP integrations, or AI agents, with working examples for the CLI, the GraphQL API, and MCP.

---

> **TL;DR:** Use the `donebear` CLI for shell scripts and cron, the GraphQL API at `api.donebear.com/graphql` for application integrations, or the hosted MCP server for AI assistants. CLI and GraphQL automation authenticate with an API key, and MCP clients sign in with OAuth. Every change lands in the same synced workspace.

In Done Bear the terminal, the API, and AI agents talk to the same server-sequenced sync engine the apps use. A task filed by a cron job syncs to your phone like one you typed.

Pick the interface that suits the caller. The CLI and GraphQL API share an API key. MCP uses an interactive OAuth sign-in, so an assistant acts as the signed-in user.

## Choose the interface before the credential

Create an API key once from the CLI:

```
donebear api-key create "Automation"
export DONEBEAR_TOKEN=<token>
```

That `db_` key authenticates the first two surfaces. MCP clients use OAuth instead:

- The [CLI](/cli) for shell scripts, Git hooks, and cron. `DONEBEAR_TOKEN` replaces the browser login, and `--json` output pipes straight into your tooling.
- The [GraphQL API](/docs/api/graphql) for direct HTTP from any language. Reads and writes for tasks, projects, teams, labels, and workspaces.
- The [hosted MCP server](/mcp/clients) for AI agents like Claude and ChatGPT, which get structured tool calls over OAuth.

If the terminal itself is the destination, read the [CLI task manager guide](/blog/cli-task-manager-for-automation) instead. This one is about the wider choice between a shell, direct HTTP, and an assistant. If you are still choosing the task manager itself, the [task manager comparisons](/compare) set Done Bear against Todoist, TickTick, and Things 3.

## Capture from CI and Git hooks

Capture is where automation pays off: a failed check becomes a task someone will see, where a log line gets skimmed past. The CLI takes its token from the environment, so a CI step can file a task when a build breaks:

```
donebear task add "Dependency audit failed on main" \
  --when today \
  --description "npm audit flagged a high-severity advisory" \
  --json
```

Pin the workspace with `--workspace <slug>` so the job never relies on someone’s default. With `--when today` the task lands in Today on every device.

## Schedule reports with cron

`--total` prints only a count, which suits scheduled jobs:

```
0 8 * * 1-5 DONEBEAR_TOKEN=$DB_KEY \
  donebear search "overdue" --total >> ~/standup.log
```

`donebear search` matches titles and descriptions, so this counts tasks that mention “overdue”. Send the number to a status bar, a Slack webhook, or a morning standup file, with no output to parse.

## Read over HTTP with GraphQL

For direct HTTP from any language, POST to the GraphQL endpoint with the same key:

```
curl https://api.donebear.com/graphql \
  -H "Authorization: Bearer $DONEBEAR_TOKEN" \
  -H "Content-Type: application/json" \
  --data '{"query":"query { viewer { id email } }"}'
```

The endpoint supports Relay-style pagination and workspace-scoped filters. The GraphQL reference has the task, project, and workspace queries.

## Hand it to an agent

If your assistant speaks MCP, the hosted server lets it triage your Inbox and file follow-ups once you’ve signed it in. If it runs shell commands instead, install the agent skill so it drives the CLI without guessing:

```
npx skills add donebear/skills -g --all -y
```

Either way it works against the same live workspace you do.

## Every surface sees the same list

You can trust automation when every surface sees the same list. The Done Bear apps are [local-first](/blog/local-first-task-manager): writes commit locally, then reconcile through real-time sync, a teammate’s edits in a shared workspace included. A task created by a script, an API call, or an agent lands in that same list, never in a copy.

## Install the CLI

```
npm install -g donebear
donebear api-key create "Automation"
```

The [automation guide](/automation) and the [API docs](/docs/api) cover every command and query. Free up to 250 tasks. [See pricing](/pricing).

---

Every Done Bear page is listed at https://donebear.com/llms.txt. Any page has a markdown copy at its URL plus `.md`. Start from the map rather than guessing a path.
