Перейти к содержимому

MCP Integration

Connect Unsloth Desktop, LM Studio, or another MCP client to the running FrameRef instance.

Это содержимое пока не доступно на вашем языке.

FrameRef can expose a local MCP server from the running application. No helper executable is installed or signed — the server runs inside FrameRef and works with the board you already have open.

Open Scripts → MCP Integration… to configure it.

  1. Open FrameRef and open a board.

  2. Open Scripts → MCP Integration….

  3. Turn on Enable MCP server.

  4. Leave Allow MCP clients to edit boards off if you only want the model to inspect the board. Turn it on for captioning, tagging, grouping, and scripts.

  5. Copy the URL shown in the dialog. It looks like:

    http://127.0.0.1:57321/mcp/<token>

The server binds to 127.0.0.1 only. The default port is 57321, and the token is part of the URL. The token is stored locally in FrameRef’s settings.

The dialog has four collapsible sections:

Section Contents
Server Enable the server, allow board edits, and choose the port.
Connect a client Copy the URL, copy an LM Studio mcp.json entry, and follow client steps.
Local vision Endpoint used by analyze_images. The endpoint controls are currently hidden; see Local vision.
AI system prompt Copy a system prompt for small local models.

Changes apply immediately. Restart your AI client after adding or changing the server.

Unsloth Desktop accepts the plain MCP URL, so no configuration file is needed.

  1. In Unsloth, open the MCP dialog and choose Add custom MCP.
  2. Set the URL to the one copied from FrameRef.
  3. Leave authentication and headers empty; the token is already in the URL.
  4. Save and refresh the tools.

A board must be open in FrameRef for the board tools to appear. If Unsloth has Remote/LAN access enabled, local commands are disabled, but a 127.0.0.1 URL still works on the same machine.

Create or edit mcp.json:

{
"mcpServers": {
"frameref": {
"url": "http://127.0.0.1:57321/mcp/<token>"
}
}
}

Enable the server in LM Studio’s MCP panel. Restart the chat after changing the URL or port.

Any MCP client that accepts a streamable HTTP URL can use the same address. If the client asks for authentication, leave it empty and keep the token in the URL.

Tool What it does
frameref_help Returns the FrameRef guide, task recipes, troubleshooting, or the live Luau API reference.
get_board Returns a board summary: item counts by type, groups, common tags, and selection count.
list_items Finds item UIDs and summaries by type, tags, caption, group, or selection, with pagination.
capture_items Renders items and returns them as MCP image content.
analyze_images Captions or tags images with a local vision model.
update_items Writes captions, tags, or ratings in bulk.
group_items Groups items under a new group with an optional name.
ungroup_items Removes groups while keeping their children on the board.
run_script Runs Luau for operations that the typed tools do not cover.

get_board is the starting point for understanding a board. It does not list every item; use list_items for that.

list_items supports:

  • types — image, video, gif, pdf, audio, text, note, group, shape, color_swatch, portal, weblink, edge, line, svg.
  • tags with tagMatch set to any or all.
  • labelContains, hasCaption, and hasTags.
  • selectedOnly, groupUid, and ungroupedOnly.
  • includeGeometry for position and size.
  • limit and offset for paging.

Always obtain UIDs from list_items or get_board. Never invent one.

capture_items renders one or more items and returns them as image content. Use it when your client forwards tool images to the model.

Some clients, including LM Studio, display MCP image results but do not pass them to the model. In that case use analyze_images, which sends the captured images to a local OpenAI-compatible vision endpoint:

analyze_images(uids=["<uid>", "<uid>"], mode="caption", apply=true)

mode can be caption, tags, or both. Set apply=false to preview the results without writing. The default caption limit is 160 characters, and results are written as one undoable step.

Use update_items for captions, tags, and ratings. For a group, caption sets the visible group name. tagMode can be add, remove, or replace.

group_items and ungroup_items are spatial: items keep their positions. Do not group items that are already inside another group unless you explicitly want nested groups.

run_script executes Luau against the active board and returns a JSON-serializable value. print() messages are returned as logs. It is intended for operations not covered by the typed tools.

Scripts run on the UI thread and have a timeout. Keep them narrow, batch the work, and avoid rendering many items at once.

analyze_images calls an OpenAI-compatible vision endpoint directly. In the current build the vision endpoint controls are hidden in the dialog, but the feature still works with previously saved values or environment variables.

Set these environment variables before starting FrameRef:

Variable Purpose
FRAMEREF_VISION_BASE_URL Endpoint base URL, for example http://127.0.0.1:1234/v1 (LM Studio), http://127.0.0.1:11434/v1 (Ollama), http://127.0.0.1:8080/v1 (llama.cpp), or an Unsloth API URL.
FRAMEREF_VISION_MODEL Optional model name. Leave empty to use the first model reported by /v1/models.
FRAMEREF_VISION_API_KEY Required by some servers such as Unsloth; usually empty for LM Studio, Ollama, and llama.cpp.

For Unsloth, create a key in Settings → API and load a vision-capable model. For LM Studio, start the local server before calling analyze_images.

The AI system prompt section contains a short prompt you can copy into your AI client. It is especially useful for small local models because it explains the tool workflow and the caption/tag rules.

The MCP initialize response also includes a short instruction primer, and frameref_help returns the full guide. For exact Luau signatures, call frameref_help(topic="api", query="<name>").

  • The MCP server is loopback-only.
  • Requests with a browser Origin header are rejected.
  • The URL token is the authentication secret. Do not share it.
  • Board writes are disabled until Allow MCP clients to edit boards is on.
  • Every write is applied as one undoable step.
  • analyze_images sends captured images to the configured vision endpoint.
  • Only one FrameRef instance can own a given MCP port. Use one instance when working with MCP.
Problem Fix
Tools do not appear Enable the server, copy the URL again after changing the port, and restart the AI client.
FrameRef is not ready Open a board in FrameRef.
No active board Call get_board, then pass the boardId you want to use.
Board edits are disabled Enable Allow MCP clients to edit boards in the MCP dialog.
Item not found or empty updates Refresh the UIDs with list_items; the items may have been deleted.
analyze_images fails Start the vision server and check the endpoint path (/v1), model, and API key.
The model cannot see capture_items images Use analyze_images; this is a client limitation, not a FrameRef error.
Port already in use Choose a different port in the dialog and copy the new URL.