How to integrate Api2pdf MCP with Codex

Connect Codex to Api2pdf MCP. Merge monthly invoices into one pdf, extract specific pages from a large pdf, and more using natural language, with authentication handled for you.

Api2pdf logoApi2pdf
Api Key

Api2Pdf is a REST API for generating PDFs from HTML, URLs, and documents using powerful engines like wkhtmltopdf and Headless Chrome. It streamlines document conversion and automation for developers and businesses.

10 Tools

Introduction

Codex is one of the most popular coding harnesses out there. And MCP makes the experience even better. With the Api2pdf MCP integration, Codex can merge and optimize PDFs, extract and reorder pages, add headers and footers, and generate barcodes and QR codes, all without leaving the terminal or the app, whichever you prefer.

Also integrate Api2pdf with

Why use Composio?

Apart from a managed and hosted MCP server, you will get:

  • CodeAct: A dedicated workbench that allows GPT to write its code to handle complex tool chaining. Reduces to-and-fro with LLMs for frequent tool calling.
  • Large tool responses: Handle them to minimise context rot.
  • Dynamic just-in-time access to 20,000 tools across 1700+ other Apps for cross-app workflows. It loads the tools you need, so GPTs aren't overwhelmed by tools you don't need.

How to install Api2pdf MCP in Codex

Run the setup command

Run this command in your terminal to add the Composio MCP server to Codex.

Terminal

It will initiate the authentication in a browser window, authorize Codex to access your Composio account.

Composio authentication page

(Optional) Authenticate with OAuth

To authenticate manually, run the login command to open a browser window and authorize Codex to access your Composio account.

bash
codex mcp login composio

Verify the connection

Run codex mcp list to confirm Composio appears as a registered MCP server.

bash
codex mcp list

Codex App

Codex App follows the same approach as VS Code.

  1. Click ⚙️ on the bottom left → MCP Servers → + Add servers → Streamable HTTP:
  2. Fill the header and Key fields with { "x-consumer-api-key" = "ck_*******" }.
  3. The Key is the Composio API key, that you can find on dashboard.composio.dev
  4. Click on Authenticate and authorize Codex to your Composio account and you're all set.
Codex App MCP setup
  1. Restart and verify if it's there in .codex/config.toml
bash
[mcp_servers.composio]
url = "https://connect.composio.dev/mcp"
http_headers = { "x-consumer-api-key" = "ck_*******" }

Try it

Ask Codex for a Api2pdf task. The first time, Composio asks you to connect your Api2pdf account.

For example, ask it to:

  • "Merge monthly invoices into one PDF"
  • "Extract specific pages from a large PDF"
  • "Add custom header and footer to document"

What is the Api2pdf MCP server, and what's possible with it?

The API2PDF MCP server is an implementation of the Model Context Protocol that connects your AI agent and assistants like Claude, Cursor, etc directly to your API2PDF account. It provides structured and secure access to PDF and document processing tools, so your agent can create PDFs with headers and footers, merge documents, rearrange pages, reduce file sizes, and generate barcodes or QR codes on your behalf.

  • PDF creation and customization: Have your agent convert HTML into a PDF with customizable headers and footers using Headless Chrome.
  • Document assembly and page control: Direct your agent to merge multiple PDFs, extract selected pages, or reorder pages into a new sequence.
  • PDF optimization and conversion: Let the agent reduce a PDF's file size or convert a PDF document into HTML using LibreOffice.
  • Document thumbnail generation: Instruct your agent to create a thumbnail image from a document using LibreOffice.
  • Barcode and QR code creation: Have your agent generate barcodes or QR codes for labels, documents, and other workflows.

Conclusion

You've successfully integrated Api2pdf with Codex using Composio's MCP server. Now you can interact with Api2pdf directly from your terminal, VS Code, or the Codex App using natural language commands.

Key benefits of this setup:

  • Seamless integration across CLI, VS Code, and standalone app
  • Natural language commands for Api2pdf operations
  • Managed authentication through Composio
  • Access to 20,000+ tools across 1700+ apps for cross-app workflows
  • CodeAct workbench for complex tool chaining

Next steps:

  • Try asking Codex to perform various Api2pdf operations
  • Explore cross-app workflows by connecting more toolkits
  • Build automation scripts that leverage Codex's AI capabilities
TOOLS

Supported Tools

Every Api2pdf action and event your agent gets out of the box.

Add Header Footer

Convert HTML to PDF with customizable headers and footers using Headless Chrome.

Check API Status

Tool to check the health status of the API2PDF service.

Delete PDF

Delete a previously generated PDF from API2PDF storage by its response ID.

Extract PDF Pages

Tool to extract specific pages from a PDF document.

LibreOffice PDF to HTML

Tool to convert a PDF document to HTML using LibreOffice.

LibreOffice Thumbnail

Tool to generate a thumbnail image of a document using LibreOffice.

Merge PDFs

Merge multiple PDF documents into a single PDF file.

Optimize PDF

Tool to optimize a PDF document to reduce file size while maintaining quality.

Reorder PDF Pages

Reorder pages of a PDF using a source URL and a list of zero-based page indices in the desired order.

Generate Barcode or QR Code

Request a barcode or QR code for a text value using ZXing.

FAQ

Frequently asked questions

Start with Api2pdf.It takes 30 seconds.

Managed auth, hosted MCP servers, and every Api2pdf tool your agent needs.Free to start.

Start building