docsmith-mcp 0.0.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/test.yml +35 -0
- package/LICENSE +21 -0
- package/README.md +109 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +679 -0
- package/dist/index.js.map +1 -0
- package/dist/python/excel_handler.py +97 -0
- package/dist/python/pdf_handler.py +81 -0
- package/dist/python/text_handler.py +331 -0
- package/dist/python/word_handler.py +98 -0
- package/examples/sample_data.csv +6 -0
- package/examples/sample_data.json +9 -0
- package/examples/sample_document.pdf +80 -0
- package/examples/sample_report.docx +0 -0
- package/examples/sample_sales_data.xlsx +0 -0
- package/examples/sample_text.txt +10 -0
- package/package.json +36 -0
- package/python/excel_handler.py +97 -0
- package/python/pdf_handler.py +81 -0
- package/python/text_handler.py +331 -0
- package/python/word_handler.py +98 -0
- package/scripts/preload-packages.mjs +64 -0
- package/src/code-runner.ts +136 -0
- package/src/index.ts +496 -0
- package/src/utils.ts +45 -0
- package/tests/document-processing.test.ts +230 -0
- package/tsconfig.json +20 -0
- package/tsdown.config.ts +21 -0
- package/vitest.config.ts +15 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, master]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main, master]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout code
|
|
15
|
+
uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- name: Setup pnpm
|
|
18
|
+
uses: pnpm/action-setup@v2
|
|
19
|
+
with:
|
|
20
|
+
version: 9
|
|
21
|
+
|
|
22
|
+
- name: Setup Node.js
|
|
23
|
+
uses: actions/setup-node@v4
|
|
24
|
+
with:
|
|
25
|
+
node-version: 24
|
|
26
|
+
cache: "pnpm"
|
|
27
|
+
|
|
28
|
+
- name: Install dependencies
|
|
29
|
+
run: pnpm install --frozen-lockfile
|
|
30
|
+
|
|
31
|
+
- name: Run tests
|
|
32
|
+
run: pnpm test:run
|
|
33
|
+
|
|
34
|
+
- name: Build
|
|
35
|
+
run: pnpm build
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 mcpc.tech
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Docsmith MCP
|
|
2
|
+
|
|
3
|
+
Python-powered document processing MCP — Process Excel, Word, PDF documents with
|
|
4
|
+
ease using Python.
|
|
5
|
+
|
|
6
|
+
## Features
|
|
7
|
+
|
|
8
|
+
- **Excel**: Read/write `.xlsx` files with sheet support and pagination
|
|
9
|
+
- **Word**: Read/write `.docx` files with paragraph and table support
|
|
10
|
+
- **PDF**: Read `.pdf` files with text extraction and pagination
|
|
11
|
+
- **Text Files**: Read/write `.txt`, `.csv`, `.md`, `.json`, `.yaml`, `.yml`
|
|
12
|
+
with pagination support
|
|
13
|
+
- **Flexible Reading Modes**: Raw full read or paginated for large files
|
|
14
|
+
- **Powered by Pyodide**: Runs in secure WebAssembly sandbox via code-runner-mcp
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pnpm install
|
|
20
|
+
pnpm build
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Configuration
|
|
24
|
+
|
|
25
|
+
Add to your MCP client configuration:
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
{
|
|
29
|
+
"mcpServers": {
|
|
30
|
+
"docsmith": {
|
|
31
|
+
"command": "node",
|
|
32
|
+
"args": ["/path/to/docsmith-mcp/dist/index.js"],
|
|
33
|
+
"env": {
|
|
34
|
+
"DOC_RAW_FULL_READ": "false",
|
|
35
|
+
"DOC_PAGE_SIZE": "100",
|
|
36
|
+
"DOC_MAX_FILE_SIZE": "50"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Environment Variables
|
|
44
|
+
|
|
45
|
+
| Variable | Description | Default |
|
|
46
|
+
| ------------------- | ------------------------- | ------- |
|
|
47
|
+
| `DOC_RAW_FULL_READ` | Enable full raw read mode | `false` |
|
|
48
|
+
| `DOC_PAGE_SIZE` | Default items per page | `100` |
|
|
49
|
+
| `DOC_MAX_FILE_SIZE` | Max file size in MB | `50` |
|
|
50
|
+
|
|
51
|
+
## Tools
|
|
52
|
+
|
|
53
|
+
### read_document
|
|
54
|
+
|
|
55
|
+
Read document content with automatic format detection.
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"file_path": "/path/to/document.xlsx",
|
|
60
|
+
"mode": "paginated",
|
|
61
|
+
"page": 1,
|
|
62
|
+
"page_size": 50,
|
|
63
|
+
"sheet_name": "Sheet1"
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### write_document
|
|
68
|
+
|
|
69
|
+
Write document content.
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"file_path": "/path/to/output.xlsx",
|
|
74
|
+
"format": "excel",
|
|
75
|
+
"data": [["Header1", "Header2"], ["Value1", "Value2"]]
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### get_document_info
|
|
80
|
+
|
|
81
|
+
Get document metadata.
|
|
82
|
+
|
|
83
|
+
```json
|
|
84
|
+
{
|
|
85
|
+
"file_path": "/path/to/document.pdf"
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Architecture
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
docsmith-mcp/
|
|
93
|
+
├── python/ # Python handler scripts
|
|
94
|
+
│ ├── excel_handler.py
|
|
95
|
+
│ ├── word_handler.py
|
|
96
|
+
│ └── pdf_handler.py
|
|
97
|
+
├── src/
|
|
98
|
+
│ ├── index.ts # MCP server
|
|
99
|
+
│ └── code-runner.ts # code-runner-mcp client
|
|
100
|
+
└── dist/ # Built output
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Python scripts are executed via
|
|
104
|
+
[code-runner-mcp](https://github.com/mcpc-tech/code-runner-mcp) in a Pyodide
|
|
105
|
+
WebAssembly environment.
|
|
106
|
+
|
|
107
|
+
## License
|
|
108
|
+
|
|
109
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|