MCP-Bridge is a middleware used to bridge between the OpenAI API and MCP (Model Context Protocol) tools, enabling developers to use MCP tools through the OpenAI API interface. Its goal is to use any MCP tool in any OpenAI-compatible client without the client itself explicitly supporting MCP.
Purpose MCP-Bridge provides a set of endpoints compatible with the OpenAI API for interacting with MCP tools. The official examples include letting Open WebUI use the official MCP fetch tool.
Main capabilities (currently implemented features)
- Non-streaming chat completions with MCP
- Streaming chat completions with MCP
- Non-streaming completions without MCP
- SSE bridging for external clients
Planned features
- Streaming completions are not yet implemented
- Planned support for MCP resources
How it works The application sits between the OpenAI API and the inference engine. Incoming requests are modified to include tool definitions for all available MCP tools on the MCP server; the request is then forwarded to the inference engine, which uses these tool definitions to generate tool calls. MCP-Bridge then manages the actual calls to the tools, then adds the tool call results to the request and returns it again to the inference engine so that the LLM can generate a reply. Finally, the reply is returned to the OpenAI API.
Usage Docker installation is recommended, and an example compose.yml is provided. Note that this requires an inference engine that supports tool calls; the official statement says it has been tested successfully on vLLM, and ollama should also be compatible.
Docker installation steps:
- Clone the repository.
- Edit the compose.yml file.
- Add a reference to the config.json file in compose.yml, using any of the following optional methods:
- Put config.json in the same directory as compose.yml and use a volume mount (you need to manually add the volume);
- Add an http url in the environment variables to download config.json from that url;
- Add the config JSON directly asenvironment variables.
- Run the service.
Manual installation (without Docker): You need to install the dependencies and create config.json in the root directory, then run the application manually. After the application is running, you can interact with it through the OpenAI API. You can visit http://yourserver:8000/docs to view the documentation; there is an endpoint that can list all available MCP tools on the server, used to test whether the configuration is correct.
REST API endpoints MCP-Bridge exposes multiple REST API endpoints for interacting with all native MCP primitives, thereby outsourcing the complexity of handling MCP servers to MCP-Bridge without sacrificing functionality. For specific usage, see the openapi documentation.
SSE bridging MCP-Bridge also provides SSE bridging for external clients, enabling external chat applications that explicitly support MCP to use MCP-Bridge as an MCP server. Point the client to the SSE endpoint (http://yourserver:8000/mcp-server/sse)即可看到服务器上所有可用的 MCP tools. This also makes it easy to test whether the configuration is working properly, and you can use wong2/mcp-cli to test: npx @wong2/mcp-cli --sse http://localhost:8000/mcp-server/sse。若想在 To use these tools in Claude Desktop or other MCP clients that only support STDIO, you can use tools such as lightconetech/mcp-gateway.
Configuration To add a new MCP server, edit the config.json file.
API Key Authentication MCP-Bridge supports API key authentication to protect the server. Once configured in config.json, requests to the MCP-Bridge server must carry the API key as a Bearer token in the Authorization header. If the api_key field is empty or absent from the configuration, authentication is skipped to maintain backward compatibility.
Use Cases Suitable for scenarios where you want existing OpenAI-compatible clients that do not support MCP (such as Open WebUI, etc.) to use MCP tools, and also suitable for integrating MCP capabilities into external applications via REST API or SSE bridging.
Limitations and Notes
- Streaming completions are not yet implemented.
- MCP resource support is still planned.
- Requires an inference engine that supports tool calling.
- The project is looking for a new maintainer; you can get in touch via Discord or by submitting an issue.
- Since Open WebUI has natively supported MCP since v0.6.31, the official position is that MCP-Bridge is now in a soft deprecated state.
The project uses the MIT license. If you encounter problems, you can submit an issue or join Discord; official also provides other documentation.