Colpali MCP Server - Python

by camillebrl

155 downloads
Not rated
GitHub

About

mcp server for Colpali (text-rich images) retrieval

Details

Author
camillebrl
Downloads
155
Categories
Other

- Semantic image search using natural language queries
- Automatic indexing of images and PDFs
- Multimodal embeddings combining vision and language (ColPali)
- Scalable storage with Elasticsearch
- Standard MCP API compatible with any MCP client

Install by cloning the repository and running make install. Configure the server in your MCP client's mcp.json with the path to start_server.sh and environment variables for Elasticsearch (ES_HOST, ES_USER, ES_PASSWORD). The server exposes four tools: search_images, index_image, get_index_stats, and clear_index.

Colpali MCP Server - Python

Un serveur MCP (Model Context Protocol) pour effectuer de la recherche (retrieval) sur une base de données d'images en utilisant ColPali et Elasticsearch.

🚀 Fonctionnalités

- Recherche sémantique d'images : Trouvez des images pertinentes en utilisant des requêtes en langage naturel
- Indexation d'images et de PDFs : Indexez automatiquement des images individuelles ou des PDFs complets
- Embeddings multimodaux : Utilise ColPali pour générer des embeddings riches combinant vision et langage
- Stockage scalable : Elasticsearch pour un stockage et une recherche efficaces
- API MCP standard : Compatible avec tout client MCP

📋 Prérequis

- Python 3.10+
- Elasticsearch 8.0+
- GPU recommandé pour ColPali (fonctionne aussi sur CPU)

🔧 Installation

git clone https://github.com/camillebrl/colpali_server
cd colpali_server
make install

🎯 Utilisation

Ajoute à ton mcp.json de ton client MCP:

{
"mcpServers": {
"colpali-server": {
"command": "path to colpali_server/start_server.sh"
"env": {
"ES_HOST": "localhost:9200", # adapt to your elasticsearch hostname
"ES_USER": "elastic", # adapt to your elasticsearch username
"ES_PASSWORD": "mot_de_passe_elasticsearch" # adapt to your elasticsearch password
}
}
}
}

Utiliser avec un client MCP

Le serveur expose les outils suivants :

🔍 search_images

Recherche des images pertinentes dans la base de données.
{
  "tool": "search_images",
  "arguments": {
    "query": "schéma d'architecture réseau",
    "top_k": 5
  }
}

📥 index_image

Indexe une nouvelle image dans la base de données. Note que les images d'un folder sont indexées 1 par 1 (batch size de 1). Si vous avez accès à une meilleure GPU, tester un batch_size plus grand.
{
  "tool": "index_image",
  "arguments": {
    "image_path": "/path/to/image.png",
    "source_file": "architecture.pdf",
    "page_number": 3,
    "metadata": {
      "author": "John Doe",
      "category": "network"
    }
  }
}

📊 get_index_stats

Obtient les statistiques de l'index.
{
  "tool": "get_index_stats",
  "arguments": {}
}

🗑️ clear_index

Vide complètement l'index (attention : irréversible).
{
  "tool": "clear_index",
  "arguments": {
    "confirm": true
  }
}

Debugging

Pour afficher les logs du server:
tail -n 1000 /tmp/colpali_mcp_startup.log

📚 Ressources

- Documentation MCP
- ColPali Paper
- Elasticsearch Guide

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.