Claude-LMStudio Bridge
将 Claude 与在 LM Studio 中运行的本地 LLM 连接起来的 MCP 服务器。
概述
该工具允许 Claude 与在 LM Studio 中运行的本地 LLM 进行交互,提供:
访问 LM Studio 中所有可用模型的列表
使用本地法学硕士 (LLM) 生成文本的能力
通过本地模型支持聊天完成
用于验证与 LM Studio 连接的健康检查工具
先决条件
支持 MCP 的Claude Desktop
LM Studio在本地安装并运行,并启用 API 服务器
已安装 Python 3.8+
快速启动(推荐)
对于 macOS/Linux:
克隆存储库
运行安装脚本
按照安装脚本的说明配置 Claude Desktop
对于 Windows:
克隆存储库
运行安装脚本
按照安装脚本的说明配置 Claude Desktop
手动设置
如果您希望手动设置:
创建虚拟环境(可选但推荐)
安装所需的软件包
配置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中使用以下命令:
检查与 LM Studio 的连接:
列出可用的模型:
使用本地模型生成文本:
发送聊天完成:
故障排除
诊断 LM Studio 连接问题
使用附带的调试工具检查您的 LM Studio 连接:
更详细的测试:
常见问题
“无法连接到 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文件来自定义桥接行为:
设置DEBUG=true以启用详细日志记录以进行故障排除。
执照
麻省理工学院
This server cannot be installed
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 进行交互,提供对列表模型的访问、生成文本以及通过本地模型使用聊天完成。
Related MCP Servers
- Asecurity-licenseAqualityThe MCP server transforms chats with Claude into journaling sessions, saving conversations locally and allowing the LLM to retrieve previous sessions to create continuity in discussions about daily activities.Last updated -36MIT License
- -security-license-qualityAn 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 -207
- Asecurity-licenseAqualityAn educational implementation of a Model Context Protocol server that demonstrates how to build a functional MCP server for integrating with various LLM clients like Claude Desktop.Last updated -1135MIT License
- -security-license-qualityAn MCP server that connects any MCP client (like Claude or Cursor) with the browser using browser-use, allowing clients to utilize existing LLMs without requiring additional API keys.Last updated -74Apache 2.0