LM Studio

by infinitimeless

16 stars
1.3k downloads
Not rated
GitHub

About

Bridges Claude with locally running LLM models via LM Studio, enabling users to leverage private models through Claude's interface while maintaining local hosting.

Details

Author
infinitimeless
Repository
infinitimeless/LMStudio-MCP
GitHub stars
16
Downloads
1,285
License
MIT License
Categories
Design, Developer Tools, AI, API, Infrastructure
Tags
#integration

- Check LM Studio API health
- List and identify loaded models
- Generate chat and raw text completions
- Create vector embeddings for semantic search
- Maintain stateful multi-turn conversations
- Start persistent sessions with a locked system prompt

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name LM Studio
    Command (node, npx, python, etc.) /bin/bash
    Arguments
    • Argument 1 -c
    • Argument 2 cd /path/to/LMStudio-MCP && source venv/bin/activate && python lmstudio_bridge.py

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

curl -fsSL https://raw.githubusercontent.com/infinitimeless/LMStudio-MCP/main/install.sh | bash
git clone https://github.com/infinitimeless/LMStudio-MCP.git
cd LMStudio-MCP
pip install requests "mcp[cli]" openai

``bash

The bridge supports flexible configuration for different deployment scenarios:

- Default: Connects to http://localhost:1234/v1
- Custom Host: Set
LMSTUDIO_HOST environment variable (e.g., 192.168.1.100)
- Custom Port: Set
LMSTUDIO_PORT environment variable (e.g., 5678`)

health_check()

Verify if LM Studio API is accessible.

list_models()

Get a list of all available models in LM Studio.

get_current_model()

Identify which model is currently loaded.

chat_completion(prompt, system_prompt, temperature, max_tokens)

Generate a chat response from your local model.

text_completion(prompt, temperature, max_tokens, stop_sequences)

Generate raw text/code completion — faster, no chat formatting overhead.

generate_embeddings(text, model)

Generate vector embeddings for semantic search and RAG workflows.

create_response(input_text, previous_response_id, reasoning_effort, stream, model)

Stateful conversation via response IDs — requires LM Studio v0.3.29+.

start_conversation(system_prompt, first_message, temperature, max_tokens, model)

Start a multi-turn session with a persistent system prompt — returns a `response_id`.

continue_conversation(response_id, message, temperature, max_tokens, model)

Continue a session started with `start_conversation` — context preserved automatically.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "lm studio": {
            "env": {},
            "args": [
                "-c",
                "cd /path/to/LMStudio-MCP && source venv/bin/activate && python lmstudio_bridge.py"
            ],
            "command": "/bin/bash"
        }
    }
}

Linux

{
    "env": [],
    "args": [
        "-c",
        "cd /path/to/LMStudio-MCP && source venv/bin/activate && python lmstudio_bridge.py"
    ],
    "command": "/bin/bash"
}

Macos

{
    "env": [],
    "args": [
        "-c",
        "cd /path/to/LMStudio-MCP && source venv/bin/activate && python lmstudio_bridge.py"
    ],
    "command": "/bin/bash"
}

Windows

{
    "env": [],
    "args": [
        "/c",
        "cd /path/to/LMStudio-MCP && source venv/bin/activate && python lmstudio_bridge.py"
    ],
    "command": "cmd"
}

LMStudio-MCP

A Model Control Protocol (MCP) server that allows Claude to communicate with locally running LLM models via LM Studio.

Screenshot 2025-03-22 at 16 50 53

Overview

LMStudio-MCP creates a bridge between Claude (with MCP capabilities) and your locally running LM Studio instance. This allows Claude to:

- Check the health of your LM Studio API
- List available models
- Get the currently loaded model
- Generate chat and raw text completions using your local models
- Generate vector embeddings for semantic search and RAG
- Hold stateful multi-turn conversations via response IDs
- Start and continue persistent conversations with a locked-in system prompt

This enables you to leverage your own locally running models through Claude's interface, combining Claude's capabilities with your private models.

Prerequisites

- Python 3.7+
- LM Studio installed and running locally with a model loaded
- Claude with MCP access
- Required Python packages (see Installation)

🚀 Quick Installation

One-Line Install (Recommended)

curl -fsSL https://raw.githubusercontent.com/infinitimeless/LMStudio-MCP/main/install.sh | bash

Manual Installation Methods

1. Local Python Installation

git clone https://github.com/infinitimeless/LMStudio-MCP.git
cd LMStudio-MCP
pip install requests "mcp[cli]" openai

2. Docker Installation

# Using pre-built image
docker run -it --network host ghcr.io/infinitimeless/lmstudio-mcp:latest

Or build locally

git clone https://github.com/infinitimeless/LMStudio-MCP.git cd LMStudio-MCP docker build -t lmstudio-mcp . docker run -it --network host lmstudio-mcp

3. Docker Compose

git clone https://github.com/infinitimeless/LMStudio-MCP.git
cd LMStudio-MCP
docker-compose up -d

For detailed deployment instructions, see DOCKER.md.

⚙️ Configuration

The bridge supports flexible configuration for different deployment scenarios:

- Default: Connects to http://localhost:1234/v1
- Custom Host: Set LMSTUDIO_HOST environment variable (e.g., 192.168.1.100)
- Custom Port: Set LMSTUDIO_PORT environment variable (e.g., 5678)

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.