Local AI MCP

io.github.TMHSDigital由 GitHub 帳號 TMHSDigital 發布v0.6.1更新於 Nov 4, 2026

Run, fit, and route work to local LLMs (Ollama, LM Studio, llama.cpp, MLX, vLLM, and more).

已驗證STDIO僅桌面AI 與機器學習

概覽

Local AI 的本機 MCP 服務;無需登入;STDIO;19 個工具。

暫無 AI 概覽:以下資訊來自註冊中心條目和服務本身。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Local AI MCP,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

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.

text
# illustrative sessionYou:    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.

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

bash
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:

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

RuntimeEnabledDefault hostList / loadedPullLoad / unloadRemoveEmbedNotes
Ollamaalwayslocalhost:11434✓ / ✓✓ progress✓ (keep_alive, num_ctx)✓✓Native /api/chat: contextLength sets num_ctx, exact timings, JSON-schema format
LM Studioalwayslocalhost: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)alwayslocalhost:8080✓ / ✓ (/slots)–––✓One model per server; start with --embeddings for embed
Docker Model Runneralwayslocalhost:12434✓ / –✓ progresson 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
vLLMVLLM_HOST–✓ / ✓–––✓health_check reports KV-cache usage and queue depth from /metrics
Foundry LocalFOUNDRY_LOCAL_HOSTdynamic 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_KEYapi.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 contacts 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.

GroupToolWhat it does
Discoverylist_providersConfigured runtimes: kind (local/hosted), live status, capabilities
list_modelsInstalled models on each live provider
list_loadedModels resident in memory, with VRAM use and context length
model_infoFamily, size, quantization, context length and layer architecture
Lifecyclepull_modelHeavy. Downloads to one provider, streaming progress notifications
remove_modelDestructive. provider is required; asks you directly through MCP elicitation when the client supports it, otherwise needs confirm: true
load_model / unload_modelOne provider, with optional keepAlive and contextLength
ensure_modelPull (if allowed), fit check, evict others (lru / all), load and verify. dryRun returns the plan only
Opshealth_checkReachability, version, runtime metrics
system_resourcesRAM and GPUs (NVIDIA, AMD, Intel, Apple Silicon), each tagged with its data source
fit_checkReturns gpu / partial / cpu / none for a model at a given context length and KV-cache precision
benchmarkHeavy. Warmup, then N runs: time-to-first-token, generation and prompt tokens/sec. models: [...] to compare
Registrysearch_availableBuilt-in offline catalog
suggest_modelBest models for a task on this machine: largest that fits on the GPU first, flags installed ones
search_modelsLive Hugging Face GGUF search with per-quantization fit and pull references (hf.co/<repo>:<quant>)
DelegationcompleteRun a completion on a model you choose: system prompt, JSON / JSON-schema output (validated), seed, sampling, images, contextLength
embedEmbeddings, always one vector per input
delegateOne 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.

VariableDefaultPurpose
OLLAMA_HOST, LMSTUDIO_HOST, LLAMACPP_HOST, DOCKER_MODEL_RUNNER_HOSTstandard local portsAlways-on runtimes
MLX_HOST, VLLM_HOST (+VLLM_API_KEY), FOUNDRY_LOCAL_HOST, OPENAI_COMPAT_HOST (+OPENAI_COMPAT_API_KEY)unsetOpt-in runtimes
LOCAL_AI_PROVIDERSunsetJSON array of extra instances {type, host, name?, apiKey?, kind?}
LOCAL_AI_DISABLEunsetComma-separated types or names to skip
MOONSHOT_API_KEY, MOONSHOT_HOSTunset, https://api.moonshot.ai/v1Hosted Moonshot provider
LOCAL_AI_ALLOW_HOSTED_FALLBACKoffLet calls without a provider use hosted providers
LOCAL_AI_DISABLE_NETWORK_SEARCHoffForbid Hugging Face search
LOCAL_AI_BENCHMARK_CACHEper-user cache dirWhere benchmark results are kept for delegate ranking (expire after 14 days); off disables
LOCAL_AI_REQUEST_TIMEOUT_MS120000Non-streamed requests
LOCAL_AI_DETECT_TIMEOUT_MS1500Detection probes
LOCAL_AI_PULL_TIMEOUT_MS3600000Downloads (0 = no limit)
LOCAL_AI_STREAM_IDLE_TIMEOUT_MS60000Abort a stream only if no token arrives for this long
LOCAL_AI_STREAM_MAX_MS1800000Hard cap on a streamed completion (0 = none)
LOCAL_AI_CACHE_TTL_MS10000Detection and model-list cache

Troubleshooting

  • A provider isn't detected. Run 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

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

CI runs on Linux, Windows and macOS with Node 22 and 24, plus a Node 20 runtime check. 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

來源:README.md,提交 5ea6f54

工具

19

list_providers

List providers

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.

輸入參數provider

list_models

List installed models

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

輸入參數provider

list_loaded

List loaded models

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

輸入參數provider

model_info

Model info

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.

輸入參數model必填provider

pull_model

Pull model

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. Without provider, uses the provider that already has the model, else the first live local provider that can pull.

輸入參數model必填provider

remove_model

Remove model

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.

輸入參數model必填confirmprovider必填

load_model

Load model

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.

輸入參數model必填providerkeepAlivecontextLength

unload_model

Unload model

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

輸入參數model必填provider

ensure_model

Ensure model is ready

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.

輸入參數evictmodel必填dryRunproviderallowPullkeepAlivekvCacheTypecontextLength

health_check

Health check

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.

輸入參數provider

system_resources

System resources

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.

無需輸入參數。

fit_check

Fit check

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.

輸入參數model必填providersizeByteskvCacheTypecontextLengthparameterSize

benchmark

Benchmark

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.

輸入參數runsmodelmodelspromptwarmupprovidermaxTokens

search_available

Search catalog

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'.

輸入參數query必填

suggest_model

Suggest model

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.

輸入參數task必填kvCacheTypepreferSpeedcontextLength

search_models

Search models (live)

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/<repo>:<quant>). source 'catalog' searches the offline curated list. The Ollama library has no public search API, so it is not a source.

輸入參數tasklimitquery必填sourcefitsOnlycontextLength

complete

Delegated completion

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.

輸入參數seedstoptopKtopPmodel必填promptstreamsystemoptionsmessagesprovidermaxTokens另有 4 個

embed

Delegated embeddings

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.

輸入參數input必填model必填provider

delegate

Delegate a task to the best local model

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. Returns the completion plus a 'routing' block explaining the choice.

輸入參數seedstoptask必填topKtopPpromptstreamsystemoptionsmessagesproviderallowPull另有 7 個

版本歷史

1
  1. v0.6.1最新Nov 3, 2026

評分

已滿足適用檢查項的 80%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分
  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

    請在儲存庫或註冊中心條目中宣告授權條款。