> ## Documentation Index
> Fetch the complete documentation index at: https://docs.peedief.com/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP Integration

> Set up AI agents for natural language PDF generation with templates

# MCP Integration for AI Agents

## Overview

MCP (Model Context Protocol) tools enable AI assistants like Claude to generate PDFs through natural conversation. Connect your AI agents to use your custom templates for intelligent document creation.

<Card title="Benefits of Template-First MCP Integration">
  * **Custom Template Usage**: AI agents use your specific template names
  * **Intelligent Data Collection**: AI guides users to provide the right information
  * **Professional Output**: Your custom templates ensure consistent, polished documents
  * **No HTML Generation**: AI works with structured data, not markup
  * **Brand Consistency**: All documents use your custom designs and branding
</Card>

## Setting Up MCP Tools

### For Claude Desktop

<Steps>
  <Step title="Open Claude Web App">
    Navigate to claude.ai in your web browser and sign in to your account
  </Step>

  <Step title="Access Tools">
    Click the tools icon located in the center below the search bar
  </Step>

  <Step title="Manage Connectors">
    In the settings menu, click on "Manage connectors" to view your MCP integrations
  </Step>

  <Step title="Add Custom Connector">
    Click "Add custom connector" and configure the following:

    * Name: `Peedief`
    * Remote MCP server URL: `https://peedief.com/api/mcp`
  </Step>

  <Step title="Connect to Server">
    Click the "Connect" button to initiate the connection to the Peedief MCP server
  </Step>

  <Step title="Authenticate">
    You'll be prompted to login with your Peedief account credentials to authorize the connection
  </Step>

  <Step title="Complete Setup">
    Once authenticated, the connector will be active and ready to use for PDF generation within Claude conversations
  </Step>
</Steps>

### For n8n

<Steps>
  <Step title="Generate an API Key">
    First, you'll need to create an API key for authentication:

    * Login to [https://peedief.com/app/sign-in](https://peedief.com/app/sign-in)
    * Go to API Keys section
    * Click "Create API Key"
    * Name your API key (e.g., "n8n Integration")
    * Hit "Create API Key"
    * Copy the API key and store it securely
  </Step>

  <Step title="Access AI Agent in n8n">
    In your n8n workflow, when using an AI Agent node
  </Step>

  <Step title="Add MCP Client Tool">
    Click the + icon near the "Tool" section, then select "MCP Client Tool"
  </Step>

  <Step title="Configure SSE Endpoint">
    Set the SSE Endpoint to: `https://peedief.com/api/sse`
  </Step>

  <Step title="Set Authentication">
    * Authentication: Header Auth
    * Credential for Header Auth: Create new Credential
  </Step>

  <Step title="Create Header Auth Credential">
    In the credential creation dialog:

    * Name: `x-api-key`
    * Value: `YOUR_API_KEY` (paste your API key from step 1)
    * Click "Save and Close"
  </Step>

  <Step title="Select Credential">
    Select the newly created credential in the "Credential for Header Auth" dropdown
  </Step>

  <Step title="Configure Tools">
    Set "Tools to Include" to "All" to enable all Peedief MCP tools
  </Step>
</Steps>

## Using MCP Tools

Once configured, AI agents can generate PDFs using specific template names through natural conversation.

### Template Name Workflow

**Using Your Custom Template Names:**

```
You: "Use template 'my-company-certificate' to create a certificate for John Smith completing Python Programming course today"

AI: I'll create a certificate using your template 'my-company-certificate' for John Smith.

[AI uses Peedief MCP tool with your template name 'my-company-certificate']

Certificate created successfully!
- Template: my-company-certificate
- Recipient: John Smith
- Course: Python Programming
- Completion Date: January 30, 2024
- Uses your custom design and branding

Download: [Certificate - John Smith - Python Programming]
```

**Template Creation Required:**
Before using MCP tools, you must first create templates in your Peedief dashboard. Each template you create has a name that you can reference in AI conversations.

### Template-Based PDF Generation

**Certificate Generation with Your Template:**

```
You: "Use template 'advanced-course-certificate' to create a certificate for John Smith who finished Advanced JavaScript yesterday with A+ grade, instructor Dr. Sarah Wilson"

AI: I'll create a professional certificate using your template 'advanced-course-certificate'.

[AI uses Peedief MCP tool with your template name 'advanced-course-certificate']

Perfect! I've generated a professional certificate with the following details:
- Template: advanced-course-certificate (your custom design)
- Recipient: John Smith  
- Course: Advanced JavaScript
- Completion Date: January 29, 2024
- Grade: A+
- Instructor: Dr. Sarah Wilson

The certificate uses your custom template design and branding.

Download: [Advanced JavaScript Certificate - John Smith]
```

### Advanced Template Usage

**Invoice Generation with Your Template:**

```
You: "Use template 'business-invoice-template' to generate an invoice for TechStart Inc. Include these services: 
- Web Development: 40 hours at $125/hour
- SEO Optimization: 10 hours at $200/hour  
- Invoice number should be INV-2024-001, due in 30 days, 8% tax rate"

AI: I'll create a professional invoice using your template 'business-invoice-template'.

[AI uses Peedief MCP tool with your template name 'business-invoice-template']

I've generated Invoice INV-2024-001 for TechStart Inc with:

Services:
- Web Development: 40 hrs × $125 = $5,000.00
- SEO Optimization: 10 hrs × $200 = $2,000.00

Subtotal: $7,000.00
Tax (8%): $560.00
Total: $7,560.00

Due Date: February 29, 2024

The invoice includes your company branding, payment terms, and professional formatting.

Download: [Invoice INV-2024-001 - TechStart Inc](https://storage.../invoice-techstart-001.pdf)
```

### Multi-Template Workflows

**Report Generation with Multiple Templates:**

```
You: "I need to create a quarterly business report that includes a cover page, executive summary, financial charts, and an appendix with detailed data tables. Use our Q4 2024 financial data."

AI: I'll create a comprehensive quarterly report using multiple templates.

[AI uses your specified report templates]

I've generated your Q4 2024 quarterly business report using:

1. **Professional Cover Page** - Company branding and report title
2. **Executive Summary** - Key metrics and highlights  
3. **Financial Charts** - Revenue trends, expense breakdown, profit margins
4. **Data Tables** - Detailed monthly figures and departmental budgets

The report includes:
- Total Pages: 12
- Charts: 4 financial visualizations
- Tables: 6 detailed data tables
- Professional formatting throughout

Download: [Q4 2024 Business Report](https://storage.../q4-2024-business-report.pdf)
```

## MCP Tool Capabilities

The Peedief MCP tools enable AI agents to:

<CardGroup cols={2}>
  <Card title="Template Usage" icon="file-text">
    Use your custom template names for document generation
  </Card>

  <Card title="Data Collection" icon="database">
    AI gathers required information through conversation
  </Card>

  <Card title="Data Validation" icon="shield-check">
    Validate user input against template schemas
  </Card>

  <Card title="PDF Generation" icon="file-pdf">
    Generate professional PDFs from structured data
  </Card>

  <Card title="Error Handling" icon="exclamation-triangle">
    Graceful handling of missing or invalid data
  </Card>

  <Card title="Usage Tracking" icon="chart-bar">
    Monitor API usage and generation limits
  </Card>
</CardGroup>

## Supported AI Assistants

### Claude Desktop

* ✅ **Full support** with native MCP integration
* ✅ **Easy setup** through settings menu
* ✅ **Automatic updates** for tool improvements

### Other MCP-Compatible Clients

* ✅ Any client supporting MCP protocol
* ✅ Custom authentication setup
* ✅ Standard MCP tool interface

<Note>
  While Claude Desktop is the primary supported platform, any MCP-compatible AI client can use Peedief tools with proper configuration.
</Note>

## Troubleshooting MCP Setup

### Common Issues

**"Tool not found" Error:**

* Verify MCP server configuration is correct
* Check that your API key is valid
* Restart Claude Desktop after configuration changes

**Authentication Failures:**

* Confirm API key has sufficient permissions
* Check if your API key has expired
* Verify the key is correctly set in environment variables

**PDF Generation Fails:**

* Ensure your account has remaining PDF credits
* Check if HTML content is valid
* Verify network connectivity to Peedief servers

### Getting Help

<CardGroup cols={2}>
  <Card title="MCP Documentation" icon="book" href="https://modelcontextprotocol.io">
    Learn more about the MCP protocol
  </Card>

  <Card title="Claude Desktop Setup" icon="desktop" href="https://claude.ai/desktop">
    Download and configure Claude Desktop
  </Card>
</CardGroup>

## Usage Limits

<Warning>
  MCP tool usage counts toward your regular Peedief plan limits:

  * **Free Plan**: 5 PDFs total
  * **Starter Plan**: 500 PDFs per month
  * **Basic Plan**: 1,500 PDFs per month
  * **Premium Plan**: 5,000 PDFs per month
</Warning>

Monitor your usage in the dashboard to avoid hitting limits during AI conversations.

## Next Steps

<Card title="Try It Out">
  Set up MCP tools with your AI assistant and start generating PDFs through natural conversation. The integration makes PDF creation seamless and intuitive!
</Card>
