# mcp-llm-bridge

> MCP Server

This repository provides a bridge connecting Model Context Protocol (MCP) servers to OpenAI-compatible LLMs, enabling the use of MCP-compliant tools with models like GPT-4o through a standardized interface.

## Overview

- **Category:** AI
- **Language:** Python
- **Stars:** 333
- **Forks:** 33
- **Owner:** bartolli
- **GitHub:** https://github.com/bartolli/mcp-llm-bridge
- **Created:** 2024-12-03T02:10:10+00:00
- **Updated:** 2025-03-28T23:58:06+00:00
- **Source:** https://model-context-protocol.com/servers/mcp-llm-bridge-openai-compatible-models

## Setup

## Setup

1.  Install `uv`: `curl -LsSf https://astral.sh/uv/install.sh | sh`
2.  Clone the repository: `git clone https://github.com/bartolli/mcp-llm-bridge.git`
3.  Change directory: `cd mcp-llm-bridge`
4.  Create a virtual environment: `uv venv`
5.  Activate the virtual environment: `source .venv/bin/activate`
6.  Install the package: `uv pip install -e .`
7.  Create test database: `python -m mcp_llm_bridge.create_test_db`
8.  Create `.env` file and set `OPENAI_API_KEY` and `OPENAI_MODEL`.
9.  Configure the bridge in `src/mcp_llm_bridge/main.py` with `BridgeConfig` and `LLMConfig`.
10. Install test dependencies: `uv pip install -e ".[test]"`


## Tools

## Available Tools

1.  **MCP LLM Bridge** (A bridge connecting Model Context Protocol (MCP) servers to OpenAI-compatible LLMs).
2.  **Bidirectional protocol translation layer** (Converts MCP tool specifications into OpenAI function schemas and handles the mapping of function invocations back to MCP tool executions).
3.  **OpenAI API support** (Primary support for OpenAI API, with additional compatibility for local endpoints that implement the OpenAI API specification).
4.  **OpenAI function-calling interface** (Enables any OpenAI-compatible language model to leverage MCP-compliant tools through a standardized interface).
5.  **Ollama compatibility** (Works with Ollama by configuring the `base_url` and `model` in `LLMConfig`).
6.  **LM Studio compatibility** (Potentially works with LM Studio by configuring the `base_url` and `model` in `LLMConfig`).
