Klavis-AI

Pandoc MCP Server

Community Klavis-AI
Updated

Klavis AI: MCP integration platforms that let AI agents use tools reliably at any scale

Pandoc MCP Server

License: MITPython: 3.12+FastAPIPandoc

๐Ÿ“– Overview

Pandoc MCP Server is a Model Context Protocol (MCP) implementation that converts Markdown text into various document formats using Pandoc. It provides a standardized interface for document conversion, uploading to Google Cloud Storage (GCS), and returning publicly accessible signed URLs.

๐Ÿš€ Features

This server provides the following capabilities through MCP tools:

Tool Description
convert_markdown_to_file Converts markdown text to various formats (PDF, DOCX, DOC, HTML, HTML5) and returns a GCS signed URL

๐Ÿ”ง Prerequisites

You'll need one of the following:

  • Docker: Docker installed and running (recommended)
  • Python: Python 3.12+ with pip

Additionally, you'll need:

  • Google Cloud Storage (GCS) Bucket: A GCS bucket where the server can upload converted files
  • Google Cloud Credentials: Application Default Credentials (ADC) configured in your environment

You can configure ADC by running:

gcloud auth application-default login

For local Python setup, you'll also need:

  • Pandoc: The Pandoc document converter
  • LaTeX: A LaTeX distribution (like TeX Live or MiKTeX) for PDF conversion

โš™๏ธ Setup & Configuration

Environment Configuration

  1. Create your environment file:

    cp .env.example .env
    
  2. Edit the .env file with your GCS bucket name:

    GCS_BUCKET_NAME=your-gcs-bucket-name
    

๐Ÿƒโ€โ™‚๏ธ Running the Server

Option 1: Docker (Recommended)

The Docker build must be run from the project root directory (klavis/):

# Navigate to the root directory of the project
cd /path/to/klavis

# Build the Docker image
docker build -t pandoc-mcp-server -f mcp_servers/pandoc/Dockerfile .

# Run the container (with Google Cloud credentials mounted)
docker run -p 5000:5000 --rm -v ~/.config/gcloud:/root/.config/gcloud pandoc-mcp-server

To use your local .env file instead of building it into the image:

docker run -p 5000:5000 --rm --env-file mcp_servers/pandoc/.env -v ~/.config/gcloud:/root/.config/gcloud pandoc-mcp-server

Option 2: Python Virtual Environment

# Create and activate virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Run the server
python server.py

Once running, the server will be accessible at http://localhost:5000.

๐Ÿ”Œ API Usage

The server implements the Model Context Protocol (MCP) standard. Here's an example of how to call a tool:

import httpx

async def call_pandoc_tool():
    url = "http://localhost:5000/execute"
    payload = {
        "tool_name": "convert_markdown_to_file",
        "tool_args": {
            "markdown_text": "# Hello World\n\nThis is a test document.",
            "output_format": "pdf"
        }
    }
    
    async with httpx.AsyncClient() as client:
        response = await client.post(url, json=payload)
        result = response.json()
        return result

๐Ÿ“‹ Common Operations

Converting Markdown to PDF

payload = {
    "tool_name": "convert_markdown_to_file",
    "tool_args": {
        "markdown_text": "# Hello World\n\nThis is a test document.",
        "output_format": "pdf"
    }
}

Converting Markdown to DOCX

payload = {
    "tool_name": "convert_markdown_to_file",
    "tool_args": {
        "markdown_text": "# Hello World\n\nThis is a test document.",
        "output_format": "docx"
    }
}

๐Ÿ› ๏ธ Troubleshooting

Docker Build Issues

  • File Not Found Errors: If you see errors like failed to compute cache key: failed to calculate checksum of ref: not found, this means Docker can't find the files referenced in the Dockerfile. Make sure you're building from the root project directory (klavis/), not from the server directory.

Common Runtime Issues

  • GCS Bucket Not Found: Verify your GCS bucket exists and you have the correct permissions
  • Google Cloud Authentication: Ensure your ADC is properly configured
  • PDF Generation Issues: Avoid using emojis or complex characters in markdown text when converting to PDF, as they might cause issues with LaTeX
  • Missing LaTeX: For local setup, ensure a LaTeX distribution is installed if you need PDF conversion

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.

MCP Server ยท Populars

MCP Server ยท New

    YV17labs

    ghostdesk

    Give any AI agent a full desktop โ€” it sees the screen, clicks, types, and runs apps like a human. Automate anything with a UI: browsers, legacy software, internal tools. No API needed. One Docker command.

    Community YV17labs
    remotebrowser

    mcp

    Free your data

    Community remotebrowser
    Decodo

    Decodo MCP Server

    The Decodo MCP server which enables MCP clients to interface with services.

    Community Decodo
    kuberstar

    Qartez MCP

    Semantic code intelligence MCP server for Claude Code - project maps, symbol search, impact analysis, and more

    Community kuberstar
    aovestdipaperino

    tokensave

    Rust port of CodeGraph โ€” a local-first code intelligence system that builds semantic knowledge graphs from codebases. Ported from the original TypeScript implementation by @colbymchenry.

    Community aovestdipaperino