This MCP server acts as a bridge between Claude and locally hosted language models running in LM Studio. It enables Claude to access your local models for text generation, chat completions, and other language model functions without sending data to external APIs.
git clone https://github.com/infinitimeless/claude-lmstudio-bridge.git
cd claude-lmstudio-bridge
chmod +x setup.sh
./setup.sh
git clone https://github.com/infinitimeless/claude-lmstudio-bridge.git
cd claude-lmstudio-bridge
setup.bat
If you prefer setting things up manually:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
After setting up the bridge, you can use these commands in Claude:
To verify if LM Studio is properly connected:
Can you check if my LM Studio server is running?
To see all models loaded in LM Studio:
List the available models in my local LM Studio
To use your local model for text generation:
Generate a short poem about spring using my local LLM
To send a query to your local model:
Ask my local LLM: "What are the main features of transformers in machine learning?"
Use the included debugging tool:
python debug_lmstudio.py
For more detailed tests:
python debug_lmstudio.py --test-chat --verbose
"Cannot connect to LM Studio API"
"No models are loaded"
"MCP package not found"
pip install "mcp[cli]" httpx python-dotenv
"Claude can't find the bridge"
chmod +x run_server.sh
(on macOS/Linux)Create a .env
file to customize settings:
LMSTUDIO_HOST=127.0.0.1
LMSTUDIO_PORT=1234
DEBUG=false
Set DEBUG=true
to enable verbose logging for troubleshooting.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.