> For the complete documentation index, see [llms.txt](https://docs.divmagic.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.divmagic.com/mcp/how-it-works.md).

# 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.
