pdf-letter-mcp

v1.0.3
io.github.bitterdev/pdf-letter-mcp Checked 1 day ago Published 4 months ago

Renders letters as print ready PDFs, DIN 5008 compliant for German window envelopes.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

create_letter Create letter PDF

Renders a letter as a PDF file in the fixed house layout (DIN 5008 address field, 25 mm writing margin, fold and punch marks, bold subject block). Pass content only, the layout is fixed. The signature image intentionally overlaps the closing line. Returns the absolute file path, the page count, layout metrics and warnings.

ParameterTypeDescription
body *stringLetter text. Blank lines separate paragraphs, "- " starts a bullet list, "1. " a numbered list, **bold** and *italic* are supported, "\pagebreak" forces a page break.
recipient *objectRecipient, positioned in the DIN 5008 address field so it shows in the envelope window.
closingstringDefault is the closing phrase of the locale.
copyToarray
countryDisplaystringWhen to print the country line, default "auto" (only for foreign recipients).
datestringISO date (2026-07-24), "today" or free text. Default "today".
dateStylestringDefault "numeric" (24.07.2026).
enclosuresarray
localestringLanguage of the fixed texts and date format. Supported: de, en, fr, es, it, nl, pt, pl, tr, da, sv, cs. Regional tags such as "en-US" are accepted. Default "de".
marksarrayRemark zone above the address, max. 3 lines, e.g. ["Einschreiben"].
metadataobject
outputPathstringTarget PDF path. Default: PDF_LETTER_OUTPUT_DIR (or the temp directory) plus a name derived from the subject.
overwritebooleanOverwrite an existing file instead of adding a counter, default false.
placestringPlace for the "place, date" line.
profilestringSender identity, taken from the profile file on this machine (see list_profiles). The profile provides address, return address line and signature image. Use this instead of typing a sender.
returnAddressLinestringReturn address line above the recipient. Generated from the sender, pass "" to hide it.
returnBase64booleanAlso return the PDF as base64, default false.
salutationstringDefault is the generic salutation of the locale.
senderobjectSender, printed as the small return address line above the recipient. Only needed when no profile is used, a profile always wins.
signatureobjectSignature below the closing line. The image is scaled and placed by the renderer: it is laid over the blank line above the printed name and deliberately overlaps the closing line, exactly like a signa…
subjectstringSubject line, printed without a "Betreff:" label as required by DIN 5008.
subjectLinesarrayFurther bold lines right below the subject. This is where a normal German letter carries references, e.g. ["Zeichen: 535 B 335D028418", "Kunden-Nummer: 335D028418"].

preview_letter Preview letter layout

Renders the letter in memory and returns layout metrics and warnings without writing a file. Use it to check whether the address fits the address field or the letter runs onto a second page.

ParameterTypeDescription
body *stringLetter text. Blank lines separate paragraphs, "- " starts a bullet list, "1. " a numbered list, **bold** and *italic* are supported, "\pagebreak" forces a page break.
recipient *objectRecipient, positioned in the DIN 5008 address field so it shows in the envelope window.
closingstringDefault is the closing phrase of the locale.
copyToarray
countryDisplaystringWhen to print the country line, default "auto" (only for foreign recipients).
datestringISO date (2026-07-24), "today" or free text. Default "today".
dateStylestringDefault "numeric" (24.07.2026).
enclosuresarray
localestringLanguage of the fixed texts and date format. Supported: de, en, fr, es, it, nl, pt, pl, tr, da, sv, cs. Regional tags such as "en-US" are accepted. Default "de".
marksarrayRemark zone above the address, max. 3 lines, e.g. ["Einschreiben"].
metadataobject
placestringPlace for the "place, date" line.
profilestringSender identity, taken from the profile file on this machine (see list_profiles). The profile provides address, return address line and signature image. Use this instead of typing a sender.
returnAddressLinestringReturn address line above the recipient. Generated from the sender, pass "" to hide it.
salutationstringDefault is the generic salutation of the locale.
senderobjectSender, printed as the small return address line above the recipient. Only needed when no profile is used, a profile always wins.
signatureobjectSignature below the closing line. The image is scaled and placed by the renderer: it is laid over the blank line above the printed name and deliberately overlaps the closing line, exactly like a signa…
subjectstringSubject line, printed without a "Betreff:" label as required by DIN 5008.
subjectLinesarrayFurther bold lines right below the subject. This is where a normal German letter carries references, e.g. ["Zeichen: 535 B 335D028418", "Kunden-Nummer: 335D028418"].

prepare_signature Prepare signature image

Cleans up a scanned signature: crops white borders, turns the paper background transparent and optionally recolours the ink. Writes a PNG that can be passed to create_letter as signature.path. Needs the optional sharp dependency.

ParameterTypeDescription
backgroundThresholdnumberLuminance cutoff, default 0.85.
base64stringImage data as base64 or data URL, alternative to path.
inkColorstringRecolour the ink, e.g. "#1a1a1a".
outputPathstringTarget PNG path. Default: output directory plus "signature.png".
overwriteboolean
pathstringPath to the scan (PNG, JPEG, and with sharp also WebP/TIFF/HEIC).
removeBackgroundbooleanTurn the white background transparent, default true.
trimbooleanCrop uniform borders, default true.

list_profiles List sender profiles

Lists the sender profiles configured on this machine. Each profile carries the address and the signature of one person, so create_letter only needs the profile key.

get_din5008_spec Get DIN 5008 geometry

Returns the millimetre geometry of the layout: address field, remark zone, writing margins, subject position, fold and punch marks.

list_locales List locales

Lists the supported languages together with their fixed texts (salutation, closing, enclosures, page numbering).

ParameterTypeDescription
localestringReturn the labels of a single locale.

list_fonts List fonts

Lists the built-in font families and resolves a font name against the installed system fonts, so you can check what create_letter would embed.

ParameterTypeDescription
familystringFont family or .ttf path to resolve.