LMStudio MCP Bridge
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., "@LMStudio MCP Bridge generate unit tests for src/utils/validation.ts"
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 Bridge for Claude Code █░░░LMStudio MCP Bridge
A robust, MCP (Model Context Protocol) bridge for LMStudio that enables Claude Code and Desktop to leverage local LLMs for code assistance tasks. Made specifically to use gpt-oss-20b model locally and offset token usage for Claude Code.
Features
Core Capabilities
6 Specialized Tools for code assistance
Request validation with Zod schemas and security checks
Intelligent caching to reduce redundant LLM calls
Rate limiting to prevent overload
Graceful shutdown handling
Structured logging with Winston
TypeScript for type safety
Available Tools
generate_docs - Generate comprehensive documentation with multiple styles (technical/user/API)
summarize - Create concise summaries with configurable length and format
extract_tags - Extract semantic tags and keywords from code
analyze_code - Perform security, performance, style, and bug analysis
refactor_suggestions - Suggest code improvements for readability/performance/maintainability
generate_tests - Generate comprehensive test cases with coverage targets
Related MCP server: lmstudio-mcp
Installation
Prerequisites
Node.js 20+
LM Studio running with a model loaded
LM Studio API server enabled (localhost:1234)
Quick Setup
# Run the automated setup
chmod +x setup.sh
./setup.shThis will:
Check prerequisites
Install dependencies
Build TypeScript
Create configuration files
Run health checks
Display Claude Desktop integration instructions
Manual Setup
# Install dependencies
npm install
# Copy environment configuration
cp .env.example .env
# Build TypeScript
npm run build
# Test connection to LM Studio
npm run health
# Start the server
npm startConfiguration
Environment Variables (.env)
# LM Studio Settings
LM_STUDIO_URL=http://localhost:1234 # LM Studio API endpoint
LM_STUDIO_TIMEOUT=30000 # Request timeout (ms)
LM_STUDIO_MAX_RETRIES=3 # Retry attempts on failure
LM_STUDIO_MODEL=openai/gpt-oss-20b # Model to use
LMSERVER_NAME=LMStudio # MCP Server Name
# Server Settings
LOG_LEVEL=info # error|warn|info|debug
GRACEFUL_SHUTDOWN_TIMEOUT=5000 # Shutdown grace period (ms)
# Performance Tuning
RATE_LIMIT_MAX_REQUESTS=60 # Max requests per minute
RATE_LIMIT_MAX_CONCURRENT=10 # Max concurrent requests
CACHE_TTL=300 # Cache duration (seconds)Claude Code / Desktop integration
You can enable the MCP server either per‑project or user‑wide. After editing config, restart Claude Code/Claude Desktop.
Project‑scoped (recommended)
Option A:
.claude/settings.local.jsonin your project
{
"mcpServers": {
"LMStudio": {
"type": "stdio",
"command": "bash",
"args": ["-lc", "./LMStudio-MCP/start.sh"],
"env": {
"NODE_ENV": "production",
"LM_STUDIO_URL": "http://localhost:1234",
"LM_STUDIO_MODEL": "openai/gpt-oss-20b"
}
}
}
}Option B:
.mcp.jsonat the project root
{
"mcpServers": {
"LMStudio": {
"type": "stdio",
"command": "bash",
"args": ["-lc", "./LMStudio-MCP/start.sh"]
}
}
}User‑scoped (global)
Add to ~/.claude.json top‑level mcpServers:
{
"mcpServers": {
"LMStudio": {
"type": "stdio",
"command": "bash",
"args": ["-lc", "/Users/you/path/to/ClaudeCodeSetup/LMStudio-MCP/start.sh"],
"env": {
"NODE_ENV": "production",
"LM_STUDIO_URL": "http://localhost:1234",
"LM_STUDIO_MODEL": "openai/gpt-oss-20b"
}
}
}
}Note: Restart Claude Code/Claude Desktop after changes so the MCP list refreshes.
Direct Testing
# Check server health
curl http://localhost:9090/health
# View logs
tail -f logs/combined.log
# Monitor errors only
tail -f logs/error.logArchitecture
┌─────────────────────────────────────────┐
│ Claude Code │
│ (MCP Client) │
└────────────┬────────────────────────────┘
│ MCP Protocol (stdio)
▼
┌─────────────────────────────────────────┐
│ LM Studio MCP Bridge │
│ ┌──────────────────────────────┐ │
│ │ Request Validation Layer │ │
│ ├──────────────────────────────┤ │
│ │ Rate Limiter & Cache │ │
│ ├──────────────────────────────┤ │
│ │ Tool Execution Engine │ │
│ ├──────────────────────────────┤ │
│ │ Error Handler & Retry │ │
│ └──────────────────────────────┘ │
└────────────┬────────────────────────────┘
│ OpenAI-compatible API
▼
┌─────────────────────────────────────────┐
│ LM Studio │
│ (Local LLM - GPT/Llama/etc) │
└─────────────────────────────────────────┘Process Management (PM2)
# Install PM2
npm install -g pm2
# Start with PM2
pm2 start dist/index.js --name lmstudio-mcp \
--max-memory-restart 500M \
--error logs/pm2-error.log \
--out logs/pm2-out.log
# Monitor
pm2 monit lmstudio-mcpLicense
MIT
Available Tools
10 toolsanalyze_codeC
Perform comprehensive code analysis for issues and improvements
Inputs: code (required), language (required), checks.
analyze_markdownC
Analyze markdown documentation for quality, completeness, and improvements
Inputs: checks, content, filePath.
extract_tagsC
Extract semantic tags and keywords from code
Inputs: code (required), language (required), maxTags.
generate_docsC
Generate comprehensive documentation for code with various styles
Inputs: code (required), style, language, includeExamples.
generate_testsC
Generate comprehensive test cases for code
Inputs: code (required), language (required), framework, coverageTarget.
process_markdownC
Process and streamline markdown documentation files
Inputs: action, format, content, filePath, +2 more.
refactor_suggestionsC
Suggest code refactoring improvements
Inputs: code (required), language (required), focus.
summarizeC
Create concise summaries of code or text with configurable length
Inputs: content (required), style, max_words.
summarize_markdownC
Extract key findings and create concise summaries from markdown documentation
Inputs: style, content, filePath, maxWords, +1 more.
tag_markdownC
Extract semantic tags and categories from markdown documentation
Inputs: content, maxTags, filePath, categories, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
The set is essentially two mirrored clusters (markdown vs. code) and the overlapping pairs — summarize_markdown/summarize, tag_markdown/extract_tags, analyze_markdown/analyze_code — are easy to misselect when input is mixed text. process_markdown is the weakest: its 'process and streamline' description collides with both summarize_markdown and analyze_markdown, leaving no clear boundary.
There is a partial *_markdown suffix convention, but it breaks down for the code-side counterparts (summarize, extract_tags) and shifts to noun-phrase names for refactor_suggestions. Verb style varies between imperative verbs (analyze, generate) and bare nouns, so the pattern is readable but not predictable.
Ten tools is a reasonable, well-scoped size for an LLM-backed code/markdown assistant. There is minor redundancy from the markdown-specific twins of generic tools, but nothing feels like pure padding or missing bulk.
Coverage spans summarize/tag/analyze/generate for code and markdown, but refactor_suggestions and analyze_code produce advice with no tool to apply fixes or write results, and there is no explain-code, bug-fix, or markdown-generation operation. These are workable gaps but they leave dead ends in the typical review-to-change workflow.
Maintenance
Related MCP Connectors
Add any agent you deploy on ibl.ai to Claude Code, Cursor or Claude Desktop and talk to it there.
Share context and questions between Claude instances — VS Code, claude.ai web, and mobile.
People and AI agents build software together in persistent cloud sessions for Claude Code.
Persistent memory for Claude Code and Cursor. Stop re-explaining your project every session.
Related MCP Servers
- AlicenseCqualityDmaintenanceBridges Claude Desktop with local LLM instances running via llama-server, enabling full conversation support with complete parameter control and health monitoring. Allows users to chat with their local models directly through Claude Desktop with configurable sampling parameters.313 npm10Creative Commons Zero v1.0 Universal
- AlicenseNot gradedqualityDmaintenanceEnables Claude Code to delegate mechanical tasks (summaries, boilerplate, reformatting) to local models running in LM Studio.1MIT
- AlicenseAqualityDmaintenanceEnables Claude Code to offload routine code generation and text processing tasks to a local Ollama LLM, saving Cloud API tokens and costs with automatic model selection and security features.11204 npm3Apache 2.0
- AlicenseAqualityBmaintenanceEnables Claude Code to delegate agent tasks to local LLMs via llama.cpp or vLLM servers on your own hardware, reducing API usage while maintaining full agent capabilities.1122MIT