lmstudio
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| LMS_PATH | No | Path to the `lms` CLI shipped with LM Studio. Default: ~/.lmstudio/bin/lms, otherwise `lms` on PATH. | |
| LM_API_TOKEN | No | API token, only needed if API authentication is enabled in LM Studio. Default: none. | |
| LMSTUDIO_BASE_URL | No | URL of the LM Studio server. Only needed for LM Studio on another machine or when `lms` is not available. Default: detected with `lms`, otherwise http://127.0.0.1:1234. | |
| LMSTUDIO_MCP_HOME | No | Folder where sessions, tasks and model defaults are kept. Default: ~/.lmstudio-mcp. | ~/.lmstudio-mcp |
| LMSTUDIO_TIMEOUT_MS | No | Timeout in milliseconds, used for loading a model. Default: 1200000 (20 minutes). | 1200000 |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
Tools for the user's LM Studio: server control, models, sessions, background tasks and local inference.
Start with server_status. If LM Studio is not reachable, call server_start (not available when only a URL of another machine is set).
Models: list_models shows what is downloaded and loaded. Check memory with estimate_load before loading. Ask the user before loading a model that needs more than about half of system_ram (in server_status: the RAM of the machine that runs LM Studio), and before every download_model: downloads can be tens of GB. load_model keeps a model that is already loaded; pass replace: true to reload it with other settings.
Context: model_defaults saves per-model load settings (context_length, ttl, gpu, parallel) that load_model, chat, sessions and tasks then use. When the user says a model needs a certain context (for example 262144 tokens), save it there. Saved defaults are the user's choice: leave context_length out of load_model, session_start, task_start, chat and estimate_load so that they apply, and pass it only when the user asks for another value.
Sessions are conversations kept in LM Studio: session_start (model, optional system_prompt and context_length), then session_send. Every answer shows how full the context is; past 80% run session_compact or start a new session. session_get lists the sessions or shows one.
Tasks run a session turn in the background: task_start returns a task_id at once; follow it with task_status (wait_seconds waits for the result) and stop it with task_cancel. Use tasks for long jobs so you can keep working meanwhile. Tasks stop when this Claude Code session ends.
chat is a one-off prompt without history. chat, sessions and tasks load the model when needed.
To give the local model code, logs or documents, pass their paths in files (chat, session_send, task_start) instead of pasting the text: the files are read from disk and added to the message.
Unload the models you loaded once the work is done, unless the user wants them kept. Check local answers before relying on them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| server_statusA | Check whether the LM Studio API is reachable, which URL is used, which models are loaded (with TTL) and which background tasks run. Call this first. |
| server_startA | Start the LM Studio API server on this machine (lms server start). Without port it reuses the last port. Listens on localhost only. |
| server_stopA | Stop the LM Studio API server on this machine (lms server stop). Other apps that use the API lose access until it is started again. |
| list_modelsA | List the models downloaded to LM Studio with key, type, size, quantization, max context, capabilities, loaded instances and saved defaults. |
| model_defaultsA | Save default load settings for a model: context length, TTL, GPU offload, parallel slots. load_model, chat, sessions and tasks use them whenever a setting is not given. With only model it shows that model's defaults, without arguments all of them; clear: true removes them. |
| estimate_loadA | Estimate the memory a model needs before loading it (lms load --estimate-only; nothing is loaded). Use it before loading large models. |
| load_modelA | Load a model into memory. Large models can take minutes and most of the RAM: run estimate_load first and get the user's OK for big ones. If the model is already loaded it is kept as it is; pass replace: true to reload it with other settings. Saved model_defaults fill in missing settings. ttl, gpu, parallel and identifier use the lms CLI (LM Studio on this machine only); flash_attention, eval_batch_size, num_experts and offload_kv_cache_to_gpu use the REST API. The two groups can't be mixed in one call. |
| unload_modelA | Unload a loaded model instance to free memory, or every loaded model with all: true. Refuses while a session request or task uses the model. |
| download_modelA | Start downloading a model from the LM Studio catalog (e.g. "qwen/qwen3-4b") or a Hugging Face URL. Downloads can be tens of GB: confirm the model with the user first. Returns a job_id for download_status. |
| download_statusB | Progress of a download started with download_model. |
| session_startA | Start a conversation with a local model that LM Studio remembers across messages. Loads the model if needed, with context_length (else the saved default) as the minimum context. Then use session_send, or task_start to run a message in the background. |
| session_sendA | Send a message in a session, with optional text files and images, and wait for the answer. Reports how full the context is. For long jobs use task_start instead. |
| session_getA | Without session_id: list the sessions with model, turns and context use. With session_id: settings, context use, summary and the latest turns. |
| session_compactA | Free the context of a session: the model summarizes the conversation, and the next message starts a fresh context that begins with that summary. Use it when session_send or task_status warns that the context is getting full. |
| session_deleteA | Delete a session (or all of them) with its tasks. Loaded models stay loaded. |
| task_startA | Run a prompt, with optional text files and images, on a local model in the background and return a task_id at once. Pass session_id to continue a session, or model (plus optional session settings) to start a new session for the task. Follow it with task_status; stop it with task_cancel. |
| task_statusA | Without task_id: list recent tasks. With task_id: progress of a running task (phase, answer so far, tool calls) or the full result of a finished one. wait_seconds waits up to that long for the task to finish before answering. |
| task_cancelA | Stop a running background task. The session keeps everything up to the previous answer. |
| chatA | Send a single prompt (with optional text files and images) to a local model and get its answer with speed stats; nothing is remembered. Loads the model if needed. For conversations use sessions, for long jobs task_start. |
| embedA | Embed texts with a local embedding model. Returns the dimensions and the cosine-similarity matrix between the texts; raw vectors only on request. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 20 tools
Most tools target clearly distinct resources and lifecycle stages, especially the model, session, task, and server management groups. The main overlap is among prompt-sending tools (chat, session_send, task_start), but descriptions make their differences clear enough for an agent.
All names use snake_case and are readable, but conventions are mixed: some are verb_noun (load_model, list_models), others are noun_verb (session_send, task_status) or noun_noun (model_defaults, download_status). The inconsistency is noticeable but not chaotic.
Twenty tools is on the heavy side and sits in the borderline 16-25 range for a single MCP server. The domain is broad (server, models, downloads, sessions, tasks, embeddings), so most tools earn their place, but the set feels larger than necessary.
The surface covers most core workflows: model download/load/unload/list, chat and sessions, background tasks, embeddings, and server control. Minor gaps remain, such as no clear download cancellation or model deletion operation, but agents can work around them.