LM Studio can use external tools through MCP, the same tool protocol Claude Desktop and Cursor use. There is no plugin store and nothing to code. Once it is wired up, a model running on your own machine can search Hugging Face, read a folder or hit an internal API, and no token goes to a cloud provider.
The setup is one JSON file. Nothing in the main window tells you where it is, which is the confusing part.
Open the Program tab in the right-hand sidebar, click Install → Edit mcp.json, and paste a server block. The file lives at ~/.lmstudio/mcp.json (C:\Users\<you>\.lmstudio\mcp.json on Windows) if you would rather open it in your own editor.
Table of contents
- What MCP actually is, in two sentences
- Check your version first
- Add your first server
- The notation LM Studio expects
- Local servers vs remote servers
- Tool call confirmations, and why you should leave them on
- Using MCP through the API instead of the app
- Pick a model that can actually call tools
- When it does not work
- The security part, which is not optional
- FAQ
- Sources
What MCP actually is, in two sentences
Model Context Protocol is a standard way for a model to call an external program. Anthropic introduced it, and it is developed in the open on GitHub.
Two roles get mixed up a lot:
| Role | What it means | Examples |
|---|---|---|
| MCP server | A program that exposes tools and resources | Hugging Face, GitHub, Notion, a filesystem reader |
| MCP host | An app that connects to servers and hands those tools to a model | LM Studio, Claude Desktop, Cursor |
LM Studio is the host. You are not installing a plugin into it. You are pointing it at programs that already speak the protocol.
On every tool call the order is:
| Step | What happens | Who controls it |
|---|---|---|
| 1 | The model decides it needs a tool | The model |
| 2 | A confirmation dialog appears with the arguments | You |
| 3 | The server executes and returns data | The server |
| 4 | The model answers using the result | The model |
Step 2 is the only place anything is stopped. The model never touches a tool directly, and nothing runs until you approve it.
Check your version first
MCP support arrived in LM Studio 0.3.17, with both local and remote servers landing in that release at build b10. On anything older the Program tab will not have the option, and editing config files will not help.
Driving MCP through the API instead of the chat window needs 0.4.0 or newer. That is a later feature with its own requirements. Update from inside the app, or download the current build from lmstudio.ai. Easy.
Add your first server
You edit one file. The Hugging Face server is a good first one because it is remote: no command to install, nothing to break on your machine, and it gives the model functions like model and dataset search.
Open Program → Install → Edit mcp.json, then paste:
{
"mcpServers": {
"hf-mcp-server": {
"url": "https://huggingface.co/mcp",
"headers": {
"Authorization": "Bearer <YOUR_HF_TOKEN>"
}
}
}
}Replace <YOUR_HF_TOKEN> with a token from your Hugging Face account settings. A read token is enough. Save the file and LM Studio connects. No restart.
To confirm it worked, load a model that supports tool use and ask something the server can answer but the model cannot know from memory. "What is the top trending model on Hugging Face right now" is a good probe. A stale answer from training data means the tool was never called. A confirmation dialog means the wiring is right. Watch for the dialog rather than judging the answer, because a plausible reply proves nothing.
Some servers publish an Add to LM Studio button on their docs page that writes this block for you via a deeplink. It does exactly what you just did by hand, so use it if you like.
The notation LM Studio expects
LM Studio follows Cursor's mcp.json notation. Most config snippets written for Cursor drop straight in, and so do snippets for Claude Desktop, since the mcpServers object is the shared part.
Two shapes show up depending on the server:
{
"mcpServers": {
"remote-example": {
"url": "https://example.com/mcp",
"headers": { "Authorization": "Bearer TOKEN" }
},
"local-example": {
"command": "npx",
"args": ["-y", "some-mcp-package@latest"]
}
}
}A url server is already running somewhere else. A command server is a program LM Studio launches on your machine when it needs it.
The outer key must be mcpServers, not servers or mcp. A wrong key gives you a file that parses as valid JSON while LM Studio finds nothing in it. The name you give each server (remote-example above) is yours to choose, but it becomes the id you reference from the API, so pick something you will recognise later instead of test1.
You can list several servers in one file. LM Studio connects to all of them and offers the combined tool set to the model. Ten servers' worth of tool descriptions add up fast in a local context window.
Local servers vs remote servers
Remote servers need network access and usually a token, so failures there look like auth errors or timeouts. Nothing new runs on your computer.
Local servers run code on your machine, and the command and args fields are what gets executed. Failures look like "command not found", usually because the runtime is missing or because LM Studio's environment does not have the same PATH as your terminal. Absolute paths fix most of it. This second kind is also where the real risk lives (see the security section below).
Tool call confirmations, and why you should leave them on
When a model calls a tool, LM Studio shows a confirmation dialog before anything executes. You can read the arguments, edit them, then approve.
You can choose always allow for a given tool, and LM Studio stops asking. Those decisions are managed under App Settings → Tools & Integrations.
Approving everything on the first run is tempting. Don't. The dialog is the only thing between a hallucinated argument and a real filesystem write. Keep confirmations on for anything that can modify or send data, and use always-allow only for read-only tools you have watched behave.
Using MCP through the API instead of the app
If you are building something rather than chatting, LM Studio exposes MCP through its API on 0.4.0 or newer. There are two approaches.
Ephemeral servers are declared inside the request itself, with nothing pre-configured. They suit one-off calls and remote tools:
curl http://localhost:1234/api/v1/chat \
-H "Authorization: Bearer <YOUR_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"model": "ibm/granite-4-micro",
"input": "What is the top trending model on hugging face?",
"integrations": [
{
"type": "ephemeral_mcp",
"server_label": "huggingface",
"server_url": "https://huggingface.co/mcp",
"allowed_tools": ["model_search"]
}
],
"context_length": 8000
}'Ephemeral servers require Allow per-request MCPs to be enabled in Server Settings. It is off by default, and forgetting it gets you a rejected request instead of an obvious error.
Pre-configured servers come from your mcp.json and are referenced by id with "type": "plugin", for example mcp/playwright. Use these for servers that need a command, and for anything you call often because you then declare nothing per request.
The response comes back with tool_call entries alongside the model's reasoning and message, so you can see which tool ran and with what arguments. Set allowed_tools even when you don't have to. A server may expose a dozen tools, and naming the one you want keeps the model on task and the prompt smaller.
Pick a model that can actually call tools
People skip this step and then blame the config. A model that was never trained for tool use will ignore the tools it is handed, or produce something that looks like a tool call but is only text. The config is fine. The model can't do it.
Check the model card for tool-use or function-calling support before assuming your mcp.json is broken. Smaller models are also much worse at deciding when to call a tool, and will answer from memory when they should have searched.
Some MCP servers were built for Claude, ChatGPT or Gemini, and their tool descriptions can be long. On a local model with a modest context window, a verbose server can eat a large share of your context before the conversation starts. LM Studio's own docs flag this. If a server feels heavy, allowed_tools trims it down.
When it does not work
Work down the list in order. The first two entries cause most failures, and both are settings, not config mistakes.
- No option in the Program tab. You are below 0.3.17. Update.
- API request rejected on an ephemeral server. "Allow per-request MCPs" is off in Server Settings.
commandserver never starts. The runtime is not on thePATHLM Studio sees. Use an absolute path to the binary.- Server connects, model ignores the tools. The model does not support tool use. Change models before touching config.
- Auth failures on a remote server. The token expired, has the wrong scope, or the
Authorizationheader is missing theBearerprefix. - Invalid JSON. A trailing comma or a smart quote from copy-paste. The in-app editor flags it. If you edited the file externally, run it through a validator.
Validate before saving, not after LM Studio refuses to load the file. Our JSON formatter and validator runs in the browser and points at the exact character. If you are comparing a working config against a broken one, the diff checker shows the difference. Neither uploads anything.
The security part, which is not optional
LM Studio's documentation says it twice: never install MCP servers from untrusted sources. Some MCP servers can run arbitrary code, read your local files and use your network connection.
An MCP server is not a sandboxed extension. A command entry tells your machine to execute a program with your user's permissions. If that program wants your SSH keys, nothing in the protocol stops it.
- Read what a server does before adding it, and prefer ones whose source you can see.
- Pin versions where you can.
@latestmeans you re-download whatever the author pushed this morning. - Keep tool confirmations on for anything that writes, deletes or sends.
- Give tokens the narrowest scope that works. A read-only token cannot delete a repository.
- Point filesystem servers at a project directory, not your home folder.
Your prompts do stay on your machine, but that guarantee covers the model, not the servers. A remote MCP server still receives whatever the tool call contains.
FAQ
Which LM Studio version added MCP support?
0.3.17, with both local and remote servers from 0.3.17 (b10). MCP via the API requires 0.4.0 or newer.
Do I have to restart LM Studio after editing mcp.json?
No. Save the file and LM Studio connects to the newly configured servers.
Can I use Claude Desktop or Cursor configs directly?
Mostly. LM Studio follows Cursor's mcp.json notation, and the mcpServers object is shared across all three, so server blocks usually transfer without edits.
Can I limit which tools a server exposes?
Through the API, yes. allowed_tools restricts a request to named tools, and it keeps verbose servers from eating your context window. Tools you already marked "always allow" are listed under App Settings, then Tools & Integrations, where you can revert them.
