CL

CLDGeminiPDF Analyzer MCP Server for Google LLMs

Share large PDFs to Google LLMs via MCP server for CLDGeminiPDF analysis, enabling API-based deeper insights and response retrieval to Claude Desktop.

Overview

The CLDGeminiPDF Analyzer MCP Server is a lightweight bridge that enables sharing large PDF documents with Google LLMs for deep analysis, and exposing the results back to client tools such as Claude Desktop via the Model Context Protocol (MCP). It is intended for workflows where PDFs exceed prompt/window constraints or where you want an API-based pipeline: upload a PDF, run CLDGeminiPDF-style document parsing and semantic extraction with Google models, then retrieve summarized insights or passages through MCP-compatible clients.

This server is useful for teams that need programmatic PDF ingestion, preprocessing, indexing, and LLM-driven analysis while keeping a simple HTTP API surface. It centralizes storage and analysis, manages context windows, and exposes endpoints that can be polled or pushed to an MCP consumer (for example, Claude Desktop), so you can integrate large-document reasoning into chat assistants, research tooling, or automated QA systems.

Features

  • Upload and store large PDFs reliably (chunking and streaming supported)
  • Run CLDGeminiPDF-style analysis using Google LLMs (configurable model and parameters)
  • Expose analysis results and passages via an HTTP API
  • MCP-compatible push or handshake endpoints to send context/results to MCP consumers
  • Configurable storage backend and file retention
  • Simple auth options (API key / token)
  • Docker support for easy deployment

Installation / Configuration

Prerequisites:

  • Docker (recommended) or Python/Node runtime depending on the distribution
  • Google Cloud credentials or API key for Google LLM access
  • Optional: MCP consumer endpoint (e.g., Claude Desktop or another MCP listener)

Clone the repository:

git clone https://github.com/tfll37/CLDGeminiPDF-Analyzer.git
cd CLDGeminiPDF-Analyzer

Docker (quick start):

# build
docker build -t cldgemini-mcp .

# run (example)
docker run -d \
  -e GOOGLE_API_KEY="your-google-api-key" \
  -e SERVER_API_KEY="supersecret" \
  -e STORAGE_PATH="/data/uploads" \
  -p 8080:8080 \
  --name cldgemini-mcp \
  cldgemini-mcp

Local (example using Python virtualenv):

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

# set environment variables
export GOOGLE_API_KEY="your-google-api-key"
export SERVER_API_KEY="supersecret"
export STORAGE_PATH="./uploads"
export PORT=8080

# run server
python app.py

Example environment variables (replace with your values):

GOOGLE_API_KEY=ya29.your_google_api_key
GOOGLE_MODEL=gpt-4o-mini (or gemini-pro if available)
SERVER_API_KEY=change-this-to-secure-value
STORAGE_PATH=/var/lib/cldgemini/uploads
MCP_CALLBACK_URL=http://localhost:5003/mcp/receive
MAX_FILE_SIZE_MB=500

Security note: store API keys securely (secrets manager or environment injection) and restrict access to the server with network-level controls.

Available Resources

The server exposes a concise REST API to manage uploads, analysis jobs, and MCP interactions. Example endpoints:

MethodPathDescription
POST/uploadUpload a PDF file (multipart/form-data)
GET/documentsList stored documents and metadata
GET/documents/{id}Download original PDF
POST/analyzeStart analysis job for a document (returns job id)
GET/results/{job_id}Fetch analysis results, summaries, chunks
POST/mcp/handshakeOptional: register or handshake with MCP consumer
POST/mcp/pushPush generated context or answer to MCP endpoint

Sample upload (curl):

curl -X POST "http://localhost:8080/upload" \
  -H "Authorization: Bearer $SERVER_API_KEY" \
  -F "file=@/path/to/large-document.pdf"

Start an analysis job:

curl -X POST "http://localhost:8080/analyze" \
  -H "Authorization: Bearer $SERVER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "document_id": "abc123",
    "model": "gemini-pro",
    "tasks": ["summarize", "qa-index", "topic-extraction"],
    "context_window": 32000
  }'

Fetch results:

curl -X GET "http://localhost:8080/results/xyz-job-id" \
  -H "Authorization: Bearer $SERVER_API_KEY"

Push to MCP consumer:

curl -X POST "http://localhost:8080/mcp/push" \
  -H "Authorization: Bearer $SERVER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "consumer_url": "http://localhost:5003/mcp/receive",
    "job_id": "xyz-job-id",
    "payload_type": "summary"
  }'

Use Cases

  • Researcher summarization: A researcher uploads a 300+ page report. The server breaks the PDF into semantic chunks, runs topic extraction and a hierarchical summary with a Google model, and returns a concise executive summary plus per-chapter highlights. The researcher requests the report via the web UI or fetches a summary via the API.

  • Claude Desktop integration: An analyst uses Claude Desktop and wants to reference long PDFs during a chat. The MCP server pushes a summarized context or relevant passages into Claude Desktop via MCP so the assistant can answer with document-aware context without re-uploading large files directly to the chat client.

  • Automated QA and compliance scanning: A compliance pipeline uploads batches of contracts. The server runs clause extraction and risk-flagging tasks, stores structured outputs (clauses, risk scores), and notifies downstream systems via MCP callbacks or webhooks for triage.

  • Enterprise document search: Index many PDFs using CLDGeminiPDF-style embeddings