
Pdf Letter Mcp
io.github.bitterdev由 GitHub 帳號 bitterdev 發布v1.0.3更新於 Oct 24, 2026
Renders letters as print ready PDFs, DIN 5008 compliant for German window envelopes.
概覽
將結構化信件資料渲染成符合 DIN 5008、適用於德國窗口信封的列印就緒 PDF,完全離線執行。
- 可以做什麼
- 這是一個本機 stdio MCP 伺服器,採用單一固定的 DIN 5008 版面,把結構化信件內容產生列印就緒的 PDF,收件人地址依標準定位,可對準 DL 與 C6/C5 窗口信封。工具包括 create_letter(渲染並寫出 PDF,回傳路徑、頁數、版面量測與警告)、preview_letter(同樣渲染但不寫入檔案)、prepare_signature(對掃描簽名進行裁切、去背與墨色重新著色並輸出 PNG)、get_din5008_spec、list_locales 與 list_fonts。支援多語信件、標記語法、清單、自動分頁、摺痕與打孔標記,以及簽名圖片。
- 適用情境
- 適合讓助理起草或產出正式的德式信件 PDF,尤其是需要裝入標準窗口信封的信件。適用於較重視一致固定版面、而非排版自由度的私人或商務通信。
- 執行需求
- 以本機 Node.js 程序執行,透過 npm 套件 pdf-letter-mcp 安裝並以 stdio 註冊。選用環境變數:PDF_LETTER_OUTPUT_DIR、PDF_LETTER_FONT_DIR、PDF_LETTER_FONT、PDF_LETTER_FONT_SIZE、PDF_LETTER_PROFILES、PDF_LETTER_PROFILE。寄件人地址與簽名來自本機設定檔,預設為 ~/.config/pdf-letter-mcp/profiles.json。沒有 Web 服務或外部 API,僅限桌面端。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Pdf Letter Mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
pdf-letter-mcp
Local MCP server (stdio) that turns structured letter data into a print ready PDF. One fixed layout, the everyday German letter, with the recipient address positioned per DIN 5008 so it sits exactly in the window of DL and C6/C5 window envelopes. No web service, no external API, everything runs offline on your machine.
Features
- One layout, no variants: return address line, recipient, right aligned "place, date", bold subject block with references below it, salutation, body, closing, signature, enclosures
- Address field 45 mm high ending at 105 mm from the left, with return address line, remark zone (Einschreiben, Nicht nachsenden) and address zone
- Return address, remarks and recipient are balanced inside the address field, so the block sits evenly in the envelope window and further address lines still fit.
addressLayout: "din"switches back to the fixed zone boundaries - Page breaks keep closing, signature image, name and enclosures together, follow-up pages carry recipient, date and page number
- Subject 33 mm below the address field, place and date three lines above it
- Fold marks at 105 mm and 210 mm, punch mark at 148.5 mm
- DIN 5008 writing margin of 25 mm on the left, and the address field follows it, so address, subject and body share one edge. The field keeps its right edge at 105 mm and stays inside the 90 mm envelope window
- Closing, one blank line, printed name.
signature.spaceMmreserves more room for signing by hand - Signature as an image file: PNG with alpha channel keeps its transparency, the image is laid over the blank line above the printed name and never shifts the text. Optional crop, background removal and ink recolouring for scans
- Multilingual: de, en, fr, es, it, nl, pt, pl, tr, da, sv, cs with locale aware date formats and address rules per country
- Language aware hyphenation, bold/italic markup, bullet and numbered lists, automatic page breaks with continuation headers
- Page numbers and a layout debug mode that draws the DIN 5008 zones
- Embedded Unicode fonts (DejaVu), any installed system font or a .ttf path
Install
Register the server in Claude Code:
Or in ~/.claude.json / claude_desktop_config.json:
Environment
Sender profiles
Sender addresses and signatures live in a file on the machine, never in the prompt. A letter names a profile, the server fills in address, return address line and signature image verbatim.
create_letter then only needs "profile": "erika" plus the content. The profile owns the identity: a sender or signature passed in the call is replaced by the profile, place, locale and closing are defaults that a letter may override. list_profiles shows what is available. Without a profile and without a sender the letter is refused instead of being invented.
The file belongs outside the repository, profiles.json is in .gitignore.
Layout is fixed
The MCP tools take content only: addresses, date, subject, references, text, signature, enclosures. There are no parameters for margins, spacing, font, image size or position, and unknown fields sent by a client are dropped. Typography is an installation setting (PDF_LETTER_FONT, PDF_LETTER_FONT_SIZE), so every letter of one installation looks identical. The building blocks for a company letterhead, an information block and a footer are still in the library, but they are not reachable through the MCP.
Tools
create_letter
The sender appears only in the small return address line above the recipient. Place and date sit right aligned above the bold subject block, references go directly below the subject.
Everything except sender, recipient and body is optional. The salutation is derived from the recipient (Frau plus Dr. Erika Mustermann becomes Sehr geehrte Frau Dr. Mustermann,), the date defaults to today, the closing to the locale default.
Body markup
- Blank line: new paragraph
- Single newline: line break (set
bodyModetomarkdownto reflow instead) - itemor1. item: bullet or numbered list**bold**,*italic*\pagebreakon its own line: forced page break
Signature
Two ways, both end up as a real image in the PDF:
- Pass the file directly:
signature.pathplustrimandremoveBackground. The scan is cleaned on every render. - Clean it once with
prepare_signatureand reuse the resulting PNG. Faster and lets you check the result before it goes into a letter.
trim, removeBackground and inkColor need the optional sharp dependency, which is installed by default. A PNG that already has a transparent background works without it.
The image is an overlay: closing, one blank line, printed name stay exactly where they are, and the signature sits on top of that blank line and across the closing, the way a signature is written over "Mit freundlichen Grüßen" on paper. That overlap is the intended result.
Size and position are decided by the renderer, not by the caller. The signature is scaled to roughly the width of the closing line, around 50 mm, capped proportionally at 1.2 times that width and 28 mm in height. There is no parameter for width, height, offset or spacing, so nothing can shift the layout letter by letter.
Verification
examples/ holds the German letter, the same letter in English and a debug variant that draws the DIN 5008 zones, so the address field position can be checked against a window envelope. preview_letter reports the same measurements as JSON, plus warnings when the address is too long or does not fit the address field.
License
MIT, see LICENSE. The bundled DejaVu fonts are covered by the Bitstream Vera and Arev licenses.
來源:README.md,提交 8e23a4a
工具
0版本歷史
1- v1.0.3最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分