PDF Gen Studio MCP Server

PDF Gen Studio MCP Server

Enables PDF and image generation from templates, JSON, HTML, or URLs through the PDF Gen Studio API. Supports rendering, template management, and multiple output formats.

Category
访问服务器

README

PDF Gen Studio MCP Server

A Model Context Protocol (MCP) server for PDF Gen Studio - Generate PDFs and images from templates, JSON, HTML, or URLs.

npm version License: MIT

Features

  • 📄 Template Rendering - Render saved templates with dynamic data injection
  • 🔧 JSON Rendering - Convert JSON design documents to PDF/images
  • 🌐 HTML Rendering - Convert HTML/CSS content to PDF/images
  • 📸 URL Rendering - Screenshot any website URL as PDF/images
  • 📋 Template Management - List and retrieve your saved templates

Installation

Using npm (Global)

npm install -g @pdfgenstudio/mcp

Using npx (No Install)

npx @pdfgenstudio/mcp

From Source

git clone https://github.com/Majid9287/pdfgenstudio-mcp.git
cd pdfgenstudio-mcp
npm install
npm run build

Using Docker

docker pull mcp/pdfgenstudio:latest

Or build locally:

docker build -t mcp/pdfgenstudio .

Configuration

Environment Variables

Set your PDF Gen Studio API key:

export PDFGENSTUDIO_API_KEY="your-api-key-here"

Or on Windows (PowerShell):

$env:PDFGENSTUDIO_API_KEY = "your-api-key-here"

Or on Windows (Command Prompt):

set PDFGENSTUDIO_API_KEY=your-api-key-here

Optional Configuration

Variable Description Default
PDFGENSTUDIO_API_KEY Your PDF Gen Studio API key Required
PDFGENSTUDIO_BASE_URL API base URL https://api.pdfgenstudio.com

Usage

As stdio Server (Default)

# Using global install
pdfgenstudio-mcp

# Using npx
npx @pdfgenstudio/mcp

# With explicit transport
pdfgenstudio-mcp --transport stdio

As HTTP Server

# Start HTTP server on port 3100
pdfgenstudio-mcp --transport http --port 3100

# Or with custom port
pdfgenstudio-mcp -t http -p 8080

Development & Testing

# Test with fastmcp CLI
npm run test

# Inspect with MCP Inspector
npm run inspect

🔌 Client Integrations

Claude Desktop

Add to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows: %APPDATA%\Claude\claude_desktop_config.json

Linux: ~/.config/Claude/claude_desktop_config.json

Using npx (Recommended)

{
  "mcpServers": {
    "pdfgenstudio": {
      "command": "npx",
      "args": ["-y", "@pdfgenstudio/mcp"],
      "env": {
        "PDFGENSTUDIO_API_KEY": "your-api-key-here"
      }
    }
  }
}

Using Local Installation

{
  "mcpServers": {
    "pdfgenstudio": {
      "command": "node",
      "args": ["/absolute/path/to/pdfgenstudio-mcp/dist/index.js"],
      "env": {
        "PDFGENSTUDIO_API_KEY": "your-api-key-here"
      }
    }
  }
}

After editing, restart Claude Desktop completely.


Docker Desktop (MCP Toolkit)

PDF Gen Studio MCP is available in Docker Desktop's MCP Toolkit catalog.

Option 1: Using Docker Desktop MCP Toolkit UI

  1. Open Docker Desktop
  2. Go to ExtensionsMCP Toolkit
  3. Search for "pdfgenstudio" in the catalog
  4. Click Install and configure your API key

Option 2: Manual Configuration

Add to your Claude Desktop configuration to use the Docker image:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "pdfgenstudio": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e", "PDFGENSTUDIO_API_KEY=your-api-key-here",
        "mcp/pdfgenstudio:latest"
      ]
    }
  }
}

Running Docker Container Directly

# Run in stdio mode (default) - for MCP client integration
docker run -it --rm \
  -e PDFGENSTUDIO_API_KEY="your-api-key-here" \
  mcp/pdfgenstudio:latest

# Run in HTTP mode - for local development/testing
docker run -it --rm -p 3100:3100 \
  -e PDFGENSTUDIO_API_KEY="your-api-key-here" \
  mcp/pdfgenstudio:latest node dist/index.js --transport http --port 3100

Using Docker Compose

# Create .env file with your API key
echo "PDFGENSTUDIO_API_KEY=your-api-key-here" > .env

# Run in stdio mode (default)
docker-compose up -d pdfgenstudio-mcp

# Run in HTTP mode (for local testing)
docker-compose --profile http up -d pdfgenstudio-mcp-http

VS Code (GitHub Copilot)

VS Code supports MCP servers through the GitHub Copilot extension.

Step 1: Enable MCP in VS Code

  1. Open VS Code Settings (Ctrl+, or Cmd+,)
  2. Search for github.copilot.chat.experimental.mcp
  3. Enable the setting

Step 2: Configure MCP Server

Create or edit .vscode/mcp.json in your workspace:

{
  "servers": {
    "pdfgenstudio": {
      "command": "npx",
      "args": ["-y", "@pdfgenstudio/mcp"],
      "env": {
        "PDFGENSTUDIO_API_KEY": "your-api-key-here"
      }
    }
  }
}

Or add to your VS Code User Settings (settings.json):

{
  "github.copilot.chat.experimental.mcp": true,
  "mcp": {
    "servers": {
      "pdfgenstudio": {
        "command": "npx",
        "args": ["-y", "@pdfgenstudio/mcp"],
        "env": {
          "PDFGENSTUDIO_API_KEY": "your-api-key-here"
        }
      }
    }
  }
}

Using Local Installation in VS Code

{
  "servers": {
    "pdfgenstudio": {
      "command": "node",
      "args": ["C:/path/to/pdfgenstudio-mcp/dist/index.js"],
      "env": {
        "PDFGENSTUDIO_API_KEY": "your-api-key-here"
      }
    }
  }
}

Cursor

Cursor has built-in MCP support. Configure it in Cursor settings.

Step 1: Open Cursor Settings

  1. Open Cursor
  2. Go to SettingsCursor SettingsMCP
  3. Or press Ctrl+Shift+P / Cmd+Shift+P and search "MCP"

Step 2: Add MCP Server

Add the following configuration:

{
  "mcpServers": {
    "pdfgenstudio": {
      "command": "npx",
      "args": ["-y", "@pdfgenstudio/mcp"],
      "env": {
        "PDFGENSTUDIO_API_KEY": "your-api-key-here"
      }
    }
  }
}

Alternative: Edit Config File Directly

macOS: ~/.cursor/mcp.json

Windows: %USERPROFILE%\.cursor\mcp.json

Linux: ~/.cursor/mcp.json

{
  "mcpServers": {
    "pdfgenstudio": {
      "command": "npx",
      "args": ["-y", "@pdfgenstudio/mcp"],
      "env": {
        "PDFGENSTUDIO_API_KEY": "your-api-key-here"
      }
    }
  }
}

Windsurf (Codeium)

Windsurf supports MCP through its configuration.

Configuration File Location

macOS: ~/.codeium/windsurf/mcp_config.json

Windows: %USERPROFILE%\.codeium\windsurf\mcp_config.json

Linux: ~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "pdfgenstudio": {
      "command": "npx",
      "args": ["-y", "@pdfgenstudio/mcp"],
      "env": {
        "PDFGENSTUDIO_API_KEY": "your-api-key-here"
      }
    }
  }
}

Zed Editor

Zed has native MCP support. Configure in Zed settings.

Configuration

Edit ~/.config/zed/settings.json:

{
  "language_models": {
    "mcp_servers": {
      "pdfgenstudio": {
        "command": "npx",
        "args": ["-y", "@pdfgenstudio/mcp"],
        "env": {
          "PDFGENSTUDIO_API_KEY": "your-api-key-here"
        }
      }
    }
  }
}

Continue (VS Code/JetBrains Extension)

Continue supports MCP servers for enhanced AI capabilities.

Configuration

Edit ~/.continue/config.json:

{
  "mcpServers": [
    {
      "name": "pdfgenstudio",
      "command": "npx",
      "args": ["-y", "@pdfgenstudio/mcp"],
      "env": {
        "PDFGENSTUDIO_API_KEY": "your-api-key-here"
      }
    }
  ]
}

HTTP/SSE Mode (For Custom Clients)

For clients that support HTTP-based MCP connections:

Start the Server

# Start HTTP server
npx @pdfgenstudio/mcp --transport http --port 3100

Endpoints

  • HTTP Streaming: http://localhost:3100/mcp
  • SSE: http://localhost:3100/sse
  • Health Check: http://localhost:3100/health

Example Client Connection

import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";

const transport = new StreamableHTTPClientTransport(
  new URL("http://localhost:3100/mcp")
);

const client = new Client({
  name: "my-client",
  version: "1.0.0",
});

await client.connect(transport);

Troubleshooting

Common Issues

  1. "API key not configured"

    • Ensure PDFGENSTUDIO_API_KEY is set in the env section
    • Check for typos in the environment variable name
  2. "Command not found" (npx)

    • Make sure Node.js 18+ is installed
    • Try using the full path to npx: /usr/local/bin/npx
  3. Server not connecting

    • Restart your IDE/application after configuration changes
    • Check the logs for error messages
    • Verify the path is correct for local installations
  4. Windows path issues

    • Use forward slashes / or escaped backslashes \\ in paths
    • Use absolute paths

Debug Mode

Run with debug logging:

DEBUG=* npx @pdfgenstudio/mcp

Verify Installation

# Test the server directly
npx @pdfgenstudio/mcp --help

# Test with MCP Inspector
npx fastmcp inspect /path/to/pdfgenstudio-mcp/src/index.ts

Available Tools

Template Tools

Tool Description
render_template Render a template to PDF/PNG/JPG with data injection
render_template_image Render template and return viewable image

JSON Tools

Tool Description
render_json Convert JSON design document to PDF/image
render_json_image Render JSON and return viewable image

HTML Tools

Tool Description
render_html Convert HTML/CSS to PDF/image
render_html_image Render HTML and return viewable image

URL Tools

Tool Description
render_url Screenshot webpage as PDF/image
render_url_image Screenshot and return viewable image

Management Tools

Tool Description
list_templates List all saved templates
get_template Get template details
get_template_schema Get modifiable template elements

Resources

The MCP server provides these resources:

URI Description
pdfgenstudio://templates List of all templates
pdfgenstudio://templates/{id} Specific template details
pdfgenstudio://docs/api API documentation
pdfgenstudio://config Current configuration status

Prompts

Pre-built prompts for common tasks:

Prompt Description
generate-invoice Generate invoice PDFs
generate-report Create report documents
capture-webpage Screenshot webpages
use-template Render templates with data
html-to-pdf Convert HTML to PDF

Example Usage

Render a Template

Use the render_template tool to generate a PDF from template ID "abc123" 
with the following data: {"name": "John Doe", "amount": "$500"}

Screenshot a Webpage

Capture a full-page screenshot of https://example.com as PNG

Generate HTML Report

Convert this HTML to PDF:
<html>
  <body>
    <h1>Monthly Report</h1>
    <p>Content here...</p>
  </body>
</html>

API Reference

For detailed API documentation, visit docs.pdfgenstudio.com

Development

# Install dependencies
npm install

# Build
npm run build

# Watch mode
npm run dev

# Test with MCP CLI
npm run test

# Inspect with MCP Inspector
npm run inspect

License

MIT License - see LICENSE for details.

Support

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选