Unified MCP endpoint and OpenAI-compatible API for Gemini CLI tools
Gemini CLI - MCP/OpenAI Bridge Server
🎉 Built on Open Source Gemini CLI - Thanks to Google!
This project is built upon the open-source Gemini CLI by Google. We appreciate Google's commitment to open source and their contribution to the developer community.
@intelligentinternet/gemini-cli-mcp-openai-bridge (or gemini-cli-bridge) is a versatile server application designed as a powerful extension to the gemini-cli ecosystem. It serves two primary roles:
MCP Toolkit: Exposes all built-in tools from
gemini-cli(such as file system operations, web search powered by Gemini models, and web content understanding) through a unified MCP endpoint.- Can also connect to any number of external MCP servers (only allowed in YOLO mode or when specific tools are configured in
configuredmode).
- Can also connect to any number of external MCP servers (only allowed in YOLO mode or when specific tools are configured in
OpenAI-Compatible API Bridge: Provides a fully compatible endpoint with the OpenAI Chat Completions API (
/v1/chat/completions). This enables any third-party tool or application that supports the OpenAI API (such as Open WebUI) to seamlessly interact with the underlying Gemini models ofgemini-cli.
Features
- Built on
gemini-cli: Directly built upon the core functionality ofgemini-cli, ensuring deep integration with Gemini models. - Native
gemini-cliTools: Exposesgemini-cli's built-in tools through the MCP protocol. - External MCP Tool Aggregation: Acts as an MCP hub, connecting and proxying tools from other tool servers (only in
yolomode or when specific tools are configured inrestrictedmode). - Full OpenAI API Compatibility: Provides
/v1/chat/completionsand/v1/modelsendpoints with support for both streaming and non-streaming requests. - Flexible Model Configuration: Allows configuring separate default LLM models for tool execution (such as web search summarization).
- Inherited Configuration & Authentication: Automatically uses the same settings and authentication state as the main
gemini-clitool, requiring no duplicate configuration. - Configurable Security Policies: Implements MCP tool-based security model with
read-only,edit,configured, andyolomodes to control tool execution.
Prerequisites
- Node.js v18 or higher
- All dependencies and configuration required by Gemini CLI
- This project automatically installs
gemini-clias a submodule (from the officialgemini-cliGitHub repository), so you don't need to install it separately. - If you already have
gemini-cliinstalled, it will be overridden by this project's submodule version.
- This project automatically installs
Installation
npm install -g @intelligentinternet/gemini-cli-mcp-openai-bridge
Usage
Security Warning: This bridge server does not ask for user confirmation when invoking tools.
- For your safety, the MCP bridge service defaults to
read-onlymode and will not bridge other MCP services you have configured in settings.json. - This project does not provide a runtime sandbox. If you wish to configure a
YOLOsecurity policy, please ensure your environment cannot be damaged by accidentally executed shell commands (strongly recommended to run in a container).
1. Start the Server
Run the command in your terminal. You can use command-line arguments to override default settings.
# Start server on all network interfaces at port 9000 with debug mode enabled
gemini-cli-bridge --host=127.0.0.1 --port=9000 --debug
# Use a faster model for tool calls and load internal GEMINI.md prompts
gemini-cli-bridge --tools-model=gemini-2.5-flash --use-internal-prompt
After the server starts successfully, you will see output similar to:
[BRIDGE-SERVER] [INFO] Starting Gemini CLI Bridge (MCP + OPENAI)...
[BRIDGE-SERVER] [INFO] Server running {
port: 8765,
host: '127.0.0.1',
mcpUrl: 'http://127.0.0.1:8765/mcp',
openAIUrl: 'http://127.0.0.1:8765/v1'
}
2. Build from Source (Developers)
git clone https://github.com/Intelligent-Internet/gemini-cli-common-bridge.git
cd gemini-cli-common-bridge
npm install
npm run build
npm run start
Authentication
This bridge server does not manage its own authentication credentials. It shares the exact same authentication mechanism as the main gemini-cli tool to ensure seamless and secure operation.
- Cached Credentials: If you h
Tools (1)
gemini-cli-toolsExposes built-in Gemini CLI tools including file system operations, web search, and web content understanding.Configuration
{"mcpServers": {"gemini-cli-bridge": {"command": "npx", "args": ["-y", "@intelligentinternet/gemini-cli-mcp-openai-bridge"]}}}