# Getting Started

Get started by installing DivMagic

**Chrome:** [<mark style="color:blue;">**Install for Chrome**</mark>](https://chromewebstore.google.com/detail/divmagic-copy-style-from/okpadhgilncoodafepkdmlneojcehclf)

**Firefox:** [<mark style="color:blue;">**Install for Firefox**</mark>](https://addons.mozilla.org/en-US/firefox/addon/divmagic/)

Chrome version works on Chrome, Edge, Brave, and other Chromium-based browsers.

## See it in action

Completely transforming Hacker News to Tailwind CSS with one click

<figure><img src="https://1321172380-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6URweRGNKNYKXJxvg9E6%2Fuploads%2FCDILEsgqx2XyCztnzFzU%2Fdemo-thumbnail.webp?alt=media&amp;token=26e02dc7-be56-4a5f-92f7-455f6e598257" alt=""><figcaption></figcaption></figure>

[<mark style="color:blue;">Click to watch</mark>](https://www.youtube.com/watch?v=ZWcrENOpbY0)


# Component Format

Change the component format of DivMagic between HTML and JSX. The code you copy will be in the format you choose.

This setting applies to the CSS selection as well. If you choose JSX, the CSS code will also be in JSX format.

**Default Value: HTML**

<figure><img src="https://1321172380-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6URweRGNKNYKXJxvg9E6%2Fuploads%2F73urdTHpIotIoq9e1KEI%2Fdivmagic-component-format.webp?alt=media&amp;token=3218aa9b-3f79-4a79-9be4-5af7c98f3da9" alt=""><figcaption></figcaption></figure>

Both HTML and JSX options produce the same result. The difference is in the format of the code.


# Style Format

Change the output style of DivMagic. There are four options: Tailwind CSS, Inline CSS, External CSS, Local CSS

**Default Value: Inline CSS**

<figure><img src="https://1321172380-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6URweRGNKNYKXJxvg9E6%2Fuploads%2FxE1l0cmkmEQeVWqmbEyU%2Fdivmagic-style-format.webp?alt=media&amp;token=1ba23fef-4eee-4ebf-960b-291b823b8349" alt=""><figcaption></figcaption></figure>

### Tailwind CSS

This is the default option. The output code will use Tailwind CSS classes.

### Inline CSS

This option will output the code with inline CSS styles.

***

All options provide the same output, just in different formats. The choice is yours.


# DevTools

You can access DivMagic directly from your browser's development tools. This section will guide you on how to use this feature.

TODO: Upload DevTools Video

## How to use DivMagic with DevTools

1. **Open Developer Console:** Navigate to your browser's developer console by right-clicking on your page and selecting 'Inspect' or simply using the shortcut
2. **Locate DivMagic Tab:** Once inside the developer console, find the 'DivMagic' tab located next to the other tabs like 'Elements', 'Console', etc.
3. **Select an Element:** Navigate to the webpage you want to copy from, and use the DivMagic tab in the dev tools to select and capture any desired element.
4. **Copy & Convert:** Once an element is selected, you can copy its styles, transform it into reusable CSS, Tailwind CSS, React, or JSX code, and more — all from within the DevTools.

<mark style="color:red;background-color:red;">If DevTools tab does not show up on your browser, make sure you enabled it from the popup and open a new tab and try again</mark>

### **Permissions Update**

With the addition of DevTools, we've updated the extension permissions. This allows the extension to add the DevTools panel seamlessly on all websites you visit and across multiple tabs.

#### ⚠️Note

When enabling DevTools Panel from the extension popup, Chrome and Firefox will display a warning that says the extension can 'read and change all your data on the websites you visit'. While the wording is alarming, we assure you that:

Minimal Data Access: We only access the bare minimum of data required to provide you the DivMagic service.

Data Security: All data accessed by the extension remains on your local machine and is not sent to any external servers. The elements you copy are generated on your device and are not sent to any server.

Privacy First: We're committed to safeguarding your privacy and security. For more details, you can view our Privacy Policy.

We appreciate your understanding and trust. If you have any concerns or questions, feel free to reach out to our support team.


# Copy Mode

Change the copy mode of DivMagic. There are two options: Exact Copy and Adaptable Copy.

**Default Value: Adaptable Copy**

<mark style="background-color:green;">We highly recommend using 'Adaptable' Copy for most use-cases. See the explanation below for more details.</mark>

<div align="left" data-full-width="false"><figure><img src="https://1321172380-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6URweRGNKNYKXJxvg9E6%2Fuploads%2F2dAXhtHblcWpaCNA9BS5%2Fpopup-copy-mode.webp?alt=media&amp;token=0e98700c-cabe-4abf-ab2e-137a1be8a7ff" alt="" width="531"><figcaption></figcaption></figure></div>

### Adaptable Copy <a href="#adaptable-copy" id="adaptable-copy"></a>

Adaptable copy mode is DivMagic's innovative approach to capturing web elements in a way that's optimized and ready for integration into your projects.

Designed to be the default option, it's recommended for a wide range of use cases due to its intelligent style optimization.

<mark style="background-color:blue;">Using the Adaptable copy mode might occasionally result in styles that look slightly different from the source. However, this deviation is intentional.</mark>

<mark style="background-color:blue;">DivMagic aims to provide an output that's not just a direct copy, but an improved and adaptable version of the original. It gives you a foundation to build upon, rather than a rigid style to work around.</mark>

**How does it work?**

Instead of capturing every single style attribute associated with an element, Adaptable mode performs an analysis of the styles and selectively retains only those necessary.

This results in a cleaner, more compact, and manageable code output.

**The goal of DivMagic is to make your development process significantly easier and faster. Adaptable copy mode is a key part of that.**

**Benefits:**

Optimized Output: Reduces the overall code volume, making it easier for you to customize the output for your own needs.

### Exact Copy <a href="#exact-copy" id="exact-copy"></a>

Exact mode provides a rigid copy of styles. It's built for use cases where you need to capture every single style attribute associated with an element.

In cases where Adaptable Copy mode is not producing the desired output, you can try using Exact Copy mode.

### Balanced Copy

Balanced copy mode strikes a middle ground between Adaptable and Exact copy modes. It aims to retain the flexibility and optimizations of Adaptable Copy while ensuring a closer adherence to the original styling than Adaptable alone.

In this mode, DivMagic performs a more selective capture of styles than Exact Copy, ensuring that important visual aspects are preserved without including all minor style details. This results in a more precise output than Adaptable mode, but with less code bloat compared to Exact mode.

Balanced mode is ideal when you need a reliable representation of an element’s styles, but also want to avoid overloading your project with unnecessary styling rules.


# Media Query

Add Media Query CSS to the copied code for responsive design. There are two options: On and Off

**Default Value: On**

<div align="left"><figure><img src="https://1321172380-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6URweRGNKNYKXJxvg9E6%2Fuploads%2FR3duyzIpEA2cDP2wXp1W%2Fpopup-media-query.webp?alt=media&amp;token=57e5b4a4-ef5b-4612-8325-a225125b5102" alt="" width="319"><figcaption></figcaption></figure></div>

## Media Query On

This option will add Media Query to the copied code for responsive design.

It works with all Component Format and Style Format options.

#### Media Query with Tailwind CSS

If you choose Tailwind CSS, Media Query will be added to the Tailwind CSS classes. If there is a Media Query style that is not supported by Tailwind CSS, it will be added as a global style.

#### Media Query with Inline CSS

If you choose Inline CSS, Media Query will be added as a global style because Inline CSS doesn't support Media Query styles.

#### Media Query with External CSS

If you choose External CSS, Media Query will be added to the External CSS.

#### Media Query with Local CSS

If you choose Local CSS, Media Query will be added to the Local CSS.

### Media Query Off

This option will not add Media Query to the copied code.


# Edit Mode

The **Edit Mode** in DivMagic’s browser extension provides a powerful, real-time editing experience for updating the styles of any element on a webpage. With Edit Mode, you can visually modify CSS properties directly in the browser, making it easier to experiment with design tweaks or test style changes without needing to dig into the codebase.

<div align="left"><figure><img src="https://1321172380-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6URweRGNKNYKXJxvg9E6%2Fuploads%2Fqmo5KlkmAGS7VMO3FMy5%2FScreenshot%202024-09-11%20at%2003.51.54.png?alt=media&amp;token=4ff935af-3b49-4890-8273-d207137237ba" alt="" width="304"><figcaption></figcaption></figure></div>

### Key Features of Edit Mode:

#### Instant Style Editing:

* When you activate Edit Mode, you can select any element on the page, and its current styles will appear in a panel (as shown in the screenshot).
* The panel displays the active CSS properties for the selected element, such as color, font size, background color, and more.

#### Add, Modify or Remove Styles:

* You can easily update existing styles by modifying the values in the style panel.
* If you need to add a new CSS property, simply enter the CSS attribute and value in the **Add styles** section at the bottom of the panel, and the change will instantly apply to the element.
* You can also remove any applied styles by clicking the **X** next to a property, instantly reflecting the change on the page.

#### Real-Time Visual Feedback:

* Every change made in Edit Mode is applied immediately, so you can see the results of your updates in real time without needing to refresh the page.
* This visual feedback helps users experiment with different design options quickly and fine-tune the look of any webpage element.


# Introduction

Welcome to the DivMagic API documentation. This guide will help you integrate with our API and utilize its features effectively.


# Getting started

Follow the step-by-step instructions to start using DivMagic API

### Generating an API Key

To use our API, you need to generate an API key. Follow these steps to create your key:

1. [**Log in**](https://divmagic.com/login) to your account
2. Navigate to the Dashboard
3. On the side menu, click on API section
4.

```
<div align="left">
```

```
<figure><img src="../.gitbook/assets/Screenshot 2024-09-09 at 20.19.18.png" alt="" width="251"><figcaption></figcaption></figure>

</div>
```

5\. Click on "Generate API Key" button

### Get credits

If your API Status is *<mark style="color:red;">Inactive</mark>* or you ran out of credits, you can purchase credits from [**this link**](https://buy.stripe.com/6oEeWScPn1oT1ZS4gw) or click "Get now" button on the API section


# Sample Requests

### cURL Example

{% code overflow="wrap" %}

```sh
curl -X POST -H "Content-type: application/json" -d '{"apiKey":"YOUR-API-KEY","url":"pocket.tailwindui.com","settings":{"componentFormat":"html","styleFormat":"tailwind"}}' https://api.divmagic.com/v1/magic
```

{% endcode %}

### JavaScript Example

```javascript
fetch('https://api.divmagic.com/v1/magic', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    'apiKey': 'YOUR_API_KEY',
    'url': 'ft.com',
    'settings': {
      'componentFormat': 'html',
      'styleFormat': 'tailwind'
    }
  })
})
  .then(response => response.json())
  .then(data => console.log(data));
```


# Request Parameters

You can specify the Component format and Style format within your request

| Parameter         | Supported Values                          |
| ----------------- | ----------------------------------------- |
| componentFormat   | "html", "jsx"                             |
| styleFormat       | "tailwind", "inline", "local", "external" |
| includeMediaQuery | true, false                               |

**For more information about request parameters, check the sections below:**

{% content-ref url="/pages/aoxcwlmI4Dcw35EW8y58" %}
[Component Format](/settings/component-format)
{% endcontent-ref %}

{% content-ref url="/pages/28wtnmMDfYScXAueULAF" %}
[Style Format](/settings/style-format)
{% endcontent-ref %}

{% content-ref url="/pages/6SjmcODd8CT2Yus2IZ0G" %}
[Media Query](/settings/media-query)
{% endcontent-ref %}


# Introduction

Copy any component from a live web page as clean HTML or JSX — from inside your AI agent.

DivMagic MCP is a remote [Model Context Protocol](https://modelcontextprotocol.io) server. Once it is connected, your agent can copy designs from real web pages and read and write your DivMagic library, without you leaving the editor.

It works the same way the DivMagic extension does: the page is opened in a real browser and what it **renders** is converted. That is the difference from fetching HTML — the output carries the computed styles and the markup the page actually produced, not the template it shipped.

```
You:   copy the pricing table from stripe.com/pricing as JSX with tailwind
Agent: → copy_component_from_url
       ← <section className="flex flex-col …">…</section>
```

### What you can do

<table data-card-size="large" data-view="cards" data-full-width="false"><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>Copy a page</strong></td><td>Render any public URL and get back HTML or JSX, styled with Tailwind classes, inline styles, or a stylesheet.</td><td></td></tr><tr><td><strong>Read your library</strong></td><td>List and read the designs already saved from the extension, Studio, or the dashboard.</td><td></td></tr><tr><td><strong>Save to your library</strong></td><td>File a copy — or markup the agent wrote — into the same library everything else lives in.</td><td></td></tr></tbody></table>

### Endpoint

| Setting        | Value                                  |
| -------------- | -------------------------------------- |
| URL            | `https://api.divmagic.com/v1/mcp`      |
| Transport      | Streamable HTTP                        |
| Authentication | `Authorization: Bearer <your MCP key>` |

### Is this the same as the API?

No. They are separate products with separate keys and separate credits.

|                | REST API      | MCP                 |
| -------------- | ------------- | ------------------- |
| Called by      | Your own code | Your AI agent       |
| Key            | API key       | MCP key (`dvmcp_…`) |
| Credits        | API credits   | MCP credits         |
| Library access | No            | Yes                 |

An API key will not authenticate against the MCP endpoint, and API credits are not spent by MCP calls.

### Next

{% content-ref url="/pages/o22qsnCAyvuLkSHYp6MJ" %}
[Getting started](/mcp/getting-started)
{% endcontent-ref %}

{% content-ref url="/pages/pSgQSIbyjrriCKphsmLs" %}
[Tools](/mcp/tools)
{% endcontent-ref %}


# Getting started

Follow the step-by-step instructions to connect DivMagic MCP to your agent

### Generating an MCP Key

To use the MCP server, you need an MCP key. This is **not** the same as your API key. The dashboard calls it *MCP API key* and it lives on the **MCP Server** page; the separate **API Keys** page holds REST API keys, which do not authenticate here.

1. [**Log in**](https://divmagic.com/login) to your account
2. Navigate to the Dashboard
3. On the side menu, click on **MCP Server**

   <div align="left"><figure><img src="https://1321172380-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6URweRGNKNYKXJxvg9E6%2Fuploads%2Fgit-blob-2d0834271b57fd9cd88ce6ca40af8d6f63fe2c75%2Fmcp-server-sidebar.png?alt=media" alt="" width="220"><figcaption></figcaption></figure></div>
4. In the **MCP API key** card, click **Create API key**

   <figure><img src="https://1321172380-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6URweRGNKNYKXJxvg9E6%2Fuploads%2Fgit-blob-edafa456b15cf49920aa68cc9847bb16ae38dab6%2Fmcp-server-panel.png?alt=media" alt=""><figcaption></figcaption></figure>
5. Copy the key immediately

Keys look like `dvmcp_…`.

{% hint style="warning" %}
The key is shown **once**. There is no way to display it again — losing it means issuing a new one, and issuing a new one revokes the old key instantly.
{% endhint %}

### Get credits

A new key is **inactive** on its own. Until the account has MCP credits, every call is refused with:

```
403  This MCP key is not active.
     Buy MCP credits at https://divmagic.com/dashboard to start using it.
```

If **Status** reads *<mark style="color:red;">Not Connected</mark>* or **Credits remaining** is 0, buy credits with the **Buy credits** button on the **MCP Server** page.

Buying credits activates the key you already hold — you do not need to create a new one.

### Connecting your client

One command sets up every coding agent on your machine:

```bash
npx divmagic-mcp
```

It asks for your key, checks it against the server before touching anything, shows which agents it found, and writes only the ones you pick.

```
Checking the key… works.

Found 3 on this machine. Which should get DivMagic?
  1. Claude Code
  2. Cursor
  3. VS Code

Which? (numbers separated by commas, or "all") all
```

**Twenty-two agents** are supported — Claude Code, Claude Desktop, Cursor, VS Code, Windsurf, Codex, Zed, Goose, Gemini CLI, Cline, GitHub Copilot CLI, Antigravity, OpenCode, Kiro CLI, Grok Build and more. Run `npx divmagic-mcp --help` for the full list.

| Option             | What it does                                                               |
| ------------------ | -------------------------------------------------------------------------- |
| `--key <key>`      | Your MCP key. Asked for if not given.                                      |
| `-a, --agent <id>` | Install only to this agent. Repeatable.                                    |
| `--all`            | Install to every supported agent, not only the ones found on this machine. |
| `-y, --yes`        | Take the detected agents without asking.                                   |
| `--endpoint <url>` | Override the server address.                                               |
| `-h, --help`       | Show the options and the agent list.                                       |

Non-interactive, for a scripted setup:

```bash
npx divmagic-mcp --key dvmcp_YOUR_KEY -a cursor -a claude-code -y
```

Restart any agent it changed — none of them reread their config while running.

{% hint style="info" %}
The installer only edits config files. There is no DivMagic software running on your machine: the server runs on our side and your agent talks to it over HTTPS. Config writing is handled by [add-mcp](https://github.com/neon-solutions/add-mcp), which keeps up with where each agent stores its servers and in which format.
{% endhint %}

### Installing by hand

If you would rather not run the installer, the configuration is a few lines.

Most clients — Cursor (`~/.cursor/mcp.json`), VS Code (`.vscode/mcp.json`), Windsurf (`~/.codeium/windsurf/mcp_config.json`):

```json
{
  "mcpServers": {
    "divmagic": {
      "url": "https://api.divmagic.com/v1/mcp",
      "headers": { "Authorization": "Bearer dvmcp_YOUR_KEY" }
    }
  }
}
```

Claude Code has its own command:

```bash
claude mcp add --transport http divmagic https://api.divmagic.com/v1/mcp \
  --header "Authorization: Bearer dvmcp_YOUR_KEY"
```

Claude Desktop's connector screen expects OAuth and has nowhere to put a key, so bridge it through stdio:

```json
{
  "mcpServers": {
    "divmagic": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://api.divmagic.com/v1/mcp",
        "--header", "Authorization: Bearer dvmcp_YOUR_KEY"
      ]
    }
  }
}
```

### Verifying the connection

Restart your client, then ask the agent for something simple:

> copy the hero section from example.com

If the connection is live, the agent calls `copy_component_from_url` and markup comes back. If it reports a `403`, the key is valid but the account has no credits yet — see [Get credits](#get-credits) above.

### Next

{% content-ref url="/pages/pSgQSIbyjrriCKphsmLs" %}
[Tools](/mcp/tools)
{% endcontent-ref %}

{% content-ref url="/pages/bYYPAhYPZ1MrDLxkpqQ5" %}
[How it works](/mcp/how-it-works)
{% endcontent-ref %}


# Tools

The five tools the DivMagic MCP server exposes to your agent

You do not call these by hand — your agent does, based on what you ask for in plain language. This page documents what each one accepts so you can see what is possible and phrase requests that reach it.

| Tool                                                  | What it does                                                           | Credits                                          |
| ----------------------------------------------------- | ---------------------------------------------------------------------- | ------------------------------------------------ |
| [`copy_component_from_url`](#copy_component_from_url) | Renders a page and returns its markup                                  | 1 per copy                                       |
| [`get_component_result`](#get_component_result)       | Picks up a copy that was still running, or reads a large one in pieces | Free                                             |
| [`list_library_components`](#list_library_components) | Lists what is in your library                                          | Free                                             |
| [`get_library_component`](#get_library_component)     | Reads one saved design                                                 | Free                                             |
| [`save_to_library`](#save_to_library)                 | Files a design into your library                                       | Free, or 1 credit when it copies the page itself |

***

## `copy_component_from_url`

Opens a real web page in a browser and converts what it renders into clean, self-contained markup.

| Parameter         | Type                                            | Default    | Description                                                |
| ----------------- | ----------------------------------------------- | ---------- | ---------------------------------------------------------- |
| `url`             | string                                          | —          | The page to copy, for example `https://stripe.com/pricing` |
| `componentFormat` | `html` \| `jsx`                                 | `html`     | Output language                                            |
| `styleFormat`     | `inline` \| `tailwind` \| `local` \| `external` | `tailwind` | How styling is emitted                                     |
| `refresh`         | boolean                                         | `false`    | Render the page again rather than reusing a stored copy    |

**Requires an active plan.** An account with no MCP credits is refused before the page is opened.

A copy usually takes 10–30 seconds. If it has not finished within **20 seconds**, you get a job id instead of markup — the work carries on in the background and [`get_component_result`](#get_component_result) picks it up.

For what the format options mean, see:

{% content-ref url="/pages/aoxcwlmI4Dcw35EW8y58" %}
[Component Format](/settings/component-format)
{% endcontent-ref %}

{% content-ref url="/pages/28wtnmMDfYScXAueULAF" %}
[Style Format](/settings/style-format)
{% endcontent-ref %}

### About `refresh`

A page copied in the last **30 days** is served from that stored copy rather than rendered again. Pass `refresh: true` when the page has changed since, or when the stored copy is visibly stale.

Both paths cost one credit. `refresh` only decides whether the time is spent re-rendering.

***

## `get_component_result`

Fetches a copy that was still running, or reads a large result a piece at a time.

| Parameter  | Type    | Description                                                                        |
| ---------- | ------- | ---------------------------------------------------------------------------------- |
| `jobId`    | string  | The id `copy_component_from_url` handed you                                        |
| `offset`   | integer | Byte offset to read from. Omit for the whole result.                               |
| `maxBytes` | integer | Bytes per piece, from 1,024 up to 262,144 (256 KB). Only meaningful with `offset`. |

While the job is still running you get:

```
Still working. Ask again in about 10 seconds.
```

Polling is free and never spends a credit.

***

## `list_library_components`

Lists what is saved in the library of the account the key belongs to — designs copied from pages with the extension, and designs filed by an agent — newest first.

Takes no parameters. Returns up to **50** entries, each with:

| Field         | Description                                      |
| ------------- | ------------------------------------------------ |
| `componentId` | The id to pass to `get_library_component`        |
| `title`       | What the component is called                     |
| `url`         | The page it came from, or `null`                 |
| `version`     | How many times it has been edited, starting at 1 |
| `createdAt`   | When it was saved                                |

***

## `get_library_component`

Returns the markup of one component from your library.

| Parameter     | Type    | Description                                                       |
| ------------- | ------- | ----------------------------------------------------------------- |
| `componentId` | string  | The id, as `list_library_components` reported it                  |
| `offset`      | integer | Byte offset to read from. Omit for the whole component.           |
| `maxBytes`    | integer | Bytes per piece, 1,024 to 262,144. Only meaningful with `offset`. |

A component belonging to a different account reads as one that does not exist.

***

## `save_to_library`

Files a design into your library, where it joins whatever was saved from the extension.

| Parameter                                 | Type   | Description                                                                                                    |
| ----------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------- |
| `title`                                   | string | What to call it, 1–200 characters                                                                              |
| `url`                                     | string | A page to copy and file in one step. The markup is not returned.                                               |
| `jobId`                                   | string | A job id from `copy_component_from_url`, to file that copy as it was rendered                                  |
| `code`                                    | string | Markup the agent wrote or repaired itself                                                                      |
| `sourceUrl`                               | string | The page it came from. Taken from the copy automatically, so only worth passing with `code`.                   |
| `refresh` `componentFormat` `styleFormat` |        | Only with `url`, and they mean exactly what they mean in [`copy_component_from_url`](#copy_component_from_url) |

Pass **exactly one** of `url`, `jobId` or `code` — never two, never none. Which one is settled by a single question: does the markup that should be filed still match what was copied?

| Pass    | When                                                                                                                                                                    | Credits    |
| ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| `url`   | Nobody needs to see the page, it is only being filed. It is copied and saved in one step, the markup never passes through the conversation, and only the id comes back. | 1 per copy |
| `jobId` | The page was already copied and the markup has not changed since. Reading or quoting it is not a change.                                                                | Free       |
| `code`  | The markup in hand differs from the copy — repaired, edited, or written by the agent.                                                                                   | Free       |

### What may be saved

The library **renders** stored markup and never runs it. Studio, the extension and the dashboard card paste the stored body straight into a page — no bundler, no JavaScript anywhere in the path.

So a save is refused if it contains any of these:

* `<script>` blocks
* `import` or `export` statements
* Function declarations
* Variable declarations
* `.map()` or any loop over data
* Props, state or hooks
* TypeScript

Repetition has to be written out: three cards are three blocks of markup, not an array and a loop.

A component may hold up to **250,000 bytes**. A larger save is refused and nothing is written.

{% hint style="info" %}
This check applies only to markup passed as `code`. A copy filed by `jobId` is DivMagic's own converter output and is never re-judged.
{% endhint %}


# How it works

Credits, caching, large results and the limits worth knowing before you hit them

### Credits

| Action                                           | Cost         |
| ------------------------------------------------ | ------------ |
| A copy delivered by `copy_component_from_url`    | **1 credit** |
| A copy served from a stored render               | **1 credit** |
| A copy that failed                               | Free         |
| Polling with `get_component_result`              | Free         |
| Reading a large result in pieces                 | Free         |
| Listing, reading and saving in the library       | Free         |
| `save_to_library` given a `url` to copy and file | **1 credit** |

One credit buys a delivered copy, whether it was rendered for you or served from a render someone already paid for. A copy that failed costs nothing: a reserved credit is returned when the work does not produce a result.

Running out of credits does not deactivate your key. You get:

```
Your MCP quota is exhausted.
Top up at https://divmagic.com/dashboard to continue.
```

Library tools keep working — an empty balance never locks you out of your own shelves. Only a save that has to copy a page first spends a credit, so that one is refused too.

### Caching

A rendered copy is kept for **30 days** and reused for the same page requested the same way. "The same way" means the same URL, the same `componentFormat` and the same `styleFormat` — change any of them and it is a different copy.

Copies are shared. If someone else already copied that page with those settings, you are served their render. These are renders of public pages, not anyone's data.

A copy older than **24 hours** arrives with a notice:

```
[stored copy, rendered 3 days ago] The page may have changed since.
To read it again, call copy_component_from_url with the same arguments and refresh: true.
```

### Waiting and jobs

`copy_component_from_url` answers inline when it can. If the render has not finished in **20 seconds**, it hands back a job id instead and the work carries on.

1. `copy_component_from_url` returns a job id
2. Your agent waits \~10 seconds and calls `get_component_result`
3. Repeat until the markup comes back

A job whose attempt stops without finishing reports:

```
The attempt on this job stopped without finishing.
Call copy_component_from_url again with the same inputs to start a fresh one.
```

That is safe to do — it starts a new render rather than waiting on a dead one.

### Large results

Anything over **256 KB** is not returned inline. A reply that size costs more context than the answer is worth.

Instead you get:

* the size of the result
* a download link, valid for **1 hour**
* the option to read it in pieces by passing `offset` to `get_component_result`

Reading in pieces is free, however many pieces it takes.

### What the agent is told to do with a copy

Every copy arrives with a notice attached, and the server states the same rule when your client connects. In short: **repair it, do not rewrite it.**

Allowed:

* Formatting and indentation
* Closing unclosed tags
* Restoring classes and attributes that went missing
* Completing fragments that were cut off
* Pointing asset URLs somewhere that resolves

Not allowed:

* Removing, shortening, summarising or sampling content
* Lifting content into constants, arrays or props
* Replacing repeated blocks with `.map()`
* Splitting into components or adding state

A page with thirty rows comes out with thirty rows, written out. Writing a copy into a project file adds the wrapper that file needs — an export, a component signature — and nothing more.

Refactoring a copy into the shape your project prefers is a separate job. It happens after you have the copy, and only if you ask for it.

### Limits

| Limit                  | Value               |
| ---------------------- | ------------------- |
| Render ceiling         | 60 seconds per page |
| Inline reply           | 256 KB              |
| Download link lifetime | 1 hour              |
| Stored copy lifetime   | 30 days             |
| Library listing        | 50 components       |
| Library component size | 250,000 bytes       |

Pages behind a login, and pages that block automated browsers, will not copy.


# Troubleshooting

What the server says when something is wrong, and what to do about it

### Connection and authentication

| What you see                                                                                       | What it means                                                                                                                    | What to do                                                                                              |
| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| `Send your DivMagic MCP key as an Authorization: Bearer header.`                                   | No key reached the server.                                                                                                       | Check that the `Authorization` header is set in your client config, spelled exactly as in the examples. |
| `This MCP key is not valid.`                                                                       | The key was not recognised. Usually a typo, a truncated paste, or a key that was revoked by issuing a new one.                   | Create a new key in the Dashboard and update your client config.                                        |
| `This MCP key is not active. Buy MCP credits at https://divmagic.com/dashboard to start using it.` | The key is genuine but the account has never bought MCP credits.                                                                 | Buy credits on the **MCP Server** page. The key you already hold activates — do not create a new one.   |
| The server connects but no tools appear                                                            | An inactive key is refused before the tool list is sent, so the connection fails as a whole rather than returning an empty list. | Same as above — buy credits, then restart the client.                                                   |
| The server does not appear in your client at all                                                   | The config was not picked up.                                                                                                    | Restart the client. Check the file path and that the JSON parses.                                       |

{% hint style="info" %}
An inactive key answers `403`, not `401`. That is deliberate: the key is real, so re-authenticating would hand back the same key. Buying credits is the only thing that changes the answer.
{% endhint %}

### Credits

| What you see                                                                         | What it means                              |
| ------------------------------------------------------------------------------------ | ------------------------------------------ |
| `Your MCP quota is exhausted. Top up at https://divmagic.com/dashboard to continue.` | The key is active but the balance is zero. |

An exhausted balance stops copies and nothing else. Your key stays active, the connection stays up, and every library tool keeps working — running out of credits never locks you out of designs you already own.

### Copying

| What you see                                                     | What it means                                      | What to do                                                           |
| ---------------------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------------------------- |
| `Still working. Ask again in about 10 seconds.`                  | The render is in progress.                         | Wait and call `get_component_result` again.                          |
| `The attempt on this job stopped without finishing.`             | The worker stopped before producing a result.      | Call `copy_component_from_url` again with the same inputs.           |
| `No such job. It may have expired; copies are kept for 30 days.` | The job id is unknown or older than 30 days.       | Run the copy again.                                                  |
| `The result is no longer available. Please run the copy again.`  | The record survived but the stored markup did not. | Run the copy again.                                                  |
| `Unable to connect to the url`                                   | The page could not be reached.                     | Check the URL. Pages behind a login or bot protection will not copy. |
| `The provided URL does not exist or is not accessible`           | The page answered `404`.                           | Check the URL.                                                       |

### The copy came back wrong

**Content is missing.** The page may render that content only after interaction, or only at a wider window. Copies are taken at a fixed browser size, so a desktop-only navigation bar that collapses on narrow screens will not be in the copy.

**The layout looks wrong when pasted.** Some sites' stylesheets do not yield media queries the converter can carry over. The copy is then a snapshot of one width rather than a responsive layout.

**The page changed since.** If the copy came with a `[stored copy, rendered …]` notice, ask again with `refresh: true`.

**The agent restructured it.** If what you received is tidier than the source — content lifted into arrays, repeated blocks turned into a `.map()` — that is the agent, not DivMagic. Ask it for the copy exactly as the tool returned it.

### Library

| What you see                                                         | What it means                                                                                        |
| -------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| `This MCP key is not attached to a DivMagic account with a library.` | The key predates a dashboard sign-in. Sign in at the Dashboard and issue the key again.              |
| A save was refused for containing JavaScript                         | The library renders markup and never runs it. See [what may be saved](/mcp/tools#what-may-be-saved). |
| A save was refused as too large                                      | A component may hold up to 250,000 bytes.                                                            |
| A component "does not exist"                                         | It belongs to another account. Components are scoped to the account the key belongs to.              |

### Still stuck

Account, billing and key questions: [divmagic.com](https://divmagic.com)

When reporting a bad copy, include the URL, the `componentFormat` and `styleFormat` you asked for, and the job id if you were given one.


# Introduction

DivMagic Studio is an integrated development environment (IDE) designed to simplify the process of writing and testing HTML, JSX, and Tailwind CSS code. Whether you're building complex web application

### Overview

DivMagic Studio consists of three main sections:

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td></td><td></td><td></td><td><a href="/studio/user-panel">User Panel</a></td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td></tr></tbody></table>


# User Panel

This section is located on the left side of the Studio. It gives you access to the [**Chatbot**](/studio/user-panel/chatbot) and [**Library**](https://github.com/DivMagicCom/Docs/tree/main/studio/user-panel/broken-reference/README.md)**.**


# Chatbot

Chatbot allows you to interact with ChatGPT without leaving the Studio page.

To use it, you have to provide your OpenAI key to the Chatbot.

![](https://1321172380-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6URweRGNKNYKXJxvg9E6%2Fuploads%2Ffh67JJtOF6tYBI1eLvBe%2FScreenshot%202024-09-09%20at%2023.52.38.png?alt=media\&token=ede78c66-2d7d-4fb9-b4bf-da3e2d99e736)

When the key is saved, you can start a conversation with ChatGPT within User panel. You can select the model on the top left.

### Provide code context

You can enable providing code context to the ChatGPT from Chatbot settings menu. When it's enabled, your code from the editor will be included in your conversation with Chatbot.

The context will not be displayed in the chat messages for simplicity, but you can ask Chatbot anything about your code. Whenever you send a message to the Chatbot, always the current state of the code will be included as context.


# Library

The **Library** section in the User Panel is where users can manage and access their saved components. It offers a streamlined experience for organizing and reusing components across multiple projects.

You can navigate to the library by clicking on ***Components*** on the User panel.

<div align="left"><figure><img src="https://1321172380-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6URweRGNKNYKXJxvg9E6%2Fuploads%2FW6D6mkIqv22kSfLJTeMH%2FScreenshot%202024-09-10%20at%2000.11.49.png?alt=media&amp;token=96d0d985-4bfc-45b1-aed6-4b4d649fecad" alt="" width="255"><figcaption></figcaption></figure></div>

In this section, you can find any component you saved. By clicking it, the component will be opened in the Studio.

<mark style="color:red;background-color:red;">**Note**</mark><mark style="color:red;background-color:red;">: The library can be also accessed through the dashboard. You can delete components in the dashboard if you need.</mark>


# Editor

The **Editor** is the central workspace in DivMagic Studio where users can write, edit, and experiment with HTML, JSX, and Tailwind CSS code. It is designed for maximum productivity, offering a powerful environment that supports real-time code updates, syntax highlighting, and seamless transitions between different code types.

### HTML & JSX Support

* DivMagic Studio allows you to write both **HTML** and **JSX** in the Editor. If you're working on a static web page or a React-based project, the Editor seamlessly supports both languages.
* You can toggle between HTML and JSX modes, ensuring that the syntax is accurately reflected and parsed based on the type of project you're working on.
* Tailwind CSS is fully supported, allowing you to apply utility classes directly in your HTML/JSX for fast and efficient styling.

### Real-Time Updates

* One of the most powerful features of the Editor is its **real-time preview** functionality. As you write or modify code, the output is immediately rendered in the **Preview iFrame** (on the right).
* This eliminates the need for manual refreshing, allowing you to see instant feedback on changes. It speeds up development by providing a live, interactive coding experience.

### Font Selection

DivMagic Studio's **Font Selection** feature allows you to customize the appearance of your project by choosing from a wide range of fonts. This feature is available directly within the Editor through a convenient dropdown menu.

### Variation

The **Variation Button** is a powerful feature in DivMagic Studio designed to give your project a fresh look with the click of a button. When pressed, it randomly changes both the colors and fonts of your project, providing a quick and fun way to explore new design variations without having to manually update each style.


# Description

The **Landing Pages** section in DivMagic Studio is a curated collection of thousands of landing pages from well-known websites. It offers a valuable resource for users seeking inspiration for their own designs by providing access to the HTML and CSS of real-world landing pages. This section empowers users to learn from the best and jumpstart their creative process.


# Introduction

DivMagic's WordPress integration allows you to effortlessly transfer your copied elements directly into the WordPress Gutenberg editor. This feature bridges the gap between web inspiration and WordPress content creation, making your workflow smoother and more efficient than ever.

{% embed url="<https://www.youtube.com/watch?v=m8Dbwlguz0M>" %}

### Why It's Useful?

* Time-Saving: Quickly transfer design elements from any website to your WordPress site without manual recreation.
* Preserve Styling: Maintain the original look and feel of copied elements, ensuring design consistency.
* Flexibility: Works with any element - from simple buttons to complex layouts.
* Gutenberg-Ready: Seamlessly integrates with the WordPress Gutenberg editor for a native editing experience.

### Key Features

<table data-card-size="large" data-view="cards" data-full-width="false"><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>One-Click Transfer</strong></td><td>Copy entire sections with a single click.</td><td></td></tr><tr><td><strong>Responsive Design</strong></td><td>Copied elements maintain their responsive properties.</td><td></td></tr><tr><td><strong>CSS Optimization</strong></td><td>Automatically optimizes CSS for WordPress compatibility.</td><td></td></tr><tr><td><strong>Block Conversion</strong></td><td>Intelligently converts copied elements into appropriate Gutenberg blocks.</td><td></td></tr></tbody></table>


# Getting Started

To start using this feature, ensure you have the latest version of DivMagic installed. The WordPress integration is designed to work out of the box with no additional configuration required.

## How to Use

1. Click the hamburger menu icon next to the Copy button\
   ![](https://1321172380-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6URweRGNKNYKXJxvg9E6%2Fuploads%2FgXe5UnsvMxogVPw5rR5d%2FScreenshot%202024-09-21%20at%2021.03.42.png?alt=media\&token=ccc2a3de-453b-4a1d-9803-9c0b63815f97)\\
2. Select Export to WordPress option\
   ![](https://1321172380-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6URweRGNKNYKXJxvg9E6%2Fuploads%2FB4hGN6jfptAdDe3wTHl5%2FScreenshot%202024-09-21%20at%2021.09.37.png?alt=media\&token=b4776400-e617-4968-9521-1c226fa2625b)\\
3. After the component is exported, you can find the exported elements on the block menu of the WordPress Gutenberg editor by searching for "divmagic"\
   ![](https://1321172380-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6URweRGNKNYKXJxvg9E6%2Fuploads%2FFgeDw06sPvx3Z7VOSL7D%2FScreenshot%202024-09-21%20at%2021.11.08.png?alt=media\&token=99f22652-2896-45c1-bcf1-e73580be1de2)\\
4. That's all! You can start using your exported components by drag & drop into the editor now


