Claude-LMStudio Bridge

by infinitimeless
Verified

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Enables advanced configuration through .env files to customize bridge behavior

  • Used for downloading the bridge software through repository cloning

  • Allows cloning the repository from GitHub as part of the installation process

Claude-LMStudio Bridge

将 Claude 与在 LM Studio 中运行的本地 LLM 连接起来的 MCP 服务器。

概述

该工具允许 Claude 与在 LM Studio 中运行的本地 LLM 进行交互,提供:

  • 访问 LM Studio 中所有可用模型的列表
  • 使用本地法学硕士 (LLM) 生成文本的能力
  • 通过本地模型支持聊天完成
  • 用于验证与 LM Studio 连接的健康检查工具

先决条件

快速启动(推荐)

对于 macOS/Linux:

  1. 克隆存储库
git clone https://github.com/infinitimeless/claude-lmstudio-bridge.git cd claude-lmstudio-bridge
  1. 运行安装脚本
chmod +x setup.sh ./setup.sh
  1. 按照安装脚本的说明配置 Claude Desktop

对于 Windows:

  1. 克隆存储库
git clone https://github.com/infinitimeless/claude-lmstudio-bridge.git cd claude-lmstudio-bridge
  1. 运行安装脚本
setup.bat
  1. 按照安装脚本的说明配置 Claude Desktop

手动设置

如果您希望手动设置:

  1. 创建虚拟环境(可选但推荐)
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
  1. 安装所需的软件包
pip install -r requirements.txt
  1. 配置Claude桌面:
    • 打开 Claude Desktop 偏好设置
    • 导航至“MCP 服务器”部分
    • 添加一个新的 MCP 服务器,配置如下:
      • 名称:lmstudio-bridge
      • 命令:/bin/bash(在 macOS/Linux 上)或 cmd.exe(在 Windows 上)
      • 参数
        • macOS/Linux:/path/to/claude-lmstudio-bridge/run_server.sh
        • Windows:/c C:\path\to\claude-lmstudio-bridge\run_server.bat

与 Claude 一起使用

设置好桥接器后,可以在Claude中使用以下命令:

  1. 检查与 LM Studio 的连接:
Can you check if my LM Studio server is running?
  1. 列出可用的模型:
List the available models in my local LM Studio
  1. 使用本地模型生成文本:
Generate a short poem about spring using my local LLM
  1. 发送聊天完成:
Ask my local LLM: "What are the main features of transformers in machine learning?"

故障排除

诊断 LM Studio 连接问题

使用附带的调试工具检查您的 LM Studio 连接:

python debug_lmstudio.py

更详细的测试:

python debug_lmstudio.py --test-chat --verbose

常见问题

“无法连接到 LM Studio API”

  • 确保 LM Studio 正在运行
  • 验证 LM Studio 中已启用 API 服务器(设置 > API 服务器)
  • 检查端口(默认值:1234)是否与 .env 文件中的端口匹配

“未加载任何模型”

  • 打开 LM Studio 并加载模型
  • 验证模型是否运行成功

“未找到 MCP 包”

  • 尝试重新安装: pip install "mcp[cli]" httpx python-dotenv
  • 确保你使用的是 Python 3.8 或更高版本

“克劳德找不到桥”

  • 检查 Claude Desktop 配置
  • 确保 run_server.sh 或 run_server.bat 的路径正确且绝对
  • 验证服务器脚本是否可执行: chmod +x run_server.sh (在 macOS/Linux 上)

高级配置

您可以通过创建具有以下设置的.env文件来自定义桥接行为:

LMSTUDIO_HOST=127.0.0.1 LMSTUDIO_PORT=1234 DEBUG=false

设置DEBUG=true以启用详细日志记录以进行故障排除。

执照

麻省理工学院

-
security - not tested
F
license - not found
-
quality - not tested

MCP 服务器允许 Claude 与在 LM Studio 中运行的本地 LLM 进行交互,提供对列表模型的访问、生成文本以及通过本地模型使用聊天完成。

  1. Overview
    1. Prerequisites
      1. Quick Start (Recommended)
        1. For macOS/Linux:
        2. For Windows:
      2. Manual Setup
        1. Usage with Claude
          1. Troubleshooting
            1. Diagnosing LM Studio Connection Issues
            2. Common Issues
          2. Advanced Configuration
            1. License
              ID: fyg4e243vk