Smart Ai Bridge

by Platano78

252 downloads
Not rated
GitHub

About

Smart AI Bridge is a production-ready Model Context Protocol (MCP) server that orchestrates AI-powered development operations across multiple backends with automatic failover, smart routing, and advanced error prevention capabilities.

Details

Author
Platano78
Downloads
252
Categories
Developer Tools, AI, API, Automation

- Multi‑AI backend orchestration with intelligent routing and health‑aware failover.
- Advanced fuzzy matching (exact → fuzzy → suggestions) reducing “text not found” errors by 80%.
- 19 total tools: 9 core plus 10 intelligent aliases for code review, file operations, and batch editing.
- Enterprise security with 9.7/10 score, DoS protection, input validation, and audit trails.
- Smart routing that auto‑selects backends based on task type (coding, analysis, large context).
- Fully expandable architecture – add unlimited AI providers via the provided extension guide.

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Smart Ai Bridge
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

After installing dependencies (npm install) and running tests (npm test), add the server to Claude Code’s mcpServers configuration using a JSON block that specifies the node command, the script path, and environment variables for endpoint URLs and API keys. Then restart Claude Code to begin using the tools.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "smart ai bridge": {
            "smart-ai-bridge": {
                "command": "node",
                "args": [
                    "smart-ai-bridge.js"
                ],
                "cwd": ".",
                "env": {
                    "LOCAL_MODEL_ENDPOINT": "http://localhost:1234/v1",
                    "CLOUD_API_KEY_1": "your-cloud-api-key-1",
                    "CLOUD_API_KEY_2": "your-cloud-api-key-2",
                    "CLOUD_API_KEY_3": "your-cloud-api-key-3"
                }
            }
        }
    }
}

McpServers

{
    "smart-ai-bridge": {
        "command": "node",
        "args": [
            "smart-ai-bridge.js"
        ],
        "cwd": ".",
        "env": {
            "LOCAL_MODEL_ENDPOINT": "http://localhost:1234/v1",
            "CLOUD_API_KEY_1": "your-cloud-api-key-1",
            "CLOUD_API_KEY_2": "your-cloud-api-key-2",
            "CLOUD_API_KEY_3": "your-cloud-api-key-3"
        }
    }
}

Smart AI Bridge

Enterprise-grade MCP server for Claude Desktop with multi-AI orchestration, intelligent routing, advanced fuzzy matching, and comprehensive security.

🎯 Overview

Smart AI Bridge is a production-ready Model Context Protocol (MCP) server that orchestrates AI-powered development operations across multiple backends with automatic failover, smart routing, and advanced error prevention capabilities.

Key Features

🤖 Multi-AI Backend Orchestration

- Pre-configured 4-Backend System: 1 local model + 3 cloud AI backends (fully customizable - bring your own providers) - Fully Expandable: Add unlimited backends via EXTENDING.md guide - Intelligent Routing: Automatic backend selection based on task complexity and content analysis - Health-Aware Failover: Circuit breakers with automatic fallback chains - Bring Your Own Models: Configure any AI provider (local models, cloud APIs, custom endpoints)

🎨 Bring Your Own Backends: The system ships with example configuration using local LM Studio and NVIDIA cloud APIs, but supports ANY AI providers - OpenAI, Anthropic, Azure OpenAI, AWS Bedrock, custom APIs, or local models via Ollama/vLLM/etc. See EXTENDING.md for integration guide.

🎯 Advanced Fuzzy Matching

- Three-Phase Matching: Exact (<5ms) → Fuzzy (<50ms) → Suggestions (<100ms) - Error Prevention: 80% reduction in "text not found" errors - Levenshtein Distance: Industry-standard similarity calculation - Security Hardened: 9.7/10 security score with DoS protection - Cross-Platform: Automatic Windows/Unix line ending handling

🛠️ Comprehensive Toolset

- 19 Total Tools: 9 core tools + 10 intelligent aliases - Code Review: AI-powered analysis with security auditing - File Operations: Advanced read, edit, write with atomic transactions - Multi-Edit: Batch operations with automatic rollback - Validation: Pre-flight checks with fuzzy matching support

🔒 Enterprise Security

- Security Score: 9.7/10 with comprehensive controls - DoS Protection: Complexity limits, iteration caps, timeout enforcement - Input Validation: Type checking, structure validation, sanitization - Metrics Tracking: Operation monitoring and abuse detection - Audit Trail: Complete logging with error sanitization

🏆 Production Ready: 100% test coverage, enterprise-grade reliability, MIT licensed

🚀 Multi-Backend Architecture

Flexible 4-backend system pre-configured with 1 local + 3 cloud backends for maximum development efficiency. The architecture is fully expandable - see EXTENDING.md for adding additional backends.

🎯 Pre-configured AI Backends

The system comes with 4 specialized backends (fully expandable via EXTENDING.md):

Cloud Backend 1 - Coding Specialist (Priority 1)

- Specialization: Advanced coding, debugging, implementation - Optimal For: JavaScript, Python, API development, refactoring, game development - Routing: Automatic for coding patterns and task_type: 'coding' - Example Providers: OpenAI GPT-4, Anthropic Claude, Qwen via NVIDIA API, Codestral, etc.

Cloud Backend 2 - Analysis Specialist (Priority 2)

- Specialization: Mathematical analysis, research, strategy - Features: Advanced reasoning capabilities with thinking process - Optimal For: Game balance, statistical analysis, strategic planning - Routing: Automatic for analysis patterns and math/research tasks - Example Providers: DeepSeek via NVIDIA/custom API, Claude Opus, GPT-4 Advanced, etc.

Local Backend - Unlimited Tokens (Priority 3)

- Specialization: Large context processing, unlimited capacity - Optimal For: Processing large files (>50KB), extensive documentation, massive codebases - Routing: Automatic for large prompts and unlimited token requirements - Example Providers: Any local model via LM Studio, Ollama, vLLM - DeepSeek, Llama, Mistral, Qwen, etc.

Cloud Backend 3 - General Purpose (Priority 4)

- Specialization: General-purpose tasks, additional fallback capacity - Optimal For: Diverse tasks, backup routing, multi-modal capabilities - Routing: Fallback and general-purpose queries - Example Providers: Google Gemini, Azure OpenAI, AWS Bedrock, Anthropic Claude, etc.

🎨 Example Configuration: The default setup uses LM Studio (local) + NVIDIA API (cloud), but you can configure ANY providers. See EXTENDING.md for step-by-step instructions on integrating OpenAI, Anthropic, Azure, AWS, or custom APIs.

🧠 Smart Routing Intelligence

Advanced content analysis with empirical learning:

// Smart Routing Decision Tree
if (prompt.length > 50,000) → Local Backend (unlimited capacity)
else if (math/analysis patterns detected) → Cloud Backend 2 (analysis specialist)
else if (coding patterns detected) → Cloud Backend 1 (coding specialist)
else → Default to Cloud Backend 1 (highest priority)

Pattern Recognition:
- Coding Patterns: function|class|debug|implement|javascript|python|api|optimize
- Math/Analysis Patterns: analyze|calculate|statistics|balance|metrics|research|strategy
- Large Context: File size >100KB or prompt length >50,000 characters

🚀 Quick Setup

1. Install Dependencies

cd .
npm install

2. Test Connection

npm test

3. Add to Claude Code Configuration

Production Multi-Backend Configuration:

{
  "mcpServers": {
    "smart-ai-bridge": {
      "command": "node",
      "args": ["smart-ai-bridge.js"],
      "cwd": ".",
      "env": {
        "LOCAL_MODEL_ENDPOINT": "http://localhost:1234/v1",
        "CLOUD_API_KEY_1": "your-cloud-api-key-1",
        "CLOUD_API_KEY_2": "your-cloud-api-key-2",
        "CLOUD_API_KEY_3": "your-cloud-api-key-3"
      }
    }
  }
}

Note: Example configuration uses LM Studio for local endpoint and NVIDIA API for cloud backends, but you can configure ANY providers (OpenAI, Anthropic, Azure, AWS Bedrock, etc.). The LOCAL_MODEL_ENDPOINT should point to your local model server (localhost, 127.0.0.1, or WSL2/remote IP).

4. Restart Claude Code

🛠️ Available Tools

🎯 Smart Edit Prevention Features

Enhanced edit_file Tool with Fuzzy Matching

Revolutionary file editing with intelligent error prevention and automatic correction capabilities.

New Features:
- Smart Validation Modes: strict (exact), lenient (fuzzy), dry_run (validation-only)
- Fuzzy Matching Engine: Configurable similarity threshold (0.1-1.0) for typo tolerance
- Intelligent Suggestions: Up to 10 alternative matches with similarity scores
- Performance Optimized: <50ms fuzzy matching for real-time applications

Example:

@edit_file({
file_path: "/src/user.js",
validation_mode: "lenient", // Enable fuzzy matching
fuzzy_threshold: 0.8, // 80% similarity required
suggest_alternatives: true, // Get helpful suggestions
edits: [
{
find: "const userName = 'alice'", // Will match even with minor typos
replace: "const userName = 'bob'",
description: "Update username with smart matching"
}
]
})

Enhanced read Tool with Verification

Advanced file reading with pre-flight validation capabilities for edit operations.

New Features:
- Text Verification: Verify text patterns exist before editing
- Multiple Verification Modes: basic, fuzzy, comprehensive
- Batch Verification: Validate multiple text patterns in single operation
- Detailed Results: Match locations, similarity scores, and suggestions

Example:

@read({
file_paths: ["/src/user.js"],
verify_texts: [
"function processUserData",
"const userName = 'alice'",
"return userData.score"
],
verification_mode: "fuzzy", // Smart pattern matching
fuzzy_threshold: 0.8
})

Primary AI Query Tools

query_deepseek - Smart Multi-Backend Routing

Revolutionary AI query system with automatic backend selection based on task specialization.

Features:
- Intelligent Routing: Automatic endpoint selection based on content analysis
- Capability Messaging: Transparent feedback on which AI handled your request
- Fallback Protection: Automatic failover to backup endpoints
- Task Specialization: Optimized routing for coding, analysis, and large context tasks

Example:

@query_deepseek(
prompt="Implement a complete game inventory system with drag-and-drop, item stacking, and persistence",
task_type="coding", // Routes to Qwen 3 Coder automatically
context="Building RPG game with React and Node.js"
)

route_to_endpoint - Direct Endpoint Control

Force queries to specific AI endpoints for comparison or specialized tasks.

Example:

@route_to_endpoint(
endpoint="cloud_backend_1", // or "cloud_backend_2", "local_backend"
prompt="Optimize this React component for performance"
)

compare_endpoints - Multi-AI Comparison

Run the same query across multiple endpoints to compare responses and capabilities.

Example:

@compare_endpoints(
prompt="Design a player progression system for an RPG",
endpoints=["cloud_backend_1", "cloud_backend_2", "local_backend"]
)

System Monitoring Tools

check_deepseek_status - Multi-Backend Health Check

Monitor status and capabilities of all configured AI backends.

Example:

@check_deepseek_status()
// Returns: Status of all backends, routing statistics, performance metrics

Advanced File Analysis Tools

analyze_files - Blazing Fast File Analysis

Enterprise-grade file analysis with concurrent processing, security validation, and intelligent content transmission.

Features:
- Concurrent Processing: 300% faster multi-file analysis
- Smart Routing: >100KB files automatically route to Local Backend (unlimited tokens)
- Security Validation: Built-in malicious content detection
- Cross-Platform: Windows/WSL/Linux path normalization
- Pattern Filtering: Intelligent file selection with glob patterns

Example:

@analyze_files(
files=["src//.js", "config/.json"],
analysis_type="security_audit",
output_format="detailed"
)

youtu_agent_analyze_files - Large File Chunking System

Advanced chunking system for processing files >32KB with semantic boundary preservation.

Features:
-
Semantic Chunking: Preserves code structure across chunks
-
95% Content Preservation: Minimal information loss
-
Cross-Chunk Relationships: Maintains context between file sections
-
TDD-Developed: Extensively tested file processing system

Example:

@youtu_agent_analyze_files(
files=["large_codebase/
/*.js"],
chunk_strategy="semantic",
preserve_boundaries=true
)

📋 Task Types & Smart Routing

Automatic Endpoint Selection by Task Type

Coding Tasks → Cloud Backend 1 (Coding Specialist)

- coding: General programming, implementation, development - debugging: Bug fixes, error resolution, troubleshooting - refactoring: Code optimization, restructuring, cleanup - game_dev: Game development, Unity/Unreal scripting, game logic

Analysis Tasks → Cloud Backend 2 (Analysis Specialist)

- analysis: Code review, technical analysis, research - math: Mathematical calculations, statistics, algorithms - architecture: System design, planning, strategic decisions - balance: Game balance, progression systems, metrics analysis

Large Context Tasks → Local Backend (Unlimited Tokens)

- unlimited: Large file processing, extensive documentation - Auto-routing: Prompts >50,000 characters or files >100KB

Task Type Benefits

Cloud Backend 1 (Coding) Advantages:
- Latest coding knowledge and best practices
- Advanced debugging and optimization techniques
- Game development expertise and Unity/Unreal patterns
- Modern JavaScript/Python/TypeScript capabilities

Cloud Backend 2 (Analysis) Advantages:
- Advanced reasoning with thinking process visualization
- Complex mathematical analysis and statistics
- Strategic planning and architectural design
- Game balance and progression system analysis

Local Backend Advantages:
- Unlimited token capacity for massive contexts
- Privacy for sensitive code and proprietary information
- No API rate limits or usage restrictions
- Ideal for processing entire codebases

🔧 Configuration & Requirements

Multi-Backend Configuration

The system is pre-configured with 4 backends (expandable via EXTENDING.md):

Local Backend Endpoint

- URL: http://localhost:1234/v1 (configure for your local model server) - Example Setup: LM Studio, Ollama, vLLM, or custom OpenAI-compatible endpoint - Requirements: - Local model server running (LM Studio/Ollama/vLLM/etc.) - Server bound to 0.0.0.0:1234 (not 127.0.0.1 for WSL2 compatibility) - Firewall allowing connections if running on separate machine

Cloud Backend Endpoints

- Example Configuration: NVIDIA API, OpenAI, Anthropic, Azure OpenAI, AWS Bedrock, etc. - API Keys: Required (set via environment variables for each provider) - Endpoint URLs: Configure based on your chosen providers - Models: Any models available from your providers (see EXTENDING.md for integration)

Cross-Platform Support

Windows (WSL2)

```bash
No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.