Analyze PDFs with Gemini AI
Java MCP server that analyzes PDFs with Google Gemini - direct PDF upload or PDFBox text extraction, model choice, requires the Filesystem MCP server.
1.0.0Add to Favorites
Why it matters
Leverage Google Gemini AI models to analyze PDF documents directly within Claude Desktop. This asset extracts and processes PDF content, enabling advanced insights and summarization.
Outcomes
What it gets done
Analyze PDF content using Gemini AI models.
Extract text and information from uploaded PDFs.
Integrate with Claude Desktop via MCP for seamless analysis.
Configure Gemini API key and model selection.
Source
Get it from source
Spark does not host a copy of it.
Open sourceReports
Agent outcome reports
No reports yet
Capabilities
Tools your agent gets
Analyze PDF documents using Google Gemini AI models with content extraction and insights.
List available Gemini models for PDF analysis including 2.5, 2.0, 1.5 series and Gemma models.
Overview
CLDGeminiPDF Analyzer MCP Server
A Java MCP server that lets Claude Desktop analyze PDF documents with Google's Gemini models, either uploading the PDF directly or falling back to Apache PDFBox text extraction, and requires the Filesystem MCP server to access files. Use it to analyze research papers, contracts, or other PDFs with Gemini from Claude Desktop. It needs a free Gemini API key and cannot yet accept drag-and-drop files, only filesystem-accessible paths.
What it does
A Java-based MCP server that lets Claude Desktop analyze PDF documents using Google's Gemini AI models. It supports two processing methods: uploading the PDF directly to Gemini, or falling back to text extraction with Apache PDFBox when direct upload isn't suitable, then sending that text to Gemini for analysis. Multiple Gemini models are selectable, spanning the 2.5, 2.0, and 1.5 series plus the open Gemma models, each with different rate limits and capabilities on the free tier.
When to use - and when NOT to
Use it to have Claude analyze research papers, contracts, or other PDF documents with Gemini's language understanding - summarizing methodology and conclusions, extracting key terms and risks from a contract, or picking a specific model like gemini-2.5-pro for a harder analysis task. It requires the separate Filesystem MCP server to actually reach PDF files, either by full file path or by finding a named file within the filesystem server's allowed directory; version 1.0.0 does not support drag-and-drop files in the chat interface, so a PDF outside the configured directory scope cannot be analyzed. Rate limits vary sharply by model on the free tier, from 10 requests per minute on the 2.5 previews to 30 on 2.0-flash-lite and the Gemma models, so a rate-limit error is often a signal to switch models rather than simply retry.
Capabilities
Core function is PDF analysis via Gemini, with direct PDF upload as the primary path and PDFBox-based text extraction as a fallback. Available models include gemini-2.5-flash-preview and gemini-2.5-pro-preview, higher capability with limited or lower rate limits, gemini-2.0-flash, the stable default at 15 RPM and 1M TPM, and gemini-2.0-flash-lite at 30 RPM and 1M TPM, gemini-1.5-flash and gemini-1.5-pro with a 2M-token context, unavailable on the free tier, and Gemma 3 models up to 27B parameters at 30 RPM and 15K TPM. A model list can be queried directly by asking Claude what Gemini models are available.
How to install
Requires Java 11+ and a free Gemini API key from Google AI Studio.
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/path/to/your/documents"
]
},
"CLDGeminiPDF": {
"command": "java",
"args": [
"-jar",
"/path/to/CLDGeminiPDF.v1.0.0.jar"
],
"env": {
"GEMINI_API_KEY": "your_api_key_here",
"GEMINI_MODEL": "gemini-2.0-flash"
}
}
}
}
Download the pre-built JAR from the project's Releases page, or build from source with mvn clean compile assembly:single.
Who it's for
Claude Desktop users who want AI analysis of PDF documents, such as papers, contracts, or reports, using Google's Gemini models, with control over which model handles the request. The project is licensed under MIT.
Source README
CLDGeminiPDF MCP Server
A Model Context Protocol (MCP) server that enables Claude Desktop to analyze PDF documents using Google's AI models. This server sends PDF files & extracts text from PDFs by leveraging Gemini's powerful language understanding to provide intelligent analysis and insights.
Quick Start
- Download: Get the pre-built JAR from Releases
- API Key: Get your free Gemini API key from Google AI Studio
- Configure: Add the server to your Claude Desktop config with the JAR path and API key
- Analyze: Start analyzing PDFs with Claude!
Features
- PDF Analysis: Extract and analyze PDF content using Gemini AI models
- Multiple Model Support: Choose from various Gemini models (2.5, 2.0, 1.5 series, and Gemma models)
- Dual Processing Methods: Direct PDF upload to Gemini or fallback text extraction
- MCP Integration: Seamless integration with Claude Desktop via Model Context Protocol
- Flexible Configuration: Environment-based configuration for easy deployment
Prerequisites
- Java 11 or higher
- Maven (for building from source)
- Google AI Studio API Key (free at aistudio.google.com)
- Claude Desktop application
- Filesystem MCP Server (required dependency)
Installation
Option 1: Download Pre-built JAR (Recommended)
- Download the latest
CLDGeminiPDF.v1.0.0.jarfrom the Releases page - Save it to a convenient location on your system
Option 2: Build from Source
git clone <your-repository-url>
cd CLDGeminiPDF
mvn clean compile assembly:single
This will create a JAR file with all dependencies included in the target/ directory.
Get Your Gemini API Key
- Visit Google AI Studio
- Sign in with your Google account
- Click "Get API Key" and create a new key
- Copy the API key for use in environment variables
Claude Desktop Integration
1. Locate Claude Desktop Configuration
The configuration file location depends on your operating system:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
2. Update Configuration File
Add both the filesystem server and CLDGeminiPDF server to your claude_desktop_config.json:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/path/to/your/documents"
]
},
"CLDGeminiPDF": {
"command": "java",
"args": [
"-jar",
"/path/to/CLDGeminiPDF.v1.0.0.jar"
],
"env": {
"GEMINI_API_KEY": "your_api_key_here",
"GEMINI_MODEL": "gemini-2.0-flash"
}
}
}
}
Important:
- Replace
/path/to/your/documentswith the directory containing your PDF files - Replace
/path/to/CLDGeminiPDF.v1.0.0.jarwith the actual path to your downloaded JAR file - Replace
your_api_key_herewith your actual Gemini API key
Example Paths:
- Windows:
"C:\\Users\\YourName\\Downloads\\CLDGeminiPDF.v1.0.0.jar" - macOS:
"/Users/YourName/Downloads/CLDGeminiPDF.v1.0.0.jar" - Linux:
"/home/yourusername/Downloads/CLDGeminiPDF.v1.0.0.jar"
3. Restart Claude Desktop
Close and restart Claude Desktop for the changes to take effect.
Available Gemini Models
Data for Free Tier Users of Google API
| Model | Description | Limits |
|---|---|---|
gemini-2.5-flash-preview-05-20 |
Latest preview with high performance | 10 RPM, 250K TPM |
gemini-2.5-flash-preview-04-17 |
Previous preview version | 10 RPM, 250K TPM |
gemini-2.5-pro-preview-05-06 |
Pro version with advanced capabilities | Limited availability |
gemini-2.0-flash |
Stable, fast model (default) | 15 RPM, 1M TPM |
gemini-2.0-flash-lite |
Lightweight version | 30 RPM, 1M TPM |
gemini-1.5-flash |
Stable general-purpose model | 15 RPM, 250K TPM |
gemini-1.5-pro |
Largest context window of 2M tokens | Unavailable for free tier users |
gemma-3 models |
Open models, up to 27B parameters | 30 RPM, 15K TPM |
Model availability depends on your API key and usage tier. Check your Google AI Studio account for available models.
Data sourced from https://ai.google.dev/gemini-api/docs/rate-limits#free-tier
Usage Examples
The CLDGeminiPDF MCP server requires the Filesystem MCP server to access PDF files. It works with complete file paths or by finding files within the allowed directory scope.
Note: Version 1.0.0 does NOT support drag-and-drop files in the chat interface. Files must be accessible through the filesystem server.
Once configured, you can use these commands in Claude Desktop:
Analyze a PDF with Full Path
Please analyze this research paper: file:///Users/username/Documents/research_paper.pdf
Focus on the methodology and conclusions.
Find and Analyze a PDF by Name
Find the "research_paper.pdf" file in the Documents directory and analyze it using Gemini.
List Available Models
What Gemini models are available for PDF analysis?
Use a Specific Model
Analyze this contract using the gemini-2.5-pro model: file:///path/to/contract.pdf
Look for key terms and potential risks.
Troubleshooting
Common Issues
"GEMINI_API_KEY environment variable is not set!"
- Ensure your API key is properly set in the Claude Desktop configuration
- Restart Claude Desktop after updating the configuration
"PDF file not found or not readable"
- Verify the file path is correct and within the filesystem server's allowed directory
- Ensure the PDF file exists and is readable
- Check file permissions
"Gemini API error: 401"
- Verify your API key is correct and valid
- Check if your API key has the necessary permissions in Google AI Studio
"Gemini API error: 429"
- You've hit rate limits. Wait and try again
- Consider using a model with higher rate limits (see table above)
Filesystem server not working
- Ensure the filesystem MCP server is properly configured
- Check that the directory path in the filesystem configuration is correct
- Verify Claude Desktop has permission to access the specified directory
Debugging
To enable detailed logging, you can modify the Java command in your configuration:
"args": [
"-Djava.util.logging.level=INFO",
"-jar",
"/path/to/CLDGeminiPDF.v1.0.0.jar"
]
Verify Configuration
Test your setup by asking Claude Desktop:
List the available Gemini models
If successful, you should see a JSON response with available models and their capabilities.
Development
Building from Source
git clone <your-repository-url>
cd CLDGeminiPDF
mvn clean compile assembly:single
The JAR file will be created in the target/ directory.
Dependencies
- Jackson (JSON processing)
- Apache PDFBox (PDF text extraction)
- MCP Java SDK (Model Context Protocol)
- Java HTTP Client (API communication)
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.