> ## Documentation Index
> Fetch the complete documentation index at: https://www.recraft.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Local MCP Server

## Billing

The local MCP server consumes **API units** — the pay-as-you-go balance used by the [Recraft API](/api-reference/getting-started). Each operation deducts API units according to the rates in [API pricing](/api-reference/pricing). API units are separate from the **subscription credits** used by the Recraft Studio app and the [Remote MCP server](/mcp-reference/remote-server); you must purchase API units before you can generate an API key.

If you'd rather pay from your **subscription credits** balance, use the [Remote MCP server](/mcp-reference/remote-server) instead.

## Prerequisites

1. **Recraft API key**
   * Access it in the [API section](https://www.recraft.ai/profile/api) of your account **Profile**.
   * Note: You will need to buy API units before you can generate an API key.
2. **MCP client installed**
   * For example, [Claude Desktop](https://claude.ai).

## Option 1: Claude Desktop Extensions

You can set up the Recraft MCP server in Claude using [Claude Desktop Extensions](https://www.anthropic.com/engineering/desktop-extensions).

1. Download **mcp-recraft-server.dxt** from the [latest release](https://github.com/recraft-ai/mcp-recraft-server/releases/latest/download/mcp-recraft-server.dxt).
2. Double-click the file to open it with Claude Desktop Extensions.
3. In Claude Desktop, click **Install**.
4. Fill out the setup form:
   * Paste your Recraft API key obtained from your [Profile API page](https://www.recraft.ai/profile/api).
   * (Optional) Specify a local path for generated image storage, or indicate that all results should be stored remotely.
5. Enable the server.

If you encounter installation issues, make sure you have the latest version of Claude Desktop installed.

## Option 2: Smithery

1. Find this MCP server on [Smithery](https://smithery.ai/server/@recraft-ai/mcp-recraft-server).
2. Install from Smithery.
   * Note: all generation results will be stored remotely.
   * If you want to store results locally, use Claude Desktop Extensions or manual setup instead.

## Option 3: Manual setup

### Requirements

* Ensure **Node.js** is installed on your machine.
  * If not, install from [nodejs.org](https://nodejs.org).
* You will need to run `npx` or `node` commands in your terminal.

### From NPM

1. Open your **Claude Desktop configuration file**: `claude_desktop_config.json`.
2. Modify the file to add the following configuration snippet (replace with your API key and desired settings):

```json theme={null}
{
  "mcpServers": {
    "recraft": {
      "command": "npx",
      "args": [
        "-y",
        "@recraft-ai/mcp-recraft-server@latest"
      ],
      "env": {
        "RECRAFT_API_KEY": "<YOUR_RECRAFT_API_KEY>",
        "IMAGE_STORAGE_DIRECTORY": "<YOUR_IMAGE_STORAGE_DIRECTORY>",
        "RECRAFT_REMOTE_RESULTS_STORAGE": "<YOUR_REMOTE_RESULTS_STORAGE_INDICATOR>"
      }
    }
  }
}
```

### From source

1. Clone the repository:

   ```bash theme={null}
   git clone https://github.com/recraft-ai/mcp-recraft-server.git
   ```
2. Navigate into the cloned directory and build the project:

   ```bash theme={null}
   npm install
   npm run build
   ```
3. Modify your `claude_desktop_config.json` file with the following configuration:

```json theme={null}
{
  "mcpServers": {
    "recraft": {
      "command": "node",
      "args": [
        "<ABSOLUTE_PATH_TO_CLONED_DIRECTORY>/dist/index.js"
      ],
      "env": {
        "RECRAFT_API_KEY": "<YOUR_RECRAFT_API_KEY>",
        "IMAGE_STORAGE_DIRECTORY": "<YOUR_IMAGE_STORAGE_DIRECTORY>",
        "RECRAFT_REMOTE_RESULTS_STORAGE": "<YOUR_REMOTE_RESULTS_STORAGE_INDICATOR>"
      }
    }
  }
}
```

### Environment variables

You can configure the following parameters in the `env` section:

* **`RECRAFT_API_KEY`** *(required)*
  Your [Recraft API key](https://www.recraft.ai/profile/api).

* **`IMAGE_STORAGE_DIRECTORY`** *(optional)*
  Local directory to store generated images. Defaults to:

  ```
  $HOME_DIR/.mcp-recraft-server
  ```

  This value is ignored if `RECRAFT_REMOTE_RESULTS_STORAGE="1"`.

* **`RECRAFT_REMOTE_RESULTS_STORAGE`** *(optional)*
  Set to `"1"` to store all generated images remotely. In this case, only URLs are returned and `IMAGE_STORAGE_DIRECTORY` is ignored.
