- Home
- MCP servers
- MCP LLM Bridge
MCP LLM Bridge
- python
1
GitHub Stars
python
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"virajsharma2000-simple-mcp-ollama-bridge": {
"command": "uv",
"args": [
"--directory",
"~/llms/mcp/mc-server-fetch/servers/src/fetch",
"run",
"mcp-server-fetch"
]
}
}
}You can bridge MCP servers to OpenAI-compatible LLMs using a lightweight bridge that runs locally. This setup lets you connect model context protocol (MCP) servers to local or remote LLM backends, enabling seamless interactions between your MCP clients and your chosen language model. It’s useful when you want to coordinate model context, prompts, tools, and responses through a single bridge that speaks MCP while talking to an LLM backend.
How to use
Run the bridge as a local stdio server that launches the MCP fetch server. Your MCP client connects to the bridge using standard I/O streams, while the bridge delegates requests to your chosen LLM backend (for example, a local Ollama/Llama instance). You can adjust the local fetch server directory and the LLM configuration to suit your environment.
How to install
Prerequisites: you need a working Python environment, and the bridge will use a local Python virtual environment managed by a helper tool.
# Install
curl -LsSf https://astral.sh/uv/install.sh | sh
git clone https://github.com/bartolli/mcp-llm-bridge.git
cd mcp-llm-bridge
uv venv
source .venv/bin/activate
uv pip install -e .
Note: reactivate the environment if needed to use the keys in `.env`: `source .venv/bin/activate`
Configure the bridge in the Python source to connect MCP to your local LLM and fetch server.
mcp_server_params=StdioServerParameters(
command="uv",
# CHANGE THIS = it needs to be an absolute directory! add the mcp fetch server at the directory (clone from https://github.com/modelcontextprotocol/servers/)
args=["--directory", "~/llms/mcp/mc-server-fetch/servers/src/fetch", "run", "mcp-server-fetch"],
env=None
),
# llm_config=LLMConfig(
# api_key=os.getenv("OPENAI_API_KEY"),
# model=os.getenv("OPENAI_MODEL", "gpt-4o"),
# base_url=None
# ),
llm_config=LLMConfig(
api_key="ollama", # Can be any string for local testing
model="llama3.2",
base_url="http://localhost:11434/v1" # Point to your local model's endpoint
),
)
Additional Endpoint Support
The bridge can work with endpoints that implement the OpenAI API specification, enabling flexible backends beyond the local MCP fetch setup.
License
MIT
Contributing
PRs welcome.
Available tools
Bridge
Connects MCP servers to an OpenAI-compatible LLM backend through a local stdio bridge and configurable fetch server.