home / mcp / mcp ai bridge mcp server
Bridges Claude Code with OpenAI and Google Gemini via a secure MCP server.
Configuration
View docs{
"mcpServers": {
"fakoli-mcp-ai-bridge": {
"command": "node",
"args": [
"/path/to/mcp-ai-bridge/src/index.js"
],
"env": {
"OPENAI_API_KEY": "YOUR_OPENAI_API_KEY",
"GOOGLE_AI_API_KEY": "YOUR_GOOGLE_API_KEY"
}
}
}
}You set up this MCP server to securely bridge Claude Code with OpenAI and Google Gemini APIs, enabling you to route requests to multiple AI models with consistent security, logging, and control over prompts, while keeping integration simple for your workflows.
Connect to the MCP server from your MCP client (Claude Code) and start sending requests to the available models. You can specify the model (for example, GPT-4o or Gemini variants) and adjust parameters like temperature per request. Rely on built-in safety features such as input validation, content filtering, and prompt-injection detection to help prevent unsafe or unintended prompts. Use the server_info tool to verify the server status, available models, and current security settings.
# Prerequisites
- Node.js (12.x or newer) installed and available in your PATH
- npm installed
# 1. Clone or copy the MCP AI Bridge directory
# (Run this from your preferred location)cd mcp-ai-bridge
npm install# Option A: Global env file in your home directory (recommended)
# Create or edit ~/.env and add API keys
OPENAI_API_KEY=your_openai_api_key_here
GOOGLE_AI_API_KEY=your_google_ai_api_key_here
# Option B: Local env file in the project directory
cp .env.example .env
# Edit .env with your keys# Option C: Configure in Claude Code (settings)
# No file changes required here; keys are provided through Claude Code configThe MCP server is designed to run locally as a stdio server. The following configuration demonstrates how to run it with Node and point to the main entry file. You can also configure the keys via environment variables in any of the supported methods above.
{
"mcpServers": {
"ai_bridge": {
"command": "node",
"args": ["/path/to/mcp-ai-bridge/src/index.js"],
"env": {
"OPENAI_API_KEY": "YOUR_OPENAI_API_KEY",
"GOOGLE_AI_API_KEY": "YOUR_GOOGLE_AI_API_KEY"
}
}
}
}You can tune security and behavior through environment variables. Key options include selecting a security level, enabling content filtering, and controlling prompt sanitization. Recommended defaults provide a balanced approach, but you can tighten or relax protections based on your use case.
Core configurable areas you may adjust include: SECURITY_LEVEL, BLOCK_EXPLICIT_CONTENT, DETECT_PROMPT_INJECTION, SANITIZE_INPUT, BLOCK_VIOLENCE, BLOCK_ILLEGAL_ACTIVITIES, BLOCK_ADULT_CONTENT, REMOVE_SCRIPTS, LIMIT_REPEATED_CHARS, ENABLE_PATTERN_CACHING, MAX_PROMPT_LENGTH_FOR_DEEP_SCAN, ALLOW_EDUCATIONAL_CONTENT, WHITELIST_PATTERNS, LOG_LEVEL, MCP_SERVER_NAME, MCP_SERVER_VERSION.
If you encounter issues, start by verifying that the server process is running and that environment variables are present. Use the server_info tool to confirm status and available models. Check that dependencies are installed (npm install) and that the index.js path you provided in the config exists. For common API key errors, ensure keys are correctly placed in your chosen configuration method and that they have the required scopes.
Run unit and security tests to ensure your setup behaves as expected. Use npm test for the full suite, or npm run test:watch for ongoing checks. When debugging in Claude Code, enable MCP debug mode to get detailed error information and use the /mcp slash command to inspect server status.
Keep your API keys secure and rotate them regularly. Do not commit keys to version control. Monitor logs for unusual activity and enforce rate limiting to control usage and cost.
Query OpenAI models with full validation and security features.
Query Google Gemini models with full validation and security features.
Get comprehensive server status and configuration information.