refern.

Extensions, Local API and MCP

Install extensions and themes, connect scripts and assistant apps to your library with the Local API and the built-in MCP server, open files in other apps, and set your own shortcuts.

This guide shows how to connect refern to other apps and tools on your computer:

  • Extensions and themes add features, file formats and new looks to refern.
  • The Local API lets scripts on your computer read and organize the open workspace.
  • The built-in MCP server lets assistant apps such as Claude Desktop, Claude Code and Codex search and organize your library, within the access you give them.
  • External Tools open selected files in Photoshop, Clip Studio Paint, Blender, PureRef and other apps.
  • Custom shortcuts let you set your own keys and mouse buttons for any command.

To build your own extension, see Build extensions.

Extensions and themes

An extension is a .refernplugin package. There are three kinds:

KindWhat it does
ThemeChanges the app's colors and fonts, and can add a background image. It cannot read your library.
App pluginAdds commands, menu entries, dialogs, sidebar panels and import sources. It runs in a sandbox.
Format decoderMakes thumbnails for file types refern does not know. It runs in a sandbox with no network access.

Open the Extensions page

Select Extensions (the puzzle icon) in the sidebar. You can also open Go to location (Ctrl+P on Windows and Linux, Cmd+P on macOS) and choose Extensions.

The page shows every installed extension as a card. Use the search box and the All, App, Theme and Format filters to find one. Use the switch on a card to turn the extension on or off. Select a card to see its details, settings, file types, shortcuts and access.

The on and off state is per computer, not per workspace.

Built-in extensions

refern includes eleven extensions by Refern Labs. You cannot uninstall them, but you can turn them off.

NameKindOn at firstWhat it does
Aseprite & Swatch PreviewsFormatYesThumbnails for Aseprite sprites and Adobe Swatch Exchange palettes, with an animation and layer viewer
Font SpecimensFormatYesSpecimen thumbnails for TTF, OTF, WOFF and WOFF2 fonts, with a type tester, waterfall and glyph map
ExifTool Metadata WriterAppNoWrites tags, creators, ratings and descriptions into your files' IPTC, XMP and EXIF metadata
Pie MenuAppNoA radial menu of 8 slices at the pointer (Alt+Q, or Option+Q on macOS, when it is on)
Reverse Image SearchAppNoFinds the source and a higher-resolution copy of an image (SauceNAO, IQDB and others)
Stock & Museum ArchivesAppNoSearches and imports from The Met Open Access, NASA, Unsplash and Pexels
Twilight SkyThemeYes (not applied)Dusk slate and sunset tones with a twilight sky backdrop, dark and light
Solarized SlateThemeNoLow-glare Solarized tones, dark and light
Studio ClayThemeNoWarm charcoal with terracotta accents, dark
OLED MidnightThemeNoTrue black with periwinkle accents, dark
Daylight PaperThemeNoWarm paper white with ink-blue accents, light

Reverse Image Search, Stock & Museum Archives and the ExifTool download use the internet when you use them. Reverse Image Search sends the item's thumbnail (at most 1,000 px), not the full file.

Install an extension from a file

  1. On the Extensions page, select Install from File....
  2. Choose a .refernplugin file.
  3. Read the install dialog. It tells you in plain sentences what the extension can do, for example:
    • "It can read the open workspace. It cannot change anything."
    • "It can read the open workspace, tag items and edit their details."
    • "It can read the open workspace, tag items and edit their details, and rename, move and trash items."
    • "It cannot connect to the internet." or "It can connect to:" with a list of sites.
    • "It can see items marked NSFW."
  4. If you agree, confirm the install.

Installing grants every access that the extension asks for. You cannot turn off one part of it. If you do not want to give that access, do not install it.

To remove an extension, open its card and select Uninstall. This removes it with its settings, saved data and saved passwords.

Load Developer Folder... loads an extension from a folder, for developers. A developer folder is not checked by the extension registry. Load only folders you trust.

Find more extensions in the extension directory. Install in refern on a listing opens refern 1.13 or later, which shows what the extension may do and asks before it installs it. You can also install an extension from a file or a folder.

Apply a theme

Turning a theme on does not apply it. To apply it:

  1. On the Extensions page, select the theme's card.
  2. In Custom Theme, select Apply.

To go back to refern's own colors, select Built-in. You can also choose a theme in Settings > General > Custom Theme, and install a theme file there with Import Theme....

The app's Light and Dark setting chooses which palette of the theme shows, when the theme has both.

If a theme has a background image, its details have a Background Image section:

  • Choose image... replaces the image with your own (PNG, JPEG, WebP or AVIF, at most 16 MB).
  • Blur sets a blur from 0 to 64 px.
  • Default goes back to the theme's own image or blur.

The background shows only behind the app frame (sidebars and bars). The active theme is per computer and does not sync.

How extensions are kept safe

  • App plugins run in a locked frame. They cannot touch the app page, your disk or other programs, and they cannot open other sites in their frame.
  • An app plugin can reach only the web hosts listed in its install dialog, over HTTPS.
  • Library answers to an extension never contain a disk path.
  • Items marked NSFW are hidden from an extension unless it asks to see them and you install it.
  • Secrets such as API keys are kept in your system's credential store, not in a file.
  • Edits by an app plugin show in Recent API changes, where you can undo them.

For the full rules, see the security model.

Local HTTP API

The Local API lets apps and scripts on your computer read, search, tag and organize the open workspace over HTTP. It is off by default.

Turn it on and create a token

  1. Open Settings > Local API.
  2. Turn on Allow apps on this computer to access the open workspace.
  3. In Tokens, select Create token.
  4. Enter a name, such as "Claude Desktop" or "Tagging script".
  5. Choose the access level: Read, Write or Organize.
  6. Optional: turn on Exclude NSFW items to hide NSFW items from this token.
  7. Copy the token now. It starts with rfn_. You cannot see it again.

To stop a token, select Revoke. Tokens do not expire. They work for any workspace, are stored only as hashes, and you can have at most 32.

Access levels

LevelWhat it allows
ReadBrowse, search and view files. Cannot change anything.
WriteEverything Read can do, plus tag items, edit their details, import, and create folders and groups.
OrganizeEverything Write can do, plus rename, move and trash items, and edit the tag list, creators and smart folders. The most access.

Give each app the lowest level it needs. No level can delete files permanently or empty the Trash.

Connect

The API listens on http://127.0.0.1:7733/v1. If port 7733 is taken, refern uses the next free port up to 7743. The port in use is written to server-port.txt in the app data folder:

SystemApp data folder
Windows%APPDATA%\com.refernapp.refern
macOS~/Library/Application Support/com.refernapp.refern
Linux~/.local/share/com.refernapp.refern

Send your token in the Authorization header:

 curl -H "Authorization: Bearer rfn_YOUR_TOKEN" http://127.0.0.1:7733/v1 

While the API is on, refern serves its full reference at http://127.0.0.1:7733/llms.txt and http://127.0.0.1:7733/llms-full.txt. These files list every endpoint, field and error.

Command-line tool and SDK

If you do not want to write raw HTTP requests, two packages on npm (Node 20 or later) connect to the Local API on this computer, find the port automatically, and verify refern before sending your token:

  • @refern/cli (refern-cli, 0.2.0+): install globally with npm install -g @refern/cli or run with npx @refern/cli. Set REFERN_API_TOKEN (or pass --token). Named commands cover status, workspaces, search, tag add, tag remove and import, and refern-cli api calls any Local API endpoint:
 export REFERN_API_TOKEN = rfn_YOUR_TOKEN refern-cli status refern-cli api GET /v1/folders --query limit= 10 refern-cli api POST /v1/items/trash --body '{"itemIds":["<item-id>"]}' refern-cli api PATCH /v1/items --body @update.json # or --body - for stdin refern-cli api GET /v1/items/ < item-i d > /thumbnail --out thumb.webp 

Repeat --query <key=value> to pass several query parameters. Add --idempotency-key <key> to make a retried write safe, or --out <file> on a GET request to save thumbnail or file bytes. A write body may name workspaceId (from refern-cli status) so it fails with workspace_changed if another workspace is open. In PowerShell, save JSON to a file and pass --body @<file> to avoid quoting issues. In Git Bash on Windows, leave off the first slash (v1/folders) so Git Bash does not rewrite the path.

  • @refern/sdk: a zero-dependency TypeScript client for Node 20+, Bun and Deno.

See SDK and CLI for the full command and client reference.

Endpoint groups

LevelWhat you can do
ReadGet workspace info, folders, items and batches of items. Search by text, by meaning, by color and by similar images. Get thumbnails, original files, tags, tag structures, creators, groups, smart folders, the change list, and job status.
WriteEdit item details and tags (with a dryRun preview), create tags, creators, folders, bookmarks and groups, link items, review Auto Tagger suggestions, run the Auto Tagger, sync with disk, import from URLs or local files, and undo a change.
OrganizeRename (one or numbered), move, copy, make linked copies, move to Trash, restore, hide folders, edit and delete tags, tag colors, tag structures, creators, smart folders and manual order.

Security model

  • The API listens only on 127.0.0.1. Other computers cannot reach it.
  • It refuses any request from a web page (any request with an Origin header), and any Host other than 127.0.0.1 or localhost.
  • Every request needs a valid token, and the token's level limits what it can do.
  • The API works only while refern is running with a workspace open, and only on that workspace.
  • The API is locked when the trial has ended and no license is active.

Limits

  • Request body: at most 1 MB.
  • At a time: two reads, one write, one import and one sync. A request that waits more than 10 seconds gets a "too many requests" answer.
  • Page size: up to 1,000 folders or tags, 500 items, or 200 search results.
  • Imports: images and videos only, from HTTPS addresses or absolute local paths, at most 50 per request. Local files are copied, not moved.

See and undo API changes

Settings > Local API > Recent API changes lists the changes that connected apps made. Select Undo on a row to reverse it. Undo skips items that were changed again later. It covers the newest 100 changes.

Built-in MCP server

refern includes an MCP server. MCP (Model Context Protocol) is a standard way for assistant apps to use tools. With it, apps such as Claude Desktop, Claude Code and Codex can search, inspect, tag and organize your local library.

The MCP server uses the same tokens and access levels as the Local API. Turn on the Local API and create a token first.

Tools

The server has 62 tools. The token's level decides how many an app gets:

LevelTools
Read20
Write39
Organize62

Examples: search, semantic_search, find_similar, find_by_color, get_item (returns the thumbnail as an image), update_items, import_from_url, import_file, run_auto_tagger, move_items, trash_items and undo_change.

Connect an app

Open Settings > Local API > Connect and choose your app.

Claude Desktop

  1. Select Save Claude Desktop bundle. refern saves refern.mcpb.
  2. Open refern.mcpb with Claude Desktop to install it.

You can also copy the config snippet from the same section into Claude Desktop's config.

Claude Code

Run this command, with your port and token:

 claude mcp add --transport http rfn http://127.0.0.1:7733/mcp --header "Authorization: Bearer rfn_YOUR_TOKEN" 

Codex

Add a server with these values:

FieldValue
Namerfn
TypeStreamable HTTP
URLhttp://127.0.0.1:7733/mcp
HeaderAuthorization: Bearer rfn_YOUR_TOKEN

Other MCP apps

Use the URL http://127.0.0.1:<port>/mcp with the header Authorization: Bearer <token>.

Ask an agent to set it up

The Ask an agent option gives a message to paste into your assistant app. It tells the app to read refern's llms.txt and add refern as an MCP server with your token.

Apps that use stdio

Start refern --mcp-stdio with your token in the REFERN_API_TOKEN environment variable. refern must be running.

What to know

  • The server works on the open workspace only. It cannot see files outside it.
  • It cannot run External Tools.
  • Very long results (over 80,000 characters) are cut.
  • Every change an app makes shows in Recent API changes, where you can undo it.

Example requests to an assistant

  • "Find my references tagged pose with a rating of 4 or more, and tag the ones without a creator as needs-credit."
  • "Search my library for images close to #e07a2f and move them to the folder Warm Palettes."
  • "Import this image URL into my Inbox folder and run the Auto Tagger on it."

Give the assistant a Read token if you only want it to search.

External Tools

External Tools open the selected files in another app on your computer, with arguments that you set. Each tool is a command, so you can give it a shortcut.

Add a tool

  1. Open Settings > External Tools.
  2. Select a preset (Photoshop, Clip Studio Paint, PureRef, Blender, Krita or Aseprite), or select Add Tool.
  3. In Program, select Choose... and pick the app's program file. A preset fills in only the name, arguments and file types. You must still choose the program.
  4. Optional: change the Name, the Arguments and the File Types (for example psd, png). Leave File Types empty to offer the tool for every file.
  5. Select Save.

Arguments

TokenMeaning
{file}Each selected file, one program run per file.
{files}All selected files in one run. Use it as its own argument.
{folder}The folder of the file.
{stem}The file name without its extension.
{ext}The file's extension.

If you use no token, refern adds the file paths after your arguments, in one run.

The presets use {files}, except Blender, which uses {file} for .blend files.

Run a tool

Right-click a selected item and choose Open in followed by the tool's name, or press the tool's shortcut.

Things to know:

  • You can send at most 500 files in one run.
  • A linked copy opens its original file.
  • refern starts the program directly, not through a command shell. On Windows, .bat and .cmd files are refused.
  • On macOS, refern opens an .app bundle with open -a.
  • File types are checked when the tool runs, not in the menu.
  • Tools are saved on this computer only. Extensions and Local API tokens cannot see or run them.

Custom keyboard shortcuts

Open Settings > Shortcuts to change the key for any command. This page is Beta.

  1. Use the search box to find a command or a key, such as "Ctrl+P" or "pie menu".
  2. Click the command's shortcut.
  3. Press the new key, a middle or side mouse button, or scroll the wheel.
  4. To remove a shortcut, press Backspace. To cancel, press Escape.

If the key is already used, refern says "Already assigned to ..." with the existing action's name.

Things to know:

  • Commands from extensions and External Tools are on the Extensions and tools page. You can give them keys and middle or side mouse buttons, but not the wheel.
  • Single-key shortcuts do not fire while you type in a text field.
  • Left and right click cannot be assigned.
  • Export... saves your shortcuts to refern-shortcuts.json, and Import... loads them. The file covers built-in commands only. Reset All goes back to the defaults.
  • Your shortcuts are saved in your profile on this computer. Tag shortcuts are saved per workspace.

Some default shortcuts:

ActionWindows and LinuxmacOS
Go to location (Quick Switcher)Ctrl+PCmd+P
SearchCtrl+KCmd+K
Search in a new tabCtrl+Shift+KShift+Cmd+K
Open settingsCtrl+,Cmd+,
Copy to folder / Move to folderC / MC / M
Undo / RedoCtrl+Z / Ctrl+Shift+ZCmd+Z / Cmd+Shift+Z
Open Pie Menu (when it is on)Alt+QOption+Q
Toggle full screenF11F11

Go to Extensions, Split view and the External Tools have no default key. Assign one if you use them often.

Search syntax

The full reference for refern's 37 search operators, with value lists, ranges, exclusion with "-", smart folders and practical query recipes for artists.

Build refern extensions

Themes, app plugins and file format decoders for refern: how the three tiers work, which to choose, working templates, and prompts for AI coding agents.

On this page

Extensions and themesOpen the Extensions pageBuilt-in extensionsInstall an extension from a fileApply a themeHow extensions are kept safeLocal HTTP APITurn it on and create a tokenAccess levelsConnectCommand-line tool and SDKEndpoint groupsSecurity modelLimitsSee and undo API changesBuilt-in MCP serverToolsConnect an appWhat to knowExample requests to an assistantExternal ToolsAdd a toolArgumentsRun a toolCustom keyboard shortcutsRelated guides