Markdownify MCP server

Integrates with the markitdown library to convert various document formats including PDF, Word, and HTML to standardized Markdown, enabling efficient document processing and format unification.
Back to servers
Setup instructions
Provider
quasimodo-XY
Release date
Mar 03, 2025
Language
TypeScript
Stats
7 stars

This MCP server is an enhanced version of the Markdownify MCP project with improved UTF-8 encoding support. It converts various file types (PDFs, images, audio, documents, web content) to Markdown format with optimized handling of multilingual content and fixed encoding issues on Windows systems.

Installation

Prerequisites

  • Node.js 16.0 or higher
  • Python 3.8 or higher
  • pnpm package manager
  • Git

Environment Setup

  1. Install Node.js:

  2. Install pnpm:

    npm install -g pnpm
    pnpm --version
    
  3. Install Python:

    • Download from Python official website
    • Ensure Python is added to PATH during installation
    • Verify installation: python --version
  4. Windows-specific UTF-8 configuration:

    # Set system-wide UTF-8
    setx PYTHONIOENCODING UTF-8
    # Set current session UTF-8
    set PYTHONIOENCODING=UTF-8
    # Enable UTF-8 in command prompt
    chcp 65001
    

Quick Start

  1. Clone the repository:

    git clone https://github.com/JDJR2024/markdownify-mcp-utf8.git
    cd markdownify-mcp-utf8
    
  2. Create and activate Python virtual environment:

    # Windows
    python -m venv .venv
    .venv\Scripts\activate
    
    # Linux/macOS
    python3 -m venv .venv
    source .venv/bin/activate
    
  3. Install dependencies:

    pnpm install
    ./setup.sh
    
  4. Build and start the server:

    pnpm run build
    pnpm start
    

Usage

Basic Usage

Convert web pages to Markdown:

python convert_utf8.py "https://example.com"

Convert local files to Markdown:

# Convert DOCX
python convert_utf8.py "document.docx"

# Convert PDF
python convert_utf8.py "document.pdf"

# Convert PowerPoint
python convert_utf8.py "presentation.pptx"

# Convert Excel
python convert_utf8.py "spreadsheet.xlsx"

Convert YouTube video transcripts:

python convert_utf8.py "https://www.youtube.com/watch?v=VIDEO_ID"

Advanced Usage

  1. Using environment variables for customization:

    # Set custom UV path
    export UV_PATH="/custom/path/to/uv"
    
    # Set custom output directory
    export MARKDOWN_OUTPUT_DIR="/custom/output/path"
    
  2. Batch processing multiple files:

    Create a batch file (e.g., convert_batch.txt) with URLs or file paths:

    https://example1.com
    https://example2.com
    file1.docx
    file2.pdf
    

    Then process the batch:

    while read -r line; do python convert_utf8.py "$line"; done < convert_batch.txt
    
  3. Enable debugging:

    export DEBUG=true
    python convert_utf8.py "your_file.docx"
    

Desktop App Integration

To integrate with a desktop application, add this to your app's server configuration:

{
  "mcpServers": {
    "markdownify": {
      "command": "node",
      "args": [
        "{ABSOLUTE_PATH}/dist/index.js"
      ],
      "env": {
        "UV_PATH": "/path/to/uv"
      }
    }
  }
}

Troubleshooting

Encoding Issues

  • If you encounter character encoding issues, ensure the PYTHONIOENCODING environment variable is set to utf-8
  • Windows users may need to run chcp 65001 to enable UTF-8 support

Permission Issues

  • Ensure you have sufficient file read/write permissions
  • On Windows, you may need to run as administrator

Common Problems

  • If Python dependencies fail to install, verify your Python version and try reinstalling them manually
  • For network-related errors when converting web content, check your internet connection
  • If the server fails to start, ensure no other process is using the same port

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "markdownify" '{"command":"node","args":["{ABSOLUTE_PATH}/dist/index.js"],"env":{"UV_PATH":"/path/to/uv"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "markdownify": {
            "command": "node",
            "args": [
                "{ABSOLUTE_PATH}/dist/index.js"
            ],
            "env": {
                "UV_PATH": "/path/to/uv"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your 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

2. Add this to your configuration file:

{
    "mcpServers": {
        "markdownify": {
            "command": "node",
            "args": [
                "{ABSOLUTE_PATH}/dist/index.js"
            ],
            "env": {
                "UV_PATH": "/path/to/uv"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later