This guide explains how to configure Claude to connect with the LMStudio-MCP server. When using Claude with Model Control Protocol (MCP), you need to properly configure the MCP JSON configuration file to establish the connection.
Claude's MCP functionality requires a configuration file that specifies how to launch and connect to MCP servers. There are two ways to add the LMStudio-MCP server to your configuration:
If you've cloned the repository locally and want Claude to launch the server directly:
{
"lmstudio-mcp": {
"command": "/bin/bash",
"args": [
"-c",
"cd /path/to/LMStudio-MCP && source venv/bin/activate && python lmstudio_bridge.py"
]
}
}Replace /path/to/LMStudio-MCP with the actual path where you've cloned the repository.
You can also use uvx to have Claude install and run the server directly from GitHub:
{
"lmstudio-mcp": {
"command": "uvx",
"args": [
"https://github.com/infinitimeless/LMStudio-MCP"
]
}
}This method will automatically fetch the latest version from GitHub and run it.
Here's a full configuration example that includes both methods (you would typically only need one):
{
"lmstudio-mcp-local": {
"command": "/bin/bash",
"args": [
"-c",
"cd ~/LMStudio-MCP && source venv/bin/activate && python lmstudio_bridge.py"
]
},
"lmstudio-mcp-github": {
"command": "uvx",
"args": [
"https://github.com/infinitimeless/LMStudio-MCP"
]
}
}If you already have other MCP servers configured, you'll need to add the LMStudio-MCP configuration to your existing JSON file. Make sure to maintain the proper JSON structure with commas between entries.
Example of adding to existing configuration:
{
"other-mcp-server": {
"command": "...",
"args": [
"..."
]
},
"lmstudio-mcp": {
"command": "uvx",
"args": [
"https://github.com/infinitimeless/LMStudio-MCP"
]
}
}- Start a conversation with Claude
- Click on "Connect an MCP server" (or similar option in the interface)
- Select "lmstudio-mcp" from the list of available servers
- Claude will launch the server and connect to it
Once connected, you can use the LMStudio-MCP functions in your conversation with Claude:
health_check()list_models()get_current_model()chat_completion(prompt, system_prompt, temperature, max_tokens)
If Claude has trouble launching the MCP server:
- Check that the path in your configuration is correct
- Ensure you have the right permissions to execute the script
- Verify that your virtual environment is properly set up
- Make sure LM Studio is running and accessible
For more details on MCP configuration, refer to Anthropic's official documentation on Model Control Protocol.