Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

6 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ AI Orchestration Platform using MCP Server

An intelligent AI orchestration platform built with MCP (Model Context Protocol) Server that dynamically routes user requests to the most appropriate AI service based on:

  • ๐Ÿ”’ Data confidentiality
  • โšก Performance requirements
  • ๐ŸŽฎ GPU availability
  • ๐Ÿ“„ Document processing
  • ๐Ÿ“š Knowledge retrieval

The system is optimized for an NVIDIA GTX 1650 GPU, balancing local AI inference, document retrieval, OCR processing, and cloud-based AI services to provide fast, secure, and accurate responses.


โœจ Features

  • ๐Ÿง  Intelligent request routing using MCP Server
  • ๐Ÿ”’ Local LLM inference for confidential data
  • โšก Ultra-fast public AI responses using Groq
  • ๐Ÿ“š RAG with pretrained ColBERT retrieval
  • ๐Ÿ“„ Intelligent OCR engine selection
  • ๐ŸŽฎ GPU-aware resource management
  • ๐Ÿ”„ Automatic service fallback
  • ๐Ÿš€ Optimized for GTX 1650 (4GB VRAM)

๐Ÿ—๏ธ System Architecture

                           User Query
                                โ”‚
                                โ–ผ
                     MCP Server (Router)
                                โ”‚
      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
      โ”‚                         โ”‚                         โ”‚
      โ–ผ                         โ–ผ                         โ–ผ
 Confidential Query        General AI Query        Image / PDF
      โ”‚                         โ”‚                         โ”‚
      โ–ผ                         โ–ผ                         โ–ผ
 Local Ollama               Groq API              OCR Router
      โ”‚                                                 โ”‚
      โ”‚                                          GPU Available?
      โ”‚                                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”
      โ”‚                                         โ”‚             โ”‚
      โ”‚                                        Yes            No
      โ”‚                                         โ”‚             โ”‚
      โ”‚                               EasyOCR / PaddleOCR  Tesseract
      โ”‚                                         โ”‚
      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                     โ–ผ
                             Extracted Text
                                     โ”‚
                                     โ–ผ
                           ColBERT RAG Pipeline
                                     โ”‚
                  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                  โ”‚                                     โ”‚
          Embedding & Indexing                 Semantic Retrieval
                  โ”‚                                     โ”‚
                  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                     โ–ผ
                              Ollama / Groq
                                     โ”‚
                                     โ–ผ
                              Final Response

๐Ÿง  MCP Server Function Routing

The MCP Server intelligently assigns functions based on the user's request.

Request Type Assigned Function
Confidential data Ollama
General AI questions Groq
OCR request OCR Router
Document Question Answering ColBERT RAG
Internal Knowledge Search ColBERT RAG
Image Text Extraction EasyOCR / PaddleOCR / Tesseract

๐Ÿค– Ollama (Local AI)

Used for:

  • Confidential company documents
  • Internal business information
  • Private knowledge bases
  • Offline inference
  • Sensitive AI workloads

Why Local?

Sensitive information should never leave the local environment.

Running Ollama locally ensures:

  • Data privacy
  • No cloud dependency
  • Secure inference
  • Low-latency responses

โšก Groq API

Used for:

  • Public knowledge
  • General AI questions
  • Coding assistance
  • Summarization
  • Non-confidential requests

Benefits

  • Extremely fast inference
  • Reduces local GPU usage
  • Handles public AI workloads efficiently
  • Improves overall response time

๐Ÿ“š Retrieval-Augmented Generation (RAG)

The platform uses pretrained ColBERT for semantic document retrieval.

Unlike traditional embedding-only retrieval, ColBERT performs late interaction retrieval, delivering higher search accuracy while maintaining excellent retrieval speed.


RAG Workflow

User Question
      โ”‚
      โ–ผ
Document Collection
      โ”‚
      โ–ผ
Chunking
      โ”‚
      โ–ผ
ColBERT Indexing
      โ”‚
      โ–ผ
Semantic Search
      โ”‚
      โ–ผ
Relevant Chunks
      โ”‚
      โ–ผ
LLM (Ollama / Groq)
      โ”‚
      โ–ผ
Answer

๐Ÿš€ Why ColBERT?

The project uses a pretrained ColBERT model because it provides:

  • Better semantic retrieval
  • Higher search accuracy
  • Context-aware ranking
  • Reduced hallucinations
  • Fast document search

๐ŸŽฎ GPU Usage for ColBERT

ColBERT uses the GPU for:

  • Document indexing
  • Embedding generation
  • Semantic retrieval
  • Similarity computation

Since ColBERT also consumes GPU memory, GPU resources are shared intelligently with other AI services.

The MCP Server manages these workloads to avoid GPU bottlenecks.


๐ŸŽฎ GPU Resource Management

The platform is optimized for an NVIDIA GTX 1650 (4 GB VRAM).

Since multiple services may require GPU acceleration, the MCP Server prioritizes workloads dynamically.

GPU Consumers

Service GPU Usage
Ollama High
ColBERT Retrieval Medium
EasyOCR Medium
PaddleOCR Medium
Groq None (Cloud)
Tesseract CPU Only

GPU Priority

Priority order:

  1. Ollama
  2. ColBERT Retrieval
  3. EasyOCR
  4. PaddleOCR
  5. Tesseract (CPU)
  6. Groq (Cloud)

This scheduling minimizes GPU contention while maintaining responsive performance.


๐Ÿ“„ Intelligent OCR Pipeline

The OCR engine is selected automatically depending on GPU availability.

High Performance Mode

When GPU resources are available:

  • EasyOCR
  • PaddleOCR

Advantages:

  • High accuracy
  • Better multilingual support
  • Faster extraction
  • Handles scanned documents effectively

Lightweight Mode

When Ollama or ColBERT is actively using the GPU:

  • Tesseract OCR

Advantages:

  • CPU-based
  • Lightweight
  • Fast startup
  • Prevents long response delays

This ensures users are not waiting unnecessarily while GPU-intensive services are running.


๐Ÿ”„ Dynamic AI Routing

User Query
      โ”‚
      โ–ผ
Is Confidential?
      โ”‚
 โ”Œโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”
 โ”‚         โ”‚
Yes        No
 โ”‚         โ”‚
 โ–ผ         โ–ผ
Ollama   Groq
 โ”‚
 โ–ผ
Need Documents?
 โ”‚
 โ–ผ
ColBERT Retrieval
 โ”‚
 โ–ผ
Generate Response

๐Ÿ”’ Privacy Strategy

Data Type Processing
Confidential Documents Local Ollama
Internal Knowledge Base Local ColBERT RAG
Public Questions Groq API
OCR Processing Local
Vector Search Local

No confidential information is transmitted to external AI providers.


โš™๏ธ Performance Strategy

The MCP Server continuously optimizes performance by:

  • Routing confidential data locally
  • Sending public requests to Groq
  • Using ColBERT for accurate retrieval
  • Monitoring GPU availability
  • Selecting the most suitable OCR engine
  • Preventing GPU overload
  • Reducing response latency

๐Ÿ› ๏ธ Technology Stack

AI Models

  • Ollama
  • Groq API

Retrieval

  • ColBERT (Pretrained)
  • RAG
  • Vector Index

OCR

  • EasyOCR
  • PaddleOCR
  • Tesseract OCR

Backend

  • Python
  • MCP Server

Hardware

  • NVIDIA GTX 1650 GPU

๐Ÿ“ˆ Benefits

  • Intelligent AI orchestration
  • Secure local inference
  • Accurate document retrieval
  • GPU-aware scheduling
  • Automatic OCR engine selection
  • Lower response latency
  • Better retrieval accuracy with ColBERT
  • Reduced hallucinations using RAG
  • Cloud and local AI integration
  • Efficient GPU utilization

๐ŸŽฏ Future Improvements

  • Dynamic GPU memory monitoring
  • Multi-agent orchestration
  • Hybrid retrieval (ColBERT + Dense Embeddings)
  • Streaming AI responses
  • Vision Language Models (VLM)
  • Automatic model selection based on confidence
  • Distributed inference support

๐Ÿ“Œ Conclusion

This project demonstrates an intelligent AI orchestration platform powered by an MCP Server, designed to optimize performance, security, and user experience.

By combining:

  • ๐Ÿ”’ Ollama for confidential local inference
  • โšก Groq for ultra-fast public AI responses
  • ๐Ÿ“š Pretrained ColBERT for high-accuracy Retrieval-Augmented Generation (RAG)
  • ๐Ÿ“„ EasyOCR, PaddleOCR, and Tesseract for adaptive OCR processing
  • ๐ŸŽฎ GPU-aware scheduling tailored for an NVIDIA GTX 1650

the platform delivers secure, scalable, and efficient AI workflows. The MCP Server intelligently routes every request based on data sensitivity, query type, and available computing resources, ensuring users receive accurate answers with minimal latency while protecting confidential information.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages