Large Language ModelsGenerate imagesGenerate videos
LM Studio MCP Image Generation: Local Setup Step by Step
A hands-on tutorial for running LM Studio MCP image generation on your own computer. Install LM Studio, pick a model that can call tools, edit mcp.json, add an image tool, approve the first call, and fix the errors that stop most setups. Working code included.
You type one sentence into a chat window on your own computer, and a few seconds later a finished photograph appears in the conversation. No browser tab, no copy and paste between apps, no cloud chatbot reading your drafts. That is what LM Studio MCP image generation feels like once the pieces are connected, and the connection takes about fifteen minutes. This tutorial follows the setup in order: installing LM Studio, choosing a model that can call tools, editing mcp.json, adding an image tool, approving the first call, and fixing the problems that trip up most first attempts.
Every file and command below is meant to be copied. Where a detail depends on your machine, a callout tells you what to check before you move on.
Why Run This Locally?
What MCP Does Here
MCP, the Model Context Protocol, is a standard way for an app to hand tools to a language model. LM Studio is the host. It loads a model on your machine, connects to one or more MCP servers, and shows the model what each server can do. When the model decides a tool is useful, LM Studio runs it and feeds the result back into the chat.
For images the tool is simple. The model writes a prompt, calls something like generate_image, and receives an image URL. The language model never draws a single pixel. It acts as a director: it takes your loose idea, turns it into a detailed brief, and hands that brief to an image engine.
Local Chat, Remote Image Engine
The split matters because it decides your hardware budget.
Piece
Where it runs
What it costs you
Chat model in LM Studio
Your computer
Memory and GPU time
MCP server process
Your computer
A few megabytes
Image model behind the tool
Your GPU or a hosted API
Depends on the option you pick
Running an image model beside a chat model on one consumer graphics card is possible but cramped, because both want video memory. Pointing the tool at a hosted API leaves the GPU free for the language model. Your conversation, your files and your tool approvals stay on your machine, and only the final image prompt travels out. This tutorial takes the hosted route and uses the PicassoIA API as the worked example, but the pattern fits any image service.
💡 Want everything offline? Swap the tool's backend for a local image server. The LM Studio side of the setup stays exactly the same.
What You Need Before You Start
Hardware That Works
The chat model's size sets the floor. These numbers are rough guidance for 4-bit builds, not benchmarks, so leave headroom for the context window.
Model class
Memory needed (approx.)
Comfortable machine
7B to 8B
about 5 GB
Laptop with 16 GB of RAM
20B
about 16 GB
Desktop with 32 GB of RAM or a 16 GB GPU
30B and up
24 GB and up
Workstation GPU or a Mac with 48 GB of unified memory
Apple Silicon Macs share one memory pool between CPU and GPU, which makes them surprisingly good at mid-size models. On Windows and Linux, an NVIDIA card with 12 GB of VRAM or more gives the smoothest ride, and a CPU-only run works if you accept slower replies.
Software Checklist
LM Studio 0.3.17 or later. That release added MCP support. Older builds have no Program tab.
Node.js (current LTS). Needed for the local command server shown below.
An image service token. For PicassoIA, create a secret on the API page. It starts with pia_sk_.
A plain text editor. The in-app editor works, but a second window helps when you compare JSON.
Install LM Studio and a Model
Download and Install
Download the installer for Windows, macOS or Linux from lmstudio.ai and run it like any other desktop app. Open the app, then check the version number in the settings. If it reads below 0.3.17, update before going further, because nothing in the next section exists in older builds.
The first launch offers a model catalog. Skip the biggest names for now. A small model that answers in two seconds tells you more about your setup than a huge one that needs a minute per reply.
Pick a Tool-Ready Model
Tool calling is a trained behavior. A model that never saw tool-use examples will ignore your image server or invent a broken call. Check each model card for "tool use" or "function calling" before you download.
Two sensible starting points, both available to try in the browser first so you can judge their writing before you spend bandwidth:
Pay attention to the context length setting when you load the model. Tool descriptions, your system prompt and the whole conversation share that window. A small window fills quickly, and a model that has lost the tool description simply stops calling the tool. Start with at least 8,000 tokens and raise it if the model forgets earlier steps.
💡 Download a 4-bit quantized build first. Prompt writing barely suffers, and the file is roughly a quarter of the full-precision size.
Wire Up the MCP Server
Open mcp.json in the App
Open any chat in LM Studio.
Switch to the Program tab in the right sidebar.
Click Install, then Edit mcp.json.
Edit the file in the built-in editor and save.
LM Studio follows Cursor's mcp.json notation, so a config written for Cursor reads the same way here. Saving should start the server and list its tools. A red error at this point almost always means broken JSON.
Add a Remote Server
Remote servers need a URL and, usually, a header with your credentials:
Replace the URL with the address your image provider publishes. PicassoIA lists its MCP connections inside your account, so check there for connection details. If a provider's sign-in flow expects a browser login instead of a static header, use the local command route below, which works with a plain token.
Add a Local Command Server
A local server is a small program that LM Studio starts for you:
💡 Check your plan. API access depends on your PicassoIA plan, so read the current terms on the pricing page before you build a daily routine around it.
First Run in the Chat Window
Open a new chat, load your tool-ready model, and confirm the server shows as enabled in the Program tab. Then ask for something concrete:
Generate a 16:9 photograph of a quiet harbor at sunrise, fishing boats at rest, soft haze, shot on 35mm film.
Here is what one round trip looks like once everything is connected:
You send the sentence above.
The model drafts a detailed brief of roughly 50 words and decides to call generate_image.
LM Studio pauses and asks for your approval.
The server creates the prediction, polls it, and gets back a URL.
The model replies with the link and a one-line description of what it requested.
On a mid-range laptop the whole loop usually lands in well under a minute, and most of that time is the language model thinking, not the image engine.
Approve the Tool Call
When the model calls your tool, LM Studio shows a confirmation dialog first. You can review the arguments, edit them, and then approve. Choose allow once while you test, or always allow for a tool you trust. Permanent permissions can be managed later in the app settings.
Read the arguments every time at the start. That is where you see what the model actually wrote: the prompt, the ratio, and anything odd it added. A model that sends a 3,000-character essay to a tool built for one paragraph needs a firmer system prompt.
After you approve, the tool runs, returns an image URL, and the model reports back in the chat. Open the link to see the result.
Write Prompts That Work
Models write better image prompts when the system prompt tells them how. Paste this into the system prompt field:
You are a photo director. When asked for an image, call generate_image with one prompt of 40 to 70 words: subject and action, setting, light direction, lens and distance, and surface texture. Never request neon, cartoon or 3D styles.
Why it works: image models respond to the same cues a photographer thinks in.
Subject and action come first, in plain words.
Light gets a direction: "window light from the left" or "overcast noon".
Lens and distance set the framing: "85mm close-up" or "24mm wide shot".
Texture adds realism: "wool weave", "wet stone", "fine film grain".
Short prompts are fine for drafts. For a final image, add detail and rerun with a fixed seed if your tool exposes one, so only a single variable changes at a time.
Fix Problems and Stay Safe
Server Won't Start
Work through this list in order:
Validate the JSON. One trailing comma is enough to stop everything.
Run the command by hand. Paste the command and args into a terminal. If it fails there, it fails in LM Studio too.
Check the path. Forward slashes on Windows, and no stray spaces.
Check the environment variable. An empty token produces an authorization error from the API rather than a crash, so read the tool's error text.
Model Ignores the Tool
Three causes account for most cases:
The model was not trained for tools. Switch to one whose card lists tool use.
Too many tools. LM Studio's own documentation warns that servers built for cloud assistants can use a large number of tokens and overload a local model. Keep one or two servers active, not ten.
The context window is too short. Raise the context length so the tool descriptions and the chat history both fit.
💡 Job stuck in processing? Remember the limit of 5 predictions at once. The API also exposes POST /v1/predictions/{id}/cancel for clearing jobs that hang.
Protect Your API Token
LM Studio's documentation says it plainly: never install MCP servers from untrusted sources. A server can run arbitrary code, read local files and use your network connection. Treat each entry in mcp.json like an app you are installing.
For your token:
Keep the secret in the env block, never in a chat message or a prompt.
Remember that mcp.json stores it as plain text, so never commit that file to a public repository.
PicassoIA allows two tokens per account, so rotate one at a time: create the new one, update mcp.json, then delete the old one.
Keep approvals on allow once for any server you did not write yourself.
How to Use P Image on PicassoIA
Before you wire a prompt into the tool, test it in a browser. P Image on PicassoIA returns a finished image in under a second with unlimited generations, which makes it a fast sandbox for prompts your language model will write later.
Paste the prompt. The prompt is the only required field. Use the one your local model wrote.
Set the aspect ratio. The default is 1:1. Choose 16:9 for wide images, or custom with a width and height that are multiples of 16.
Adjust the optional settings. Turn on prompt upsampling for short prompts. Enter a seed when you want to reproduce a result.
Generate. Click the generate button and wait about a second.
Download. Save the image and compare it with what your tool returned in LM Studio.
Parameter
Type
What it does
prompt
string
Required. The text description
aspect_ratio
choice
1:1 by default, plus 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, custom
width, height
integer
Used with custom only, multiples of 16
prompt_upsampling
boolean
Lets an LLM add visual detail to short prompts
seed
integer
Same seed and prompt reproduce the same image
If the draft looks right but you want a different look, run the same prompt through Z-Image Turbo, Flux 2 Klein 4B or Seedream 4.5 and keep the one that fits your project.
Make Your Own Images Today
You now have a chat window that writes briefs and an engine that turns them into photographs. Try one round tonight. Ask your local model for three prompts about a scene you care about, paste each into P Image on Picasso IA, and see which wording gives you the sharpest result. Then send the winning style to your LM Studio tool and watch the same image appear without leaving the chat.
Picasso IA also offers image editing, upscaling and short video clips, so a good still can become a thumbnail, a poster or a moving scene later. Browse the full catalog at picassoia.com/en/all-models, pick a model, and generate your first image today.