Skip to content
Back to search

mcp-llm-bridge

MCP implementation that enables communication between MCP servers and OpenAI-compatible LLMs

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/bartolli--mcp-llm-bridge/badge.svg)](/listings/bartolli--mcp-llm-bridge)

HTML

<a href="/listings/bartolli--mcp-llm-bridge"><img src="/api/listings/bartolli--mcp-llm-bridge/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

These steps run a script from the network that findsafeskills does not scan.

# 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

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 119 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # MCP LLM Bridge
  2. 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.
  3. 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.
  4. Read more about MCP by Anthropic here:
  5. - [Resources](https://modelcontextprotocol.io/docs/concepts/resources)
  6. - [Prompts](https://modelcontextprotocol.io/docs/concepts/prompts)
  7. - [Tools](https://modelcontextprotocol.io/docs/concepts/tools)
  8. - [Sampling](https://modelcontextprotocol.io/docs/concepts/sampling)
  9. Demo:
  10. ![MCP LLM Bridge Demo](assets/output.gif)
  11. ## Quick Start
  12. ```bash
  13. # Install
  14. curl -LsSf https://astral.sh/uv/install.sh | sh
  15. git clone https://github.com/bartolli/mcp-llm-bridge.git
  16. cd mcp-llm-bridge
  17. uv venv
  18. source .venv/bin/activate
  19. uv pip install -e .
  20. # Create test database
  21. python -m mcp_llm_bridge.create_test_db
  22. ```
  23. ## Configuration
  24. ### OpenAI (Primary)
  25. Create `.env`:
  26. ```bash
  27. OPENAI_API_KEY=your_key
  28. OPENAI_MODEL=gpt-4o # or any other OpenAI model that supports tools
  29. ```
  30. Note: reactivate the environment if needed to use the keys in `.env`: `source .venv/bin/activate`
  31. Then configure the bridge in [src/mcp_llm_bridge/main.py](src/mcp_llm_bridge/main.py)
  32. ```python
  33. config = BridgeConfig(
  34. mcp_server_params=StdioServerParameters(
  35. command="uvx",
  36. args=["mcp-server-sqlite", "--db-path", "test.db"],
  37. env=None
  38. ),
  39. llm_config=LLMConfig(
  40. api_key=os.getenv("OPENAI_API_KEY"),
  41. model=os.getenv("OPENAI_MODEL", "gpt-4o"),
  42. base_url=None
  43. )
  44. )
  45. ```
  46. ### Additional Endpoint Support
  47. The bridge also works with any endpoint implementing the OpenAI API specification:
  48. #### Ollama
  49. ```python
  50. llm_config=LLMConfig(
  51. api_key="not-needed",
  52. model="mistral-nemo:12b-instruct-2407-q8_0",
  53. base_url="http://localhost:11434/v1"
  54. )
  55. ```
  56. 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.
  57. #### LM Studio
  58. ```python
  59. llm_config=LLMConfig(
  60. api_key="not-needed",
  61. model="local-model",
  62. base_url="http://localhost:1234/v1"
  63. )
  64. ```
  65. I didn't test this, but it should work.
  66. ## Usage
  67. ```bash
  68. python -m mcp_llm_bridge.main
  69. # Try: "What are the most expensive products in the database?"
  70. # Exit with 'quit' or Ctrl+C
  71. ```
  72. ## Running Tests
  73. Install the package with test dependencies:
  74. ```bash
  75. uv pip install -e ".[test]"
  76. ```
  77. Then run the tests:
  78. ```bash
  79. python -m pytest -v tests/
  80. ```
  81. ## License
  82. [MIT](LICENSE.md)
  83. ## Contributing
  84. PRs welcome.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.