How Do You Set Up Foxit's PDF MCP Server and Make Your First Tool Call?
AI agents work with PDFs all the time. With raw REST calls (plain HTTP requests to a PDF API), each PDF job needs the same code around it. Each job starts with an upload and a call to the operation you want. Then you wai
AI agents work with PDFs all the time. With raw REST calls (plain HTTP requests to a PDF API), each PDF job needs the same code around it. Each job starts with an upload and a call to the operation you want. Then you wait. Your code polls the taskId that the API returns until the job is done, and only then downloads the result. Error handling and auth tokens for several endpoints add more code. The next conversion or merge needs that whole loop again.
An MCP server from Foxit does that REST work inside its own process. MCP stands for Model Context Protocol, an open standard for connecting AI apps to outside tools. Claude Desktop, VS Code and Cursor all support it. The server exposes Foxit's cloud PDF Services API as 30+ tools, and your agent calls each one by name. According to Albano Moura's guide, a first working call takes under 15 minutes.
Full guide: Foxit MCP Server: Give AI Agents Direct Access to 30+ PDF Tools via Model Context Protocol
How do you connect the server to your AI app?
You add one entry to the app's MCP config file. Then you restart the app.
Before that, you need a free Foxit developer account. Signing up needs no credit card. The account gives you 2 keys for PDF Services: a client_id and a client_secret. You also need Python 3.11+ with the uv package manager. The TypeScript version of the server needs Node.js 18+ and pnpm instead.
Clone Foxit's foxit-pdf-api-mcp-server repo from GitHub. In Claude Desktop, go to Settings > Developer > Edit Config. Then open claude_desktop_config.json in a text editor and add the guide's entry under the mcpServers key:
{
"mcpServers": {
"foxit-pdf": {
"command": "uv",
"args": [
"--directory",
"/path/to/foxit-pdf-api-mcp-server",
"run",
"foxit-pdf-api-mcp-server"
],
"env": {
"FOXIT_CLOUD_API_HOST": "https://na1.fusion.foxit.com/pdf-services",
"FOXIT_CLOUD_API_CLIENT_ID": "your_client_id",
"FOXIT_CLOUD_API_CLIENT_SECRET": "your_client_secret"
}
}
}
}
Point --directory at the folder you cloned. The env block holds the 3 variables the server reads. The same command, args and env values work in any AI app that supports MCP.
Quit Claude Desktop completely, then reopen it. The app starts the server as a local subprocess that talks over stdio (standard input and output). The server should now show as Running in the Developer tab, and its 30+ tools should appear under Customize > Connectors > foxit-pdf.
If the server never shows up, it failed to start. Claude's MCP logs usually show the cause. The guide names 2 common causes: a missing uv binary or a wrong --directory path.
VS Code works too. Its entry goes in .vscode/mcp.json under a top-level servers key, and it needs "type": "stdio" so VS Code starts the server the same way. The MCP: Add Server command in the Command Palette can write that entry for you.
What does a tool call look like?
A tool call is a small JSON object with the tool's name and its input. The server describes each tool with a JSON schema, and the AI app reads that schema to learn what the tool takes and returns.
Most tools work on document IDs. You get one by sending a file to Foxit's cloud with upload_document. In the guide's example, the agent then calls pdf_from_word with the ID of an uploaded Word file:
{
"name": "pdf_from_word",
"input": {
"documentId": "doc_abc123"
}
}
While PDF Services runs the conversion in the background, the MCP server keeps polling until the job is done. Its reply carries the new PDF's ID in resultDocumentId:
{
"success": true,
"taskId": "task_xyz789",
"resultDocumentId": "doc_result456",
"message": "Word document converted to PDF successfully. Download using documentId: doc_result456"
}
To save the new PDF, the agent calls download_document with that ID. The next tool can also take the ID directly. For example, pdf_compress can shrink the new PDF.
The agent writes these calls for you. You type a request in plain words. The guide's example is "Convert this Word file to PDF and compress it." For that request, the agent picks pdf_from_word and pdf_compress. For every call, Claude Desktop opens an approval prompt with the tool's name and its exact arguments. The call waits for your approval. Then its JSON result comes back into the chat. Because you see which tool the agent chose and what it is about to send, the guide calls this prompt your audit point.
For a first test, the guide suggests pdf_from_url with any public URL. It needs no upload.
How do the pieces fit together?
The AI app sits in the middle. It talks to the model at its provider. Once you approve a tool call, the app passes it to the local Foxit MCP server. That server sends the job to PDF Services in Foxit's cloud.
- The AI app runs the Foxit MCP server as a local subprocess. When it connects, the app discovers the server's 30+ tools.
- Every tool call passes through your approval prompt in Claude Desktop.
- PDF Services runs the job. The MCP server polls until the job finishes, then returns the
resultDocumentIdto the agent. - Before the model reads the layout report, your code filters it. That report comes from
pdf_structural_analysisas JSON with the position of every heading, paragraph and table cell. - DocGen fills a document template with your values, and eSign sends a document out for signature. The Foxit MCP server does not cover them. Your own MCP tools reach them.
- Your
client_idandclient_secrettravel with every call to PDF Services. The guide says to set them as environment variables and keep them out of the prompt.
What did I learn about building on the server?
The steps above come from Albano Moura's guide. It's worth sharing. Beyond the setup, reading it taught me 4 things.
Why does the layout report need a filter?
The report for a long contract can be too big for the context window (the most text a model can handle in one request). The guide says the report's JSON can run to many thousands of elements. If you send it whole, the extraction tends to come back truncated or confused. That failure raises no clean error.
Because pdf_structural_analysis returns the ID of a ZIP file, the agent has to fetch it with download_document and unzip it. The guide puts the filter in the code that does the unzipping. Keep only the element types and pages that matter. For a contract, the guide says that usually means the heading blocks and the relevant table. The model then reads what is left to find values like the customer's name.
How do you add signing and document generation?
You wrap the eSign and DocGen calls you need in custom MCP tools with typed inputs. The guide's examples are create-folder, send-folder and generate-document.
eSign and DocGen are separate Foxit REST APIs. The agent could also reach them from a code interpreter (a tool where the model writes and runs its own code). The guide says raw HTTP from there breaks easily and is hard to audit. It recommends custom tools instead. The AI app calls them by name like the PDF tools, and their keys stay inside the tool's process instead of the prompt.
eSign calls a signing package a folder: one or more PDFs plus the signers. In the guide's signing flow, the agent creates the folder with POST /api/folders/createfolder, then sends it to the signers with POST /api/folders/sendDraftFolder. DocGen needs no polling. Its /document-generation/api/GenerateDocumentBase64 call returns the finished PDF in the response body.
Which keys does eSign use?
A separate pair. Your eSign tool sends its own client ID and secret to /api/oauth2/access_token on the eSign host and gets back an access token. This is the OAuth2 client-credentials flow. PDF Services works differently. It takes your PDF Services keys as headers on each call. Foxit keeps the 2 sets of keys apart by design.
Which eSign host should you call?
Pick the host that meets your data residency rules (the rules on where your data may be processed). The guide uses the US host, na1.foxitesign.foxit.com. Foxit also runs eu1.foxitesign.foxit.com for the EU, na2.foxitesign.foxit.com for Canada and au1.foxitesign.foxit.com for Australia. Only the host changes. The endpoints and request bodies stay the same.
How would I start with it?
Because every file the server handles is processed in Foxit's cloud, I would start with public documents. I would run pdf_structural_analysis on a PDF as a layout check before its text goes into the AI systems I build to answer questions from documents.
Albano's guide also walks through a sales agent that builds a contract from a Word template and routes it for signature.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.