Local AI MCP
Unified MCP server for managing local model runtimes (Ollama, LM Studio, etc.), enabling provider-agnostic discovery, lifecycle management, hardware-fit checks, and delegated inference.
README
Local AI MCP
Unified MCP server for managing local model runtimes (Ollama, LM Studio, and more): provider-agnostic discovery, lifecycle, hardware-fit, and delegated inference.
Local AI MCP is an MCP server that turns your local model runtimes into an agent-callable control plane. It is operations-first: its primary job is to discover, inspect, fit, and manage the models running on your own machine. It speaks to runtimes over their local HTTP APIs and exposes one consistent tool surface across them, so an agent does not need to know whether a model lives in Ollama or LM Studio.
The server communicates over stdio only. It is a client to your local runtimes and never opens a network listener of its own.
Why an ops-first local-model server
- Discovery and lifecycle, not just chat. List what is installed, what is loaded, pull and remove models, load and unload them, and check their fit against your hardware before you commit VRAM to them.
- Hardware-aware.
system_resourcesandfit_checkread your real RAM and GPU/VRAM so an agent can pick a model that will actually run, andsuggest_modelranks candidates by task and by what fits. - Provider-agnostic. Every tool takes an optional
providerargument. Omit it and the tool operates across all detected runtimes, aggregating results per provider.
Inference is delegation, not chat
The complete and embed tools exist to delegate (offload) inference to a local model for cost control and privacy: keep tokens and data on your own hardware instead of sending them to a hosted API. They are deliberately framed as delegated/offloaded inference primitives, not as a conversational chat surface.
The provider-adapter model
Each runtime is implemented as an adapter behind a single Provider interface (src/providers/types.ts) with a uniform method set: detect, health, listModels, listLoaded, modelInfo, pull, remove, load, unload, complete, embed, and capabilities. Adding a runtime means adding one adapter; the tool layer is unchanged.
| Adapter | Default host | Transport | Notes |
|---|---|---|---|
Ollama (src/providers/ollama.ts) |
http://localhost:11434 |
Native REST + OpenAI-compatible | load/unload map to Ollama keep_alive semantics (keep_alive to load, keep_alive: 0 to unload). complete/embed use the OpenAI-compatible /v1 routes. |
LM Studio (src/providers/lmstudio.ts) |
http://localhost:1234 |
REST (/api/v0) + OpenAI-compatible |
Uses the lms CLI for load/unload/pull/remove when present; falls back to REST for listModels/listLoaded/complete/embed. |
Auto-detection: on each call the server probes the configured local endpoints to determine which runtimes are live. Hardware probing is isolated in src/hardware/ and branches by platform (Windows / Linux); it exposes total/free RAM and, where detectable, GPU name and VRAM.
Tool surface (16 tools)
Discovery
| Tool | Description |
|---|---|
list_providers |
Configured runtimes, their host, live/detected status, and capabilities. |
list_models |
Installed models across detected providers (or one provider). |
list_loaded |
Models currently resident in memory. |
model_info |
Detailed metadata for a model. |
Lifecycle
| Tool | Description |
|---|---|
pull_model |
Download a model. Heavy: may transfer multiple GB. |
remove_model |
Delete a model from disk. Destructive: requires confirm: true and a provider (no fan-out); refuses without confirm: true. |
load_model |
Load a model into memory (Ollama keep_alive; LM Studio lms load). |
unload_model |
Evict a model from memory. |
Ops
| Tool | Description |
|---|---|
health_check |
Liveness and version per provider. |
system_resources |
Total/free RAM, CPU count, and GPU/VRAM. |
fit_check |
Whether a model fits in free VRAM (GPU) or RAM (CPU), with the numbers. |
benchmark |
Measure latency and tokens/sec with one small completion. Heavy: runs real inference. |
Registry
| Tool | Description |
|---|---|
search_available |
Search a curated catalog of well-known models (Ollama library oriented). |
suggest_model |
Recommend a model for a task, ranked by what fits your detected hardware. |
Delegation (offloaded inference)
| Tool | Description |
|---|---|
complete |
Delegate a completion to a local model (cost/privacy offload, not chat). |
embed |
Delegate embedding generation to a local model. |
Every tool except system_resources accepts an optional provider (ollama | lmstudio). Omit it to operate across all detected runtimes.
Install and run
npx @tmhs/local-ai-mcp
Claude Desktop / Cursor config
{
"mcpServers": {
"local-ai": {
"command": "npx",
"args": ["-y", "@tmhs/local-ai-mcp"],
"env": {
"OLLAMA_HOST": "http://localhost:11434",
"LMSTUDIO_HOST": "http://localhost:1234"
}
}
}
}
Configuration
All configuration is via environment variables with sane defaults:
| Variable | Default | Description |
|---|---|---|
OLLAMA_HOST |
http://localhost:11434 |
Ollama base URL (scheme optional; added if missing). |
LMSTUDIO_HOST |
http://localhost:1234 |
LM Studio base URL. |
LOCAL_AI_REQUEST_TIMEOUT_MS |
120000 |
Timeout for normal requests (inference, pull progress, etc.). |
LOCAL_AI_DETECT_TIMEOUT_MS |
1500 |
Timeout for provider auto-detection probes. |
LOCAL_AI_PULL_TIMEOUT_MS |
3600000 |
Timeout for model pulls (multi-GB downloads); set 0 to disable. |
Development
npm install
npm run build # tsc -> dist/
npm test # vitest; runs fully offline (mocked HTTP, stubbed hardware)
The test suite requires no running runtime and no downloaded model: every HTTP call is mocked and hardware probing is stubbed.
License
CC-BY-NC-ND-4.0 -- see LICENSE.
Built by TMHSDigital
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
mcp-server-qdrant
这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器