Skip to main content
Glama

Claude-LMStudio Bridge

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

local-only server

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

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

  1. 概述
    1. 先决条件
      1. 快速启动(推荐)
        1. 对于 macOS/Linux:
        2. 对于 Windows:
      2. 手动设置
        1. 与 Claude 一起使用
          1. 故障排除
            1. 诊断 LM Studio 连接问题
            2. 常见问题
          2. 高级配置
            1. 执照

              Related MCP Servers

              • -
                security
                A
                license
                -
                quality
                MCP server for toolhouse.ai. This does not rely on an external llm unlike the official server.
                Last updated -
                1
                Python
                MIT License
              • -
                security
                A
                license
                -
                quality
                A server for the Machine Chat Protocol (MCP) that provides a YAML-based configuration system for LLM applications, allowing users to define resources, tools, and prompts without writing code.
                Last updated -
                5
                Python
                MIT License
                • Linux
                • Apple
              • -
                security
                F
                license
                -
                quality
                An MCP server that allows Claude and other LLMs to manage persistent memories across conversations through text file storage, enabling commands to add, search, delete and list memory entries.
                Last updated -
                2
                TypeScript
              • -
                security
                A
                license
                -
                quality
                A Python-based MCP server that allows Claude and other LLMs to execute arbitrary Python code directly through your desktop Claude app, enabling data scientists to connect LLMs to APIs and executable code.
                Last updated -
                23
                MIT License
                • Apple
                • Linux

              View all related MCP servers

              MCP directory API

              We provide all the information about MCP servers via our MCP API.

              curl -X GET 'https://glama.ai/api/mcp/v1/servers/infinitimeless/claude-lmstudio-bridge'

              If you have feedback or need assistance with the MCP directory API, please join our Discord server