Ollama MCP Bridge WebUI
一种TypeScript实现,通过web界面将本地LLM(通过Ollama)连接到模型上下文协议(MCP)服务器。这座桥允许开源模型使用与Claude相同的工具和功能,使强大的本地AI助手完全在您自己的硬件上运行。
特性
- 多MCP集成:同时连接多个MCP服务器
- 刀具检测:根据查询自动识别要使用的工具
- web界面:带有可折叠工具描述的干净UI
- 综合工具集:文件系统、网络搜索和推理能力
设置
自动安装
设置网桥的最简单方法是使用附带的安装脚本:
./install.bat此脚本将:
- 如果需要,检查并安装Node.js
- 检查Ollama,必要时安装Ollama
- 安装所有依赖项
- 创建工作区目录(../workspace)
- 设置初始配置
- 构建TypeScript项目
- 下载Ollama的Qwen模型
运行脚本后,您只需:
- 将API密钥添加到
.env文件(the$VARIABLE_NAME配置中的引用将被替换为实际值)
手动设置
如果您更喜欢手动设置:
- 从以下位置安装Ollama ollama.com/下载
- 拉动Qwen模型:
ollama pull qwen2.5-coder:7b-instruct-q4_K_M - 安装依赖项:
npm install - 创建工作区目录:
mkdir ../workspace - 在中配置API密钥
.env - 构建项目:
npm run build
配置
网桥通过两个主要文件进行配置:
1.bridge_gonfig.json
此文件定义了MCP服务器、LLM设置和系统提示。环境变量被引用 $VARIABLE_NAME 语法。
例子:
{
"mcpServers": {
"filesystem": {
"command": "node",
"args": [
"To/Your/Directory/Ollama-MCP-Bridge-WebUI/node_modules/@modelcontextprotocol/server-filesystem/dist/index.js",
"To/Your/Directory/Ollama-MCP-Bridge-WebUI/../workspace"
],
"allowedDirectory": "To/Your/Directory/Ollama-MCP-Bridge-WebUI/../workspace"
},
"brave-search": {
"command": "node",
"args": [
"To/Your/Directory/Ollama-MCP-Bridge-WebUI/node_modules/@modelcontextprotocol/server-brave-search/dist/index.js"
],
"env": {
"BRAVE_API_KEY": "$BRAVE_API_KEY"
}
},
"sequential-thinking": {
"command": "node",
"args": [
"To/Your/Directory/Ollama-MCP-Bridge-WebUI/node_modules/@modelcontextprotocol/server-sequential-thinking/dist/index.js"
]
}
},
"llm": {
"model": "qwen2.5-coder:7b-instruct-q4_K_M",
"baseUrl": "http://localhost:11434",
"apiKey": "ollama",
"temperature": 0.7,
"maxTokens": 8000
},
"systemPrompt": "You are a helpful assistant that can use various tools to help answer questions. You have access to three main tool groups: 1) Filesystem operations - for working with files and directories, 2) Brave search - for finding information on the web, 3) Sequential thinking for complex problem-solving. When a user asks a question that requires external information, real-time data, or file manipulation, you should use a tool rather than guessing or using only your pre-trained knowledge."
}
2..env文件
此文件存储敏感信息,如API密钥:
# Brave Search API key
BRAVE_API_KEY=your_brave_key_here桥将自动更换 $BRAVE_API_KEY 在配置中使用您的实际值 .env 文件。
用法
开始桥
只需运行:
./start.bat这将通过web界面启动网桥。
web界面
打开http://localhost:8080(或控制台中显示的端口)访问web界面。
许可证
MIT许可证-有关详细信息,请参阅许可证文件
