LM Studio MCP Connector & Daemon
Click on "Deploy 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., "@LM Studio MCP Connector & Daemon ask my local LM Studio model to explain this TypeScript error"
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.
LM Studio MCP Connector & Daemon
๐ค AI Transparency & Disclosure: This project, its source code, multi-OS installation scripts, and technical documentation were designed and authored with Artificial Intelligence assistance (Google Antigravity โ Models: Gemini 3.8 Flash for orchestration and local LM Studio models for cognitive reasoning). All code is systematically tested and validated by a strict Quality Gate.
A standalone, modern, ultra-resilient Model Context Protocol (MCP) server and daemon written in TypeScript to connect any agentic AI platform (Antigravity, Gemini, Claude Desktop, Cursor, VS Code) to one or multiple LM Studio instances via Stdio JSON-RPC or HTTP.
๐ What's New in Version 2.0.0
๐ Multi-Instance Architecture & Load Balancing: Configure multiple LM Studio machines (local, LAN, dedicated GPU servers). Requests are automatically routed using the Least-Connections algorithm.
๐ก๏ธ Automatic Failover & Circuit Breaker: If an instance times out, experiences connection errors, or shuts down, the connector seamlessly fails over to the next eligible instance.
โก Antigravity Remote Fallback Directive: If all local instances become unavailable, the connector returns a structured diagnostic (
REMOTE FALLBACK REQUIRED) instructing the calling agent to complete the task using its native remote LLMs without failing the execution.๐ฅ๏ธ HTTP Daemon & Embedded Real-Time Web GUI: Run with
--daemonto host a web dashboard (http://127.0.0.1:9123/) for live monitoring (latency, in-flight requests, loaded models) and hot-reloading instance configurations without restarting.๐ Transparent Stdio Bridge: Standard Stdio clients automatically detect if the daemon is running and transparently forward requests to it, surfacing live metrics in the Web GUI without changing client configs.
๐ท๏ธ Role-Based Routing: Assign specialized roles (
chat,embeddings,all) to instances (e.g. reserve fast embeddings to a specific machine without stalling heavy code completions).โก Zero Runtime Dependencies: Built 100% on native Node.js APIs (
fetch,readline,node:http,node:events,AbortController).
Related MCP server: io.github.0xzr/freellmpool
๐ ๏ธ Exposed MCP Tools
The connector exposes 5 standardized tools:
Tool | Description | Main Arguments |
| Send a prompt/instruction to the local LM Studio model with auto-detection, load balancing, and remote fallback on complete outage. |
|
| List all AI models available across active instances in the pool. | None |
| Compute vector embeddings for text using the configured local embedding model. |
|
| Probe latency, status, and active models across all configured instances. | None |
| Retrieve a detailed JSON report of pool metrics, in-flight connections, and failover stats. | None |
๐ Usage Modes
1. Standard Stdio Mode (Direct for Antigravity / Claude / Cursor)
In your MCP client configuration file (mcp_config.json, claude_desktop_config.json, etc.):
{
"mcpServers": {
"lmstudio": {
"command": "node",
"args": [
"E:/SourceCode/LMStudio_MCP_Connector/dist/index.js",
"--instances",
"http://127.0.0.1:1234,http://192.168.1.50:1234"
]
}
}
}2. Persistent HTTP Daemon & Web Dashboard
Run the connector as a background daemon:
node dist/index.js --daemon --port 9123 --instances "http://127.0.0.1:1234,http://192.168.1.50:1234"Web Dashboard: Open
http://127.0.0.1:9123/in your browser.MCP HTTP / RPC Endpoint:
POST http://127.0.0.1:9123/mcpReal-Time SSE Stream:
GET http://127.0.0.1:9123/api/events
๐ป CLI Options
Options:
--daemon, -d Run as persistent HTTP & SSE Daemon with embedded Web GUI
--port, --daemon-port, -p <n> Port for HTTP Daemon & Web GUI (default: 9123 or $LMSTUDIO_DAEMON_PORT)
--daemon-url <url> Explicit daemon URL for Stdio proxy (default: auto-detected 9123)
--no-proxy, --standalone Disable daemon proxy bridge and force local standalone execution
--instances <urls/json> Multi-instance list (comma-separated URLs or JSON array)
--url, -u <url> Primary LM Studio API URL (default: http://127.0.0.1:1234)
--model, -m <name> Model to use or fallback chat model (default: auto-detected)
--fallback-chat-model <name> Alias for --model
--fallback-embed-model <name> Fallback embedding model (default: text-embedding-nomic-embed-text-v1.5)
--timeout, -t <ms> HTTP Request timeout in ms (default: 60000)
--check-health Perform a health check across all instances and exit
--version, -v Display version number (v2.0.0)
--help, -h Show help messageAdvanced JSON Configuration for --instances or LMSTUDIO_INSTANCES
[
{ "id": "local-gpu", "name": "Desktop RTX 4090", "url": "http://127.0.0.1:1234", "roles": ["chat"], "priority": 2 },
{ "id": "lan-embed", "name": "Embedding Server", "url": "http://192.168.1.50:1234", "roles": ["embeddings"], "priority": 1 },
{ "id": "backup-cpu", "name": "Backup Node", "url": "http://192.168.1.60:1234", "roles": ["all"], "priority": 1 }
]๐ก๏ธ Resilience & Antigravity Remote Fallback
When all local LM Studio instances are offline or unreachable:
The connector does not hang or crash.
The MCP tool returns
isError: truewith an explicit directive:โ ๏ธ [LM STUDIO OFFLINE - REMOTE FALLBACK REQUIRED] No local LM Studio instances are currently reachable. Antigravity is instructed to immediately fulfill this user request using its native remote LLM capabilities without failing the turn.The calling agent instantly recognizes the condition and fulfills the user request with its native cloud LLM (Gemini, Claude, GPT), ensuring zero workflow interruption.
Once LM Studio is restarted, the background health probe automatically restores
ONLINEstatus in real time.
๐งช Testing & Automated Quality Gate
The project is governed by an automated Quality Gate enforcing strict TypeScript typing and native tests:
# Run TypeScript strict checks and all 29 unit & integration tests:
node scripts/quality_gate_hook.js --cli๐ License
Distributed under the MIT License. See LICENSE for details.
Available Tools
5 toolslmstudio_chatB
Send a prompt or instruction to the local LM Studio model and get the generated completion. If all local instances are offline, returns a directive instructing the agent to fallback to remote LLMs.
Inputs: prompt (required), model, max_tokens, temperature, +1 more.
lmstudio_embeddingsB
Generate vector embeddings for input text using the local LM Studio embedding model.
Inputs: input (required), model.
lmstudio_healthA
Check the health, status, latency, and loaded models of configured LM Studio instances.
Inputs: no named parameters.
lmstudio_list_modelsA
List all AI models currently loaded and available across LM Studio instances.
Inputs: no named parameters.
lmstudio_pool_statusB
Inspect multi-instance pool metrics, load balancing distribution, and failover status.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogโฆ
TDQS
Scored across 5 tools
Each tool targets a distinct capability: chat completion, model listing, embeddings, instance health, and pool-level metrics. The only mild overlap is lmstudio_health vs lmstudio_pool_status, both of which report on instance state, but the descriptions distinguish per-instance diagnostics from aggregate load-balancing/failover metrics.
All five tools use a consistent snake_case pattern with the same lmstudio_ namespace prefix followed by a clear noun/verb topic. No mixed conventions or vague verbs.
Five tools is well-scoped for a local-model connector: one each for inference, embeddings, model discovery, instance health, and pool observability. No tool appears redundant or filler.
Core workflows (chat, embeddings, model discovery, health/pool monitoring) are covered. However, model lifecycle operations like loading/unloading models or selecting a target instance per request are absent, which could limit agent control over the daemon.
Maintenance
Related MCP Connectors
Real-time chat hub for AI agents โ Claude Code, Cursor, Cline, Codex over MCP or REST.
AI routing, memory, guardrails, and governance. Routes across Claude, GPT, Gemini.
OpenAI-compatible BYOK LLM gateway: per-task routing, shadow evaluation, promotion gates.
Hosted runtime for persistent agent teams, durable workflows, memory, schedules, and goals.
Related MCP Servers
- FlicenseAqualityDmaintenanceMCP server that connects LLM agents to a local LM Studio instance, enabling model management, OpenAI-compatible chat completions, text completions, and embeddings through a set of tools.91-
- FlicenseNot gradedqualityAmaintenanceEnables coding agents and OpenAI- or Anthropic-compatible clients to send chat requests through a single local pooled endpoint that spans free provider tiers, with keyless startup, automatic failover, model discovery, and capacity/health inspection tools.-
- AlicenseNot gradedqualityAmaintenanceEnables connecting, aggregating, and routing multiple backend Model Context Protocol servers (Stdio, SSE, and Streamable HTTP) by exposing their combined tools and resources through unified SSE/HTTP endpoints or a single Stdio interface, with optional authentication and web-based admin management.120 npmMIT
- AlicenseNot gradedqualityAmaintenanceAggregates multiple backend Model Context Protocol servers of Stdio, SSE, and Streamable HTTP types and exposes their combined tools and resources through a single unified SSE, Streamable HTTP, or Stdio interface with request routing and authentication. Includes an optional web admin UI for managing server connections, enabling or disabling individual tools, overriding tool names and descriptions, and live-reloading configuration.120 npmMIT