Skip to main content
Glama
Local AI MCP

Local AI MCP

Official
by TMHSDigital

Local AI MCP

One MCP server for every local model runtime on your machine. It knows what fits your GPU, and it never sends a prompt to the cloud unless you tell it to.

npm CI License: CC-BY-NC-ND-4.0 Type

Install in Cursor Install in VS Code Claude Desktop extension

Local AI MCP gives your agent (Claude, Cursor, VS Code, and others) one control plane for Ollama, LM Studio, llama.cpp, Docker Model Runner, MLX, vLLM and Foundry Local. Your agent can see what's installed and loaded, check what will actually fit in your VRAM, get models ready, and hand work off to the best local model with a single delegate call.

# illustrative session
You:    Summarise these 40 pages of meeting notes locally, I don't want them in the cloud.
Agent:  → delegate { task: "summarize", prompt: "...", contextLength: 32768 }
        ← routing: ollama / qwen3:14b — already loaded (no load cost); general model; fits: gpu
          local: true · 412 tokens · 38 tok/s

Why use it

  • It knows your hardware. fit_check sizes the KV cache from the model's actual layer architecture, adds up VRAM across GPUs, models partial GPU/CPU offload, and understands Apple Silicon unified memory. It answers "will this model run, and where?" with numbers rather than guesses.

  • It works across runtimes. If you run Ollama and LM Studio, each call goes to the runtime that actually has the model. Lifecycle actions such as pull, load and unload affect exactly one runtime.

  • It keeps data local by default. Hosted providers such as Moonshot are opt-in, and a call without a provider argument never uses one. Every result reports provider, host and local, so you can see where inference ran.

  • It handles operations, not just chat. Pull with progress, load with a context size, evict least-recently-used models to make room, benchmark time-to-first-token and tokens per second, and search Hugging Face for GGUF quantizations that fit your machine.

Related MCP server: Ollama MCP Server

Things to ask your agent

  • "What can I run for coding on this laptop?" → suggest_model, then ensure_model

  • "Free up my GPU." → list_loaded, then unload_model (or use the free-vram prompt)

  • "Benchmark my installed coder models and tell me which is fastest." → benchmark { models: [...] }

  • "Find a newer Gemma build that fits my 12 GB card." → search_models { source: "huggingface" }

  • "Extract the invoice fields from this text as JSON, locally." → delegate { task: "extract", responseFormat: { type: "json_schema", ... } }

  • "Will Llama 3.1 70B run here with 32K context?" → fit_check { model, contextLength: 32768 }

Quick start

Install at least one runtime (Ollama, LM Studio, llama.cpp, Docker Model Runner, MLX, vLLM or Foundry Local), then add the server to your client. No configuration is needed for runtimes on their default ports.

Claude Code

claude mcp add local-ai -- npx -y @tmhs/local-ai-mcp

Claude Desktop. Download the .mcpb file from the latest release and open it. You get a settings screen for hosts and no JSON to edit. Alternatively, add this to claude_desktop_config.json:

{
  "mcpServers": {
    "local-ai": { "command": "npx", "args": ["-y", "@tmhs/local-ai-mcp"] }
  }
}

Cursor / VS Code. Use the install buttons above, or add the same command/args to .cursor/mcp.json or .vscode/mcp.json (VS Code uses a top-level "servers" key instead of "mcpServers").

Windsurf, Cline, Zed and other clients. Any stdio MCP client works: the command is npx, the args are ["-y", "@tmhs/local-ai-mcp"].

Windows: a few clients can't launch npx directly. If the server doesn't start, use "command": "cmd", "args": ["/c", "npx", "-y", "@tmhs/local-ai-mcp"].

Adding a hosted provider (optional). Put MOONSHOT_API_KEY in the server's env. It is only used when a tool call names provider: "moonshot", unless you also set LOCAL_AI_ALLOW_HOSTED_FALLBACK=1.

Supported runtimes

Runtime

Enabled

Default host

List / loaded

Pull

Load / unload

Remove

Embed

Notes

Ollama

always

localhost:11434

✓ / ✓

✓ progress

✓ (keep_alive, num_ctx)

✓

✓

Native /api/chat: contextLength sets num_ctx, exact timings, JSON-schema format

LM Studio

always

localhost:1234

✓ / ✓

✓ via lms

✓ via lms (TTL, context)

✓ via lms

✓

Lifecycle needs the lms CLI; without it, models load on first request

llama.cpp (llama-server)

always

localhost:8080

✓ / ✓ (/slots)

–

–

–

✓

One model per server; start with --embeddings for embed

Docker Model Runner

always

localhost:12434

✓ / –

✓ progress

on first request

✓

✓

Enable host-side TCP support in Docker Desktop

MLX (mlx_lm.server)

MLX_HOST

–

✓ / –

–

on first request

–

–

Apple Silicon; switches models per request

vLLM

VLLM_HOST

–

✓ / ✓

–

–

–

✓

health_check reports KV-cache usage and queue depth from /metrics

Foundry Local

FOUNDRY_LOCAL_HOST

dynamic port

✓ / ✓

✓ progress

✓ (TTL)

–

–

Find the port with foundry service status

OpenAI-compatible (Jan, LocalAI, …)

OPENAI_COMPAT_HOST

–

✓ / ✓

–

–

–

✓

Local or hosted, inferred from the host

Moonshot AI (Kimi)

MOONSHOT_API_KEY

api.moonshot.ai/v1

✓ / –

–

–

–

–

Hosted: never selected implicitly

You can run more than one instance of a runtime, for example a second Ollama box on your LAN, with LOCAL_AI_PROVIDERS='[{"type":"ollama","name":"ollama-gpu2","host":"http://192.168.1.20:11434"}]'. Use LOCAL_AI_DISABLE=lmstudio,dockermodelrunner to skip probing runtimes you don't use.

Privacy model

  • Each provider is either local or hosted. The kind is inferred from its host: loopback, private LAN ranges, *.local, Tailscale CGNAT and host.docker.internal count as local. You can override it per instance in LOCAL_AI_PROVIDERS.

  • With no provider argument, complete, embed, delegate, benchmark, load_model and the other model-scoped tools only consider live local providers that have the model. If the model exists only on a hosted provider, the call fails and tells you how to opt in.

  • Hosted providers are never probed on routine calls. Only health_check and diagnostics contact them.

  • search_models with source: "huggingface" queries the Hugging Face Hub, and only when you ask it to. Set LOCAL_AI_DISABLE_NETWORK_SEARCH=1 to forbid it.

  • The server uses stdio only. It never opens a network listener.

Tools (19)

Every tool declares MCP annotations (read-only, destructive, open-world) and an output schema, and returns structured content.

Group

Tool

What it does

Discovery

list_providers

Configured runtimes: kind (local/hosted), live status, capabilities

list_models

Installed models on each live provider

list_loaded

Models resident in memory, with VRAM use and context length

model_info

Family, size, quantization, context length and layer architecture

Lifecycle

pull_model

Heavy. Downloads to one provider, streaming progress notifications. background: true returns a job id instead

pull_status / pull_cancel

Check or stop background pulls

remove_model

Destructive. provider is required; asks you directly through MCP elicitation when the client supports it, otherwise needs confirm: true

load_model / unload_model

One provider, with optional keepAlive and contextLength

ensure_model

Pull (if allowed), fit check, evict others (lru / all), load and verify. dryRun returns the plan only

Ops

health_check

Reachability, version, runtime metrics

diagnostics

Effective config (keys redacted), per-provider detection with latency and errors, speed cache, hardware probe sources. Paste it into bug reports

system_resources

RAM and GPUs (NVIDIA, AMD, Intel, Apple Silicon), each tagged with its data source

fit_check

Returns gpu / partial / cpu / none for a model at a given context length and KV-cache precision

benchmark

Heavy. Warmup, then N runs: time-to-first-token, generation and prompt tokens/sec. models: [...] to compare

Registry

search_available

Built-in offline catalog

suggest_model

Best models for a task on this machine: largest that fits on the GPU first, flags installed ones

search_models

Live Hugging Face GGUF search with per-quantization fit and pull references (hf.co/<repo>:<quant>)

Delegation

complete

Run a completion on a model you choose: system prompt, JSON / JSON-schema output (validated), seed, sampling, images, contextLength

embed

Embeddings, always one vector per input

delegate

One call: picks the best local model for a task (loaded, then installed and fitting, then optionally pulled; larger size tiers first, with speed measured by benchmark on this machine breaking ties within a tier), runs it, and explains the choice

Resources: local-ai://system, local-ai://loaded (subscribable; updates when models load or unload), and local-ai://models/{provider}. Prompts: setup, free-vram, benchmark-my-models, pick-model.

Configuration

Every setting is an environment variable, and blank means the default. See .env.example for the full annotated list.

Variable

Default

Purpose

OLLAMA_HOST, LMSTUDIO_HOST, LLAMACPP_HOST, DOCKER_MODEL_RUNNER_HOST

standard local ports

Always-on runtimes

MLX_HOST, VLLM_HOST (+VLLM_API_KEY), FOUNDRY_LOCAL_HOST, OPENAI_COMPAT_HOST (+OPENAI_COMPAT_API_KEY)

unset

Opt-in runtimes

LOCAL_AI_PROVIDERS

unset

JSON array of extra instances {type, host, name?, apiKey?, kind?}

LOCAL_AI_DISABLE

unset

Comma-separated types or names to skip

MOONSHOT_API_KEY, MOONSHOT_HOST

unset, https://api.moonshot.ai/v1

Hosted Moonshot provider

LOCAL_AI_ALLOW_HOSTED_FALLBACK

off

Let calls without a provider use hosted providers

LOCAL_AI_DISABLE_NETWORK_SEARCH

off

Forbid Hugging Face search

LOCAL_AI_BENCHMARK_CACHE

per-user cache dir

Where benchmark results are kept for delegate ranking (expire after 14 days); off disables

LOCAL_AI_REQUEST_TIMEOUT_MS

120000

Non-streamed requests

LOCAL_AI_DETECT_TIMEOUT_MS

1500

Detection probes

LOCAL_AI_PULL_TIMEOUT_MS

3600000

Downloads (0 = no limit)

LOCAL_AI_STREAM_IDLE_TIMEOUT_MS

60000

Abort a stream only if no token arrives for this long

LOCAL_AI_STREAM_MAX_MS

1800000

Hard cap on a streamed completion (0 = none)

LOCAL_AI_CACHE_TTL_MS

10000

Detection and model-list cache

Troubleshooting

  • A provider isn't detected. Run diagnostics (or health_check). Check the host and port. From WSL, use the Windows host IP. From a container, use host.docker.internal. For Docker Model Runner, enable host-side TCP support.

  • LM Studio pull/load fails with "requires the lms CLI". Install the lms CLI as described in the LM Studio CLI docs so it is on PATH, then restart your MCP client.

  • llama.cpp embed fails. Start llama-server with --embeddings and an embedding-capable model.

  • Answers about long inputs look truncated (Ollama). Pass contextLength (it sets num_ctx). The result includes a warning when truncation is likely.

  • "was not found on any live local provider". The model is either not installed (check list_models) or only available on a hosted provider. Name that provider explicitly to use it.

  • macOS memory numbers look low. system_resources reports available memory (free, inactive and purgeable pages) and the Metal working-set limit, not total RAM.

Development

npm install
npm run build       # tsc -> dist/
npm test            # vitest, fully offline (mocked HTTP, stubbed hardware)
npm run lint        # Biome
npm run typecheck   # src and tests
npm run gen:tools   # regenerate mcp-tools.json after changing tools
npm run smoke       # boot the built server over stdio

CI runs on Linux, Windows and macOS with Node 22 (the minimum supported) and 24. A nightly workflow tests the adapters against real Ollama and llama.cpp. See CONTRIBUTING.md, including Adding a runtime adapter.

Support

Questions and ideas go in Discussions. Report bugs with the issue templates, and security problems through private reporting. If this saves you time, consider sponsoring.

License

CC-BY-NC-ND-4.0. See LICENSE. Contributions are accepted under the DCO and the inbound grant described in CONTRIBUTING.md.


Built by TMHSDigital

Available Tools

22 tools
benchmarkBenchmarkA

HEAVY: Runs REAL inference. Measures a model on this machine with a warmup (absorbs load time) plus N streamed runs: time-to-first-token, generation tokens/sec (runtime-reported when available, else measured after the first token), and prompt-processing speed. Pass models[] to compare several models with the same prompt, ranked by generation speed.

Inputs: runs, model, models, prompt, +3 more. Returns: results

completeDelegated completionA
Read-only

DELEGATED INFERENCE: Offload a completion to a model you choose for cost savings and privacy. Without provider, runs on the live LOCAL provider that has the model (never a hosted API unless LOCAL_AI_ALLOW_HOSTED_FALLBACK is set); the result's 'provider', 'host' and 'local' fields say where it ran. Supports system prompts, JSON / JSON-Schema output (validated 'parsed' field), seed/topP/topK, image inputs for vision models, and contextLength for long inputs. Streams tokens via MCP progress notifications when the client sends a progressToken.

Inputs: model (required), seed, stop, topK, +13 more. Returns: host, text, local, model, +2 more

delegateDelegate a task to the best local modelA

ONE CALL to offload work locally: pick the best model for a task on THIS machine, make it ready, and run it. Prefers models already loaded (no load cost), then installed models that fit your free VRAM, then (with allowPull) the best catalog model that fits. Task specialists (coder, vision, reasoning) win over general models; then larger fitting models win, grouped into size tiers (within ~20% parameter count); inside a tier, the model benchmarked fastest on this machine wins (run benchmark to record speeds; results expire after 14 days). Never uses a hosted provider unless allowHosted is true (or, when allowHosted is omitted, LOCAL_AI_ALLOW_HOSTED_FALLBACK is set), and even then any suitable local model is preferred. Models that only fit in system RAM run on CPU when nothing fits the GPU. Returns the completion plus a 'routing' block explaining the choice.

Inputs: task (required), seed, stop, topK, +17 more. Returns: text, model, routing, provider

diagnosticsDiagnosticsA
Read-onlyIdempotent

One read-only snapshot for troubleshooting: the effective configuration (API keys never shown, only whether one is set), every configured provider with its detection result, latency and error, the benchmark speed cache, and how hardware was probed. Paste its output into bug reports.

Inputs: no named parameters. Returns: config, hardware, providers, speedCache

embedDelegated embeddingsA
Read-onlyIdempotent

DELEGATED EMBEDDINGS: Generate embeddings for a string or an array of texts. Without provider, runs on the live local provider that has the model. Always returns one vector per input.

Inputs: input (required), model (required), provider. Returns: host, local, model, provider, +2 more

ensure_modelEnsure model is readyA
Idempotent

Make a model ready in one call: optionally pull it, check it fits current free VRAM, unload other models if needed (evict: 'lru' or 'all'), load it, and verify. Use dryRun:true to get the plan without changing anything.

Inputs: model (required), evict, dryRun, provider, +4 more. Returns: fit, plan, model, ready, +2 more

fit_checkFit checkA
Read-onlyIdempotent

Will a model run on this machine, and where? Uses the installed model's size and exact layer architecture when the runtime exposes it (else parameter-count or catalog estimates) to size weights + KV cache for a context length, then compares with free VRAM summed across GPUs and available RAM. Returns target gpu / partial (GPU+CPU split) / cpu / none, with the numbers and how the KV estimate was made. Credits back memory the model already uses if it is loaded.

Inputs: model (required), provider, sizeBytes, kvCacheType, +2 more. Returns: fits, note, model, loaded, +4 more

health_checkHealth checkA
Read-onlyIdempotent

Check whether each provider is reachable and report its version (and live metrics such as vLLM KV-cache usage). Without provider, checks every configured provider, including hosted ones.

Inputs: provider. Returns: health

list_loadedList loaded modelsA
Read-onlyIdempotent

List models currently loaded into memory on each live provider, with VRAM use and context length where the runtime reports them.

Inputs: provider. Returns: loaded

list_modelsList installed modelsA
Read-onlyIdempotent

List models installed/available on each live provider, keyed by provider. Pass provider to query just one.

Inputs: provider. Returns: models

list_providersList providersA
Read-onlyIdempotent

List configured model runtimes (Ollama, LM Studio, llama.cpp, Docker Model Runner, and any opt-in MLX / vLLM / Foundry Local / OpenAI-compatible / hosted instances) with host, kind (local or hosted), live status, and capabilities.

Inputs: provider. Returns: providers

load_modelLoad modelA
Idempotent

Load a model into memory on ONE provider so it is ready for inference. Optional keepAlive (e.g. '5m', '1h') and contextLength. Without provider, uses the live local provider that has the model.

Inputs: model (required), provider, keepAlive, contextLength. Returns: load

model_infoModel infoA
Read-onlyIdempotent

Detailed metadata for one model (family, parameter size, quantization, context length, and layer architecture where available). Without provider, queries the live local providers that have the model.

Inputs: model (required), provider. Returns: info, model

pull_cancelCancel pullA
Idempotent

Stop a background pull started with pull_model { background: true }. Finished jobs are returned unchanged.

Inputs: jobId (required). Returns: job

pull_modelPull modelA
Idempotent

HEAVY: Download a model onto ONE provider (multiple GB, can take a long time). Streams download progress via MCP progress notifications when the client sends a progressToken. With background:true, returns a jobId immediately instead; poll pull_status and stop it with pull_cancel (use this when the client has no progress display or a short tool timeout). Without provider, uses the provider that already has the model, else the first live local provider that can pull.

Inputs: model (required), provider, background. Returns: job, pull

pull_statusPull statusA
Read-onlyIdempotent

Status of background pulls started with pull_model { background: true }: state (running, done, failed, cancelled), progress, and result or error. Without jobId, lists every job this server remembers (finished jobs are kept for an hour; jobs are forgotten on restart).

Inputs: jobId. Returns: jobs

remove_modelRemove modelA
Destructive

DESTRUCTIVE: Permanently delete a model from one provider. provider is REQUIRED (no fan-out). If the client supports elicitation the user is asked to confirm directly; otherwise confirm:true is required.

Inputs: model (required), provider (required), confirm. Returns: remove

search_availableSearch catalogA
Read-onlyIdempotent

Search the built-in curated catalog of well-known local models (Ollama tags) by name, family, or task. Offline and instant. For live results with per-quant fit, use search_models with source 'huggingface'.

Inputs: query (required). Returns: note, query, results

search_modelsSearch models (live)A
Read-onlyIdempotent

Find models to download, annotated with whether each fits this machine. source 'huggingface' searches GGUF repos on the Hugging Face Hub and returns per-quant sizes, the best quant for this hardware, and pullable references (Ollama: hf.co/:). source 'catalog' searches the offline curated list. The Ollama library has no public search API, so it is not a source.

Inputs: query (required), task, limit, source, +2 more. Returns: query, source, results

suggest_modelSuggest modelA
Read-onlyIdempotent

Recommend catalog models for a task, ranked for THIS machine: fully-on-GPU first, then partial GPU offload, then CPU-only. Within a tier the largest (most capable) model comes first unless preferSpeed is true. Flags models already installed on a live provider and explains each pick.

Inputs: task (required), kvCacheType, preferSpeed, contextLength. Returns: task, suggestions

system_resourcesSystem resourcesA
Read-onlyIdempotent

Report local hardware: platform, total/available RAM, CPU count, and GPUs with total/free VRAM (NVIDIA via nvidia-smi, AMD/Intel via sysfs or the Windows registry, Apple Silicon unified memory). Each GPU names its data source.

Inputs: no named parameters. Returns: gpus, cpuCount, platform, ramFreeBytes, +1 more

unload_modelUnload modelA
Idempotent

Unload a model from memory to free VRAM/RAM on ONE provider. Without provider, uses the live local provider that has it loaded.

Inputs: model (required), provider. Returns: unload

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 22 tools

    Disambiguation3/5

    Most tools map to a distinct resource (providers, models, hardware, pulls), but several pairs overlap meaningfully: search_available is explicitly a subset of search_models (source 'catalog'), diagnostics partially duplicates health_check + system_resources, and ensure_model overlaps with the pull_model/load_model/fit_check combination. complete vs delegate is also a judgement call for an agent, since both run inference and only the description clarifies which to pick. Descriptions do a lot of work to disambiguate, keeping this above a 2.

    Naming Consistency3/5

    The dominant pattern is snake_case verb_noun (pull_model, list_models, search_models, remove_model, suggest_model), but it is mixed with noun_noun (model_info, system_resources, health_check, fit_check) and bare single-word tools (complete, delegate, embed, benchmark, diagnostics). Everything is readable and there is some within-family consistency (list_*, pull_*, search_*), but the overall set does not follow one predictable convention.

    Tool Count3/5

    22 tools is on the heavy side for a local-runtime manager, and a few do not clearly earn their place: search_available is redundant with search_models, and pull_status/pull_cancel are arguably one job-status tool. The remaining surface (lifecycle, discovery, hardware, inference) is defensible, so this sits at borderline rather than excessive.

    Completeness4/5

    The model lifecycle is well covered end to end: search/suggest, pull with background jobs, load/unload, fit check, benchmark, delete, plus inference (complete/delegate/embed) and hardware/diagnostics. Minor gaps remain, notably no way to add or edit provider configuration, no model copy/alias/rename, and no way to cancel long-running non-pull work such as benchmark. These are workaround-able rather than blocking.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Discovers local model runtimes such as Ollama, LM Studio, and LocalAI, and exposes their endpoint metadata to MCP clients like Copilot.
      3
      8 npm
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables MCP-compatible applications to interact with local and cloud-hosted LLM models for model management, text generation, chat, embeddings, and web search/fetch.
      956 npm
      AGPL 3.0
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables MCP-compatible clients to manage, run, and interact with local or cloud LLM models through exposed tools for listing, pulling, generating, chatting, embeddings, and web search/fetch. Supports Claude Desktop, Cline, and hybrid local/cloud setups.
      956 npm
      AGPL 3.0
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables 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.
      956 npm
      AGPL 3.0