LM Studio MCP Server
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 MCP Server list available models"
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 MCP Server
A Model Context Protocol (MCP) server for LM Studio that enables model management through standardized tools.
Features
📋 List Models - View all available models and their current state
🚀 Load Models - Load models into memory with configurable TTL
🛑 Unload Models - Immediately unload models from memory
⚙️ Configure Models - Adjust model settings like TTL and draft models
📊 Model Details - Get detailed information about specific models
Related MCP server: LM Studio MCP Bridge
Prerequisites
Node.js >= 18.0.0
LM Studio running with local server enabled
LM Studio local server running on port 1234 (default) or custom port
Installation
npm install
npm run buildQuickstart (Build & Run)
Follow these steps to build and run the MCP server locally.
Install dependencies and build the project:
npm install
npm run buildStart the server (uses the compiled files in
dist):
npm startThe server writes MCP communication to
stdoutand logs tostderr.
Environment variable tips:
Default LM Studio URL:
http://localhost:1234.To use a custom LM Studio URL, set
LM_STUDIO_BASE_URLbefore starting.
PowerShell (Windows) example:
$env:LM_STUDIO_BASE_URL = "http://localhost:1234"
npm startCommand Prompt (Windows) example:
set LM_STUDIO_BASE_URL=http://localhost:1234 && npm startmacOS / Linux example:
LM_STUDIO_BASE_URL="http://localhost:1234" npm startDevelopment workflow:
Rebuild on change (in one terminal):
npm run watchRun the server (in another terminal):
npm run dev(starts Node with the inspector)
You can also run the compiled script directly with node dist/index.js if preferred.
Configuration
LM Studio Setup
Open LM Studio
Go to the Developer tab
Enable the local server (default port: 1234)
Optionally enable "Serve on Local Network" if accessing remotely
Environment Variables
LM_STUDIO_BASE_URL- Base URL for LM Studio API (default:http://localhost:1234)
Usage
With Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"lmstudio": {
"command": "node",
"args": ["/path/to/lmstudio-mcp/dist/index.js"],
"env": {
"LM_STUDIO_BASE_URL": "http://localhost:1234"
}
}
}
}With Other MCP Clients
Run the server directly:
node dist/index.jsThe server communicates over stdio following the MCP protocol.
Available Tools
list_models
List all available models with their current state (loaded/not-loaded).
Parameters: None
Example Response:
[
{
"id": "lmstudio-community/Meta-Llama-3-8B-Instruct-GGUF",
"type": "llm",
"publisher": "Meta",
"architecture": "llama",
"state": "loaded",
"max_context_length": 8192
}
]get_model_details
Get detailed information about a specific model.
Parameters:
model_id(string, required) - The ID of the model
Example:
{
"model_id": "lmstudio-community/Meta-Llama-3-8B-Instruct-GGUF"
}load_model
Load a model into memory with configurable Time-To-Live.
Parameters:
model_id(string, required) - The ID of the model to loadttl(number, optional) - Time-To-Live in seconds before auto-unload (default: 3600)
Example:
{
"model_id": "lmstudio-community/Meta-Llama-3-8B-Instruct-GGUF",
"ttl": 7200
}unload_model
Unload a model from memory immediately.
Parameters:
model_id(string, required) - The ID of the model to unload
Example:
{
"model_id": "lmstudio-community/Meta-Llama-3-8B-Instruct-GGUF"
}configure_model
Configure model settings such as TTL and draft model for speculative decoding.
Parameters:
model_id(string, required) - The ID of the model to configurettl(number, optional) - Time-To-Live in secondsdraft_model(string, optional) - Draft model ID for speculative decoding
Example:
{
"model_id": "lmstudio-community/Meta-Llama-3-8B-Instruct-GGUF",
"ttl": 1800,
"draft_model": "small-draft-model"
}How It Works
LM Studio uses JIT (Just-In-Time) model loading. Models are loaded on-demand when inference requests are made:
Loading: Making an inference request automatically loads the model with the specified TTL
Unloading: Models auto-unload after TTL expires, or immediately when TTL is set to 0
Configuration: Model settings are applied through inference request parameters
Development
Build
npm run buildWatch Mode
npm run watchDebug
npm run devAPI Reference
This server interfaces with the LM Studio Developer API:
GET /api/v0/models- List all available modelsGET /api/v0/models/{model}- Get model detailsPOST /api/v0/chat/completions- Used for loading/configuring models
Troubleshooting
Connection Refused
Ensure LM Studio is running
Verify the local server is enabled in Developer settings
Check that port 1234 (or custom port) is accessible
Model Not Found
Verify the model ID is correct using
list_modelsEnsure the model is downloaded in LM Studio
Model Won't Load
Check available system memory
Verify model compatibility with your system
Review LM Studio logs for errors
License
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Links
Available Tools
5 toolsconfigure_modelC
Configure model settings such as TTL and draft model for speculative decoding
Inputs: model_id (required), ttl, draft_model.
get_model_detailsB
Get detailed information about a specific model including architecture, quantization, and context length
Inputs: model_id (required).
list_modelsA
List all available models in LM Studio with their current state (loaded/not-loaded)
Inputs: no named parameters.
load_modelB
Load a model into memory with configurable Time-To-Live (TTL). The model will auto-unload after the TTL expires.
Inputs: model_id (required), ttl.
unload_modelB
Unload a model from memory immediately by setting its TTL to 0
Inputs: model_id (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Tools have largely distinct purposes: list_models for overview, get_model_details for specifics, load/unload for state changes, configure_model for settings. However, load_model and configure_model both involve TTL, and unload_model is essentially a special case of configure_model (TTL=0), creating minor overlap.
All tool names follow a consistent snake_case verb_noun pattern: list_models, get_model_details, load_model, unload_model, configure_model. No deviations.
Five tools is well-scoped for model lifecycle management in LM Studio. Each tool covers a distinct operation without redundancy.
The surface covers listing, inspecting, loading, unloading, and configuring models, which is solid for model management. Minor gaps include no tool for downloading or deleting model files, but these may be outside the server's scope.
Maintenance
Related MCP Connectors
Chat, image, video, and audio models from many vendors behind one remote MCP server and one key.
Hosted MCP server for LLM cost estimation, model comparison, and budget-aware routing.
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
MCP server for OpenAI API (chat completions, image generation, embeddings) via AceDataCloud
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI assistants to manage LM Studio models, including listing, loading, and unloading models through the LM Studio API.65ISC
- 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
- AlicenseAqualityCmaintenanceEnables MCP clients to scan local GGUF models, estimate VRAM and suggest GPU offload layers, manage llama-server lifecycle, and proxy OpenAI-format chats with idle auto-unload.9MIT