npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

documents-mcp

v1.1.2

Published

MCP server for creating and reading PDF, DOCX, and PPTX documents

Readme

Documents MCP

An MCP (Model Context Protocol) server that provides AI agents with tools to create and read PDF, DOCX, and PPTX documents.

Features

  • Create PDF - Generate PDF documents with text, headings, tables, images, and page numbers
  • Create DOCX - Generate Word documents with headings, paragraphs, lists, tables, and images
  • Create PPTX - Generate PowerPoint presentations with slides, text, shapes, tables, and charts
  • Read PDF - Extract text content and metadata from PDF files (supports Gemini AI analysis)
  • Read DOCX - Extract text and HTML content from Word documents (supports Gemini AI analysis)
  • Read PPTX - Extract text content from PowerPoint presentations (supports Gemini AI analysis)

Installation

npm install documents-mcp

Or use directly with npx:

npx documents-mcp

Usage with Claude Desktop

Add to your Claude Desktop configuration (~/.config/claude/claude_desktop_config.json on macOS/Linux or %APPDATA%\Claude\claude_desktop_config.json on Windows):

{
  "mcpServers": {
    "documents-mcp": {
      "command": "npx",
      "args": ["documents-mcp"],
      "env": {
        "OUTPUT_DIR": "/path/to/output/documents"
      }
    }
  }
}

Environment Variables

All environment variables are optional. Configure only the providers you need:

AI Provider API Keys

| Variable | Description | |----------|-------------| | OPENAI_API_KEY | OpenAI API key | | ANTHROPIC_API_KEY | Anthropic API key | | GOOGLE_API_KEY | Google AI API key | | GEMINI_API_KEY | Gemini API key (alias for GOOGLE_API_KEY) | | PERPLEXITY_API_KEY | Perplexity API key | | XAI_API_KEY | xAI (Grok) API key | | GROQ_API_KEY | Groq API key |

Local Model Endpoints

| Variable | Default | Description | |----------|---------|-------------| | OLLAMA_BASE_URL | http://localhost:11434 | Ollama server URL | | LMSTUDIO_BASE_URL | http://localhost:1234 | LM Studio server URL | | VLLM_BASE_URL | http://localhost:8000 | vLLM server URL |

Output Configuration

| Variable | Default | Description | |----------|---------|-------------| | OUTPUT_DIR | Current directory | Default directory for saved documents |

Tool Reference

create-pdf

Create a PDF document with structured content.

Parameters:

  • title (required): Document title
  • author (optional): Document author
  • content (required): Array of content items:
    • { type: "text", content: string, fontSize?: number, bold?: boolean, color?: {r, g, b} }
    • { type: "heading", content: string, level: 1-6 }
    • { type: "table", headers: string[], rows: string[][] }
    • { type: "image", base64: string, format: "png"|"jpg"|"jpeg", width?: number, height?: number }
    • { type: "pageBreak" }
  • outputPath (optional): File path to save the PDF
  • pageSize (optional): "A4", "Letter", or "Legal"

create-docx

Create a Word document with rich formatting.

Parameters:

  • title (required): Document title
  • author (optional): Document author
  • content (required): Array of content items:
    • { type: "text", content: string, bold?: boolean, italic?: boolean, underline?: boolean }
    • { type: "heading", content: string, level: 1-6 }
    • { type: "paragraph", content: string, alignment?: "left"|"center"|"right"|"justified" }
    • { type: "bulletList", items: string[] }
    • { type: "numberedList", items: string[] }
    • { type: "table", headers: string[], rows: string[][] }
    • { type: "image", base64: string, width?: number, height?: number }
    • { type: "pageBreak" }
  • outputPath (optional): File path to save the DOCX

create-pptx

Create a PowerPoint presentation.

Parameters:

  • title (required): Presentation title
  • author (optional): Presentation author
  • slides (required): Array of slide objects:
    • title (optional): Slide title
    • subtitle (optional): Slide subtitle
    • layout: "title", "titleAndContent", "blank", or "sectionHeader"
    • elements: Array of elements:
      • { type: "textBox", text: string, x?, y?, w?, h?, fontSize?, bold?, color?, align? }
      • { type: "image", base64: string, x?, y?, w?, h? }
      • { type: "shape", shapeType: "rect"|"ellipse"|"triangle"|"line"|"arrow", ... }
      • { type: "table", headers: string[], rows: string[][], x?, y?, w? }
      • { type: "chart", chartType: "bar"|"line"|"pie"|"doughnut", data: [...], ... }
    • backgroundColor (optional): Slide background color
    • notes (optional): Speaker notes
  • outputPath (optional): File path to save the PPTX

read-pdf

Extract text content from a PDF file.

Parameters:

  • filePath (optional): Path to the PDF file
  • base64Content (optional): Base64-encoded PDF content
  • prompt (optional): Instruction for AI analysis (requires GOOGLE_API_KEY)

Returns: { text, metadata: { pageCount, info, version }, characterCount, wordCount, aiAnalysis? }

read-docx

Extract text content from a Word document.

Parameters:

  • filePath (optional): Path to the DOCX file
  • base64Content (optional): Base64-encoded DOCX content
  • outputFormat (optional): "text", "html", or "both"
  • prompt (optional): Instruction for AI analysis (requires GOOGLE_API_KEY)

Returns: { text?, html?, characterCount, wordCount, aiAnalysis? }

read-pptx

Extract text content from a PowerPoint presentation.

Parameters:

  • filePath (optional): Path to the PPTX file
  • base64Content (optional): Base64-encoded PPTX content
  • prompt (optional): Instruction for AI analysis (requires GOOGLE_API_KEY)

Returns: { text, slideCount, slides: [{slide, text}], aiAnalysis? }

Running as HTTP Server

Start the HTTP server for web-based MCP clients:

npm run start:http
# or
npx documents-mcp-http

The HTTP server exposes:

  • GET /sse - SSE endpoint for MCP clients
  • POST /messages?sessionId=<id> - Message endpoint for SSE sessions
  • GET /health - Health check endpoint

Client SDK

Use the client SDK to connect to the documents-mcp server programmatically:

import { createClient } from "documents-mcp/client";

// Connect via STDIO (for CLI usage)
const client = createClient({
  transport: "stdio",
  command: "documents-mcp",
});

await client.connect();

// List available tools
const tools = await client.listTools();
console.log(tools);

// Create a PDF
const result = await client.createPdf({
  title: "My Document",
  content: [
    { type: "heading", content: "Hello World", level: 1 },
    { type: "text", content: "This is a sample document." },
  ],
});

console.log(result.content); // { success: true, filePath: "...", pageCount: 1 }

await client.disconnect();

SSE Transport

For HTTP/SSE connections:

const client = createClient({
  transport: "sse",
  url: "http://localhost:3000/sse",
});

await client.connect();
// ... use client methods
await client.disconnect();

Available Client Methods

| Method | Description | |--------|-------------| | connect() | Connect to the MCP server | | disconnect() | Disconnect from the server | | listTools() | List available tools | | callTool(name, args) | Call any tool by name | | createPdf(options) | Create a PDF document | | createDocx(options) | Create a Word document | | createPptx(options) | Create a PowerPoint presentation | | readPdf(options) | Extract text from a PDF | | readDocx(options) | Extract text from a Word document | | readPptx(options) | Extract text from a PowerPoint |

Programmatic Usage (Direct)

You can also use the document tools directly without the MCP server:

import { createPdf, readPdf } from "documents-mcp";

// Create a PDF
const result = await createPdf.handler(
  createPdf.schema.parse({
    title: "My Document",
    content: [{ type: "text", content: "Hello World" }],
  })
);

// Read a PDF
const extracted = await readPdf.handler(
  readPdf.schema.parse({
    filePath: "/path/to/document.pdf",
  })
);

Development

# Clone the repository
git clone https://github.com/HarjjotSinghh/documents-mcp.git
cd documents-mcp

# Install dependencies
npm install

# Run in development mode
npm run dev

# Build for production
npm run build

License

MIT