How Docsray Works
Understanding the MCP architecture and how Docsray integrates with Claude.
What is an MCP Server?
Docsray is a Model Context Protocol (MCP) server, not a standalone CLI tool. This means:
- It runs as a server that provides tools to AI assistants
- Claude connects to it via the MCP protocol
- You interact through Claude, not directly with the server
Architecture Overview
┌─────────────┐ MCP Protocol ┌──────────────┐
│ Claude │ ◄──────────────────► │ Docsray │
│ Desktop │ │ MCP Server │
└─────────────┘ └──────────────┘
▲ │
│ ▼
│ ┌──────────────┐
You type: │ Document │
"Xray invoice.pdf" │ Processing │
└──────────────┘
Installation vs Usage
Installation (One-time setup)
# Install the package
pip install docsray-mcp
# Or run directly with uvx
uvx docsray-mcp start
Configuration (One-time setup)
Configure Claude Desktop to connect to Docsray:
{
"mcpServers": {
"docsray": {
"command": "uvx",
"args": ["docsray-mcp"],
"env": {
"LLAMAPARSE_API_KEY": "your-key-here"
}
}
}
}
Usage (Daily interaction)
You don't run commands directly! Instead, you ask Claude:
You: Analyze the invoice.pdf file on my desktop
Claude: I'll analyze that invoice for you using Docsray...
[Uses docsray_xray tool]
Here's what I found in the invoice:
- Vendor: Acme Corp
- Total Amount: $1,234.56
- Due Date: March 15, 2024
...
The Five Tools
When you ask Claude to work with documents, it uses these Docsray tools:
1. docsray_peek
You say: "What's in this PDF?"
Claude uses: docsray_peek
tool
You get: Document overview and metadata
2. docsray_map
You say: "Show me the structure of this document"
Claude uses: docsray_map
tool
You get: Complete document hierarchy
3. docsray_xray
You say: "Extract everything from this invoice"
Claude uses: docsray_xray
tool
You get: All entities, tables, text, and images
4. docsray_extract
You say: "Get the tables from page 5"
Claude uses: docsray_extract
tool
You get: Specific content in your preferred format
5. docsray_seek
You say: "Find the payment terms section"
Claude uses: docsray_seek
tool
You get: Navigation to specific content
Common Misunderstandings
❌ Wrong: Direct CLI Usage
# This doesn't exist:
docsray xray document.pdf --provider llama-parse
# Or this:
mcp docsray xray document.pdf
✅ Right: Through Claude
You: Xray document.pdf with provider llama-parse
Claude: [Uses docsray_xray tool with those parameters]
❌ Wrong: Python Import
# You can't import it in your code:
import docsray
result = docsray.xray("document.pdf")
✅ Right: MCP Server Connection
Claude Desktop → MCP Protocol → Docsray Server → Document Processing
Behind the Scenes
When you ask Claude to "Xray invoice.pdf", here's what happens:
- Claude interprets your request
- Claude calls the
docsray_xray
tool via MCP - Docsray server receives the tool call
- Provider selected (LlamaParse or PyMuPDF)
- Document processed using the provider
- Results cached for future use
- Data returned to Claude via MCP
- Claude presents the results to you
Advanced Usage
Specifying Providers
# Let Docsray choose
Analyze report.pdf
# Force LlamaParse (comprehensive)
Xray report.pdf with provider llama-parse
# Force PyMuPDF (fast)
Extract text from report.pdf with provider pymupdf4llm
Custom Instructions
Xray contract.pdf with custom instructions:
"Focus on payment terms, penalties, and termination clauses"
Working with URLs
Analyze https://example.com/document.pdf
Troubleshooting
Server Not Starting?
- Check your Claude Desktop config file
- Verify the command path is correct
- Ensure Python/uvx is installed
Tools Not Available?
- Restart Claude Desktop
- Check server logs for errors
- Verify installation with
pip list | grep docsray
Provider Issues?
- For LlamaParse: Check API key is set
- For PyMuPDF: Always available as fallback
- Try specifying provider explicitly
Next Steps
Now that you understand how Docsray works:
Remember: Docsray is a server that gives Claude document superpowers - you interact through Claude, not directly with Docsray!