Skip to content
Documentation menu

Build on it

MCP server

Connect Claude Code, Claude Desktop, Cursor or VS Code to your DL2App links through the hosted Model Context Protocol server.

DL2App hosts a Model Context Protocol server at /api/mcp on the dashboard’s host. It lets a coding agent or assistant list, create, change and archive links and read analytics, with the same keys, scopes, limits and errors as the REST API.

Connect

Authentication is a secret key in a header: Authorization: Bearer sk_live_…. Create the key under API keys in a project. Its scopes decide what the assistant can do: a key without links:write can only read.

Claude Code

Run in a terminal. Add --scope user to use it in every project.

claude mcp add --transport http dl2 https://portal.dl2.app/api/mcp \
  --header "Authorization: Bearer sk_live_…"

Claude Desktop

Settings → Developer → Edit Config (claude_desktop_config.json), then restart Claude Desktop.

{
  "mcpServers": {
    "dl2": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://portal.dl2.app/api/mcp",
        "--header",
        "Authorization:${DL2_AUTH}"
      ],
      "env": {
        "DL2_AUTH": "Bearer sk_live_…"
      }
    }
  }
}

Claude Desktop's built-in connectors sign in with OAuth, which DL2App doesn't have yet, so this uses the mcp-remote bridge (needs Node.js) to send the key as a header.

Cursor

.cursor/mcp.json in your project, or ~/.cursor/mcp.json for every project.

{
  "mcpServers": {
    "dl2": {
      "url": "https://portal.dl2.app/api/mcp",
      "headers": {
        "Authorization": "Bearer sk_live_…"
      }
    }
  }
}

VS Code

.vscode/mcp.json in your workspace. VS Code asks for the key once and stores it.

{
  "servers": {
    "dl2": {
      "type": "http",
      "url": "https://portal.dl2.app/api/mcp",
      "headers": {
        "Authorization": "Bearer ${input:dl2-key}"
      }
    }
  },
  "inputs": [
    {
      "type": "promptString",
      "id": "dl2-key",
      "description": "DL2App secret key (sk_live_…)",
      "password": true
    }
  ]
}

The command-line tool prints the same configuration with your key filled in: dl2 mcp config --client cursor.

Transport

Streamable HTTP, request and response only: POST /api/mcp with one JSON-RPC 2.0 message, or a batch, returns one JSON answer. There is no event stream (GET answers 405) and no session, so any request can stand alone. Protocol versions: 2025-11-25, 2025-06-18, 2025-03-26, 2024-11-05.

Tools

There is one tool for each REST endpoint, generated from the same list as the API reference, plus a few shortcuts for assistants.

ToolScopeKindWhat it does
list_projectslinks:readreadProjects the key can see, newest first.
get_projectlinks:readreadOne project with its link hosts, a summary of its iOS and Android apps, and how many links it has.
list_linkslinks:readreadA project's links, newest first.
create_linklinks:writewriteCreates one link.
create_links_bulklinks:writewriteCreates up to 1,000 links in one request.
get_linklinks:readreadOne link by id.
update_linklinks:writewrite, destructiveChanges only the fields you send; the rest stay as they are.
archive_linklinks:writewrite, destructiveArchives the link: it stops redirecting and disappears from lists, and its click history is kept.
get_link_statsanalytics:readreadTotals, a daily series and breakdowns for one link.
get_project_statsanalytics:readreadThe same figures across the whole project, plus its ten most-clicked links and the clicks on paths that aren't links (passthrough).
get_project_healthlinks:readreadThe most recent result of each check on each of the project's hosts.
create_campaign_linkslinks:writewriteCreates one link per channel for a campaign: the same destination each time, a different set of UTM tags.
find_linkslinks:readreadSearches a project's links with everyday filters; every filter given must match.
explain_linklinks:readreadSays where a link sends each kind of visitor (iPhone, iPad, Android, in-app browsers, desktop, link previews), after applying the project's defaults and which apps are set up.
qr_codelinks:readreadReturns the QR code for a link as SVG, drawn with the design saved for it in the dashboard (or the default look).

Safety

  • Dry runs. Every write tool takes dry_run. With it, nothing is written and the result says what would change: the links that would be created, a field-by-field diff for an update, or the link and its recent clicks for an archive. create_links_bulk, archive_link, create_campaign_links are dry runs unless you send dry_run: false.
  • Scopes. Write tools need links:write, dry run or not. Stats tools need analytics:read.
  • Annotations. Tools carry readOnlyHint, destructiveHint and idempotentHint, so a client can ask before the destructive ones.
  • Retries. Write tools take idempotency_key; a repeat within 24 hours returns the first result.
  • Small results. Lists return compact rows, 25 at a time, with next_cursor.
  • Errors. A failed call has isError: true and the API’s error code, a message and a suggested next step.

Resources and prompts

  • dl2://projects: the projects the key can use.
  • dl2://projects/{project_id}/settings: one project’s hosts, apps, default routing, deferred deep linking and link-preview defaults.
  • Prompt launch_campaign: Plans and creates a set of tracked links for one campaign, with a dry run first.
  • Prompt audit_broken_links: Checks a project's host health and looks for links that are disabled, expired, flagged or pointing nowhere useful.
  • Prompt weekly_link_report: Summarises the last seven days of clicks, app opens and installs for a project.
MCP server · Docs · DL2App