# Connect an AI assistant

For designers and integrators.

The 3DAPI MCP server lets an AI assistant use your account through this API: read and edit products, orders, stocks and extras as a designer, quote files and order prints as an integrator. It runs on your computer and uses your API key.

## Create a key for the assistant

Create a separate key on the API keys page of your dashboard (designers: [https://dapi.digital/dashboard/public-api-keys](https://dapi.digital/dashboard/public-api-keys), integrators: [https://dapi.digital/integrator/api-keys](https://dapi.digital/integrator/api-keys)), with only the scopes you want the assistant to use: read scopes for read tools, write scopes (for example `products:write` or `orders:write`) for the matching write and money tools. You can revoke it at any time without touching your other integrations. Right after you create a key, the dashboard shows these install steps with the key already filled in.

Tool results are sent to your AI assistant and the model behind it. Buyer names, emails and addresses on orders are included only when the key has `orders:read_customer` (or full access). Leave that scope off to keep buyer personal data out of the assistant: orders then show no customer and only the shipping country.

## Install

Pick your AI client and replace `YOUR_API_KEY` with your key. Everything except the Claude Desktop extension runs the server with `npx -y @dapi-digital/mcp`, which needs Node.js 20 or later.

### Claude Desktop

[Download the Claude Desktop extension](https://public-api.dapi.digital/docs/downloads/dapi-digital.mcpb)

1.  Double-click `dapi-digital.mcpb` to open it in Claude Desktop (or install it from Settings, then Extensions) and click Install.
2.  Paste your API key. Claude Desktop keeps it in your system's secure storage.
3.  Turn off Allow changes for read only, or Allow orders and refunds to never move money.

The extension runs on the Node.js built into Claude Desktop, so there is nothing else to install.

Or add the server by hand: open Settings, then Developer, then Edit Config, add it to `claude_desktop_config.json` and restart Claude Desktop. This way needs Node.js 20 or later.

**claude\_desktop\_config.json**

```json
{
  "mcpServers": {
    "3dapi": {
      "command": "npx",
      "args": ["-y", "@dapi-digital/mcp"],
      "env": {
        "DAPI_API_KEY": "YOUR_API_KEY"
      }
    }
  }
}
```

### Claude Code

Run this in a terminal. Add `--scope user` after `add` to use it in every project, not only the current one.

**Terminal**

```bash
claude mcp add 3dapi --env DAPI_API_KEY=YOUR_API_KEY -- npx -y @dapi-digital/mcp
```

### Codex

Run this in a terminal:

**Terminal**

```bash
codex mcp add 3dapi --env DAPI_API_KEY=YOUR_API_KEY -- npx -y @dapi-digital/mcp
```

Or add the server to `~/.codex/config.toml`, which the Codex CLI, the IDE extension and the app share:

**~/.codex/config.toml**

```toml
[mcp_servers.3dapi]
command = "npx"
args = ["-y", "@dapi-digital/mcp"]

[mcp_servers.3dapi.env]
DAPI_API_KEY = "YOUR_API_KEY"
```

### Grok Build

Grok Build, xAI's terminal agent, runs local MCP servers. Its `grok mcp add` command takes no environment variables, so add the server to `~/.grok/config.toml`:

**~/.grok/config.toml**

```toml
[mcp_servers.3dapi]
command = "npx"
args = ["-y", "@dapi-digital/mcp"]
env = { DAPI_API_KEY = "YOUR_API_KEY" }
```

The Grok apps and the xAI API connect only to remote MCP servers over HTTPS, so they cannot run this one.

## Tools

Every tool is one operation of this API, named by its operation id. There are three kinds:

-   **Read tools** (`GET` operations) change nothing.
-   **Write tools** create, change or delete things on your real account at once, for example a product, a variant, an extra or a quote. Their descriptions start with `[Write]`.
-   **Money tools** charge or refund. They show you a summary first and run only after you approve it (see below). Their descriptions start with `[Money]`.

When it starts, it calls [Identify the current credentials](https://public-api.dapi.digital/docs/reference/identity.md#get_me) and offers only the tools your kind of account can use and your key's scopes allow. A key with only read scopes gives the assistant only read tools.

-   Designers: ask _"Which of my orders shipped this week, and which are on hold?"_ and the client calls [list\_orders](https://public-api.dapi.digital/docs/reference/orders.md#list_orders).
-   Integrators: ask _"List my quotes from yesterday that are still slicing."_ and the client calls [list\_quotes](https://public-api.dapi.digital/docs/reference/quotes.md#list_quotes).

## Write tools and files

Write tools act on your real account as soon as the assistant calls them, so ask for the change you want and check what it did. Delete tools say they cannot be undone.

The server sends its own `Idempotency-Key` with every POST, a new one per call, as described in [Idempotency](https://public-api.dapi.digital/docs/guides/idempotency.md). The assistant cannot choose or reuse one.

To attach a file, the assistant calls `upload_file` with the full path of a file you named on your computer and what it is for (for example `design_file` or `quote_file`). It reads that one file, never a folder, uploads it as in [Uploads](https://public-api.dapi.digital/docs/guides/uploads.md), and gets back the upload id to use in the write.

## Money tools: preview, then confirm

These tools move money:

-   [create\_integrator\_order](https://public-api.dapi.digital/docs/reference/integrator-orders.md#create_integrator_order): charges your wallet in wallet mode, or opens a payment for your customer in checkout mode.
-   [cancel\_integrator\_order](https://public-api.dapi.digital/docs/reference/integrator-orders.md#cancel_integrator_order): refunds a paid order or closes an open checkout.

Each one runs in two steps:

1.  The assistant calls the tool. Nothing happens: it gets back a summary and a `confirmation_token`.
2.  It shows you the summary and asks whether to go ahead.
3.  Only if you agree, it calls the tool again with the same details and the token, and the action runs.

The summary names the account, the items and quantities, and the money: prices per item from your variants, quotes or stocks, a shipping estimate, the refund for a cancellation, and your wallet balance when the key can read it. These figures are estimates; VAT and the final total are computed by the API when the action runs.

The token lasts 10 minutes and works once. If anything in the request changes, or the server restarts, the assistant has to show you a new summary. A confirmation that is sent twice by mistake still runs only once.

## Safety switches and settings

Add these to the server's environment the same way as the key. The Claude Desktop extension asks for them in its settings instead.

-   `DAPI_API_KEY` (required): your API key. The server never prints or logs it.
-   `DAPI_ALLOW_WRITES=false` runs read only, whatever the key can do.
-   `DAPI_ALLOW_MONEY=false` keeps write tools but never charges or refunds, so the assistant cannot place or cancel orders.

## When something fails

If the key is missing or refused, the server stops at startup and your client shows the reason in its MCP logs, for example `invalid_api_key`. When a tool call fails, the assistant receives the API's error with its `code`, `message` and `request_id`, as described in [Errors](https://public-api.dapi.digital/docs/guides/errors.md). Quote the request id when you contact support.

---

3DAPI API Docs. This page on the web: https://public-api.dapi.digital/docs/guides/mcp. Index of every page: https://public-api.dapi.digital/docs/llms.txt.
