
pont MCP-llm
Implémentation MCP qui permet la communication entre les serveurs MCP et les LLM compatibles OpenAI
10
Github Watches
35
Github Forks
288
Github Stars
MCP LLM Bridge
A bridge connecting Model Context Protocol (MCP) servers to OpenAI-compatible LLMs. Primary support for OpenAI API, with additional compatibility for local endpoints that implement the OpenAI API specification.
The implementation provides a bidirectional protocol translation layer between MCP and OpenAI's function-calling interface. It converts MCP tool specifications into OpenAI function schemas and handles the mapping of function invocations back to MCP tool executions. This enables any OpenAI-compatible language model to leverage MCP-compliant tools through a standardized interface, whether using cloud-based models or local implementations like Ollama.
Read more about MCP by Anthropic here:
Demo:
Quick Start
# 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 .
# Create test database
python -m mcp_llm_bridge.create_test_db
Configuration
OpenAI (Primary)
Create .env
:
OPENAI_API_KEY=your_key
OPENAI_MODEL=gpt-4o # or any other OpenAI model that supports tools
Note: reactivate the environment if needed to use the keys in .env
: source .venv/bin/activate
Then configure the bridge in src/mcp_llm_bridge/main.py
config = BridgeConfig(
mcp_server_params=StdioServerParameters(
command="uvx",
args=["mcp-server-sqlite", "--db-path", "test.db"],
env=None
),
llm_config=LLMConfig(
api_key=os.getenv("OPENAI_API_KEY"),
model=os.getenv("OPENAI_MODEL", "gpt-4o"),
base_url=None
)
)
Additional Endpoint Support
The bridge also works with any endpoint implementing the OpenAI API specification:
Ollama
llm_config=LLMConfig(
api_key="not-needed",
model="mistral-nemo:12b-instruct-2407-q8_0",
base_url="http://localhost:11434/v1"
)
Note: After testing various models, including llama3.2:3b-instruct-fp16
, I found that mistral-nemo:12b-instruct-2407-q8_0
handles complex queries more effectively.
LM Studio
llm_config=LLMConfig(
api_key="not-needed",
model="local-model",
base_url="http://localhost:1234/v1"
)
I didn't test this, but it should work.
Usage
python -m mcp_llm_bridge.main
# Try: "What are the most expensive products in the database?"
# Exit with 'quit' or Ctrl+C
Running Tests
Install the package with test dependencies:
uv pip install -e ".[test]"
Then run the tests:
python -m pytest -v tests/
License
Contributing
PRs welcome.
相关推荐
Advanced software engineer GPT that excels through nailing the basics.
Embark on a thrilling diplomatic quest across a galaxy on the brink of war. Navigate complex politics and alien cultures to forge peace and avert catastrophe in this immersive interstellar adventure.
FindetundanalysiertOnlineProdukteeinschlielichAmazonnachVolumenBewertungenundPreis
L'application tout-en-un desktop et Docker AI avec chiffon intégré, agents AI, constructeur d'agent sans code, compatibilité MCP, etc.
Pont entre les serveurs Olllama et MCP, permettant aux LLM locaux d'utiliser des outils de protocole de contexte de modèle
La communauté du curseur et de la planche à voile, recherchez des règles et des MCP
🧑🚀 全世界最好的 LLM 资料总结 (数据处理、模型训练、模型部署、 O1 模型、 MCP 、小语言模型、视觉语言模型) | Résumé des meilleures ressources LLM du monde.
Plateforme d'automatisation de workflow à code équitable avec des capacités d'IA natives. Combinez le bâtiment visuel avec du code personnalisé, de l'auto-hôte ou du cloud, 400+ intégrations.
Une liste organisée des serveurs de protocole de contexte de modèle (MCP)
Serveurs MCP géniaux - une liste organisée de serveurs de protocole de contexte de modèle
🔥 1Panel fournit une interface Web intuitive et un serveur MCP pour gérer des sites Web, des fichiers, des conteneurs, des bases de données et des LLM sur un serveur Linux.
Ce référentiel est pour le développement du serveur MCP Azure, apportant la puissance d'Azure à vos agents.
Serveurs AWS MCP - Serveurs MCP spécialisés qui apportent les meilleures pratiques AWS directement à votre flux de travail de développement
Reviews

user_TlJH7KBB
I've been using the mcp-llm-bridge by bartolli from the GitHub link provided, and it has truly enhanced my application experience. The seamless integration and user-friendly interface make it ideal for developers. Highly recommend checking it out for optimizing your MCP applications!