这是一个使用TypeScript实现的连接本地LLM(通过Ollama)到Model Context Protocol (MCP)服务器的桥梁,并提供了一个网页界面。此桥梁允许开源模型使用与Claude相同的工具和功能,从而能够在您自己的硬件上运行强大的本地AI助手。
设置桥梁最简单的方法是使用包含的安装脚本:
./install.bat
该脚本将执行以下操作:
运行脚本后,您只需:
.env文件中(配置中的$VARIABLE_NAME引用将被实际值替换)如果您希望手动设置:
ollama pull qwen2.5-coder:7b-instruct-q4_K_Mnpm installmkdir ../workspace.env文件中配置API密钥npm run build桥梁通过两个主要文件进行配置:
此文件定义了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": {
你的命令": "node",
"参数": [
"To/Your/Directory/Ollama-MCP-Bridge-WebUI/node_modules/@modelcontextprotocol/server-sequential-thinking/dist/index.js"
]
}
},
"llm": {
"模型": "qwen2.5-coder:7b-instruct-q4_K_M",
"基础URL": "http://localhost:11434",
"API密钥": "ollama",
"温度": 0.7,
"最大令牌数": 8000
},
"系统提示": "您是一个有用的助手,可以使用各种工具来帮助回答问题。您有三个主要工具组的访问权限:1) 文件系统操作 - 用于处理文件和目录,2) Brave搜索 - 用于在网络上查找信息,3) 顺序思维 - 用于复杂的问题解决。当用户提出需要外部信息、实时数据或文件操作的问题时,您应该使用工具而不是猜测或仅使用预训练的知识。"
}
此文件存储敏感信息,如API密钥:
# Brave搜索API密钥
BRAVE_API_KEY=your_brave_key_here
桥梁会自动将配置中的$BRAVE_API_KEY替换为您.env文件中的实际值。
只需运行:
./start.bat
这将启动带有网页界面的桥梁。
在浏览器中打开http://localhost:8080(或控制台显示的端口)以访问网页界面。
MIT许可证 - 查看LICENSE文件获取详细信息