Skip to main content

Getting started

github.com/Serendipity-AI/markdown2pdf-mcp

For Claude Desktop users

Get started using the pre-built markdown2pdf server in Claude for Desktop. You can find our MCP server here. In this tutorial you will extend Claude for Desktop so that it can convert markdown to PDF using this service, prompting for payment when required. You can see how this looks below. Don’t worry — it will ask you for your permission before executing these actions!

1. Download Claude for Desktop

First, download Claude for Desktop for macOS or Windows, then follow the installation instructions. Anthropic does not publish a Linux build of Claude for Desktop, but the markdown2pdf server itself runs anywhere Node.js 18 or later runs, so Linux users can use it from another MCP client such as Claude Code. If you already have Claude for Desktop, make sure it’s on the latest version by clicking on the Claude menu on your computer and selecting “Check for Updates…”
Yes. The markdown2pdf server is a local stdio server, so it works in any MCP client that runs local servers, including Claude for Desktop and Claude Code. To add it to Claude Code, run:

2. Add the markdown2pdf server

To add this functionality, we will be installing a pre-built markdown2pdf server in Claude for Desktop. Get started by opening up the Claude menu on your computer and select “Settings…” Please note that these are not the Claude Account Settings found in the app window itself. This is what it should look like on a Mac: Click on “Developer” in the left-hand bar of the Settings pane, and then click on “Edit Config”: If you don’t already have a configuration file, Claude for Desktop creates one at:
  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
and displays it in your file system. Open the file in any text editor and add a markdown2pdf entry under "mcpServers", keeping any servers already listed there. For a new, empty file, the full contents look like this:
You will also need Node.js 18 or later on your computer for this to run properly. To verify you have Node installed, open the command line on your computer.
  • On macOS, open the Terminal from your Applications folder.
  • On Windows, press Windows + R, type “cmd”, and press Enter.
Once in the command line, verify you have Node installed by entering in the following command:
If you get an error saying “command not found” or “node is not recognized”, or the version is below 18, download Node from nodejs.org.
How does the configuration file work?
This configuration file tells Claude for Desktop which MCP servers to start up every time you start the application. In this case, we have added one server called “markdown2pdf” that uses the Node npx command to install and run @serendipityai/markdown2pdf-mcp. This server lets Claude convert markdown to PDF.
Command Privileges
Claude for Desktop will run the commands in the configuration file with the permissions of your user account, and access to your local files. Only add commands if you understand and trust the source.

3. Restart Claude

After updating your configuration file, quit and restart Claude for Desktop. Claude for Desktop then starts the markdown2pdf server, and the markdown2pdf tool appears in the list of tools and connectors available to your chats.

4. Try it out!

You can now ask Claude to convert any markdown content to PDF. Claude asks for your approval before it calls the tool.

The markdown2pdf tool

The server provides a single tool, markdown2pdf, which takes these inputs:

Paying with Lightning

The markdown2pdf server takes payment over Lightning only (L402), not X402. Each conversion runs like this:
1

Claude requests the conversion

The tool returns a Lightning invoice for 5 sats, with a link to a QR code for it.
2

You pay the invoice

Pay the invoice from your own Lightning wallet, either by scanning the QR code or by pasting the invoice.
3

Claude runs the conversion again

Ask Claude to run the same conversion again. The server recognises the paid request and returns a link to your PDF.
The repeat request must carry the same content, title and date as the first one. Because the date forms part of the request, a repeat on a later day produces a new invoice.