PUB Viewer command line and local API
Read Microsoft Publisher .pub files from your own programs: command line and local HTTP API, on your computer or on a server in your network. Text, pictures and HTML as JSON, without sending documents to the cloud.
Download (Windows, macOS, Linux) For AI assistants
Why local
- Your documents never leave your network: no cloud service to trust with your files, and simpler for GDPR too.
- No call limits and no per-request cost: process as many publications as you want, at the speed of your computer.
- The same converter as the website and the app: text of every page in reading order, tables, pictures and an HTML copy.
- JSON answers, identical for the command line, the API and the AI assistants.
Installation
- Download pubviewer-mcp.zip and extract it to a folder. Node.js 18 or newer is required.
- Open a terminal in the folder and try:
node server.js help. - The first 10 documents are free; after that you need PUB Viewer Pro:
node server.js login(email and code).
Command line
node server.js read "C:\docs\brochure.pub"
node server.js images "C:\docs\brochure.pub" "C:\docs\pictures"
node server.js html "C:\docs\brochure.pub" "C:\docs\html"
node server.js folder "C:\docs"Every command prints its result as JSON. Exit codes: 0 success, 1 error (message on stderr), 3 PUB Viewer Pro needed. For old files with non-Western text add --codePage 1251 (or another Windows code page).
Local HTTP API
Start the API: it answers on http://127.0.0.1:8766, only to this computer.
node server.js servePOST /v1/read_publication– title, properties, text of every page, picturesPOST /v1/extract_images– the pictures (saved in a folder, or as base64 in the answer)POST /v1/publication_to_html– self-contained HTML copy (in a folder, or inline)POST /v1/read_folder– one row per .pub file of a folder: pages, title, words, picturesGET /openapi.json– OpenAPI 3.1 description ·GET /v1/tools– tools and schemas ·GET /health– status and licence
Send the file in the request body (application/octet-stream, file name in the name parameter) or, if your program runs on the same machine, its path as JSON:
curl -X POST "http://127.0.0.1:8766/v1/read_publication?name=brochure.pub" ^
-H "content-type: application/octet-stream" --data-binary @brochure.pub
curl -X POST http://127.0.0.1:8766/v1/read_folder -H "content-type: application/json" ^
-d "{\"folder\": \"C:/docs\"}"In Python:
import requests
with open("brochure.pub", "rb") as f:
r = requests.post("http://127.0.0.1:8766/v1/read_publication",
params={"name": "brochure.pub"}, data=f,
headers={"content-type": "application/octet-stream"})
doc = r.json()["result"]
print(doc)Answers are {"ok": true, "result": …} or {"ok": false, "error": "…", "code": "…"}, with HTTP status 402 when Pro is needed.
On a server in your company network
node server.js serve --host 0.0.0.0 --port 8766 --token A-LONG-SECRET-PHRASEPrograms send the token with every request (Authorization: Bearer …). Requests coming from web pages and requests with a different host name are refused.
Build your own agent or MCP server
The API exposes the same tools as the extension for AI assistants, with JSON schemas in /v1/tools and /openapi.json: you can connect them to your own agent, to an MCP server of yours, to an automation flow, or generate a client for your language. If you use Claude, Cursor or VS Code, the extension is ready to go.
Licence and price
Command line, local API and the extension for AI assistants are a PUB Viewer Pro feature: €9.99, one-off, the same licence as the website and the Windows app. The first 10 documents are free. The licence is personal: one person, on their own devices, also for work.
Frequently asked questions
Do I need an Internet connection?
No. The command line and the API work on the computer or server where you start them, even offline. The Internet is only used to activate Pro (email and code).
Which programming languages can I use?
Any language that can make an HTTP request and read JSON: Python, C#, Java, PHP, JavaScript, PowerShell, VBA… The OpenAPI description (/openapi.json) lets you generate the client for your language automatically.
Can I build my own MCP server or agent on top of the API?
Yes. The API exposes the same tools as the extension for AI assistants, with published JSON schemas, so you can use them in your own agent, your own MCP server or an automation flow. If you just want to use it with Claude, Cursor or VS Code, there is already a ready-made extension.
Is it safe to run it on a company server?
By default it only answers to the computer it runs on. On a network start it with a secret token (--token), which your programs send with every request; requests from web pages and with a different host name are refused. To reach it from outside your internal network use a proxy with HTTPS.
Does it make PDFs? Does it run on Linux and Mac?
It reads and extracts: text, pictures, HTML copy, folder inventory. PDF is done by the Windows app or the website. The package itself runs on Windows, Linux and macOS with Node.js 18 or newer.