
一个中间件,提供一个兼容 OpenAI 的终端,可以调用 MCP 工具
概览
MCP-Bridge 作为 OpenAI API 与 MCP(MCP)工具之间的桥梁,使开发者能够通过 OpenAI API 接口利用 MCP 工具。 正在寻找新的维护者来协助项目。如果你感兴趣,可以在Discord联系或提交相关问题。此外,Open WebUI自0.6.31版本起原生支持MCP(模型上下文协议),因此MCP-Bridge现在应被视为软弃用。 MCP-Bridge 旨在促进 MCP 工具与 OpenAI API 的集成。它提供了一组端点,可以用来与 OpenAI API 兼容的方式与 MCP 工具交互。这允许你使用任何客户端使用任意 MCP 工具,而无需明确支持 MCP。例如,请参见这个使用开放 Web UI 配合官方 MCP 抓取工具的示例。
概述(AI 翻译)
MCP-Bridge 作为 OpenAI API 与 MCP(MCP)工具之间的桥梁,使开发者能够通过 OpenAI API 接口利用 MCP 工具。
[!注]
正在寻找新的维护者来协助项目。如果你感兴趣,可以在Discord中联系或发起相关问题。
此外,Open WebUI 自 0.6.31 版本起原生支持 MCP(模型上下文协议),因此 MCP-Bridge 现在应被视为软弃用。
概述
MCP-Bridge 旨在促进 MCP 工具与 OpenAI API 的集成。它提供了一组端点,可以用来与 OpenAI API 兼容的方式与 MCP 工具交互。这允许你使用任何客户端使用任意 MCP 工具,而无需明确支持 MCP。例如,请参见这个使用开放 Web UI 配合官方 MCP 抓取工具的示例。
当前功能
工作特性:
-
非流式聊天完成,使用MCP
-
通过MCP进行流式聊天完成
-
无MCP的非流式完成
-
MCP 工具
-
MCP抽样
-
面向外部客户端的SSE Bridge。
计划中的特色:
-
流式补全尚未实现
-
计划支持MCP资源
安装
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
MCP-Bridge
MCP-Bridge acts as a bridge between the OpenAI API and MCP (MCP) tools, allowing developers to leverage MCP tools through the OpenAI API interface.
[!NOTE]
Looking for new maintainers to assist with the project. Reach out in the Discord or open an issue if you are interested.
Additionally, Open WebUI natively supports MCP (Model Context Protocol) starting in v0.6.31, so MCP-Bridge should be considered as soft deprecated now.
Overview
MCP-Bridge is designed to facilitate the integration of MCP tools with the OpenAI API. It provides a set of endpoints that can be used to interact with MCP tools in a way that is compatible with the OpenAI API. This allows you to use any client with any MCP tool without explicit support for MCP. For example, see this example of using Open Web UI with the official MCP fetch tool.
Current Features
working features:
-
non streaming chat completions with MCP
-
streaming chat completions with MCP
-
non streaming completions without MCP
-
MCP tools
-
MCP sampling
-
SSE Bridge for external clients
planned features:
-
streaming completions are not implemented yet
-
MCP resources are planned to be supported
Installation
The recommended way to install MCP-Bridge is to use Docker. See the example compose.yml file for an example of how to set up docker.
Note that this requires an inference engine with tool call support. I have tested this with vLLM with success, though ollama should also be compatible.
Docker installation
-
Clone the repository
-
Edit the compose.yml file
You will need to add a reference to the config.json file in the compose.yml file. Pick any of
- add the config.json file to the same directory as the compose.yml file and use a volume mount (you will need to add the volume manually)
- add a http url to the environment variables to download the config.json file from a url
- add the config json directly as an environment variable
see below for an example of each option:
environment:
- MCP_BRIDGE__CONFIG__FILE=config.json # mount the config file for this to work
- MCP_BRIDGE__CONFIG__HTTP_URL=http://10.88.100.170:8888/config.json
- MCP_BRIDGE__CONFIG__JSON={"inference_server":{"base_url":"http://example.com/v1","api_key":"None"},"mcp_servers":{"fetch":{"command":"uvx","args":["mcp-server-fetch"]}}}
The mount point for using the config file would look like:
volumes:
- ./config.json:/mcp_bridge/config.json
- run the service
docker-compose up --build -d
安装
uvx mcp-server-fetch