dsh-document-editor
DiscoveredDSH MCP server for reading, creating, editing, and verifying PDF, Word, Excel, and PowerPoint files.
dsh-document-editor
DSH MCP server for reading, creating, editing, and verifying PDF, Word, Excel, and PowerPoint files. The tools use the existing Python libraries and return structured results.
Tools
| Format | Tools |
|---|---|
create_pdf, read_pdf, edit_pdf | |
Word (.docx) | create_word_document, read_word_document, modify_word_document |
Excel (.xlsx) | create_excel_workbook, read_excel_workbook, modify_excel_worksheet |
PowerPoint (.pptx) | create_pptx_presentation, read_pptx_presentation, modify_pptx_presentation |
| All four | verify_document |
Edit tools create a sibling *_edited file by default, preserving the source. Pass output_path to choose another destination. Writes replace the destination only after the complete file has been saved successfully.
Install
Python 3.10 or newer is required.
pip install -r src\requirements.txt
Add cordis.patch.yml to the DSH profile and set command to the absolute path of the Python interpreter that has these dependencies installed. Restart the profile after changing its MCP configuration. Do not use uv run unless its environment also has the dependencies.
Use
Paths may be absolute or relative to the MCP server's current working directory. Tools create parent folders when writing output files.
Security and privacy
The server runs locally over MCP stdio and makes no network requests. It can read any path passed to a tool, subject to the operating system permissions of the user running it. Read tools return extracted document contents to the connected MCP client, which handles them under its own data policy.
Formats
create_pdf takes pages: [{content, pagesize?}], with optional title, author, and output_path. Long text flows across as many pages as needed; pagesize accepts A4 or Letter. Chinese text uses ReportLab's built-in STSong CID font.
read_pdf returns metadata and extracted text by page. edit_pdf appends text pages and writes a copy by default. verify_document strictly parses PDFs and reports page and readable-text counts.
{
"title": "项目报告",
"author": "张三",
"pages": [{"content": "中文报告正文。", "pagesize": "A4"}],
"output_path": "report.pdf"
}
Word
create_word_document accepts paragraphs: [{text, style?}] and tables: [{headers?, rows}]. Heading styles such as heading1 and heading2 are supported.
modify_word_document accepts paragraphs, tables, and table_updates. A paragraph with a zero-based index replaces that paragraph; one without an index is appended. table_updates entries use {table_index, row_index, column_index, text} with zero-based indexes. New tables use {headers?, rows}.
read_word_document returns paragraphs and table cell data.
Excel
create_excel_workbook takes sheets: [{name, headers?, rows?}].
modify_excel_worksheet edits the named sheet (creating it if needed); if omitted, it edits the first sheet. cells maps A1-style addresses to values or formulas, for example {"B2": 12, "C2": "=SUM(A2:B2)"}. rows are appended after existing data; headers, when supplied, update row 1. read_excel_workbook returns cached cell values in rows and formula expressions in a separate formulas map; formulas are not recalculated by openpyxl.
PowerPoint
create_pptx_presentation takes slides: [{layout, title?, content?}]. Layouts include title, title_and_content, section_header, two_content, and blank. Text is added to placeholders when available and to text boxes otherwise.
modify_pptx_presentation takes slide_data. Include a zero-based index to replace that slide's title/content; omit it to append a slide. read_pptx_presentation returns all text shapes without truncation.
Verify
verify_document(input_path) checks PDF parsing or Office package CRC and parser readability. A supported but damaged file returns success: true, valid: false with the error; unsupported extensions and missing files return error.
Check
Run from the plugin directory:
python scripts\test_e2e.py
python scripts\test_encoding.py
test_e2e.py performs an MCP handshake and round-trips the four formats, edits generated files, and calls verification. test_config.py checks a deployment-style launch from outside the plugin directory. To check a specific install, set DOCUMENT_EDITOR_PYTHON, DOCUMENT_EDITOR_SERVER, and DOCUMENT_EDITOR_CWD before running it.
Examples
The validation samples include original and edited PDF, DOCX, XLSX, and PPTX files created and verified through MCP.
Limits
- PDF creation and editing handle text pages; editing existing page text, forms, annotations, images, and layout is not implemented.
- Word edits target paragraphs and table cells; advanced Word features such as tracked changes and embedded objects are preserved by python-docx only where its format support allows.
- Excel formulas are written and read but not calculated. Existing workbook macros are not supported by
.xlsxtools. - PowerPoint tools edit slide text and create basic text-first slides; they do not render slides or edit charts, media, or complex shape geometry.
- Office rendering can vary between Microsoft Office, WPS, LibreOffice, and Google Docs.
Files
src/server.py MCP server
src/requirements.txt Python dependencies
scripts/test_e2e.py MCP and document round-trip check
scripts/test_encoding.py Chinese stdio round-trip check
cordis.patch.yml DSH profile entry
MIT License.
Comments
Loading…
Similar plugins
by qingmumingyang
DSH 文档读写工具包 - PDF/DOCX/XLSX/CSV 读写与 PDF 导出(利用dsh制作的,希望能帮到你们)
★ 1
MIT
JavaScript
Sep 25, 2026
dsh plugin --profile web add dsh-doc-toolkitby pqkisvery666
DSH 办公文件插件:阅读 PDF/DOCX/XLSX/PPTX,生成 DOCX/XLSX/PPTX/PDF/CSV。A DSH plugin for reading and generating common office files.
★ 3
MIT
JavaScript
Sep 11, 2026
dsh plugin --profile web add dsh-basic-officeby didclawapp-ai
DeepSeek Harness plugin for PPTX / DOCX / XLSX / PDF read/write/edit
★ 6
MIT
TypeScript
Aug 15, 2026
dsh plugin --profile web add dsh-zagens-officeby xby-skill
一个支持AI助手读取和分析PDF文件的MCP服务器,提供PDF元数据提取、页面范围阅读和关键词搜索等功能。
★ 0
MIT
TypeScript
Aug 28, 2026
dsh plugin --profile web add xby-read-pdfby l2685209197
DSH 插件:用 DeepSeek 翻译文本型 PDF,保留版式/字体/图片/链接,输出可编辑 PDF(单次 ≤50 页)
★ 0
↓ 110/wk
MIT
TypeScript
Sep 1, 2026
dsh plugin --profile web add dsh-pdf-translateby LR611415
`DSH plugin to read/write Word (.docx), PDF and text files`
★ 0
JavaScript
Sep 24, 2026
dsh plugin --profile web add dsh-plugin-documents