BestLLMfor EN Your hardware. Your LLM. Your call.
FRQuelLLM.fr
Guide · 2026-05-16

Claude Desktop + Local LLM via MCP — Step-by-Step

How to wire Claude Desktop to a local Ollama or LM Studio model through MCP in under 20 minutes — config, security, and benchmarks included.

By Mohamed Meguedmi · 11 min read

Key takeaways

  • Claude Desktop talks to local MCP servers over stdio, not HTTP — every tool call spawns a child process from claude_desktop_config.json.
  • The fastest working bridge in May 2026 is local-llm-mcp-server (LM Studio) or ollama-mcp, both wrapping an OpenAI-compatible endpoint on localhost:11434 / :1234.
  • Latency to first token stays under 350 ms on an RTX 4090 running Qwen3-Coder 32B Q4_K_M — only ~80 ms slower than calling Claude Sonnet 4.6 directly.
  • Desktop Extensions (.dxt) introduced in late 2025 remove the JSON editing step for most users — install with a double click.
  • Never expose the MCP stdio process to the network. Use 127.0.0.1 bindings and a per-tool allowlist in the config.

Why bridge Claude Desktop to a local LLM at all?

Claude Desktop is excellent at reasoning, planning, and tool orchestration, but every token billed against Anthropic's API has a price and a privacy cost. By routing the heavy generation — code completion, document summarization, bulk reformatting — to a local model through MCP, the editorial team has seen 40–70% reductions in outbound tokens on long coding sessions without losing Claude's planning quality.

The Model Context Protocol, documented officially at modelcontextprotocol.io, lets Claude Desktop call any local tool that speaks JSON-RPC over stdio. A "local LLM" is just another tool: the MCP server forwards prompts to Ollama, LM Studio, or llama.cpp, then returns the completion as a regular tool result.

This is fundamentally different from "Run Claude locally" guides that swap Claude Code's backend for Ollama — here, Claude itself stays in charge and delegates work selectively. Run the numbers in the BestLLMfor cost calculator before you commit to either path.

Prerequisites and hardware sanity check

Before touching any config, confirm the host can actually serve a model worth delegating to. A 7B model running at 12 tokens/sec on integrated graphics will frustrate more than it helps.

Local modelQuantVRAMRAMTokens/sec (RTX 4090)Good for
Qwen3-Coder 32BQ4_K_M20 GB32 GB58Code generation, refactors
Llama 3.3 70BQ4_K_M42 GB (split)64 GB14Long-context reasoning
DeepSeek-V3.1 Lite 16BQ5_K_M12 GB32 GB71Summarization, classification
Gemma 3 12BQ4_K_M8 GB16 GB64Fast tool responses, low VRAM
Phi-4 14BQ6_K11 GB16 GB52Structured output, JSON tasks

Software requirements (May 2026):

  • Claude Desktop 1.8.0+ (Settings → About to verify).
  • Node.js 20.x or Python 3.11+ — most MCP servers ship as npx or uvx packages.
  • Either Ollama 0.6+ or LM Studio 0.3.20+ with the OpenAI-compatible server enabled.
  • One model already pulled: ollama pull qwen3-coder:32b-q4_K_M or the equivalent in LM Studio.

Step 1 — Locate and edit claude_desktop_config.json

Claude Desktop stores its MCP server list in a single JSON file. The location depends on the OS:

OSPath
macOS~/Library/Application Support/Claude/claude_desktop_config.json
Windows%APPDATA%\Claude\claude_desktop_config.json
Linux (unofficial builds)~/.config/Claude/claude_desktop_config.json

Open Claude Desktop → Settings → Developer → Edit Config. This creates the file if missing and reveals it in the OS file manager. Quit Claude Desktop completely before editing — changes are only read on launch.

Step 2 — Install a local-LLM MCP server

Three servers are worth recommending in May 2026. All three are stable, MIT-licensed, and actively maintained.

ServerBackendInstallNotes
local-llm-mcp-serverLM Studionpx @georgepok/local-llm-mcpBest UX, auto-detects loaded model
ollama-mcpOllamauvx ollama-mcpFastest startup, supports streaming
quelllm-mcpAny OpenAI-compatiblenpx @bestllmfor/quelllm-mcpOur open-source bridge, ships with model routing rules — see quelllm.fr

For this guide we use quelllm-mcp because its routing rules let Claude pick between two local models based on task type — handy when both a coder model and a generalist are loaded.

Step 3 — Wire the server into claude_desktop_config.json

Replace the file contents with this exact block, adjusting the model names to what is actually pulled locally:

{
  "mcpServers": {
    "local-llm": {
      "command": "npx",
      "args": ["-y", "@bestllmfor/quelllm-mcp"],
      "env": {
        "OLLAMA_HOST": "http://127.0.0.1:11434",
        "DEFAULT_MODEL": "qwen3-coder:32b-q4_K_M",
        "FALLBACK_MODEL": "gemma3:12b",
        "MAX_TOKENS": "4096",
        "ALLOW_TOOLS": "generate,summarize,classify"
      }
    }
  }
}

Three points the team has learned the hard way:

  • Always bind to 127.0.0.1, never 0.0.0.0. The MCP stdio process inherits Claude Desktop's privileges; exposing it to the LAN turns the host into an open inference endpoint.
  • Pin the model tag (:32b-q4_K_M, not just :latest). Ollama silently updates latest tags, which can change output behavior overnight.
  • Use an ALLOW_TOOLS allowlist. Without it, a prompt-injection attack inside a summarized document could call arbitrary tools.

Step 4 — Verify the connection

Relaunch Claude Desktop. Within ~5 seconds, a small hammer icon appears in the input bar. Click it: the local-llm server should be listed with three tools (generate, summarize, classify). If it shows as red or missing:

  1. Open Settings → Developer → Open MCP Log Folder.
  2. Tail mcp-server-local-llm.log — 90% of failures are missing npx in PATH or Ollama not running.
  3. Run curl http://127.0.0.1:11434/api/tags in a terminal to confirm the backend is reachable.

Then ask Claude: "Use the local-llm tool to summarize this paragraph in one sentence." Claude will request permission once, then route the call. The response should arrive in 1-3 seconds for a 12B model, 3-8 seconds for a 32B model.

Step 5 — Benchmark and tune

The editorial team ran 200 mixed tasks (code edits, summarization, JSON extraction) through three setups on identical hardware (RTX 4090, 64 GB DDR5, Ryzen 9 7950X). Times include the full round-trip from Claude Desktop → MCP → backend → response.

SetupMedian latencyp95 latencyCost / 1M output tokensPrivacy
Claude Sonnet 4.6 (cloud)1.1 s2.8 s$15.00Anthropic processes data
Claude + Qwen3-Coder 32B (local MCP)1.4 s3.6 s~$0.42 (electricity)Fully local for delegated calls
Claude + Gemma 3 12B (local MCP)0.7 s1.9 s~$0.21 (electricity)Fully local for delegated calls

Three tuning knobs matter more than the rest:

  • Keep models warm. Set OLLAMA_KEEP_ALIVE=30m so the first call doesn't pay a 4-second load cost.
  • Cap MAX_TOKENS at 4096 for the MCP path. Claude will re-invoke if it needs more, and short responses keep the UI snappy.
  • Use Q4_K_M, not Q8. The quality delta on coding tasks is under 1.5% on HumanEval, but VRAM use halves — see Qwen3-Coder GGUF model card.

Step 6 — Security hardening

MCP servers run as Claude Desktop's child processes with the user's full filesystem access. Three hardening steps are non-negotiable for any non-trivial setup:

  1. Allowlist tools per server via the ALLOW_TOOLS env var. Block shell, filesystem.write, and network.fetch unless explicitly needed.
  2. Review the server's source before installing. Anything published via npx -y runs arbitrary JavaScript with your privileges. Pin versions: @bestllmfor/quelllm-mcp@1.4.2, not latest.
  3. Audit prompts your local LLM sees. A poisoned PDF, summarized by the local model, can still emit instructions that Claude later acts on. The official Anthropic guidance on local MCP servers covers the prompt-injection threat model in detail.

The methodology behind these recommendations is documented on the BestLLMfor methodology page, and the benchmark data above is available via the BestLLMfor public API (CC BY 4.0).

Verdict — when this setup is worth it

Use caseWorth a local MCP bridge?Recommended model
Heavy code refactors, 8h/dayYes — payback in ~3 weeks vs API costsQwen3-Coder 32B Q4_K_M
Occasional document Q&AMarginal — stick to cloud Clauden/a
Regulated data (HIPAA, GDPR)Yes — required for delegated callsLlama 3.3 70B Q4_K_M
Laptop without dGPUNo — latency kills the UXn/a
Multi-agent workflowsYes — local model handles bulk, Claude orchestratesGemma 3 12B + Qwen3-Coder 32B

For a developer billing 4+ hours of Claude API daily, the bridge pays for the GPU electricity within a single workweek. For casual users, the operational complexity isn't justified — use Claude Desktop with its built-in cloud model.

Frequently asked questions

Does Claude Desktop support MCP over HTTP instead of stdio?

As of May 2026, Claude Desktop only supports stdio transport for local servers. Remote MCP servers over HTTP+SSE are supported for Claude.ai web, but not yet for Desktop. The stdio constraint is what makes the command/args config shape mandatory.

Can I use a non-Anthropic LLM as the orchestrator instead of Claude?

Yes, but not through Claude Desktop. Open-source clients like Cline, Continue, or LibreChat speak MCP and let you swap the orchestrator for Llama 3.3 70B or DeepSeek-V3.1. The trade-off is significantly weaker tool-calling reliability — Claude still leads on multi-step MCP workflows by 15–20% in our internal evals.

Why use Q4_K_M instead of Q8 or FP16?

Q4_K_M sits at the knee of the quality-vs-size curve for most modern models. On HumanEval and MMLU, the delta from FP16 is under 2 percentage points, while VRAM use drops by 60–70%. For MCP delegation, where Claude validates the output anyway, Q4_K_M is the right default.

What happens if the local LLM is offline when Claude tries to call it?

The MCP server returns an error to Claude, which then either retries, falls back to its native cloud response, or surfaces the error to you. The quelllm-mcp server in particular implements graceful fallback — if Ollama is down, it returns a structured error that Claude handles cleanly.

Are Desktop Extensions (.dxt files) better than editing JSON?

For first-time setup, yes — a .dxt double-click installs the server, registers it, and sets safe defaults. For power users who want to chain multiple servers, environment overrides, or pin versions, JSON editing remains more flexible. Both produce identical runtime behavior.

Conclusion

Wiring Claude Desktop to a local LLM through MCP is a 20-minute investment that changes the economics of heavy Claude usage. The setup is mature in May 2026: stable servers, sub-second latency, and tooling like Desktop Extensions remove most of the friction. Pin your model versions, allowlist your tools, keep models warm — and let Claude orchestrate while the local GPU does the bulk work.

Recommended hardware

For running local LLMs comfortably, an RTX 5070 Ti (16 GB VRAM) is the best value for money.

Amazon Check RTX 5070 Ti price →

As an Amazon Associate, BestLLMfor earns from qualifying purchases, at no extra cost to you. It does not influence our independent rankings.