|
| 1 | +# LLM Bridge MCP |
| 2 | + |
| 3 | +LLM Bridge MCP allows AI agents to interact with multiple large language models through a standardized interface. It leverages the Message Control Protocol (MCP) to provide seamless access to different LLM providers, making it easy to switch between models or use multiple models in the same application. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- Unified interface to multiple LLM providers: |
| 8 | + - OpenAI (GPT models) |
| 9 | + - Anthropic (Claude models) |
| 10 | + - Google (Gemini models) |
| 11 | + - DeepSeek |
| 12 | + - ... |
| 13 | +- Built with Pydantic AI for type safety and validation |
| 14 | +- Supports customizable parameters like temperature and max tokens |
| 15 | +- Provides usage tracking and metrics |
| 16 | + |
| 17 | +## Tools |
| 18 | + |
| 19 | +The server implements the following tool: |
| 20 | + |
| 21 | +``` |
| 22 | +run_llm( |
| 23 | + prompt: str, |
| 24 | + model_name: KnownModelName = "openai:gpt-4o-mini", |
| 25 | + temperature: float = 0.7, |
| 26 | + max_tokens: int = 8192, |
| 27 | + system_prompt: str = "", |
| 28 | +) -> LLMResponse |
| 29 | +``` |
| 30 | + |
| 31 | +- `prompt`: The text prompt to send to the LLM |
| 32 | +- `model_name`: Specific model to use (default: "openai:gpt-4o-mini") |
| 33 | +- `temperature`: Controls randomness (0.0 to 1.0) |
| 34 | +- `max_tokens`: Maximum number of tokens to generate |
| 35 | +- `system_prompt`: Optional system prompt to guide the model's behavior |
| 36 | + |
| 37 | +## Installation |
| 38 | + |
| 39 | +1. Clone the repository: |
| 40 | + |
| 41 | +```bash |
| 42 | +git clone https://github.com/yourusername/llm-bridge-mcp.git |
| 43 | +cd llm-bridge-mcp |
| 44 | +``` |
| 45 | + |
| 46 | +2. Install [uv](https://github.com/astral-sh/uv) (if not already installed): |
| 47 | + |
| 48 | +```bash |
| 49 | +# On macOS and Linux |
| 50 | +curl -LsSf https://astral.sh/uv/install.sh | sh |
| 51 | + |
| 52 | +# On Windows |
| 53 | +powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" |
| 54 | +``` |
| 55 | + |
| 56 | +## Configuration |
| 57 | + |
| 58 | +Create a `.env` file in the root directory with your API keys: |
| 59 | + |
| 60 | +``` |
| 61 | +OPENAI_API_KEY=your_openai_api_key |
| 62 | +ANTHROPIC_API_KEY=your_anthropic_api_key |
| 63 | +GOOGLE_API_KEY=your_google_api_key |
| 64 | +DEEPSEEK_API_KEY=your_deepseek_api_key |
| 65 | +``` |
| 66 | + |
| 67 | +## Usage |
| 68 | + |
| 69 | +### Using with Claude Desktop or Cursor |
| 70 | + |
| 71 | +Add a server entry to your Claude Desktop configuration file or `.cursor/mcp.json`: |
| 72 | + |
| 73 | +```json |
| 74 | +"mcpServers": { |
| 75 | + "llm-bridge": { |
| 76 | + "command": "uvx", |
| 77 | + "args": [ |
| 78 | + "llm-bridge-mcp" |
| 79 | + ], |
| 80 | + "env": { |
| 81 | + "OPENAI_API_KEY": "your_openai_api_key", |
| 82 | + "ANTHROPIC_API_KEY": "your_anthropic_api_key", |
| 83 | + "GOOGLE_API_KEY": "your_google_api_key", |
| 84 | + "DEEPSEEK_API_KEY": "your_deepseek_api_key" |
| 85 | + } |
| 86 | + } |
| 87 | +} |
| 88 | +``` |
| 89 | + |
| 90 | +## License |
| 91 | + |
| 92 | +This project is licensed under the MIT License - see the LICENSE file for details. |
0 commit comments