LM Studio Control
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@LM Studio Control Load a model with the best settings for my GPU and benchmark it."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
LM Studio Control — MCP server
Let Claude (or any MCP app) run LM Studio for you: start the server, load and unload models, tune load settings for your GPU, benchmark, chat, embed, download models and switch runtimes.
The settings optimizer stands out. It doesn't use rules of thumb. It asks LM Studio's own memory estimator about each candidate setup and keeps the fastest one that fits your VRAM.
Unofficial. Not affiliated with LM Studio or Element Labs. Uses the official
@lmstudio/sdk.
Real example
27B model (4.4 GB file) on a laptop RTX 4050 with 6 GB VRAM:
Setup | Context | KV cache | Speed |
LM Studio defaults | 262k | f16 | 6.1 tok/s |
| 32k | q8_0 | 7.5 tok/s |
| 8k | f16 | 9.9 tok/s |
One prompt: "Load bonsai-27b with the best settings for my GPU and benchmark it."
Related MCP server: llmstudio-mcp
Install
Requirements: LM Studio 0.4 or newer, running on the same computer. Node.js 18+ is only needed for the manual setups.
Claude Desktop (one click)
Download
lmstudio-mcp.mcpbfrom the latest release.Double-click it (or drag it onto Claude Desktop) and press Install.
Claude Code
git clone https://github.com/ZenZeiTen/lmstudio-mcp
claude mcp add lmstudio --scope user -- node /path/to/lmstudio-mcp/bundle/lmstudio-mcp.mjsAny other MCP app (Cursor, Cline, Windsurf…)
Clone the repo and add this to the app's MCP config:
{
"mcpServers": {
"lmstudio": {
"command": "node",
"args": ["/path/to/lmstudio-mcp/bundle/lmstudio-mcp.mjs"]
}
}
}bundle/lmstudio-mcp.mjs is a single self-contained file. No npm install needed.
Tools
Area | Tool | What it does |
Status |
| App version, HTTP server up/down, loaded models |
| GPUs and VRAM, RAM, CPU, runtime engine compatibility | |
Server |
| OpenAI-compatible server: port, CORS, network interface |
Models |
| Downloaded models: size, quantization, max context |
| Loaded models with live load settings and busy state | |
| Load with any of 22 settings (below) | |
| Unload one or all | |
Tuning |
| LM Studio's VRAM/RAM estimate, without loading |
| Best context / GPU offload / KV cache for your hardware; | |
| Real tokens per second and time to first token | |
Inference |
| Sampling options, JSON-schema output, speculative decoding |
| Embedding vectors | |
| Token count with the model's own tokenizer | |
Downloads |
| Catalog search with LM Studio's "will it fit" estimate |
| Background downloads with progress and cancel | |
Runtimes |
| List engines (CUDA, Vulkan, CPU, MLX…) and pick one per format |
Escape hatch |
| Runs any |
Load settings: context_length, gpu_offload, main_gpu, split_strategy, disabled_gpus, cpu_expert_layers_ratio (MoE), offload_kv_cache_to_gpu, flash_attention, k_cache_quant, v_cache_quant, eval_batch_size, physical_batch_size, max_parallel_predictions, unified_kv_cache, keep_model_in_memory, try_mmap, num_experts, seed, rope_frequency_base, rope_frequency_scale, gpu_strict_vram_cap, speculative_draft_model.
LM Studio's REST API rejects several of these (KV-cache quantization, for example). The SDK used here accepts all of them.
How the optimizer decides
Each candidate goes to LM Studio's estimateResourcesUsage. It is accepted only if:
estimated VRAM ≤ VRAM × (1 − headroom, default 10 %)
the part left in RAM ≤ RAM × (1 − headroom, default 20 %)
LM Studio's load guardrails pass
The search order:
Full GPU offload, KV cache in VRAM, Flash Attention on. Binary search for the largest context, in 256-token steps.
Partial offload: the largest GPU share (5 % steps) that fits VRAM, then checked against RAM. Handles models too big for VRAM or RAM alone, such as a 70B on 24 GB VRAM + 32 GB RAM.
CPU only, as a last resort.
Goal | Context target | KV cache tried |
| 32k | q8_0, then q4_0 |
| model maximum | q8_0, then q4_0 |
| 8k | f16, then q8_0 |
| 16k | f16, then q8_0 |
single_user=true (default) sets parallel slots to 1, so one conversation gets the full context. A run takes 2–35 estimator calls.
Settings
Set these in Claude Desktop's extension settings, or as environment variables for manual setups. All are optional.
Variable | Default | Use |
|
| Port checked and used by server start |
| auto | Control LM Studio on another machine, e.g. |
| – | Only if "Require authentication" is on in LM Studio |
|
| Location of the |
|
| Run |
Safety
Server stop, unload and
lmstudio_cliare marked destructive, so MCP apps ask before running them.Binding the server to
0.0.0.0exposes LM Studio to your network. Turn on authentication in LM Studio first.lmstudio_cliruns only thelmsprogram, without a shell. Arguments are passed as a list, so shell injection isn't possible.
Build from source
npm install
npm run build # TypeScript → dist/
npm test # optimizer unit tests
npm run bundle # single-file bundle → bundle/lmstudio-mcp.mjs
npm run pack:mcpb # Claude Desktop extension → lmstudio-mcp.mcpbLicense
MIT © 2026 Ricardo Sandy Aries
Available Tools
19 toolslmstudio_benchmarkARead-only
Measure real speed of a loaded model: tokens per second, time to first token, prompt size. Runs fixed prompts at temperature 0. Use to compare settings.
Inputs: identifier (required), runs, prompt, max_tokens.
lmstudio_chatB
Send a chat to a local model and get the reply with speed stats. If the model is not loaded, LM Studio loads it with its saved defaults.
Inputs: stop, min_p, model, top_k, +10 more.
lmstudio_cliADestructive
Run any lms command for anything the other tools do not cover (e.g. runtime update, import, link, daemon). Pass arguments without the leading 'lms'. Avoid streaming commands like 'log stream'.
Inputs: args (required), timeout_seconds.
lmstudio_count_tokensARead-only
Count tokens in a text using a loaded model's own tokenizer, and compare with its context length.
Inputs: text (required), model.
lmstudio_download_modelA
Download a model from the catalog in the background. Picks the file LM Studio recommends for this machine unless you name a quantization. Check progress with lmstudio_download_status.
Inputs: query (required), quantization.
lmstudio_download_statusB
Progress of downloads started in this session. Can also cancel one.
Inputs: cancel, job_id.
lmstudio_embedBRead-only
Turn text into embedding vectors with a local embedding model. Returns vectors, or only their dimensions if vectors are not needed.
Inputs: texts (required), model, include_vectors.
lmstudio_estimate_memoryARead-only
Ask LM Studio how much VRAM and RAM a model would use with given load settings, without loading it. Shows whether it passes LM Studio's safety guardrails.
Inputs: model (required), config.
lmstudio_hardwareARead-only
Hardware LM Studio sees: GPUs with VRAM, system RAM, CPU and instruction sets, plus the runtime engines and whether each is compatible. Use before tuning load settings.
Inputs: all_engines.
lmstudio_list_loadedARead-only
List models currently loaded in memory, with their live load settings (context, GPU offload, KV cache, etc.), idle timeout and whether they are busy.
Inputs: no named parameters.
lmstudio_list_modelsARead-only
List models downloaded on this machine, with size, quantization, architecture and maximum context.
Inputs: type, filter.
lmstudio_load_modelA
Load a downloaded model into memory with explicit settings. Omitted settings use LM Studio's saved defaults for that model. For automatic tuning use lmstudio_optimize_settings instead.
Inputs: model (required), config, identifier, ttl_seconds.
lmstudio_optimize_settingsA
Find the best load settings for a model on this hardware, using LM Studio's own memory estimator (no guessing). Searches context length, GPU offload and KV-cache precision so the model fits VRAM/RAM with headroom. Goals: balanced (32k context, full GPU if possible), max_context (largest context that fits), max_speed (everything on GPU, 8k context), max_quality (unquantized KV cache). Set apply=true to load it.
Inputs: model (required), goal, apply, identifier, +7 more.
lmstudio_runtime_enginesB
List installed inference engines (llama.cpp CUDA/Vulkan/CPU, MLX…) and which one is selected per model format, or select a different engine.
Inputs: name, action, version, model_format.
lmstudio_search_modelsARead-only
Search the LM Studio catalog / Hugging Face for models to download. Shows each file option with size and LM Studio's fit estimate for this machine (full GPU, partial GPU, CPU, or won't fit).
Inputs: query (required), limit, format.
lmstudio_server_startAIdempotent
Start LM Studio's OpenAI-compatible HTTP server (what other apps and curl talk to). Wakes the LM Studio service first if needed.
Inputs: cors, port, network_interface.
lmstudio_server_stopADestructiveIdempotent
Stop LM Studio's HTTP server. Loaded models stay loaded; apps using the API will lose their connection.
Inputs: no named parameters.
lmstudio_statusBRead-only
Overview of LM Studio: app version, whether the OpenAI-compatible HTTP server is running, and which models are loaded right now.
Inputs: http_port.
lmstudio_unload_modelADestructiveIdempotent
Unload a loaded model (frees its RAM/VRAM), or all loaded models.
Inputs: all, identifier.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 19 tools
Most tools target a clearly distinct operation (load vs unload vs estimate vs benchmark vs chat). The only fuzzy pairs are lmstudio_status vs lmstudio_list_loaded (both report what's loaded) and lmstudio_load_model vs lmstudio_optimize_settings, but the descriptions explicitly cross-reference and differentiate them.
All tools share the lmstudio_ prefix and are mostly verb_noun (load_model, list_models, download_status). A few are bare nouns (status, hardware, benchmark, chat, cli) which slightly breaks the verb_noun pattern but stays readable and predictable.
19 tools is on the heavy side but each covers a real facet of the domain: server control, hardware, model catalog/downloads, load/unload lifecycle, memory estimation, optimization, benchmarking, and inference. The lmstudio_cli escape hatch keeps the surface from bloating further.
Load/unload/list/download/search/benchmark/chat/embed plus server lifecycle and runtime engine selection cover the full model-management lifecycle. Minor gaps like deleting a downloaded model or configuring server settings (port, API key) are largely workable around via lmstudio_cli.
Maintenance
Related MCP Connectors
Chat, image, video, and audio models from many vendors behind one remote MCP server and one key.
Use AI models for chat, image, and video generation from Claude Code and other MCP hosts.
Connect ChatGPT and Claude to your Mac, Windows or Linux with secure MCP remote access.
Remote MCP for RunComfy: ComfyUI deployments, hosted models, LoRA training. 31 tools.
Related MCP Servers
- AlicenseCqualityDmaintenanceEnables MCP clients to interact with local LLMs via LM Studio, supporting dynamic chat, vision, RAG, file interaction, and model orchestration.28MIT
- FlicenseAqualityDmaintenanceMCP server that connects LLM agents to a local LM Studio instance, enabling model management, OpenAI-compatible chat completions, text completions, and embeddings through a set of tools.91-
- AlicenseNot gradedqualityDmaintenanceExposes local LM Studio language models as MCP tools, enabling chat completions and model listing through a local OpenAI-compatible API without requiring API keys.MIT
- FlicenseBqualityCmaintenanceEnables MCP clients to administer a local LM Studio instance: loading, estimating, downloading, configuring and unloading models, running chat and embedding inference, diagnosing the server, engines and hardware, and managing MCP connectors with conflict-safe configuration. It also builds a local document index supporting citation-checked search and answers grounded in TXT, Markdown, PDF and DOCX files.28-