cv-writer-mcp

francisco-perez-sorrosal/cv-writer-mcp

3.3

If you are the rightful owner of cv-writer-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The CV Writer MCP Server is a tool that converts markdown CV content to LaTeX and compiles it to PDF, leveraging AI for intelligent conversion and error fixing.

Tools
4
Resources
0
Prompts
0

CV Writer MCP Server

An AI-powered Model Context Protocol (MCP) server that generates professional CVs from markdown with intelligent style optimization. Built with OpenAI Agents SDK and FastMCP framework.

๐Ÿš€ Features

Complete End-to-End Pipeline

  • Markdown โ†’ LaTeX โ†’ PDF โ†’ Style Optimization โ†’ Final PDF
  • Multi-variant style generation with AI quality judge
  • Automatic LaTeX error fixing with retry logic
  • Iterative quality improvement with feedback loops
  • Organized file naming: iter1_var2.tex, iter1_var2_refined.pdf (iteration 1, variant 2, refined)

AI-Powered Intelligence

  • OpenAI Agents SDK: Multiple specialized agents for conversion, compilation, and styling
  • Quality Judge: LLM-as-a-judge pattern for variant evaluation with scientific scoring
  • Smart Defaults: Cost-aware configuration (fast by default, quality on demand)
  • True Parallel Processing: Each variant progresses through ALL steps independently (generation โ†’ compilation โ†’ validation โ†’ refinement)
  • Enhanced Logging: Clear file identification in judge comparisons

MCP Integration

  • Primary Tools: md_to_latex, compile_and_improve_style
  • Debug Tools: Individual phase tools for testing
  • Transport Flexibility: stdio (Claude Desktop) and HTTP support
  • Resource Serving: PDFs and LaTeX files via MCP resources

MCPB Bundle Support

  • Portable Distribution: Bundle server + dependencies into single .mcpb file
  • Easy Installation: Drag-and-drop installation in Claude Desktop
  • Self-Contained: All Python dependencies bundled in lib/ directory
  • Automated Build: Makefile and pixi tasks with uv for fast bundling

๐Ÿ“ฆ Installation

Prerequisites

  • Python 3.11+
  • LaTeX distribution (TeX Live, MiKTeX, or MacTeX)
  • OpenAI API key (for AI agents)

Quick Setup

# Clone repository
git clone https://github.com/francisco-perez-sorrosal/cv-writer-mcp.git
cd cv-writer-mcp

# Install with pixi (recommended)
pixi install

# Set OpenAI API key
export OPENAI_API_KEY="your-api-key-here"

# Verify installation
pixi run check-latex

๐Ÿ“ฆ MCPB Bundle Installation (Recommended)

For the easiest installation experience:

  1. Download cv-writer-mcp.mcpb from releases
  2. Open Claude Desktop settings
  3. Go to "MCP Servers" tab
  4. Click "Install from file"
  5. Select cv-writer-mcp.mcpb
  6. Set OPENAI_API_KEY in environment variables

That's it! The server is ready to use.

Building Your Own Bundle

Requires uv to be installed (ultra-fast Python package manager):

# Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh

# Build complete MCPB bundle
make build-mcpb

# Or use individual steps
pixi run python-bundle       # Build wheel with uv
pixi run update-mcpb-deps    # Export dependencies with uv
pixi run mcp-bundle          # Install to lib/ with uv
pixi run pack                # Create .mcpb file

Install LaTeX

macOS:

brew install --cask mactex

Ubuntu/Debian:

sudo apt-get install texlive-full

Windows: Download MiKTeX or TeX Live

๐ŸŽฏ Quick Start

End-to-End CV Generation

# FAST MODE (Default) - Quick & Cheap (~3-4 LLM calls)
pixi run generate-cv-fast

# QUALITY MODE - 2 variants, judge picks best (~6-8 LLM calls)
pixi run generate-cv-quality

# ITERATIVE MODE - Best quality with feedback loops (~15-25 LLM calls)
pixi run generate-cv-iterative

What Happens in Each Mode?

ModeVariantsIterationsJudgeCostUse Case
Fast11No~3-4 callsTesting, quick iterations
Quality21Yes~6-8 callsProduction CVs
Iterative23Yes~15-25 callsHighest quality needed

๐Ÿ—๏ธ Architecture

Complete Pipeline

Phase 1: Markdown โ†’ LaTeX
  โ””โ”€ MD2LaTeXAgent (OpenAI agent)

Phase 2: Initial Compilation (LOOP #1: compile-fix-compile)
  โ””โ”€ LaTeXExpert
      FOR attempt in 1..max_attempts:
        โ”œโ”€ CompilationAgent: compile LaTeX
        โ”œโ”€ If errors: CompilationErrorAgent fixes them
        โ””โ”€ Retry until success or max attempts

Phase 3: Style Improvement (LOOP #2: true parallel processing)
  โ””โ”€ PDFStyleCoordinator
      FOR iteration in 1..max_iterations:
        โ”œโ”€ Step 1: Capture & Analyze PDF (VisualCriticAgent)
        โ”œโ”€ Step 2: Generate N variants IN PARALLEL
        โ”‚   FOR each variant (parallel execution):
        โ”‚     โ”œโ”€ FormattingAgent: translate critiques โ†’ LaTeX fixes
        โ”‚     โ”œโ”€ LOOP #1: compile-fix-compile (nested!)
        โ”‚     โ”œโ”€ Visual Validation: detect critical regressions
        โ”‚     โ”œโ”€ Refinement: fix critical issues (Branch Judge)
        โ”‚     โ””โ”€ Final variant ready with validation metadata
        โ”œโ”€ Step 3: Main Quality Judge evaluates all completed variants
        โ””โ”€ Decision: pass/needs_improvement/fail โ†’ stop or continue

Smart Defaults

Auto-Enables Judge: When num_variants >= 2 (needed to pick best) Auto-Disables Judge: When num_variants = 1 (nothing to compare) Cost-Aware: Default is 1 variant, 1 iteration (fast & cheap) Quality-Aware: Easy to enable quality mode with --variants 2

Key Architectural Improvements

๐Ÿš€ True Parallel Processing: Each variant now progresses through its complete lifecycle independently:

  • Generation โ†’ Compilation โ†’ Validation โ†’ Refinement (if needed)
  • No sequential bottlenecks between processing phases
  • Maximum resource utilization and speed

๐Ÿ“ Clear File Naming: Organized, descriptive naming convention:

  • iter1_var2.tex instead of i1v2.tex
  • iter1_var2_refined.pdf instead of i1v2r.pdf
  • Easy to understand file relationships and versions

๐Ÿ”ง Enhanced Error Handling: Robust pipeline that continues processing even if individual variants fail:

  • Graceful handling of compilation failures
  • Null-safe PDF path processing
  • Individual variant failures don't stop the entire pipeline

๐Ÿ“š Usage

MCP Server

Start the server for Claude Desktop or other MCP clients:

# Start with stdio transport (default for Claude Desktop)
export TRANSPORT="stdio"
pixi run serve

# Start with HTTP transport
export TRANSPORT="streamable-http"
pixi run serve

Primary MCP Tools

md_to_latex โญ

Complete end-to-end pipeline: Markdown โ†’ LaTeX โ†’ PDF โ†’ Style โ†’ Final PDF

Parameters:

  • markdown_content (required): Markdown CV content
  • output_filename (optional): Custom output filename
  • enable_style_improvement (default: true): Enable style phase
  • max_compile_attempts (default: 3): Max compilation retries
  • max_style_iterations (default: 1): Max style iterations
  • num_style_variants (default: 1): Number of variants per iteration
  • enable_quality_validation (default: None): Judge enabled if variants >= 2

Example:

{
  "markdown_content": "# John Doe\n## Experience...",
  "num_style_variants": 2,
  "max_style_iterations": 3
}
compile_and_improve_style โญ

Compile existing LaTeX and improve styling: LaTeX โ†’ PDF โ†’ Style โ†’ Final PDF

Parameters:

  • tex_filename (required): Name of .tex file
  • output_filename (optional): Custom output filename
  • max_compile_attempts (default: 3): Max compilation retries
  • max_style_iterations (default: 1): Max style iterations
  • num_style_variants (default: 1): Number of variants
  • enable_quality_validation (default: None): Auto-enabled if variants >= 2

CLI Commands

Primary Workflows
# Fast mode (1 variant, 1 iteration, no judge)
pixi run generate-cv-fast

# Quality mode (2 variants, judge picks best)
pixi run generate-cv-quality

# Iterative mode (3 iterations, 2 variants, judge-driven)
pixi run generate-cv-iterative

# Compile and improve existing LaTeX
pixi run compile-and-improve
Debug/Test Workflows (Individual Phases)
# Check LaTeX installation
pixi run check-latex

# Phase 1: Markdown โ†’ LaTeX only
pixi run convert-markdown

# Phase 2: LaTeX โ†’ PDF only (with error fixing)
pixi run compile-latex

# Phase 3: PDF โ†’ Styled LaTeX only
pixi run fix-style
Custom Commands
# Custom workflow with specific parameters
python -m cv_writer_mcp generate-cv-from-markdown input/cv.md \
  --output my_cv.pdf \
  --max-style-iter 3 \
  --variants 2 \
  --quality

# Disable style improvement (just convert and compile)
python -m cv_writer_mcp generate-cv-from-markdown input/cv.md \
  --no-enable-style

# Force quality judge on single variant
python -m cv_writer_mcp generate-cv-from-markdown input/cv.md \
  --variants 1 \
  --quality

โš™๏ธ Configuration

Create a .env file:

# Required
OPENAI_API_KEY=your-api-key-here

# Optional
TRANSPORT=stdio                  # "stdio" or "streamable-http"
HOST=localhost
PORT=8000
OUTPUT_DIR=./output
TEMP_DIR=./temp
LATEX_TIMEOUT=180
LOG_LEVEL=INFO

๐Ÿงช Development

Setup

# Install development dependencies
pixi install

# Run all checks (format, lint, type-check, test)
pixi run ci

Development Commands

# Format code
pixi run format

# Lint code
pixi run lint

# Type checking
pixi run type-check

# Run tests
pixi run test

# Run tests with coverage
pixi run test-cov

Project Structure

cv-writer-mcp/
โ”œโ”€โ”€ src/cv_writer_mcp/
โ”‚   โ”œโ”€โ”€ orchestration/         # End-to-end pipeline orchestrator
โ”‚   โ”‚   โ”œโ”€โ”€ pipeline_orchestrator.py
โ”‚   โ”‚   โ””โ”€โ”€ models.py
โ”‚   โ”œโ”€โ”€ compilation/            # LaTeX compilation with error fixing
โ”‚   โ”‚   โ”œโ”€โ”€ latex_expert.py
โ”‚   โ”‚   โ”œโ”€โ”€ compiler_agent.py
โ”‚   โ”‚   โ”œโ”€โ”€ error_agent.py
โ”‚   โ”‚   โ”œโ”€โ”€ tools.py
โ”‚   โ”‚   โ”œโ”€โ”€ models.py
โ”‚   โ”‚   โ””โ”€โ”€ configs/
โ”‚   โ”‚       โ”œโ”€โ”€ compiler_agent.yaml
โ”‚   โ”‚       โ””โ”€โ”€ error_agent.yaml
โ”‚   โ”œโ”€โ”€ conversion/             # Markdown to LaTeX conversion
โ”‚   โ”‚   โ”œโ”€โ”€ md2latex_agent.py
โ”‚   โ”‚   โ”œโ”€โ”€ models.py
โ”‚   โ”‚   โ””โ”€โ”€ configs/
โ”‚   โ”‚       โ””โ”€โ”€ md2latex_agent.yaml
โ”‚   โ”œโ”€โ”€ style/                  # PDF style improvement
โ”‚   โ”‚   โ”œโ”€โ”€ pdf_style_coordinator.py
โ”‚   โ”‚   โ”œโ”€โ”€ visual_critic_agent.py    # Design quality critic
โ”‚   โ”‚   โ”œโ”€โ”€ formatting_agent.py       # LaTeX implementation
โ”‚   โ”‚   โ”œโ”€โ”€ quality_agent.py          # LLM-as-a-judge
โ”‚   โ”‚   โ”œโ”€โ”€ pdf_computer.py           # Screenshot capture
โ”‚   โ”‚   โ”œโ”€โ”€ tools.py
โ”‚   โ”‚   โ”œโ”€โ”€ models.py
โ”‚   โ”‚   โ””โ”€โ”€ configs/
โ”‚   โ”‚       โ”œโ”€โ”€ formatting_agent.yaml
โ”‚   โ”‚       โ”œโ”€โ”€ quality_agent.yaml
โ”‚   โ”‚       โ””โ”€โ”€ visual_critic_agent.yaml
โ”‚   โ”œโ”€โ”€ main.py                 # MCP server and CLI entry point
โ”‚   โ”œโ”€โ”€ models.py               # Shared data models
โ”‚   โ”œโ”€โ”€ utils.py                # Utility functions
โ”‚   โ””โ”€โ”€ logger.py               # Logging configuration
โ”œโ”€โ”€ context/                    # LaTeX templates
โ”œโ”€โ”€ input/                      # Sample input files
โ”œโ”€โ”€ output/                     # Generated files
โ””โ”€โ”€ tests/                      # Test suite

๐Ÿ’ก How It Works

Multi-Variant Style Improvement

  1. Screenshot Capture: Utility function uses Playwright to convert PDF pages to PNG images
  2. Visual Critique: VisualCriticAgent analyzes screenshots and identifies design quality issues
    • Evaluates spacing, consistency, readability, layout
    • Describes problems in design language (not code)
    • Suggests WHAT should improve (goals, not implementation)
  3. Generate Variants in Parallel: Each variant progresses through its complete lifecycle independently:
    • Variant 1: Conservative approach (safe, minimal changes)
    • Variant 2: Aggressive approach (bold formatting, space optimization)
    • Variant 3+: Balanced approaches
  4. Parallel Processing Pipeline: Each variant simultaneously executes:
    • FormattingAgent: translates critiques โ†’ LaTeX fixes
    • Compilation: compile-fix-compile loop until success
    • Visual Validation: detect critical regressions
    • Refinement: fix critical issues using Branch Judge (if needed)
  5. Main Judge Evaluation: StyleQualityAgent compares all completed variants and selects the best
  6. Iterate: If score is "needs_improvement", repeat with judge feedback

Quality Criteria & Scoring

The judge evaluates variants using a scientific scoring methodology:

Four Quality Dimensions (Weighted)
  • Design Coherence (30%): Unified, intentional design system
  • Spacing Efficiency (25%): Effective vertical space utilization
  • Visual Consistency (25%): Uniform formatting across similar elements
  • Readability (20%): Easy information scanning and navigation
Quality Thresholds
  • "pass": Overall score โ‰ฅ 0.75 AND all metrics โ‰ฅ 0.65
  • "needs_improvement": 0.55 โ‰ค score < 0.75 OR any metric < 0.65 but โ‰ฅ 0.45
  • "fail": Score < 0.55 OR any metric < 0.45
Iteration Control
  • Early Termination: System stops when judge returns "pass" score
  • Maximum Iterations: Respects max_iterations parameter
  • Judge Feedback: Each iteration uses feedback from previous evaluation

File Naming System

The system uses clear, descriptive naming conventions:

Base variants:     iter1_var1.tex, iter1_var2.pdf           (iteration 1, variant 1/2)
Refined variants:  iter1_var1_refined.tex, iter1_var2_refined.pdf  (iteration 1, variant 1/2, refined)
Backup files:      iter1_var1_backup_20251006_145832.tex    (organized backups with timestamps)

Benefits of New Naming:

  • Clear Structure: Easy to understand iteration and variant relationships
  • Linear Progression: Files are organized in chronological order
  • Version Tracking: Refined versions clearly distinguished from base variants
  • Backup Organization: Timestamped backups with descriptive prefixes

Enhanced Judge Logging

The system provides clear visibility into judge decisions:

โš–๏ธ  MAIN JUDGE: Comparing 2 variants (Iteration 1)
๐Ÿ“„ Original PDF: schwab_cv_iterative.pdf
๐Ÿ“Š Variants to compare:
  ๐Ÿ“„ Variant 1 (original): iter1_var1.pdf
  ๐Ÿ“„ Variant 2 (refined): iter1_var2_refined.pdf
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

๐Ÿ† MAIN JUDGE RESULT: Selected Variant 2 (refined)
๐Ÿ“„ Winning file: iter1_var2_refined.pdf
๐Ÿ“Š Score: pass
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

๐Ÿ” Troubleshooting

LaTeX Not Found

# Check installation
pixi run check-latex

# Verify LaTeX is in PATH
which pdflatex

# Install LaTeX (see Installation section)

Compilation Errors

The system automatically fixes most LaTeX errors through the compile-fix-compile loop. If issues persist:

  1. Check the error logs in console output
  2. Review the generated .tex file in ./output/
  3. Try increasing max_compile_attempts

Style Improvement Issues

If style improvement fails:

  1. Ensure Playwright browsers are installed: pixi run playwright install
  2. Check that PDF was generated successfully in Phase 2
  3. Try with --variants 1 --no-quality to disable judge

Iteration Stopping Early

If iterations stop before reaching max_iterations:

  1. Check Judge Scores: Look for "โœ… Quality criteria met! Stopping iterations."
  2. Judge is Too Lenient: The quality judge may be giving "pass" scores too easily
  3. Current Issue: Judge returns "pass" even when issues remain, causing early termination
  4. Workaround: Use --variants 1 to disable judge, or modify quality thresholds

Cost Management

To reduce API costs:

# Use fast mode (default)
pixi run generate-cv-fast

# Disable style improvement entirely
python -m cv_writer_mcp generate-cv-from-markdown input/cv.md --no-enable-style

# Single variant, no judge
python -m cv_writer_mcp generate-cv-from-markdown input/cv.md --variants 1

๐Ÿ“Š Performance

Parallel Processing Benefits

The new parallel architecture provides significant performance improvements:

ConfigurationLLM CallsTimeQualityParallel Benefits
Fast (default)~3-4~30sGoodSingle variant processing
Quality (2 variants)~6-8~45sBetter~25% faster - variants process independently
Iterative (3ร—2)~15-25~90sBest~50% faster - true parallel pipeline

Speed Improvements

Before (Sequential): Variants โ†’ Wait for all โ†’ Validation โ†’ Refinement โ†’ Judge After (Parallel): Each variant: Generation โ†’ Compilation โ†’ Validation โ†’ Refinement โ†’ Ready

Key Performance Gains:

  • Parallel Validation: No waiting for all variants to complete
  • Independent Refinement: Each variant refines independently
  • Faster Iterations: Reduced overall pipeline latency
  • Better Resource Utilization: CPU and I/O operations happen concurrently

Times are approximate and depend on CV complexity and API latency

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Make changes and add tests
  4. Run checks: pixi run ci
  5. Commit: git commit -m "Add feature"
  6. Push and submit a pull request

๐Ÿ“„ License

MIT License - see LICENSE file for details.

๐Ÿ‘ค Author

Francisco Perez-Sorrosal

๐Ÿ™ Acknowledgments

Built with: