qdrant-financial-docs
# Claude Financial Intelligence System
Equip Claude Desktop with custom tools to search **both text and images** in financial PDFs using multimodal embeddings, vector search, and the Model Context Protocol (MCP).
> ๐ฌ **ยฟHablas espaรฑol?** Join our [Spanish-speaking Telegram community](https://t.me/IA_CienciaDeDatos_ES) to discuss AI, ML, and data science projects!
**The Problem:** Traditional search systems only index text, missing 50%+ of information locked in charts, graphs, and visualizations.
**The Solution:** This system embeds both text chunks AND images into the same 3072-dimensional vector space using Google Gemini's multimodal embeddings, then exposes search tools to Claude Desktop via MCP.

---
## ๐ฏ Key Features
- **Multimodal Search**: Query charts, graphs, and text using multimodal embeddings
- **Hybrid Search**: Combine semantic similarity with metadata filtering
- **Custom Tools**: 4 custom MCP tools for semantic search, filtering, comparisons, and discovery
- **Local Development**: Runs entirely on your laptop via Dockerโno cloud required
- **Production Ready**: Seamless migration to Qdrant Cloud when you need scale
---
## ๐๏ธ Architecture
### Ingestion Pipeline
Extract text AND images from PDFs, embed both modalities using Gemini API, and store in Qdrant with rich metadata (ticker, quarter, year, document type).

### Query Flow
Hybrid search combines metadata filtering with semantic similarity to return multimodal results (text + charts).

---
## ๐ ๏ธ Tech Stack
| Component | Technology | Purpose |
|-----------|-----------|---------|
| **LLM Interface** | Claude Desktop | Natural language queries via MCP |
| **Bridge** | Model Context Protocol (MCP) | Exposes custom tools to Claude |
| **Tools** | LangChain Community | Semantic search, filtering, comparisons |
| **Vector DB** | Qdrant | Local/[cloud vector storage](https://cloud.qdrant.io/signup?utm_medium=referral&utm_source=stars&utm_campaign=devrel&utm_content=eduardo-vasquez) |
| **Embeddings** | Google Gemini Embeddings 2 | Multimodal embeddings (3072-dim, text + images) |
| **PDF Parsing** | LangChain + PyPDF | Extract text + images from PDFs |
| **Package Manager** | uv | Fast Python dependency management |
---
## ๐ Quick Start
### Prerequisites
- Docker (for Qdrant)
- Python 3.10+
- Claude Desktop
- Google Gemini API key (free tier available)
### 1. Clone & Install
```bash
git clone <your-repo-url>
cd agent-tools-claude
```
### 2. Set Up Environment
Copy the example environment file and fill in your API key:
```bash
cp .env.example .env
# Edit .env and add your GEMINI_API_KEY
```
### 3. Start Qdrant
```bash
docker compose up -d
```
Qdrant will be available at `http://localhost:6333` (Web UI at `/dashboard`)
### 4. Ingest Documents
```bash
# Install dependencies (using uv)
uv sync
# Ingest PDFs using Justfile
just ingest data/nvidia/
# Or ingest a single PDF
just ingest data/nvidia/NVDA-Q3-2025.pdf
```
Alternatively, run the ingestion script directly:
```bash
uv python scripts/ingest_pdf.py data/nvidia/
```
### 5. Configure Claude Desktop
Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
```json
{
"mcpServers": {
"qdrant-financial-docs": {
"command": "/path/to/uv",
"args": [
"--directory",
"/path/to/agent-tools-claude",
"run",
"servers/mcp_server.py"
]
}
}
}
```
### 6. Restart Claude Desktop
Quit Claude Desktop completely (โ+Q) and reopen. You should see the ๐ icon indicating MCP tools are connected.
### 7. Start Querying!
Try these queries in Claude Desktop:
- "What was NVIDIA's Q3 2025 data center revenue?"
- "Compare Q2 and Q3 gaming revenue"
- "Show me all Q4 documents"
- "What risks were mentioned in the earnings call?"
---
## ๐ Project Structure
```
agent-tools-claude/
โโโ servers/
โ โโโ mcp_server.py # MCP server implementation
โ โโโ tool_definitions.yaml # Declarative tool descriptions
โโโ src/
โ โโโ config.py # Configuration (loads .env)
โ โโโ models/
โ โ โโโ embedder.py # Gemini embedder wrapper
โ โโโ helpers/
โ โ โโโ logs.py # Logging utilities
โ โ โโโ qdrant_utils.py # Qdrant operations
โ โโโ tools/
โ โ โโโ qdrant_tools.py # LangChain tool definitions
โ โโโ scripts/
โ โโโ pdf_ingestion.py # Multimodal ingestion pipeline
โโโ scripts/
โ โโโ ingest_pdf.py # CLI for PDF ingestion
โ โโโ delete_collection.py # Utility to reset database
โโโ examples/
โ โโโ list_qdrant_tools.py # List all MCP tools
โ โโโ test_qdrant_tools.py # Test tools directly
โโโ data/ # Your PDF documents (gitignored)
โโโ docker-compose.yml # Qdrant local setup
โโโ pyproject.toml # Python dependencies
โโโ .env.example # Environment variable template
โโโ README.md # This file
```
---
## ๐ง Configuration
### Environment Variables
| Variable | Description | Default |
|----------|-------------|---------|
| `GEMINI_API_KEY` | Google Gemini API key | Required |
| `QDRANT_URL` | Qdrant instance URL | `http://localhost:6333` |
| `QDRANT_API_KEY` | Qdrant Cloud API key (optional) | None |
| `QDRANT_COLLECTION_NAME` | Collection name in Qdrant | `stock-market` |
| `EMBEDDING_MODEL` | Gemini embedding model | `gemini-embedding-2-preview` |
| `EMBEDDING_DIMENSIONS` | Vector dimensions | `3072` |
### PDF Metadata Extraction
The ingestion pipeline automatically extracts metadata from filenames:
**Pattern:** `{TICKER}-{Quarter}-{Year}-{Type}.pdf`
**Examples:**
- `NVDA-Q3-2025-Transcript.pdf` โ ticker: NVDA, quarter: Q3, year: 2025
- `AMD-Q4-2024-Presentation.pdf` โ ticker: AMD, quarter: Q4, year: 2024
Metadata enables fast filtering: "Get all Q3 2025 documents" (20ms vs 500ms semantic search)
---
## ๐ก Usage Examples
### CLI: Ingest Documents
```bash
# Single file
just ingest data/nvidia/NVDA-Q3-2025.pdf
# Entire folder (recursive)
just ingest data/nvidia/
```
---
## ๐จ MCP Tools
The system exposes 4 custom tools to Claude Desktop:

### 1. `search_documents`
- **Purpose:** Semantic search by meaning (not exact keywords)
- **Use Case:** "What did Jensen say about AI chips?"
### 2. `filter_by_metadata`
- **Purpose:** Fast retrieval of all documents matching filters
- **Use Case:** "Get all Q3 2025 documents"
### 3. `compare_quarters`
- **Purpose:** Cross-period trend analysis
- **Use Case:** "Compare Q2 vs Q3 revenue"
### 4. `get_available_data`
- **Purpose:** Discover available tickers, quarters, years
- **Use Case:** "What data do you have?"
---
## ๐งช Development
### Run MCP Server Directly
```bash
# Test the MCP server
uv run servers/mcp_server.py
```
### Test Tools Without Claude
```bash
# List available tools
python examples/list_qdrant_tools.py
# Test semantic search
python examples/test_qdrant_tools.py
```
### Reset Database
```bash
# Delete collection and start fresh
just delete-collection
```
### View Qdrant UI
Open `http://localhost:6333/dashboard` to:
- Explore collections
- View vector points
- Test queries manually
---
## ๐ฎ Future Enhancements
- [ ] **Multi-Company Support:** Ingest AMD, Intel, etc. for competitive analysis
- [ ] **REST API:** Webhook endpoint for automatic ingestion
- [ ] **Audio Transcription:** Add earnings call audio via Whisper
- [ ] **Multi-Language:** Leverage Gemini's 100+ language support
- [ ] **Cloud Migration:** Scale to Qdrant Cloud for millions of vectors
---
## ๐ค Contributing
Contributions welcome! This is a learning project showcasing:
- Building custom Claude Desktop tools via MCP
- Multimodal search implementation
- Vector database optimization
- Hybrid search strategies
---
## ๐ License
MIT License - see [LICENSE](LICENSE) file for details
---
## ๐ Resources
- [Qdrant Documentation](https://qdrant.tech/documentation/?utm_medium=referral&utm_source=stars&utm_campaign=devrel&utm_content=eduardo-vasquez)
- [Google Gemini API](https://ai.google.dev/)
- [Anthropic Claude](https://claude.ai/)
---
## ๐ฌ Join the Community
Interested in AI, machine learning, and data science? **Join our community to learn and share:**
- ๐ฌ **[Telegram Community (Spanish)](https://t.me/IA_CienciaDeDatos_ES)** - Discuss AI, ML, data science, and build cool projects together (Spanish-speaking community)
- ๐ผ **[LinkedIn](https://www.linkedin.com/in/eduardo-vasquez-n)** - Let's connect and stay in touch
Found this project helpful? Give it a โญ on GitHub!
TDQS
Scored across 5 tools
The descriptions work hard to separate search_documents (specific topic) from filter_by_metadata (whole-quarter summaries), but compare_quarters is essentially filter_by_metadata run across multiple quarters, so the boundary is thin. Similarly, get_collection_stats and get_available_data both answer 'how much data do you have?' using document counts, differentiated only by 'technical debugging' vs. 'discovery' framing. The explicit WHEN/NEVER guidance helps, but several tool pairs still tempt misselection.
All five tools use snake_case verb-first names (get_collection_stats, search_documents, filter_by_metadata, compare_quarters, get_available_data). The verb choice reflects the action (get/search/filter/compare) and the noun reflects the target resource, making the set highly predictable.
Five tools is a tight, well-scoped set for a read-only financial document QA server, and each one has an identifiable role. However, compare_quarters is arguably an aggregate variant of filter_by_metadata, so one tool is somewhat redundant, leaving the set a touch thin on genuinely distinct operations.
The read-only surface covers discovery (get_available_data, get_collection_stats), targeted retrieval (search_documents), full retrieval (filter_by_metadata), and trend analysis (compare_quarters) โ a coherent lifecycle for document QA. Minor gaps exist, such as fetching a single document by ID or listing distinct tickers without counts, but agents can work around these.