MCP tools reference
The StyleRef MCP server exposes 15 tools. Five are anonymous and read-only; ten require a connected StyleRef account and a scope. This page documents each with its parameters and behavior.
Account-scoped tools gate on a scope (styles:read, styles:write, or extract). An anonymous call to one is answered with HTTP 401 and a WWW-Authenticate header, which is what makes an OAuth-capable client offer sign-in — see Authentication & scopes. A connected call whose token lacks the scope returns an INSUFFICIENT_SCOPE message instead.
Costs and limits
| What | Free plan | Pro |
|---|---|---|
Read tools, apply_style_to_prompt, validate_style_md | free | free |
extract_style | 30 credits per extraction, first generation of the saved draft included | included |
generate_style | 5 credits | included |
| Requests to the server | 60 a minute per IP | 60 a minute per IP |
extract_style calls | 5 a minute | 5 a minute |
publish_style calls | 10 an hour | 10 an hour |
Credit prices are the current ones; Plans & limits is the source of truth. A call over a rate limit returns HTTP 429 with Retry-After.
The context parameter
Every tool takes one parameter not listed in its table below: a required context string. Say in a short sentence what you are trying to accomplish with the call — for example "find a minimal style for a landing page hero". It is used to understand what agents come to StyleRef for, so the tools can be made to serve those goals better. It never changes what a tool returns.
Anonymous tools
No login. These read and apply public styles.
search_styles
Search the public gallery. The entry point for finding a style.
| Parameter | Type | Notes |
|---|---|---|
query | string | 2–5 keywords: what is being made plus the look (for example fintech dashboard light). Optional. |
category | string | Discipline/category filter. Optional. |
sort | popular | recent | Ordering. Defaults to recent. |
limit | integer 1–10 | Max results. Defaults to 8. |
Returns compact cards — name, slug, @handle, essence, URL, hero image, and up to six palette hex colors so a client can show swatches without a second call. Feed a slug to get_style_md, get_style or apply_style_to_prompt.
Results are ranked by meaning as well as by keyword, so a query like billing dashboard with readable tables finds styles that describe the same thing in other words. Each card ends with a why line — the words that matched and in which field, or “close in meaning”.
Clients that render MCP Apps (Claude.ai, Claude Desktop, ChatGPT) also get an interactive card list. Coding agents get text only, so the result stays small in their context.
get_style
Fetch a style compiled into a ready-to-use spec.
| Parameter | Type | Notes |
|---|---|---|
ref | string | Required. A style reference — a share slug, a /share URL, or (connected) your own style’s id or /styles/{id} URL. |
format | default | flux | midjourney | diffusion | stylemd | json | Output dialect. Defaults to default. |
sections | string[] | Return only these sections (for example ["colors","typography"]) to cut tokens. |
compact | boolean | Strip boilerplate and collapse whitespace to save tokens. |
Every response carries the canonical StyleRef URL. json and stylemd return their own structure; other formats get a metadata header and attribution footer. A second text block names the style, its author and its link, for the agent to pass on to the user — it is never part of the spec.
The image dialects (flux, midjourney, diffusion) leave out writing-voice items — formality, emoji and hashtag usage, tone of copy — which only add noise to an image prompt. default and stylemd keep them.
Your own styles compile from your last generation. get_style, get_style_md and apply_style_to_prompt serve what you last generated — on styleref.io or with generate_style (below) — not your live edits. It is the same rule the REST API follows, so every surface hands out the same thing. Gallery styles are already frozen published snapshots and are unaffected. A style you have never generated returns this as the tool’s output:
This style hasn’t been generated yet. Call generate_style with the same ref first, then retry.
apply_style_to_prompt
Wrap a request in a style and return one ready-to-paste prompt for a target tool. No AI call, no credits.
| Parameter | Type | Notes |
|---|---|---|
prompt | string | Required. The raw user request to style. |
ref | string | Required. The style to apply. |
target | chatgpt | claude | gemini | midjourney | flux | dalle | stable-diffusion | generic | Required. Sets the dialect and how the style is placed relative to the request. |
get_style_md
Return a complete STYLE.md body for a style, ready to write into a repo.
| Parameter | Type | Notes |
|---|---|---|
ref | string | Required. The style to export. |
The first text block is the file. A second text block names the style and its link for the agent to tell the user; it does not belong in the file.
validate_style_md
Lint a STYLE.md document. Read-only.
| Parameter | Type | Notes |
|---|---|---|
text | string | Required. The STYLE.md document to check. |
Returns valid, errors, warnings, and parsed meta. See Validate & lint.
Account-scoped tools
These require a connected StyleRef account. The scope is listed per tool.
list_my_styles · styles:read
List the styles in the connected user’s library — name, visibility, last update, link.
| Parameter | Type | Notes |
|---|---|---|
limit | integer 1–50 | Max styles. Defaults to 20. |
save_style · styles:write
Save (like) a public gallery style to the user’s library. Idempotent.
| Parameter | Type | Notes |
|---|---|---|
ref | string | Required. The gallery style to save. |
fork_style · styles:write
Remix a public style into the user’s library as a private, editable copy with lineage back to the original.
| Parameter | Type | Notes |
|---|---|---|
ref | string | Required. The gallery style to remix. |
create_style · styles:write
Author a style from structured blocks, or duplicate one of your own styles with from_ref (a plain copy, no lineage). To remix someone else’s style, use fork_style, which credits the original and respects the creator’s remix setting. You can pass both to duplicate-then-tweak. Read the styleref://schema resource first for valid block types.
| Parameter | Type | Notes |
|---|---|---|
name | string | Style name. Optional when duplicating. |
description | string | One-paragraph description. Optional. |
blocks | array | Style blocks per the schema. Required unless from_ref is given. |
from_ref | string | Duplicate one of your own styles. Other creators’ styles are refused; use fork_style instead. |
Each block is { type, value } where type is a schema block type and value matches the shape the schema defines.
update_style · styles:write
Rename a style and/or add or replace blocks (a supplied block replaces the existing block of the same type). Blocks cannot be deleted through MCP.
| Parameter | Type | Notes |
|---|---|---|
ref | string | Required. One of your styles — its share slug or id. list_my_styles returns a ready-to-use ref. |
name | string | New name. Optional. |
set_blocks | array | Blocks to add or replace, matched by type. Optional. |
generate_style · styles:write
Generate one of your own styles so get_style, get_style_md and apply_style_to_prompt can use it — the same as pressing Generate on styleref.io. Call it after create_style, update_style or fork_style. It freezes the style as it is at that moment; later edits wait for the next generation.
| Parameter | Type | Notes |
|---|---|---|
ref | string | Required. One of your styles — its share slug or id. |
Costs 5 credits on the Free plan and nothing on Pro. The result states the cost and your remaining balance. Without enough credits it returns the price and a link to the pricing page, and spends nothing; if saving fails, any credits spent are refunded.
extract_style · extract
Run AI extraction to derive a structured style from any combination of sources. Async — returns an id to poll. Spends extraction credits on the Free plan (see Plans & limits).
| Parameter | Type | Notes |
|---|---|---|
text | string | A description or brand brief. To capture a project’s look: a summary with its exact colors (with role and rough share), fonts, radii, spacing, layout and mood. Raw theme code also works but extracts less well. Up to 40,000 characters. |
reference | string | A named aesthetic to emulate (for example “Bauhaus”). |
image_url | string (https) | A public image URL. |
document_url | string (https) | A public PDF or text file URL. |
images | array | Up to 3 images sent inline: { data, media_type?, name? }, data as base64 or a data: URL. 1 MB each, 3 MB total. For screenshots the agent has locally. |
Provide at least one source; multiple are fused into one style. Poll check_extraction_status for the result.
To capture a project’s existing look, send a summary of it as text plus screenshots or finished pieces as images. The text gives the exact values and the images give the proportions; the capture-project-style prompt runs the whole flow.
check_extraction_status · extract
Poll an extraction started by extract_style.
| Parameter | Type | Notes |
|---|---|---|
extraction_id | string | Required. The id returned by extract_style. |
save_as_draft | boolean | On completion, save the result as a draft style in your library. |
name | string | Name for the draft. Defaults to the AI-suggested title. |
Saving is idempotent — polling twice with save_as_draft returns the same style rather than creating a duplicate. The draft is saved already generated (included in the extraction’s price), so get_style_md and get_style can use it right away. When the extraction came from an image, that image is attached to the draft as an inspiration image, the same as in the app.
On the free plan an extraction is capped to the top style items by rank. When items are withheld, the result says so on its own line (“Free plan: the top 10 style items were returned and 12 more are locked — Pro unlocks the full extraction”) instead of returning a silently shortened list. Relay that line to the user.
publish_style · styles:write
Publish one of your styles through the moderation pipeline. public lists it in the gallery. unlisted means what it means everywhere in StyleRef: anyone with the link can open it, and it is not in the gallery. Both run an automated safety and metadata review.
| Parameter | Type | Notes |
|---|---|---|
ref | string | Required. One of your styles. |
visibility | public | unlisted | Defaults to public. |
confirm_rights | boolean | Must be true — confirms you have the rights to publish. |
Publishing to public requires at least 10 style items. unlisted has no minimum.
Re-publishing an already published style keeps the current public version live while the new version is reviewed. The new version replaces it only once it passes review; if it is rejected, the current version stays up.
set_style_visibility · styles:write
Lightweight visibility control: private revokes the share link; unlisted takes a listed style out of the gallery and keeps its link working. Activating a link for the first time must go through publish_style (it needs moderation).
| Parameter | Type | Notes |
|---|---|---|
ref | string | Required. One of your styles. |
visibility | private | unlisted | Required. |
Next steps
- Resources & prompts — browseable data and reusable prompts.
- Authentication & scopes — connect an account for write tools.
- Connect your client — set up the server.