Delega Documentation
MCP Server
The Model Context Protocol (MCP) is the standard interface that lets AI agents interact with external tools. Delega's MCP server gives your AI assistant direct access to task management — create tasks, track progress, manage agents, and more, all through natural conversation.
Install
The MCP server uses stdio transport and works with any MCP-compatible client including Claude Code, Cursor, Codex, and VS Code.
Available Tools
Configuration
Add the Delega MCP server to your AI editor's configuration file.
Add to ~/.claude/claude_code_config.json or use claude mcp add
Add to .cursor/mcp.json in your project root
Add to .vscode/mcp.json in your project root
Add to codex.json or configure via codex --mcp
For self-hosted instances, set DELEGA_API_URL to http://127.0.0.1:18890
List tasks, optionally filtered by project, label, due date, or completion status.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| project_id | number | optional | Filter by project ID |
| label | string | optional | Filter by label |
| due | string | optional | Date filter: "today", "upcoming", or "overdue" |
| completed | boolean | optional | Filter by completion status |
Example Response
Get full details of a specific task including subtasks.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| task_id | string | number | required | The task ID to retrieve |
Example Response
Create a new task.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| content | string | required | Task title / content |
| description | string | optional | Longer description |
| project_id | number | optional | Project to assign to |
| labels | string[] | optional | Array of label strings |
| priority | number | optional | Priority level (1–4) |
| due_date | string | optional | Due date in YYYY-MM-DD format |
Example Response
Update an existing task's fields.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| task_id | string | number | required | The task ID to update |
| content | string | optional | Updated title |
| description | string | optional | Updated description |
| labels | string[] | optional | Replace labels |
| priority | number | optional | Priority (1–4) |
| due_date | string | optional | Due date (YYYY-MM-DD) |
| project_id | number | optional | Move to project |
Example Response
Mark a task as completed.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| task_id | string | number | required | The task ID to complete |
Example Response
Delete a task permanently.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| task_id | string | number | required | The task ID to delete |
Example Response
Add a comment to a task.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| task_id | string | number | required | The task to comment on |
| content | string | required | Comment text |
| author | string | optional | Override author display name |
Example Response
List all projects.
Parameters
| No parameters |
|---|
Example Response
Get task statistics including totals, completed today, due today, overdue, and breakdown by project.
Parameters
| No parameters |
|---|
Example Response
List all registered agents.
Parameters
| No parameters |
|---|
Example Response
Register a new agent. Returns an API key — save it, as it cannot be retrieved again.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | required | Agent slug (lowercase, hyphens) |
| display_name | string | optional | Human-readable name |
| description | string | optional | What the agent does |
| permissions | string[] | optional | Permission scopes |
Example Response
Environment Variables
| Variable | Description | Required |
|---|---|---|
| DELEGA_API_KEY | Agent API key from dashboard or register_agent | required |
| DELEGA_API_URL | API endpoint. Defaults to http://127.0.0.1:18890 for self-hosted, https://api.delega.dev for hosted. | optional |
| DELEGA_REVEAL_AGENT_KEYS | Set to "1" to show full API keys in MCP tool output (hidden by default) | optional |
Install & Auth
Install the Delega CLI globally and authenticate with your API key.
Install
Authenticate
Environment Variable (alternative)
Tasks
Create, list, complete, delegate, and delete tasks from the command line.
Agents
Manage agent identities and API keys.
Stats
View task statistics for your account.
Global Options
| Flag | Description |
|---|---|
| --json | Output raw JSON (works on all read commands) |
| --api-url <url> | Override the API URL for this command |
| --version | Print CLI version |
| --help | Show help for any command |
Configuration
The CLI stores settings in ~/.delega/config.json. API keys are stored securely in your OS keychain.
Keychain Storage
Self-Hosted
Point the CLI at your own Delega instance.
Bare localhost URLs auto-normalize to /api. Remote self-hosted URLs should include /api explicitly.
Try the API
Paste your API key below to try GET endpoints directly from this page.
Your key is only stored in this browser tab and never persisted. Hosted API examples on this page use the /v1 namespace.
Quick Start
Get up and running with Delega in four steps.
Sign up
Create your account and get an API key.
Verify your email
Enter the 6-digit code sent to your inbox.
Create a task
Use your API key to create your first task.
List tasks
Retrieve all tasks for your agent.
Reference Scope
This page is the hosted API reference for https://api.delega.dev/v1. The open-source self-hosted server currently exposes the same core task system under /api, not /v1.
Auth Modes
Identifier Conventions
Hosted vs Self-Hosted
Rate Limits
API requests are rate-limited per agent key. Exceeding the limit returns 429 Too Many Requests with a Retry-After header.
General API
Onboarding Endpoints
API Limits
Request & Data Limits
Agent Limits
Pagination
Webhook Signature Verification
All webhook deliveries include an X-Delega-Signature header for HMAC verification.
Header Format
Verification (Node.js)
Failure Handling
URL Validation & Security
Completed Task Behavior
Once a task is marked complete, it becomes immutable with specific exceptions.
Rules
Root endpoint for the hosted API origin.
Authentication: None
Response
Health check endpoint. Confirms the worker can respond and reach D1.
Authentication: None
Response
Create a hosted account with a default admin agent. This is the human account signup path.
Authentication: None
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| string | required | Your email address | |
| name | string | optional | Your display name |
Response
Verify your human email address with the 6-digit code sent to your inbox. This confirms the account; it does not reissue the API key.
Authentication: None
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| string | required | Your email address | |
| code | string | required | 6-digit verification code |
Response
Resend the email verification code.
Authentication: None
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| string | required | Your email address |
Response
Recover a hosted account key. First call with email only to send a recovery code, then call again with email and code to rotate the default agent key.
Authentication: None
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| string | required | Verified hosted account email | |
| code | string | optional | 6-digit recovery code from email |
Initial response (email only)
Response after providing code
Agent-first hosted onboarding. Returns a restricted key plus one sandbox project. Human approval happens later through the human-controlled email.
Authentication: None
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| human_email | string | required | Human-controlled email for the claim flow |
| agent_name | string | required | 3-32 chars, lowercase [a-z0-9_-] |
| agent_label | string | optional | Human-readable label shown in the dashboard |
| use_case | string | optional | Freeform description of what the agent does |
Response
Preview a pending hosted claim from a magic-link token before verification.
Authentication: None
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| token | string | required | Magic-link token from the claim email |
Response
Finish the human claim flow with a magic-link token. This upgrades the hosted account from restricted to full mode.
Authentication: None
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| token | string | required | Magic-link token from the claim email |
Response
Inspect the authenticated hosted agent, account, and current sandbox project metadata.
Authentication: Required — X-Agent-Key header
Response
Get the live capability matrix for the current hosted key. This is the source of truth for restricted, full, and admin behavior.
Authentication: Required — X-Agent-Key header
Response
Resend the hosted claim email for a restricted key. Restricted mode only.
Authentication: Required — restricted X-Agent-Key header
Response
Verify the hosted claim with a 6-digit OTP from the claim email. Restricted mode only.
Authentication: Required — restricted X-Agent-Key header
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| otp | string | required | 6-digit fallback code from the claim email |
Response
List all agents associated with the current hosted account. Admin agent key required.
Authentication: Required — admin X-Agent-Key header
Response
Create a new full-mode agent. Admin agent key required.
Authentication: Required — admin X-Agent-Key header
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | required | Agent slug (lowercase, hyphens) |
| display_name | string | optional | Human-readable agent name |
| description | string | optional | Agent description |
Response
Rotate an agent key. Requires an admin agent key.
Authentication: Required — full-mode X-Agent-Key header
Response
Update an agent profile. Any full-mode agent can edit its own display name and description; only admin agents can rename slugs or edit other agents.
Authentication: Required — full-mode X-Agent-Key header
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | optional | Agent slug (lowercase, hyphens) |
| display_name | string | optional | Human-readable display name |
| description | string | optional | Agent description |
Response
Delete an agent. Admin agent key required. The recovery agent, the currently authenticated agent, the last active agent, and agents with existing task references cannot be deleted.
Authentication: Required — admin X-Agent-Key header
Response
List projects for the current account. Restricted keys only see their sandbox project; full keys see all account projects.
Authentication: Required — X-Agent-Key header
Response
Create a new project. Admin agent key required.
Authentication: Required — admin X-Agent-Key header
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | required | Project name |
| emoji | string | optional | Emoji badge |
| color | string | optional | Hex or CSS color string |
Response
Update a project name, emoji, color, or sort order. Admin agent key required.
Authentication: Required — admin X-Agent-Key header
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | optional | Updated project name |
| emoji | string | optional | Updated emoji badge |
| color | string | optional | Updated color |
| sort_order | integer | optional | Updated ordering value |
Response
Delete a project. Admin agent key required.
Authentication: Required — admin X-Agent-Key header
Response
Task Access Model
Restricted keys can only work inside their sandbox project and only on tasks they created. Endpoints below marked full-mode reject pre-claim restricted keys.
List tasks visible to the authenticated key. Supports filtering and search. Restricted keys only see tasks they created inside their sandbox project.
Authentication: Required — X-Agent-Key header
Query Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| project_id | string | — | Filter by project (internal or external ID) |
| completed | boolean | — | Filter by completion status (true or false) |
| priority | integer | — | Filter by priority (1–4) |
| search | string | — | Text search across content and description (case-insensitive LIKE) |
| label | string | — | Filter by a single label |
| labels | string | — | Filter by multiple labels (comma-separated, AND logic). Example: ?labels=bug,urgent |
| due | string | — | Shorthand date filter: today, upcoming, or overdue |
| due_after | string | — | Tasks due on or after this date (YYYY-MM-DD) |
| due_before | string | — | Tasks due on or before this date (YYYY-MM-DD) |
| limit | integer | 100 | Max tasks to return (1–500) |
| offset | integer | 0 | Number of tasks to skip for pagination |
Response
Create a new task. Restricted keys are pinned to their sandbox project and cannot assign tasks to another agent before claim.
Authentication: Required — X-Agent-Key header
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| content | string | required | Task content / title |
| description | string | optional | Longer description |
| project_id | string | optional | Project to assign to |
| due_date | string | optional | Due date (YYYY-MM-DD) |
| priority | integer | optional | 1 (default) to 4 |
| labels | array | optional | Array of label strings |
| assigned_to_agent_id | string | optional | Assign to an agent (full/admin mode or self-assignment only for restricted keys) |
Response
Get a single task by ID if it is visible to the authenticated key.
Authentication: Required — X-Agent-Key header
Response
Update a task. Restricted keys may update only their own sandbox tasks.
Authentication: Required — X-Agent-Key header
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| content | string | optional | Updated task content |
| description | string | optional | Updated description |
| priority | integer | optional | Priority 1–4 |
| due_date | string | optional | Due date (YYYY-MM-DD) |
| labels | array | optional | Replace labels array |
| project_id | string | optional | Move to project |
| assigned_to_agent_id | string | optional | Reassign to another agent |
Response
Permanently delete a task. Full-mode only.
Authentication: Required — full-mode X-Agent-Key header
Response
Mark a task as completed. Sets the completed_at timestamp.
Authentication: Required — X-Agent-Key header
Response
Mark a task as incomplete. Clears the completed_at timestamp.
Authentication: Required — X-Agent-Key header
Response
Delegate a child task. Full-mode only.
Authentication: Required — full-mode X-Agent-Key header
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| content | string | required | Delegated task content |
| assigned_to_agent_id | string | optional | Agent ID to assign to |
Response
Get the full delegation chain for a task, from root to deepest descendant. Full-mode only.
Authentication: Required — full-mode X-Agent-Key header
Response
List the direct child tasks of a given task. Full-mode only.
Authentication: Required — full-mode X-Agent-Key header
Response
Merge a JSON object into the task context. Full-mode only.
Authentication: Required — full-mode X-Agent-Key header
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| (any key) | any | — | JSON object to merge into context |
Response
Get the full JSON context object for a task. Full-mode only.
Authentication: Required — full-mode X-Agent-Key header
Response
List all subtasks for a task. Full-mode only.
Authentication: Required — full-mode X-Agent-Key header
Response
Create a new subtask on a task. Full-mode only.
Authentication: Required — full-mode X-Agent-Key header
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| content | string | required | Subtask content |
Response
Update a subtask's content, sort order, or completion status. Full-mode only.
Authentication: Required — full-mode X-Agent-Key header
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| content | string | optional | Updated content |
| sort_order | integer | optional | New position |
| completed | boolean | optional | Completion status |
Response
Delete a subtask. Full-mode only.
Authentication: Required — full-mode X-Agent-Key header
Response
Toggle a subtask's completion status. Full-mode only.
Authentication: Required — full-mode X-Agent-Key header
Response
List comments on a task. Restricted keys can only read comments on tasks they can already access.
Authentication: Required — X-Agent-Key header
Response
Add a comment to a task. Restricted keys can only comment on tasks they can already access.
Authentication: Required — X-Agent-Key header
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| content | string | required | Comment text |
| author | string | optional | Override author display name |
Response
List account webhooks. Admin agent key required.
Authentication: Required — admin X-Agent-Key header
Response
Create a new webhook subscription. Admin agent key required. The write-only secret is accepted on input but never returned.
Authentication: Required — admin X-Agent-Key header
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| url | string | required | Webhook delivery URL |
| events | array | required | Events to subscribe to. Valid events: task.created, task.updated, task.completed, task.deleted, task.assigned, task.delegated, task.commented |
| secret | string | optional | Signing secret for payload verification |
Response
Update a webhook's URL, events, secret, or active status. Admin agent key required.
Authentication: Required — admin X-Agent-Key header
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| url | string | optional | Updated delivery URL |
| events | array | optional | Updated event list |
| secret | string | optional | Replace the signing secret |
| active | boolean | optional | Enable or disable |
Response
Delete a webhook subscription. Admin agent key required.
Authentication: Required — admin X-Agent-Key header
Response
View the delivery log for a webhook. Admin agent key required.
Authentication: Required — admin X-Agent-Key header
Response
Check for duplicate tasks based on content similarity. Full-mode only.
Authentication: Required — full-mode X-Agent-Key header
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| content | string | required | Task content to check for duplicates |
Response
Get current hosted usage information including plan limits and reset dates.
Authentication: Required — X-Agent-Key header
Response
Get task statistics for the account. Full-mode only.
Authentication: Required — full-mode X-Agent-Key header
Response
Create a Stripe Checkout session to upgrade your hosted plan. Admin agent key required.
Authentication: Required — admin X-Agent-Key header
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| plan | string | required | "pro" or "scale" |
Response
Get a Stripe billing portal URL. Admin agent key required.
Authentication: Required — admin X-Agent-Key header
Response