SecretiveShell/MCP-Bridge

A middleware to provide an openAI compatible endpoint that can call MCP tools

928 ★117 forksPythonUpdated 8mo ago

What you need to know

A bridge between the OpenAI API and MCP tools: it sits between an OpenAI-compatible inference engine and MCP servers, injecting MCP tool definitions into requests so any OpenAI-API client (e.g. Open WebUI) can use MCP tools without explicit MCP support. Soft-deprecated now that Open WebUI natively supports MCP.

Install

Docker: git clone, edit compose.yml with config (volume-mounted config.json, MCP_BRIDGE__CONFIG__HTTP_URL, or MCP_BRIDGE__CONFIG__JSON), then docker-compose up --build -d.
Manual: uv sync, create config.json, uv run mcp_bridge/main.py.

Usage

  • Configure config.json with the inference server (base_url, api_key) and mcp_servers (command/args per MCP server, e.g. "fetch": {"command":"uvx","args":["mcp-server-fetch"]}).
  • Interact via the OpenAI API at http://yourserver:8000; view docs at /docs and list available MCP tools from there.
  • Point an external MCP-capable client at the SSE bridge endpoint http://yourserver:8000/mcp-server/sse (test with npx @wong2/mcp-cli --sse).
  • Enable API key auth by adding a security.auth section to config.json and sending Authorization: Bearer <key>.

Key features

  • Non-streaming and streaming chat completions with MCP tools; non-streaming completions without MCP.
  • MCP tool calling and MCP sampling (with configurable model fitness: intelligence/cost/speed).
  • SSE Bridge that exposes the server as an MCP server to external clients.
  • REST API endpoints for all native MCP primitives (tools, sampling, config), plus API key authentication.
  • How it works: request is modified to include MCP tool definitions, forwarded to the inference engine, tool calls are executed against MCP servers, results are returned for the LLM response.

Best for

Users of OpenAI-API-compatible frontends (especially Open WebUI) who want to call MCP tools through an inference engine with tool-call support such as vLLM or ollama.

Caveats

  • Soft deprecated: Open WebUI natively supports MCP since v0.6.31, so the project is superseded for that use case.
  • Looking for new maintainers; streaming completions without MCP and MCP resources are not yet implemented.
  • Requires an inference engine with tool-call support (tested with vLLM; ollama should also work).
Platforms: macOS · Linux · WindowsClients: Open WebUI · Any OpenAI-API client · MCP clients via SSE
Documentation ↗

Reviewed 2026-08-07

Topics

aiclaudemcpmcp-servermcp-serversmodel-context-protocolopenaiopenai-api
View on GitHub ↗
Stars
928★
Forks
117
Language
Python
License
MIT
Created
2024-11-30
Last push
2025-12-08