local-llm-mcp
This server connects Claude Code to a local LLM (via LM Studio) to offload token-expensive tasks, reducing cloud context usage and costs.
Local file processing (
local_digest): Summarize, analyze, or extract information from files or directories using glob patterns. Returns only the processed result, automatically handling map-reduce for content exceeding the model's context window.Batch processing (
local_map): Apply the same instruction to each matched file individually (with a configurable file limit, default 40) and receive one result per file — ideal for classification, extraction, or pattern detection across a codebase.Free-form queries (
local_ask): Send any prompt (boilerplate generation, rewording, commit messages, regex, translation) directly to the local model, with an optional system prompt.Local model status (
local_status): Diagnose LM Studio server state, including loaded models, aliases, and context length.Automatic model management: On startup, ensures the chosen model is loaded with sufficient context (default 32,768 tokens) to avoid silent truncation.
Configurable model aliases: Select between
code(e.g.,qwen3-coder-30b, fast direct answers) orlight(e.g.,gemma-4-e4b, VRAM-efficient but uses internal reasoning).Security: Restrict file access to specific directories via
LOCAL_ALLOWED_ROOTSenvironment variable.
Click on "Install 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., "@local-llm-mcpsummarize all Python files in src/"
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.
English | Français
local-llm-mcp
An MCP server connecting Claude Code to LM Studio, to offload token-expensive work to a local model — without giving up the cloud model's agentic capabilities.
The idea
Claude keeps the driving seat; only the bulk work goes local.
The saving doesn't come from "use a cheaper model." It comes from keeping raw content out of the cloud context: the tools read the files themselves, on the server side, and only return the processed result.
Claude Code ──(MCP call: "summarize src/**/*.cs")──► local-llm-mcp
│
├─ reads the files from disk
├─ chunks if beyond local context
└─ queries LM Studio :1234
│
Claude Code ◄────────(≈700 tokens of summary)────────────────────────┘Without this intermediary, reading a source tree burns tens of thousands of context tokens. With it, the cost shrinks to the size of the response.
Related MCP server: Claude Sidekick
Measurements
Recorded on a real Godot/C# project, with qwen3-coder-30b:
Target | Tokens read locally | Tokens returned | Duration |
One 886-line file (46 KB) | 13,462 | 757 | 49 s |
8 JSON data files | 35,537 | 674 | 50 s |
The ratio depends entirely on the task: a summary compresses a lot, an exhaustive extraction much less.
Requirements
LM Studio with its local server running (port 1234 by default)
Node.js 18 or later
A loaded model — see Model choice below
Tested on Windows 11. server.js has no Windows-specific dependency (the LM
Studio CLI path is resolved per platform), but the helper script
start-local.ps1 is PowerShell-specific.
Installation
git clone https://github.com/drangoht/local-llm-mcp.git
cd local-llm-mcp
npm ciThen register the server with Claude Code, giving the absolute path to
server.js:
claude mcp add local-llm --scope user -- node /absolute/path/to/local-llm-mcp/server.js--scope user makes it available across all your projects. Use --scope project
to limit it to the current repo.
Verification: claude mcp list should show local-llm: ✔ Connected.
Exposed tools
Tool | Role | Savings |
| Reads files (globs), applies an instruction, returns only the result. Automatic map-reduce beyond local context. | High — the main tool |
| Applies the same instruction to each file separately, one result per file. Batch processing. | High |
| Free-form question, no file reading. Boilerplate, rewording, commit messages, regex. | Low |
| Diagnostics: models, aliases, context actually loaded. | — |
Model choice
Two aliases are exposed:
Alias | Default model | Note |
|
| Answers directly, no reasoning phase. |
|
| Lighter on VRAM, but always reasons. |
The chosen default is the larger model, which deserves an explanation since it's counter-intuitive. On the same short task, measured:
Raw throughput | Tokens produced | Of which discarded internal reasoning | |
| 67 tok/s | 347 | ~85% |
| 13.5 tok/s | 19 | 0 |
The smaller model is five times faster per token, but produces eighteen times
more of them for an equivalent result. In useful output, the larger model
wins. Also, the enable_thinking: false parameter has no effect on this model,
and a max_tokens set too low makes it return an empty content — the
server detects this case and reports it explicitly instead of silently
returning an empty string.
Adjust to your hardware via LOCAL_MODEL_CODE / LOCAL_MODEL_LIGHT.
Automatic model loading
On startup, the server checks via lms ps --json that the model is loaded with
sufficient context, and reloads it if not.
This check exists for a specific reason: LM Studio's defaultContextLength
setting is 4096 tokens. Its just-in-time loading (justInTimeModelLoading)
therefore brings the model back down to 4096 as soon as the TTL expires or the
application restarts — and local_digest then breaks silently: truncated
responses, no error raised. It's the most painful failure mode because it's
invisible.
The check is non-blocking (the MCP handshake stays around 0.4 s) and costs
nothing when the configuration is already correct. Disable it with
LOCAL_AUTOLOAD=0.
start-local.ps1 (Windows) does the same thing from a terminal, useful for
preloading the model before opening Claude Code to avoid waiting on the first
call.
Configuration
All environment variables are optional.
Variable | Default | Role |
|
| LM Studio endpoint |
|
| Model for the |
|
| Model for the |
|
| Context required at startup |
|
|
|
|
| Unload the model after 8 h of inactivity |
|
| Max call duration (10 min) |
| (none) | Roots allowed for reading, separated by |
|
| Path to the LM Studio CLI |
Restricting reads
By default the server can read any file accessible to the user. To confine it to your code folders:
claude mcp add local-llm --scope user \
--env LOCAL_ALLOWED_ROOTS="/path/to/projects" \
-- node /absolute/path/to/local-llm-mcp/server.jsTimeouts on the Claude Code side
In ~/.claude/settings.json:
"env": {
"MCP_TIMEOUT": "60000",
"MCP_TOOL_TIMEOUT": "900000"
}A generous MCP_TOOL_TIMEOUT is necessary: a local_map over several dozen
files takes several minutes.
When to delegate locally, when to stay in the cloud
Delegate locally | Keep in the cloud |
Summarizing a large file or a directory tree | Deciding on an architecture |
Extracting a list (methods, TODOs, dependencies) | Writing code that must be right the first time |
Classifying or sorting files by criteria | Debugging a subtle issue |
First pass over unfamiliar code | Multi-step reasoning |
Boilerplate, commit messages, regex | Anything that commits to functional correctness |
Short rule: local is for reducing volume, not for settling a question.
Limitations
The local model makes mistakes. It misses edge cases and sometimes invents method names. Its output is a starting point to verify, never a conclusion on anything critical.
Modest throughput on a GPU that doesn't fully fit the model in VRAM. On the reference setup (Radeon RX 9070, 16 GB), a 30B model in Q4 overflows by about 3.5 GB and runs at ~13.5 tok/s. A
local_mapover 40 files takes several minutes.No streaming: results arrive as a single block.
A single resident model if VRAM is limited; switching between aliases forces a reload (~16 s for an 18 GB model).
Troubleshooting
Symptom | Likely cause | Fix |
| Application closed or server stopped | Open LM Studio, or |
Truncated or inconsistent responses | Context dropped back to 4096 |
|
Empty response + message about reasoning |
| Switch to |
First call very slow (~20-30 s) | Model loading | Normal; preload with |
Timeout on the Claude Code side |
| See Timeouts above |
License
MIT — see LICENSE.
Available Tools
4 toolslocal_askA
Pose une question libre au modele local, sans lecture de fichier. Utile pour du boilerplate, une reformulation, une traduction, un message de commit, une regex — tout ce qui ne merite pas le modele cloud.
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | Defaut : code. | |
| prompt | Yes | La demande. | |
| system | No | Consigne systeme optionnelle. | |
| max_tokens | No | Defaut : 1200. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations exist, so the description must cover behavioral traits. It only states 'no file reading' and hints at local model usage. No mention of safety, side effects, rate limits, or auth. For a mutation-like tool (query), more transparency is needed.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences, front-loaded with the core purpose, no extraneous words. Efficient and clear about the tool's raison d'être.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With 4 parameters, no output schema, and no annotations, the description is too brief. It lacks details on return format, error handling, token management, and the difference between 'code' and 'light' models.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so baseline is 3. Description adds no parameter-specific semantics beyond the schema—e.g., it doesn't explain the 'model' enum values or 'max_tokens' default implications.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool poses a free-form question to the local model without file reading, and lists specific use cases (boilerplate, reformulation, translation, commit message, regex). This differentiates it from siblings like local_map, local_digest, which likely involve file processing.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Description provides explicit use cases and notes it's for tasks not worthy of the cloud model. It implies file-reading tasks use siblings, but does not explicitly name alternatives or give when-not guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
local_digestA
Lit un ou plusieurs fichiers EN LOCAL et applique une instruction dessus (resumer, extraire, analyser, repondre a une question), puis ne renvoie QUE le resultat. Le contenu brut des fichiers n'entre jamais dans le contexte de Claude — c'est le principal levier d'economie de tokens. A privilegier avant de lire soi-meme un gros fichier ou un ensemble de fichiers. Fait automatiquement du map-reduce si le volume depasse le contexte local.
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Repertoire de base. Defaut : repertoire courant du serveur. | |
| model | No | "code" (qwen3-coder-30b, defaut, repond directement, recommande partout) ou "light" (gemma-4-e4b, plus leger en VRAM mais raisonne toujours : prevoir max_tokens >= 800). | |
| patterns | Yes | Chemins ou globs relatifs a `cwd` (ex: ["src/**/*.cs", "docs/GDD.md"]). | |
| max_tokens | No | Longueur max de la reponse. Defaut : 1200. | |
| instruction | Yes | Ce que le modele local doit faire du contenu (ex: "Liste les methodes publiques et leur role en une ligne chacune"). |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden. It discloses that raw file content never enters Claude's context (token economy), that only the result is returned, and that map-reduce is automatic for large volumes. These are significant behavioral traits. Missing details like authorization or error handling are acceptable for a local read tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is three sentences, each essential. First sentence states core functionality, second highlights the primary benefit (token savings), third gives usage guidance and map-reduce note. No fluff, front-loaded with key information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given 5 parameters, all covered by schema with additional description, no output schema needed (description states only result returned). The description fully explains how the tool works, when to use it, and its token-saving behavior. An agent can correctly select and invoke this tool based solely on this definition.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so baseline is 3. The description adds meaningful detail: 'model' enum values are explained with usage context (default 'code' is recommended everywhere, 'light' needs larger max_tokens), 'patterns' are clarified as globs relative to cwd, and 'instruction' is exemplified. This adds value beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('Lit' - reads) and resource ('fichiers EN LOCAL') and clearly states the action: apply an instruction to the content and return only the result. It distinguishes from manual reading by highlighting token savings and map-reduce behavior, and implicitly differentiates from siblings like local_map, local_ask, and local_status by focusing on digestion with an instruction.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly recommends using this tool before reading a large file yourself ('A privilegier avant de lire soi-meme un gros fichier ou un ensemble de fichiers'). It also explains the map-reduce fallback for large volumes. However, it does not explicitly state when not to use it or provide direct comparisons to sibling tools beyond the implied purpose.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
local_mapA
Applique la MEME instruction a chaque fichier separement et renvoie un resultat par fichier. Pour le traitement par lot : classer des fichiers, extraire un champ de chacun, detecter un motif dans une arborescence. Traitement sequentiel (le GPU ne parallelise pas utilement) — compter quelques secondes par fichier.
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Repertoire de base. | |
| model | No | Defaut : code. | |
| patterns | Yes | Globs des fichiers a traiter. | |
| max_files | No | Garde-fou. Defaut : 40. | |
| max_tokens | No | Longueur max par fichier. Defaut : 400. | |
| instruction | Yes | Instruction appliquee a chaque fichier individuellement. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description fully covers behavior: it states the operation is sequential, not parallelizable by GPU, and estimates seconds per file. It also mentions returning a result per file. This is good transparency, though it doesn't detail side effects or error handling.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is relatively compact, with three sentences: main purpose, examples, and performance note. It starts with the core function, so it's well front-loaded. Could be slightly more concise, but overall efficient.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given 6 parameters and no output schema, the description covers the core purpose and performance but does not specify the output format or structure (e.g., how results per file are returned). It is adequate for basic use but incomplete for an agent needing to parse results.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so the description does not need to add much. It repeats the 'instruction' purpose from the schema but adds no new meaning. The description does not elaborate on patterns, cwd, model, max_files, or max_tokens beyond what the schema already provides.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states that local_map applies the same instruction to each file separately and returns one result per file. It provides specific examples like classifying files, extracting a field, and detecting patterns, which helps distinguish it from siblings like local_digest, local_ask, and local_status.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives clear use cases (batch processing, classification, extraction) and performance characteristics (sequential, seconds per file). However, it does not explicitly state when not to use this tool or compare it to alternatives, so it lacks exclusion guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
local_statusA
Etat de LM Studio : modeles disponibles, modele charge, contexte configure. A appeler en cas d'erreur ou de lenteur inattendue.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, but the description adequately describes the behavioral traits: it is a read-only status check that returns model availability, loaded model, and context. It implies no side effects, which is appropriate for a simple status tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence that efficiently conveys the purpose and usage. No wasted words; front-loaded with the core function.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with no parameters and no output schema, the description provides enough context about what it returns (available models, loaded model, configured context). It is complete enough for a simple status check, though a native English speaker might need translation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
There are no parameters, so schema coverage is 100%. The description does not add parameter details, but none are needed. Baseline for 0 parameters is 4.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool returns the state of LM Studio, listing available models, loaded model, and configured context. It includes a specific usage scenario (error or unexpected slowness), distinguishing it from siblings like local_digest, local_map, and local_ask.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly says when to call the tool (in case of error or slowness). It does not mention when not to use it, but the context is clear given the sibling tools have different purposes.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
4 tool updates
v1.0.0- First observed
local_ask - First observed
local_digest - First observed
local_map - First observed
local_status
TDQS
Most tools have distinct purposes: local_digest reads files and returns only the result, local_map processes each file separately, local_ask is a free-form query without file input, and local_status checks the LM Studio state. However, local_digest and local_map could be confused as both involve file processing with instructions, though descriptions clarify the difference.
All tool names follow a consistent pattern: 'local_' prefix followed by a descriptive verb in lowercase snake_case (digest, map, ask, status). No mixing of conventions or unexpected variations.
Four tools is well-scoped for a local LLM server. It covers file processing (digest and map), free-form queries (ask), and system status (status). This is neither too sparse nor too heavy for the domain.
The tool set covers the main interactions with a local LLM: processing files (digest, map), asking questions (ask), and checking status (status). Minor gaps exist, such as a tool to load/unload models or access raw file content, but these may be outside the intended scope.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
Augments MCP Server - A comprehensive framework documentation provider for Claude Code
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
MCP server unifying ERPs, CRMs, APIs and knowledge base for Claude, ChatGPT and Gemini.
Related MCP Servers
- AlicenseAqualityDmaintenanceAn MCP server that offloads bulk coding tasks to local LLMs, allowing Claude Code to delegate repetitive work like boilerplate generation and code polishing while preserving its context for complex reasoning.101MIT
- FlicenseAqualityDmaintenanceA Model Context Protocol (MCP) server that connects Claude to local Ollama models, enabling offloading of simpler tasks to save Claude tokens.715-
- AlicenseAqualityCmaintenanceMCP server that enables cloud models (like Gemini/Claude) to delegate coding tasks to a local llama.cpp server, preserving cloud usage limits through an AI-powered code review loop.61MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that allows Claude Code to offload mechanical tasks such as summarization, classification, and drafting to a local LLM, reducing API costs while keeping Claude in control of complex reasoning and quality review.12MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/drangoht/local-llm-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server