marker-mcp
v1.0.0
Published
MCP server for Marker PDF document conversion service
Downloads
7
Maintainers
Readme
Marker MCP Server (Node.js)
A Node.js MCP (Model Context Protocol) server wrapper for Marker, enabling AI assistants like Claude to directly convert documents, extract tables, and perform OCR.
🚀 Quick Start with NPX
The easiest way to use Marker MCP server is with NPX (no installation required):
# Run directly with NPX
npx marker-mcp start
# Or with a remote Marker server
npx marker-mcp start --url http://your-marker-server:8000
# Generate Claude Desktop config
npx marker-mcp install-config --local📦 Installation Methods
1. NPX (Recommended)
No installation needed - run directly:
npx @marker-pdf/mcp-server start2. Global Installation
npm install -g marker-mcp
marker-mcp start3. Local Installation
npm install marker-mcp
npx marker-mcp start4. Docker
# Quick start with Docker
docker run -p 3000:3000 marker-mcp
# Or use Docker Compose
git clone https://github.com/VikParuchuri/marker.git
cd marker/node-mcp
docker-compose up🔧 Configuration
Environment Variables
# Marker server URL (default: http://localhost:8000)
export MARKER_URL=http://your-marker-server:8000
# GPU configuration (optional)
export CUDA_VISIBLE_DEVICES=0
export TORCH_DEVICE=cuda
# LLM configuration for enhanced processing (optional)
export OLLAMA_BASE_URL=http://localhost:11434
export OLLAMA_MODEL=mistral:7b-instruct
export GOOGLE_API_KEY=your_api_key_hereClaude Desktop Integration
Option 1: Auto-generate config
npx marker-mcp install-config --localOption 2: Manual config
Add to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
Linux: ~/.config/claude/claude_desktop_config.json
{
"mcpServers": {
"marker-pdf": {
"command": "npx",
"args": ["marker-mcp", "start", "--local"],
"env": {
"CUDA_VISIBLE_DEVICES": "0",
"TORCH_DEVICE": "cuda"
}
}
}
}For remote Marker server:
{
"mcpServers": {
"marker-pdf": {
"command": "npx",
"args": ["marker-mcp", "start"],
"env": {
"MARKER_URL": "http://your-marker-server:8000"
}
}
}
}🛠️ Available Tools
Once configured, Claude can use these tools:
1. convert_document
Convert documents (PDF, DOCX, PPTX, etc.) to markdown, JSON, or HTML.
Usage: "Convert this PDF to markdown" or "Convert this document to JSON format"
2. extract_tables
Extract tables from documents in various formats.
Usage: "Extract all tables from this PDF as markdown"
3. ocr_document
Perform OCR on scanned documents or images.
Usage: "OCR this scanned document" or "Extract text from this image"
4. start_marker_server
Start a local Marker server (if not running remotely).
Usage: "Start the local Marker server on port 8000"
5. check_marker_status
Check if the Marker server is running and healthy.
Usage: "Check if Marker is running"
🐳 Docker Deployment
Quick Start
# Run with basic setup
docker run -p 3000:3000 -p 8000:8000 marker-mcp
# Run with GPU support
docker run --gpus all -p 3000:3000 -p 8000:8000 marker-mcpDocker Compose (Production)
git clone https://github.com/VikParuchuri/marker.git
cd marker/node-mcp
# Start basic services
docker-compose up
# Start with LLM support (Ollama)
docker-compose --profile with-llm up
# Production setup with nginx
docker-compose --profile production upEnvironment Variables for Docker
Create a .env file:
CUDA_VISIBLE_DEVICES=0
TORCH_DEVICE=cuda
OLLAMA_BASE_URL=http://ollama:11434
OLLAMA_MODEL=mistral:7b-instruct
GOOGLE_API_KEY=your_api_key_here📋 Command Line Usage
# Start MCP server
marker-mcp start
# Start with local Marker server
marker-mcp start --local --port 8000
# Start with remote Marker server
marker-mcp start --url http://remote-server:8000
# Run in Docker
marker-mcp docker --port 3000
# Generate Claude config
marker-mcp install-config --remote http://your-server:8000🔍 Usage Examples
After configuring Claude Desktop, you can ask Claude:
- "Convert this PDF to markdown" - Converts document to markdown format
- "Extract tables from this document as JSON" - Extracts structured table data
- "OCR this scanned document" - Extracts text from images/scans
- "Convert this PowerPoint to HTML" - Converts presentations
- "Process only pages 1-5 of this PDF with OCR" - Selective processing
🚀 Remote Deployment Options
1. Cloud Server
Deploy on any cloud provider (AWS, GCP, Azure, etc.):
# On your server
git clone https://github.com/VikParuchuri/marker.git
cd marker/node-mcp
npm install
npm start2. Docker on Cloud
docker run -d --name marker-mcp -p 80:3000 marker-mcp3. Kubernetes
apiVersion: apps/v1
kind: Deployment
metadata:
name: marker-mcp
spec:
replicas: 1
selector:
matchLabels:
app: marker-mcp
template:
metadata:
labels:
app: marker-mcp
spec:
containers:
- name: marker-mcp
image: marker-mcp
ports:
- containerPort: 3000⚡ Performance & GPU Support
For optimal performance:
- GPU Support: Set
TORCH_DEVICE=cudaandCUDA_VISIBLE_DEVICES=0 - Memory: Ensure sufficient RAM (8GB+ recommended)
- Storage: Fast SSD storage for model caching
- Network: Good bandwidth for downloading models on first run
🛠️ Development
# Clone and install
git clone https://github.com/VikParuchuri/marker.git
cd marker/node-mcp
npm install
# Run in development mode
npm run dev
# Build Docker image
npm run docker:build
# Run tests
npm test📚 API Reference
The MCP server communicates with Claude through the Model Context Protocol. All tools support:
- File paths: Local file system paths
- URLs: Download files from URLs
- Base64 data: Direct base64 encoded file content
🐛 Troubleshooting
Common Issues
"Marker server is not running"
- Use
marker-mcp start --localto start local server - Or set correct
MARKER_URLfor remote server
- Use
"CUDA out of memory"
- Set
TORCH_DEVICE=cputo use CPU instead - Reduce concurrent processing
- Set
"Permission denied"
- Check file permissions
- Run with appropriate user permissions
Models not downloading
- Ensure internet connection
- Check disk space (models require several GB)
Debug Mode
DEBUG=* marker-mcp start📄 License
GPL-3.0-or-later - Same as Marker
🤝 Contributing
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
📞 Support
- Issues: GitHub Issues
- Discord: Marker Discord
- Documentation: Marker Docs
