Skip to main content
Glama
as7722314

mcp-office-parser

by as7722314
README.md
# mcp-office-parser

> ⚠️ **AI-Generated Project — Use With Caution**
>
> This project was generated with the assistance of AI. While efforts have been made to verify correctness, the code may contain errors, security vulnerabilities, or unexpected behavior. It has **not** been fully audited or tested in production environments. Use at your own risk, and always review the source code before deploying.

An MCP (Model Context Protocol) server for reading, writing, and converting LibreOffice and Microsoft Office documents — implemented in pure JavaScript with no external binary dependencies.

## Quick Start

```bash
npx @barry.wu0329/mcp-office-parser
```

## What It Does

`mcp-office-parser` exposes document manipulation capabilities as MCP tools that AI assistants (like Claude) can use to:

- **Read** ODT, DOCX, ODP, PPTX, TXT, and more
- **Read spreadsheets** from ODS, XLSX, CSV files
- **Create** new documents (ODT, ODS, DOCX, XLSX, PDF)
- **Edit** existing documents by inserting text
- **Convert** between formats (e.g., DOCX → PDF, ODT → TXT)
- **Search** through documents for specific content
- **Merge** multiple documents into one

## Configuration

### Claude Desktop

Add to `claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "mcp-office-parser": {
      "command": "npx",
      "args": ["@barry.wu0329/mcp-office-parser"]
    }
  }
}
```

### VS Code (MCP extension)

Add to `.vscode/mcp.json`:

```json
{
  "servers": {
    "mcp-office-parser": {
      "command": "npx",
      "args": ["@barry.wu0329/mcp-office-parser"]
    }
  }
}
```

## Supported File Formats

| Format | Read | Write | Notes |
|--------|------|-------|-------|
| `.odt` | ✅ | ✅ | LibreOffice Writer |
| `.ods` | ✅ | ✅ | LibreOffice Calc |
| `.odp` | ✅ | ✅ | LibreOffice Impress |
| `.docx` | ✅ | ✅ | Microsoft Word |
| `.xlsx` | ✅ | ✅ | Microsoft Excel |
| `.pptx` | ✅ | — | Microsoft PowerPoint |
| `.txt` | ✅ | ✅ | Plain text |
| `.csv` | ✅ | ✅ | Comma-separated values |
| `.pdf` | ✅ | ✅ | Read via pdf-parse; write via pdf-lib |
| `.html` | — | ✅ | HTML conversion output |

## Available MCP Tools

| Tool | Description |
|------|-------------|
| `get_document_info` | Get file metadata (size, format, modified time) |
| `read_document_text` | Extract plain text from a document |
| `read_spreadsheet_data` | Read spreadsheet data as a 2D array |
| `create_document` | Create a new document with content |
| `insert_text_at_position` | Insert text at start, end, or replace content |
| `list_documents` | Find all supported documents in a directory |
| `search_documents` | Search document contents for a query string |
| `get_document_statistics` | Word count, character count, sentence count, etc. |
| `convert_document` | Convert between formats |
| `merge_text_documents` | Merge multiple documents into one |

## MCP Resources

- `documents://` — Lists all discoverable documents as JSON
- `document://{path}` — Reads a document's text content

## Requirements

- Node.js >= 18.17.0
- No LibreOffice or other external tools needed

## License

MIT

TDQS

D1.8/5.0

Scored across 11 tools

Disambiguation3/5

Most tools have distinct targets (e.g., read_document_text vs. read_spreadsheet_data), but get_document_info and get_document_statistics could be confused, and insert_text_at_position and insert_table_docx are both insertion operations with unclear boundaries. Without descriptions, an agent might struggle to pick the right tool for metadata vs. statistics.

Naming Consistency4/5

All tools follow a verb_noun pattern (get, read, create, insert, list, search, convert, merge), which is consistent. Minor deviations include mixing 'read' and 'get' for similar actions, and suffixes like 'at_position' vs. 'docx' are not uniform, but the overall pattern is readable.

Tool Count5/5

11 tools is within the ideal 3-15 range and each tool seems to serve a distinct function in document processing. The count feels well-scoped and not bloated.

Completeness3/5

The surface covers reading, creating, inserting, converting, and merging documents, but lacks obvious operations like deleting or updating documents, and spreadsheet write capabilities are absent. This may force an agent to work around missing functionality for typical office document workflows.

Maintenance

ActivityInactive
ResponsivenessNo issues