Skip to main content

MCP server to bridge LLM calls via Model Context Protocol

Project description

llms-bridge-mcp

An MCP (Model Context Protocol) server to bridge LLM calls via the Model Context Protocol.

Installation

Using uv:

uv sync

Usage

Run in stdio mode (for MCP clients like Claude Desktop)

uv run stdio

Run in HTTP mode

uv run http --host 0.0.0.0 --port 3011

Run in SSE mode

uv run sse --host 0.0.0.0 --port 3011

Development mode with Smithery

uv run dev

Available Tools

The server dynamically registers tools based on available API keys. Each tool allows you to call different LLM providers through the MCP interface.

llms_bridge_call_chatgpt

Call OpenAI ChatGPT models with a prompt.

Parameters:

  • prompt (str, required): The user message/prompt
  • model (str, optional): OpenAI model (default: gpt-4o)
  • temperature (float, optional): Sampling temperature 0-2 (default: 0.7)
  • max_tokens (int, optional): Maximum response tokens (default: 4096)
  • system_message (str, optional): System message for context

Requires: OPENAI_API_KEY environment variable

llms_bridge_call_gemini

Call Google Gemini models with a prompt.

Parameters:

  • prompt (str, required): The user message/prompt
  • model (str, optional): Gemini model (default: gemini/gemini-2.0-flash-exp)
  • temperature (float, optional): Sampling temperature 0-2 (default: 0.7)
  • max_tokens (int, optional): Maximum response tokens (default: 4096)
  • system_message (str, optional): System message for context

Requires: GEMINI_API_KEY environment variable

llms_bridge_call_perplexity

Call Perplexity Sonar API for web-search enhanced responses.

Parameters:

  • prompt (str, required): The user message/prompt
  • model (str, optional): Perplexity model (default: perplexity/sonar)
  • temperature (float, optional): Sampling temperature 0-2 (default: 0.7)
  • max_tokens (int, optional): Maximum response tokens (default: 4096)
  • system_message (str, optional): System message for context

Requires: PERPLEXITY_API_KEY environment variable

llms_bridge_server_misconfiguration

This tool appears when no API keys are configured. It provides setup instructions.

Testing

Run tests with pytest:

uv run pytest

Configuration

Environment Variables

Set the following environment variables:

  • OPENAI_API_KEY: OpenAI API key for ChatGPT models
  • GEMINI_API_KEY: Google Gemini API key
  • PERPLEXITY_API_KEY: Perplexity API key
  • MCP_HOST: Host to bind to (default: 0.0.0.0)
  • MCP_PORT: Port to bind to (default: 3011)
  • MCP_TRANSPORT: Transport type (default: streamable-http)

MCP Configuration Files

The project includes several MCP configuration files for different deployment modes:

  • mcp-config-stdio.json - Stdio mode for Claude Desktop and other MCP clients (uses uvx)
  • mcp-config-http.json - HTTP mode for REST API integration
  • mcp-config-sse.json - SSE (Server-Sent Events) mode for streaming
  • mcp-config-local.json - Local development using uv

Using with Claude Desktop

For published package via uvx (recommended):

# Linux/Mac
cat mcp-config-stdio.json >> ~/Library/Application\ Support/Claude/claude_desktop_config.json

# Or manually merge the JSON content into your Claude config

For local development:

# Update the path in mcp-config-local.json to match your installation
# Then merge into Claude config
cat mcp-config-local.json >> ~/Library/Application\ Support/Claude/claude_desktop_config.json

Running via uvx (without installation)

# Stdio mode
uvx --prerelease=allow llms-bridge-mcp@latest stdio

# HTTP mode
uvx --prerelease=allow llms-bridge-mcp@latest http --host 0.0.0.0 --port 3011

# SSE mode
uvx --prerelease=allow llms-bridge-mcp@latest sse --host 0.0.0.0 --port 3011

Features

  • Dynamic Tool Registration: Tools are automatically registered based on available API keys
  • Multiple LLM Providers: Support for OpenAI, Google Gemini, and Perplexity
  • Flexible Deployment: Run via stdio, HTTP, or SSE transports
  • MCP Protocol: Full Model Context Protocol support via FastMCP
  • LiteLLM Integration: Unified interface to multiple LLM providers
  • Graceful Shutdown: Proper signal handling for clean exits

Project Structure

llms-bridge-mcp/
├── src/
│   └── llms_bridge_mcp/
│       ├── __init__.py
│       └── server.py           # Main server implementation
├── tests/
│   └── test_server.py          # Test suite including real LLM calls
├── mcp-config-stdio.json       # Stdio mode for Claude Desktop
├── mcp-config-http.json        # HTTP mode config
├── mcp-config-sse.json         # SSE mode config
├── mcp-config-local.json       # Local development config
├── .env.template               # Environment variables template
├── pyproject.toml              # Project dependencies and metadata
└── README.md

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llms_bridge_mcp-0.1.2.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llms_bridge_mcp-0.1.2-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file llms_bridge_mcp-0.1.2.tar.gz.

File metadata

  • Download URL: llms_bridge_mcp-0.1.2.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for llms_bridge_mcp-0.1.2.tar.gz
Algorithm Hash digest
SHA256 9ffd4d1e4b5aec59673caff9daf37610571e3a96dd3b169e61c607b0335cc779
MD5 e8aeda8d42760490e0862782fe4769cd
BLAKE2b-256 00f88a993e46e8136a377584130f1e795ebbb8f93d4b2e0d5f110f64de268274

See more details on using hashes here.

File details

Details for the file llms_bridge_mcp-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: llms_bridge_mcp-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for llms_bridge_mcp-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a33e573a7e3b6a270b4bf05ad6c1459108b3e0e0843a5de10118158ebdc99341
MD5 77dc51a6741e99bbc92b0cea106b5843
BLAKE2b-256 9f50e4cd0f4a6bca99359388570dec6e0ab309c24e4eb2f4c664f58ff5d7932d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page