惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
H
Help Net Security
Last Week in AI
Last Week in AI
The Cloudflare Blog
博客园 - 三生石上(FineUI控件)
小众软件
小众软件
IT之家
IT之家
aimingoo的专栏
aimingoo的专栏
大猫的无限游戏
大猫的无限游戏
Jina AI
Jina AI
Google DeepMind News
Google DeepMind News
B
Blog
C
Check Point Blog
T
Tailwind CSS Blog
云风的 BLOG
云风的 BLOG
D
Docker
Recent Announcements
Recent Announcements
Vercel News
Vercel News
博客园 - 聂微东
阮一峰的网络日志
阮一峰的网络日志
MyScale Blog
MyScale Blog
The GitHub Blog
The GitHub Blog
Stack Overflow Blog
Stack Overflow Blog
雷峰网
雷峰网
人人都是产品经理
人人都是产品经理
月光博客
月光博客
F
Fortinet All Blogs
Blog — PlanetScale
Blog — PlanetScale
B
Blog RSS Feed
The Register - Security
The Register - Security
V
Visual Studio Blog
F
Full Disclosure
Hugging Face - Blog
Hugging Face - Blog
T
Threat Research - Cisco Blogs
Latest news
Latest news
PCI Perspectives
PCI Perspectives
Cisco Talos Blog
Cisco Talos Blog
博客园 - Franky
D
DataBreaches.Net
A
Arctic Wolf
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
G
Google Developers Blog
P
Palo Alto Networks Blog
Engineering at Meta
Engineering at Meta
Microsoft Azure Blog
Microsoft Azure Blog
T
Tenable Blog
L
LINUX DO - 热门话题
Spread Privacy
Spread Privacy

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Generate PDFs and Word Documents Inside Claude Code and Cursor with MCP
Iteration La · 2026-04-30 · via DEV Community

The Template Treadmill

You need a PDF. Maybe it's an invoice for a client. Maybe it's a project report for the team. Maybe it's a product spec with tables and images.

So you open your template engine — LaTeX, Jinja2, wkhtmltopdf, Puppeteer, Carbone — and start wrestling with layout. Margins are wrong. The table overflows. The font doesn't embed. Two hours later you have a PDF that looks almost right and a build script you'll never want to touch again.

Developers have been generating documents this way for decades. Template files, rendering engines, format-specific quirks. What if your AI assistant could just build the document for you — right inside the tool you're already using?

That's what MCP makes possible. The Model Context Protocol is an open standard that lets AI tools like Claude Code and Cursor discover and call external APIs directly. Instead of writing template code, you describe what you want in plain language. The assistant figures out the document structure, calls the API, and hands you the file.

Iteration Layer's Document Generation API ships as an MCP server. Connect it once, and every conversation becomes a document authoring session.

What MCP Actually Is

MCP stands for Model Context Protocol. It's a standard that lets AI clients — Claude Code, Cursor, Windsurf, and any MCP-compatible tool — connect to external services as "tools" the model can invoke.

Think of it like USB for AI tools. You plug in a service, the assistant discovers what it can do, and it starts using it when relevant. No SDK integration, no template files, no deployment scripts.

When you connect Iteration Layer as an MCP server, your assistant gains the ability to generate documents from structured content — PDFs, Word documents, EPUB ebooks, and PowerPoint presentations. All from a chat prompt.

Setting Up in Claude Code

Claude Code supports MCP servers natively. Add the Iteration Layer server with a single command:

claude mcp add iterationlayer --transport http https://api.iterationlayer.com/mcp

Enter fullscreen mode Exit fullscreen mode

The first time you use an Iteration Layer tool, a browser window opens for OAuth authentication. Log in, authorize access, and you're connected. No API keys to manage.

To verify the server is available, start a conversation and ask Claude Code what MCP tools it has access to. You should see generate_document listed among the available tools.

Setting Up in Cursor

Add to your .cursor/mcp.json:

{
  "mcpServers": {
    "iterationlayer": {
      "type": "http",
      "url": "https://api.iterationlayer.com/mcp"
    }
  }
}

Enter fullscreen mode Exit fullscreen mode

Save and restart. The Document Generation tool is now available in your Cursor AI conversations. Authentication works the same way — OAuth in the browser on first use.

How Tool Discovery Works

When your AI assistant starts a conversation, it queries all connected MCP servers to learn what tools are available. The Iteration Layer MCP server advertises a generate_document tool with a description of its capabilities — supported formats, block types, styling options, and page configuration.

The assistant reads this tool description and knows when to use it. If you mention generating a document, creating a PDF, or building a report, the assistant recognizes that generate_document is the right tool. You never need to say "use Iteration Layer's Document Generation API" — it figures that out from context.

This is the key difference from a traditional template approach. You don't write markup. You don't configure a rendering engine. The assistant handles the translation between your natural language request and the structured API call.

Generating Documents Conversationally

Once connected, you describe the document you want in natural language. Here's what that looks like.

You type:

"Generate a PDF invoice for Acme Corp. Invoice number INV-2026-0312, dated March 1, 2026. Three line items: 'Consulting hours (40h)' at $6,000, 'Infrastructure setup' at $2,400, and 'Documentation' at $800. Subtotal $9,200, tax 19% ($1,748), total $10,948. Use A4 with comfortable margins."

The assistant translates that into a structured document definition — headlines, paragraphs, a table with header and body rows, styled text for the totals — calls the API, and returns the PDF. The whole exchange takes seconds.

You can iterate from there:

"Add the company logo from https://example.com/acme-logo.png at the top right. Make the invoice number bold. Add a footer with 'Payment due within 30 days' on every page."

The assistant adjusts the content blocks, adds an image block and a footer definition, and regenerates. Same workflow you'd follow in a word processor — but through conversation.

More Conversations, More Use Cases

The conversational interface handles far more than invoices. Here are a few more prompts and what the assistant does with them.

Creating a project report:

"Generate a PDF report titled 'Q1 Performance Review'. Add a table of contents. Three sections: 'Revenue' with a summary paragraph and a table of monthly figures, 'Customer Growth' with a paragraph and a bar chart placeholder image, and 'Outlook' with two paragraphs. Use Letter size, professional styling."

The assistant builds the document with headlines at the right levels, a table-of-contents block that auto-generates from those headlines, tables with proper headers, and paragraph blocks with the text you described. Page breaks between sections keep the layout clean.

Generating a Word document:

"Create a DOCX employee handbook. Title page with 'Employee Handbook — 2026' centered. Sections for 'Code of Conduct', 'Benefits', 'Time Off Policy', and 'Remote Work'. Use a numbered list for the conduct rules and a table for the PTO breakdown by tenure. Include page numbers in the footer."

The assistant sets the format to docx and builds the content with headlines, lists, tables, page breaks, and a footer containing a page-number block. The output is an editable Word document — not a locked PDF. Your HR team can refine it further.

Building an EPUB ebook:

"Generate an EPUB with the title 'Getting Started with Elixir'. Three chapters: 'Installation', 'Basic Types', and 'Pattern Matching'. Each chapter gets a headline and two paragraphs of content. Add a table of contents at the beginning."

The assistant produces a valid EPUB file with proper navigation, a generated table of contents, and chapter structure. Drop it on a Kindle or open it in any ebook reader.

Creating a presentation:

"Generate a PPTX with 5 slides. Title slide: 'Product Roadmap Q2'. Then one slide each for 'Auth Improvements', 'API v2', 'Dashboard Redesign', and 'Timeline'. Each content slide gets a headline and 3-4 bullet points."

The assistant generates a PowerPoint file with structured slides. Open it in PowerPoint or Google Slides to add your own styling and visuals.

Iterating on Documents Conversationally

The real power of MCP is the feedback loop. After the first generation, you refine the document based on what you see.

Say the invoice table looks right but the footer text is too small. You reply:

"Make the footer text 8pt and light gray. Also add a horizontal separator line above it."

The assistant updates the footer styles and adds a separator block. No template to edit, no build to re-run. You iterate on the document in plain language until it matches what you need.

This is especially valuable when you're figuring out the right structure for a new document type. Instead of guessing the layout upfront, tweaking template markup, rebuilding, and checking — you have a conversation. Once the document looks right, you can take that exact structure and use it in your production code via the API.

What You Can Build

The Document Generation API supports content block types that cover most document authoring needs:

  • Paragraphs — text with full markdown support (bold, italic, links), custom fonts, and per-block style overrides
  • Headlines — h1 through h6, automatically collected for table of contents generation
  • Tables — header rows, body rows, per-cell content, configurable column widths and border styles
  • Grids — 12-column layout system for multi-column content within a document
  • Lists — ordered and unordered, with nested sub-items
  • Images — embedded from URLs or base64, with width and height control
  • Table of contents — auto-generated from your headline hierarchy
  • QR codes — generated from any value, with custom size and colors
  • Barcodes — six formats (Code 128, EAN-13, Codabar, Code 39, EAN-8, ITF)
  • Separators — horizontal rules with configurable style, thickness, and spacing
  • Page breaks — explicit control over pagination

Four output formats from one content model: PDF, DOCX, EPUB, and PPTX. Define the document once, generate it in whichever format you need.

Custom Fonts and Styling

The API accepts custom fonts in TTF, OTF, WOFF, and WOFF2 formats. Reference them by URL or base64 in the request, then use them across your document.

Every element is stylable. Document-level styles set the defaults — font family, size, color, line height for text; spacing and weight for headlines; border styles for tables. Individual blocks can override any style property, so a single paragraph can use a different font without changing the rest of the document.

When you tell the assistant "use Inter for body text and Playfair Display for headlines, dark navy color scheme," it knows to include both font definitions and set the appropriate styles at the document level.

Headers, Footers, and Page Numbers

Documents support headers and footers that repeat on every page. Both accept the same block types as the main content — paragraphs, images, separators, and more. A common pattern is a company logo in the header and page numbers in the footer.

The page-number block type renders the current page number dynamically. Place it in your footer with a text alignment and the API handles the numbering across all pages.

MCP vs Direct API Calls

MCP is for ad-hoc work. You need one document, right now, and you don't want to write code. The assistant handles the document structure, the styling, the block composition. You describe, it generates.

For production pipelines — generating invoices from order data, creating reports on a schedule, building documents from CMS content — use the API directly. The request body is JSON. Any language that can make an HTTP POST can generate documents.

The two approaches complement each other. Prototype in conversation with MCP, then extract the document structure into your codebase for automation. The JSON definition you refined conversationally is the same JSON you pass to the API endpoint — no translation needed.

Get Started

Sign up for a free account at iterationlayer.com — no credit card required. Run the claude mcp add command above, authenticate in the browser, and generate your first document from your next Claude Code or Cursor conversation.

The docs cover every block type, every style property, and every output format. Start with a simple invoice or report — it's the fastest way to see how structured document generation feels different from templates.