{"id":22404317,"url":"https://github.com/bartolli/mcp-llm-bridge","last_synced_at":"2026-05-31T01:30:29.596Z","repository":{"id":266191566,"uuid":"897653458","full_name":"bartolli/mcp-llm-bridge","owner":"bartolli","description":"MCP implementation that enables communication between MCP servers and OpenAI-compatible LLMs","archived":false,"fork":false,"pushed_at":"2025-03-28T12:43:51.000Z","size":4514,"stargazers_count":337,"open_issues_count":2,"forks_count":39,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-07-31T19:22:39.015Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bartolli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-03T02:10:10.000Z","updated_at":"2025-07-31T02:15:52.000Z","dependencies_parsed_at":"2024-12-03T03:35:24.413Z","dependency_job_id":null,"html_url":"https://github.com/bartolli/mcp-llm-bridge","commit_stats":null,"previous_names":["bartolli/mcp-llm-bridge"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bartolli/mcp-llm-bridge","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartolli%2Fmcp-llm-bridge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartolli%2Fmcp-llm-bridge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartolli%2Fmcp-llm-bridge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartolli%2Fmcp-llm-bridge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bartolli","download_url":"https://codeload.github.com/bartolli/mcp-llm-bridge/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartolli%2Fmcp-llm-bridge/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33716338,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-30T02:00:06.278Z","response_time":92,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-05T10:01:33.487Z","updated_at":"2026-05-31T01:30:29.572Z","avatar_url":"https://github.com/bartolli.png","language":"Python","funding_links":[],"categories":["AI/ML","Python"],"sub_categories":[],"readme":"# MCP LLM Bridge\n\nA 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.\n\nThe 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.\n\nRead more about MCP by Anthropic here:\n\n- [Resources](https://modelcontextprotocol.io/docs/concepts/resources)\n- [Prompts](https://modelcontextprotocol.io/docs/concepts/prompts)\n- [Tools](https://modelcontextprotocol.io/docs/concepts/tools)\n- [Sampling](https://modelcontextprotocol.io/docs/concepts/sampling)\n\nDemo:\n\n![MCP LLM Bridge Demo](assets/output.gif)\n\n## Quick Start\n\n```bash\n# Install\ncurl -LsSf https://astral.sh/uv/install.sh | sh\ngit clone https://github.com/bartolli/mcp-llm-bridge.git\ncd mcp-llm-bridge\nuv venv\nsource .venv/bin/activate\nuv pip install -e .\n\n# Create test database\npython -m mcp_llm_bridge.create_test_db\n```\n\n## Configuration\n\n### OpenAI (Primary)\n\nCreate `.env`:\n\n```bash\nOPENAI_API_KEY=your_key\nOPENAI_MODEL=gpt-4o # or any other OpenAI model that supports tools\n```\n\nNote: reactivate the environment if needed to use the keys in `.env`: `source .venv/bin/activate`\n\nThen configure the bridge in [src/mcp_llm_bridge/main.py](src/mcp_llm_bridge/main.py)\n\n```python\nconfig = BridgeConfig(\n    mcp_server_params=StdioServerParameters(\n        command=\"uvx\",\n        args=[\"mcp-server-sqlite\", \"--db-path\", \"test.db\"],\n        env=None\n    ),\n    llm_config=LLMConfig(\n        api_key=os.getenv(\"OPENAI_API_KEY\"),\n        model=os.getenv(\"OPENAI_MODEL\", \"gpt-4o\"),\n        base_url=None\n    )\n)\n```\n\n### Additional Endpoint Support\n\nThe bridge also works with any endpoint implementing the OpenAI API specification:\n\n#### Ollama\n\n```python\nllm_config=LLMConfig(\n    api_key=\"not-needed\",\n    model=\"mistral-nemo:12b-instruct-2407-q8_0\",\n    base_url=\"http://localhost:11434/v1\"\n)\n```\n\nNote: 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.\n\n#### LM Studio\n\n```python\nllm_config=LLMConfig(\n    api_key=\"not-needed\",\n    model=\"local-model\",\n    base_url=\"http://localhost:1234/v1\"\n)\n```\n\nI didn't test this, but it should work.\n\n## Usage\n\n```bash\npython -m mcp_llm_bridge.main\n\n# Try: \"What are the most expensive products in the database?\"\n# Exit with 'quit' or Ctrl+C\n```\n\n## Running Tests\n\nInstall the package with test dependencies:\n\n```bash\nuv pip install -e \".[test]\"\n```\n\nThen run the tests:\n\n```bash\npython -m pytest -v tests/\n```\n## License\n\n[MIT](LICENSE.md)\n\n## Contributing\n\nPRs welcome.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbartolli%2Fmcp-llm-bridge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbartolli%2Fmcp-llm-bridge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbartolli%2Fmcp-llm-bridge/lists"}