docsray-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@docsray-mcpExtract text from ./report.pdf"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
๐ Docsray MCP Server
Docsray is a powerful Model Context Protocol (MCP) server that gives AI assistants like Claude advanced document perception capabilities. Extract text, navigate pages, analyze structure, and understand any document with ease.
โ Status: Published to PyPI and TestPyPI - Working in Cursor, Claude Desktop, and other MCP clients
โจ Features
๐ฏ Five Powerful Tools
docsray_peek- Quick document overview with format detection and provider capabilitiesdocsray_map- Generate comprehensive document structure maps with cachingdocsray_xray- AI-powered deep analysis extracting entities, relationships, and insightsdocsray_extract- Extract content in multiple formats (markdown, text, JSON, tables)docsray_seek- Navigate to specific pages, sections, or search for content
๐ Multi-Provider Architecture
PyMuPDF4LLM - Lightning-fast PDF processing (โ Implemented)
Fast markdown extraction
Basic table detection
Multi-page support
Always enabled as fallback
LlamaParse - Deep document understanding with LLMs (โ Implemented)
AI-powered entity extraction
Custom analysis instructions
Comprehensive caching in .docsray directories
Rich format preservation (markdown, images, tables)
PyTesseract - OCR for scanned documents (๐ Planned)
Mistral OCR - AI-powered OCR and analysis (๐ Planned)
๐ Key Benefits
Universal Input Support - Local files (./path, ../path, /absolute) and URLs (https://)
Intelligent Provider Selection - Automatically chooses the best tool for each task
Smart Caching - LlamaParse results cached in .docsray directories for instant access
Dynamic Discovery - Tools report actual capabilities based on what's enabled
Production Ready - Comprehensive error handling, logging, and 56 tests
Self-Documenting - Built-in resources for discovery by MCP clients
Related MCP server: Utility MCP Server
๐ฆ Installation
Quick Start with uvx (Recommended)
# Run directly without installation
uvx docsray-mcp start
# Or install globally
uv tool install docsray-mcp
# Then run with:
docsray start
# or
docsray-mcp startAlternative: Install with pip
# Basic installation (PyMuPDF4LLM only)
pip install docsray-mcp
# With LlamaParse for AI analysis
pip install "docsray-mcp[ai]"
# Development installation
pip install -e ".[dev]"๐ Quick Start
1. Set up API Keys (Optional but Recommended)
Create a .env file in your project:
# For AI-powered analysis with LlamaParse
LLAMAPARSE_API_KEY=llx-your-key-here
# Or use environment variables
export LLAMAPARSE_API_KEY=llx-your-key-hereGet your free LlamaParse API key at cloud.llamaindex.ai
2. Configure with Your MCP Client
For Cursor
Add to your Cursor settings:
{
"mcpServers": {
"docsray": {
"command": "uvx",
"args": ["docsray-mcp"],
"env": {
"LLAMAPARSE_API_KEY": "llx-your-key-here"
}
}
}
}For Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"docsray": {
"command": "uvx",
"args": ["docsray-mcp"],
"env": {
"LLAMAPARSE_API_KEY": "llx-your-key-here"
}
}
}
}๐ Usage Examples
Basic Document Overview
Peek at ./document.pdf to see its structure and available formatsExtract Entities from Contracts
Xray ./contract.pdf and extract all parties, dates, payment terms, and obligationsNavigate Documents
Map the complete structure of ./manual.pdf including all sections and subsectionsExtract Specific Content
Extract pages 10-20 from ./report.pdf as markdownAnalyze Web Documents
Analyze https://arxiv.org/pdf/2301.00234.pdf for methodology and key findingsCompare Providers
Extract text from document.pdf with provider pymupdf4llm (fast)
Xray document.pdf with provider llama-parse (AI analysis)๐ ๏ธ Advanced Configuration
Environment Variables
# Provider Configuration
DOCSRAY_PYMUPDF4LLM_ENABLED=true # Always true by default
DOCSRAY_LLAMAPARSE_ENABLED=true
LLAMAPARSE_API_KEY=llx-your-key
# Performance Tuning
DOCSRAY_CACHE_ENABLED=true
DOCSRAY_CACHE_TTL=3600
DOCSRAY_MAX_CONCURRENT_REQUESTS=5
DOCSRAY_TIMEOUT_SECONDS=30
# Logging
DOCSRAY_LOG_LEVEL=INFOProvider Capabilities
PyMuPDF4LLM (Always Available)
โ Fast text extraction
โ Markdown formatting
โ Basic table detection
โ Multi-page support
โ No AI analysis
โ No OCR
LlamaParse (When API Key Configured)
โ AI-powered analysis
โ Entity extraction
โ Custom instructions
โ Table extraction
โ Image extraction
โ Layout preservation
โ Relationship mapping
โ Result caching
๐งช Testing
# Run all tests
pytest tests/
# Run only unit tests (no API calls)
pytest tests/unit/
# Run integration tests
pytest tests/integration/
# Run with coverage
pytest tests/ --cov=src/docsray --cov-report=htmlCurrent test coverage: 52 tests passing with comprehensive coverage across all components
๐ API Reference
Tool: docsray_peek
Get quick document overview and metadata.
{
"document_url": "path/to/document.pdf",
"depth": "structure", # metadata | structure | preview
"provider": "auto" # auto | pymupdf4llm | llama-parse
}Tool: docsray_map
Generate comprehensive document structure map.
{
"document_url": "path/to/document.pdf",
"include_content": false,
"analysis_depth": "deep", # basic | deep | comprehensive
"provider": "auto"
}Tool: docsray_xray
Deep AI-powered document analysis.
{
"document_url": "path/to/document.pdf",
"analysis_type": ["entities", "key-points"],
"custom_instructions": "Extract all dates and amounts",
"provider": "llama-parse"
}Tool: docsray_extract
Extract content in various formats.
{
"document_url": "path/to/document.pdf",
"extraction_targets": ["text", "tables"],
"output_format": "markdown", # markdown | text | json
"pages": [1, 2, 3], # Optional: specific pages
"provider": "auto"
}Tool: docsray_seek
Navigate to specific document locations.
{
"document_url": "path/to/document.pdf",
"target": {"page": 5}, # or {"section": "Introduction"} or {"query": "search text"}
"extract_content": true,
"provider": "auto"
}๐๏ธ Architecture
docsray-mcp/
โโโ src/docsray/
โ โโโ server.py # FastMCP server with discovery resources
โ โโโ providers/ # Provider implementations
โ โ โโโ base.py # Provider interface
โ โ โโโ pymupdf4llm.py # Fast PDF extraction
โ โ โโโ llamaparse.py # AI-powered analysis
โ โโโ tools/ # MCP tool implementations
โ โ โโโ peek.py # Document overview
โ โ โโโ map.py # Structure mapping
โ โ โโโ xray.py # Deep analysis
โ โ โโโ extract.py # Content extraction
โ โ โโโ seek.py # Navigation
โ โโโ utils/ # Utilities
โ โโโ cache.py # Document caching
โ โโโ llamaparse_cache.py # LlamaParse .docsray cache
โโโ tests/
โ โโโ unit/ # Fast isolated tests
โ โโโ integration/ # Component interaction tests
โ โโโ manual/ # Debugging scripts
โโโ PROMPTS.md # Example prompts for all use cases๐ค Contributing
We welcome contributions! See CONTRIBUTING.md for guidelines.
Development Setup
# Clone the repository
git clone https://github.com/docsray/docsray-mcp.git
cd docsray-mcp
# Install in development mode
pip install -e ".[dev]"
# Run tests
pytest tests/
# Run linting
ruff check src/๐ License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
๐ Acknowledgments
Built on FastMCP framework
Document processing powered by PyMuPDF4LLM
AI analysis powered by LlamaParse
Inspired by the Model Context Protocol specification
๐ฌ Support
๐ Documentation
๐ Issue Tracker
๐ฌ Discussions
Made with โค๏ธ for the MCP ecosystem
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for building and testing AI agents with multi-model experimentation and insights.
MCP server unifying ERPs, CRMs, APIs and knowledge base for Claude, ChatGPT and Gemini.
An MCP server that integrates with Discord to provide AI-powered features.
OCR, transcription, file extraction, and image generation for AI agents via MCP.
Related MCP Servers
- AlicenseBqualityDmaintenanceAn MCP server that lets AI assistants read and visually analyze local documents โ PDFs, Excel spreadsheets, CSV files, Word documents, PowerPoint presentations, and images.442 npm53 PyPIMIT
- FlicenseNot gradedqualityCmaintenanceAn MCP server that provides AI-powered document processing and search capabilities, including PDF summarization, text extraction, metadata retrieval, and web search via Google Custom Search.-

clichefactory-mcpofficial
AlicenseNot gradedqualityDmaintenanceMCP server for ClicheFactory, enabling structured data extraction from documents such as PDFs, images, and office files via AI assistants.36 PyPIMIT- FlicenseNot gradedqualityCmaintenanceMCP server that provides document conversion and processing tools, enabling AI assistants to handle document formats through natural language.-