llmstudio-mcp
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., "@llmstudio-mcp list all available models in LM Studio"
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.
llmstudio-mcp
MCP server exposing a local LM Studio instance to LLM agents — list / load / unload models, run chat and text completions, generate embeddings, and reach any other LM Studio REST endpoint via a raw escape hatch.
Table of contents
Related MCP server: mcp-file-system-lmstudio
Tools
Tool | Parameters | Description |
|
| Lists downloaded models with metadata (type, state, context length, quant) |
|
| Info about a single model |
| — | Models currently resident in memory |
|
| Loads a model into memory |
|
| Frees a model from memory |
|
| OpenAI-compatible chat completion ( |
|
| OpenAI-compatible text completion ( |
|
| OpenAI-compatible embeddings ( |
|
| Escape hatch for any LM Studio REST endpoint |
Environment variables
Variable | Required | Default | Description |
| no |
| LM Studio server URL |
| no | empty | API token (only if you enabled token auth in LM Studio's Developer tab) |
| no |
| HTTP timeout in seconds; raise for slow models or large generations |
Prerequisites
LM Studio running with its API server enabled — either the desktop app with
the Developer tab toggle on, or lms server start from the CLI. At least one
model downloaded (lms get <model>).
Wiring it up
Only requirement: uv (https://docs.astral.sh/uv/). Nothing else to install.
Claude Code
claude mcp add llmstudio-mcp -- uvx --from git+https://github.com/dam2452/llmstudio-mcp.git llmstudio-mcpIf you enabled API token auth in LM Studio:
claude mcp add llmstudio-mcp -e LMSTUDIO_MCP_API_KEY=<token> -- uvx --from git+https://github.com/dam2452/llmstudio-mcp.git llmstudio-mcpClaude Desktop / other MCP client
{
"mcpServers": {
"llmstudio-mcp": {
"command": "uvx",
"args": ["--from", "git+https://github.com/dam2452/llmstudio-mcp.git", "llmstudio-mcp"]
}
}
}After pushing a new version: uv cache clean and restart the client.
Local run
uv run --directory . llmstudio-mcpTests (manual):
uv run --directory . --with pytest pytest test/Available Tools
9 toolschatA
Send a chat completion request to a model (OpenAI-compatible /v1/chat/completions).
The model is auto-loaded if not already in memory (JIT loading enabled by default in LM Studio). Set stream=True only when the MCP client supports streamed responses; most do not.
Examples: chat(model="qwen/qwen3-4b-2507", messages=[{"role":"user","content":"Hello"}]) chat(model="qwen/qwen3-4b-2507", messages=[{"role":"system","content":"Be terse."},{"role":"user","content":"Hi"}], temperature=0.2, max_tokens=64)
Inputs: model (required), messages (required), stop, tools, +5 more. Returns: object
completeA
Send a raw text-completion request to a model (OpenAI-compatible /v1/completions).
Prefer chat() for instruction-tuned conversational models. complete() is useful for base / completion models or for prompt-template experimentation.
Examples: complete(model="qwen/qwen3-4b-2507", prompt="The meaning of life is", max_tokens=20)
Inputs: model (required), prompt (required), stop, top_k, +4 more. Returns: object
embedA
Generate an embedding vector for the given text (OpenAI-compatible /v1/embeddings).
input can be a single string or a list of strings for batch embedding.
Examples: embed(model="text-embedding-nomic-embed-text-v1.5", input="hello world") embed(model="text-embedding-nomic-embed-text-v1.5", input=["hello", "world"], normalize=True)
Inputs: input (required), model (required), normalize. Returns: object
get_loaded_modelsA
List models currently loaded into memory (ready for inference).
Examples: get_loaded_models()
Inputs: no named parameters. Returns: object
get_modelB
Get detailed info about a single model.
Examples: get_model(model_key="qwen/qwen3-4b-2507") get_model(model_key="text-embedding-nomic-embed-text-v1.5")
Inputs: model_key (required). Returns: object
list_modelsA
List models available in the local LM Studio instance.
Queries /api/v0/models which returns every downloaded model with rich metadata: type (llm / vlm / embeddings), publisher, arch, quantization, state (loaded / not-loaded), and max_context_length.
Examples: list_models() list_models(type="llm") list_models(type="embeddings")
Inputs: type. Returns: object
load_modelA
Load a model into memory so it is ready for inference.
If context_length is omitted, the model's configured default is used. Only LLMs loaded via LM Studio's llama.cpp engine honor flash_attention, num_experts, eval_batch_size and offload_kv_cache_to_gpu.
Examples: load_model(model_key="qwen/qwen3-4b-2507") load_model(model_key="openai/gpt-oss-20b", context_length=16384, flash_attention=True)
Inputs: model_key (required), num_experts, context_length, eval_batch_size, +2 more. Returns: object
raw_requestA
Escape hatch: send an arbitrary request to the LM Studio REST API.
Use this when you need an endpoint not covered by a dedicated tool (e.g. /api/v1/chat stateful chats, /api/v1/models/download, /v1/responses, the Anthropic-compatible /v1/messages, etc.). path must start with a slash and is appended to the configured base URL.
Examples: raw_request(method="GET", path="/api/v0/models") raw_request(method="POST", path="/api/v1/chat", json_body={"model":"qwen/qwen3-4b-2507","messages":[{"role":"user","content":"hi"}]})
Inputs: path (required), method (required), json_body. Returns: object
unload_modelA
Unload a model instance from memory, freeing RAM / VRAM.
The instance_id is the identifier returned by load_model (usually equal to the model key, but may differ when multiple instances of the same model are loaded). Use get_loaded_models to discover currently loaded instance_ids.
Examples: unload_model(instance_id="qwen/qwen3-4b-2507")
Inputs: instance_id (required). Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Each tool has a distinct purpose: chat, complete, and embed for inference; list_models, get_model, load_model, unload_model for model management; raw_request as an escape hatch. No functional overlap.
Consistent verb_noun pattern (e.g., get_loaded_models, list_models, load_model) with simple action verbs for inference (chat, complete, embed). All lowercase with underscores; clear and predictable.
9 tools cover the core server management lifecycle: model discovery, loading/unloading, inference, and a raw_request for extensibility. Neither too few nor too many for the domain.
Covers all essential operations: model listing, loading, inference (chat/complete/embed), and unloading. Missing model download/delete is a minor gap, but raw_request can handle edge cases.
Maintenance
Related MCP Connectors
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
MCP server for building and testing AI agents with multi-model experimentation and insights.
MCP server for OpenAI API (chat completions, image generation, embeddings) via AceDataCloud
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
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
- 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
- FlicenseAqualityBmaintenanceEnables MCP-compatible clients to use locally running LM Studio models as tools for sending prompts, listing available models, and checking server status. It automatically handles WSL2 networking and follows the currently loaded model without reconfiguration.3-
- AlicenseNot gradedqualityAmaintenanceEnables MCP-compatible applications to manage and use local or cloud-hosted models, including listing, pulling, generating, chatting, embeddings, and web search/fetch through a unified tool interface.923 npmAGPL 3.0