Skip to main content
Glama
README.md
# Doc MCP Server šŸ“„

[![Python](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
[![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat-square)](LICENSE)
[![Stars](https://img.shields.io/github/stars/ceeyang-ai/doc-mcp-server?style=flat-square)](https://github.com/ceeyang-ai/doc-mcp-server)
[![MCP](https://img.shields.io/badge/MCP%20Server-5e81ac?style=flat-square)](https://github.com/ceeyang-ai/doc-mcp-server)
[![GitHub](https://img.shields.io/badge/GitHub-ceeyang--ai/doc--mcp--server-black?logo=github)](https://github.com/ceeyang-ai/doc-mcp-server)

A **Model Context Protocol (MCP)** server for document processing — PDF generation with Markdown rendering, text extraction, merging, and web-to-PDF conversion.

> Built for AI agents. Works with **Hermes Agent**, **Claude Code**, **Cursor**, and any MCP-compatible client.

## ✨ Features

| Tool | Description |
|------|-------------|
| `markdown_to_pdf` | Render Markdown → PDF with headings, lists, code blocks, HR |
| `generate_pdf` | Simple plain text → PDF with custom font size |
| `url_to_pdf` | Fetch a URL via [Jina Reader](https://r.jina.ai) and save as PDF |
| `extract_pdf_text` | Extract text from any PDF (file, URL, or base64) |
| `pdf_metadata` | Read PDF metadata (title, author, pages, size) |
| `merge_pdfs` | Merge multiple PDFs into a single document |
| `convert_text` | Text format conversion & cleanup (case, whitespace) |
| `count_words` | Word, character, line, paragraph & reading time stats |

## šŸš€ Quick Start

### Install

```bash
# From PyPI (coming soon)
pip install doc-mcp-server

# Or directly from GitHub
pip install git+https://github.com/ceeyang-ai/doc-mcp-server.git
```

### Run

```bash
# Start as MCP server (stdio mode)
doc-mcp-server
```

## šŸ”Œ Usage with AI Agents

### Hermes Agent

Add to `~/.hermes/config.yaml`:

```yaml
mcp_servers:
  doc:
    command: "doc-mcp-server"
```

Restart → use `mcp_doc_markdown_to_pdf`, `mcp_doc_extract_pdf_text`, etc.

### Claude Code / Cursor / Any MCP Client

Add to your MCP config:

```json
{
  "mcpServers": {
    "doc": {
      "command": "doc-mcp-server"
    }
  }
}
```

## šŸ“– Examples

### Markdown → PDF

```python
# Via MCP tool call
result = markdown_to_pdf(
    markdown="# My Report\n\n- Item 1\n- Item 2\n\n```python\nprint('hello')\n```",
    title="Report",
    filename="report.pdf"
)
```

### Merge PDFs

```python
result = merge_pdfs(
    sources=[
        "https://example.com/doc1.pdf",
        "/path/to/local/file.pdf",
    ]
)
```

### URL → PDF

```python
result = url_to_pdf(
    url="https://en.wikipedia.org/wiki/Markdown",
    filename="wiki-md.pdf"
)
```

## šŸ›  Requirements

- Python 3.10+
- fpdf2 ≄ 2.8
- PyMuPDF ≄ 1.24
- mcp ≄ 1.0

## šŸ“¦ Project Structure

```
doc-mcp-server/
ā”œā”€ā”€ doc_mcp_server/
│   └── __init__.py       # All tools + MarkdownPDF engine
ā”œā”€ā”€ pyproject.toml         # Build config (setuptools)
ā”œā”€ā”€ README.md
└── LICENSE (MIT)
```

## šŸ‘Øā€šŸ’» Development

```bash
git clone https://github.com/ceeyang-ai/doc-mcp-server.git
cd doc-mcp-server
pip install -e .
python3 -c "from doc_mcp_server import markdown_to_pdf; print(markdown_to_pdf('# Hello', 'Test'))"
```

## šŸ“„ License

MIT — free for personal and commercial use.

TDQS

B3.3/5.0

Scored across 8 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: text conversion, word counting, PDF extraction, PDF generation (two variants), PDF merging, metadata reading, and URL-to-PDF conversion. No two tools have overlapping functionality.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern in snake_case (e.g., convert_text, extract_pdf_text, merge_pdfs). The naming is predictable and easy to understand.

Tool Count5/5

With 8 tools covering text conversion, word counting, and various PDF operations (extraction, generation, merging, metadata, URL conversion), the count is well-scoped for a document processing server.

Completeness4/5

Missing some common operations like converting PDFs to other formats or editing PDF content, but the set is complete for core document tasks (create, read, merge, convert, and get metadata).

Maintenance

ActivityInactive
ResponsivenessNo issues