mcp-word-bridge 3.2.2 → 3.2.4
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/README.md +163 -46
- package/index.js +11 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ MCP server for live Word document editing via Office Add-in. Enables programmati
|
|
|
5
5
|
## Architecture
|
|
6
6
|
|
|
7
7
|
```
|
|
8
|
-
MCP Client
|
|
8
|
+
MCP Client←stdio→index.js←WebSocket→Taskpane (Office Add-in)←→Word JS API←→Word Document
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
Single process. The MCP client spawns `index.js`, which starts both the HTTPS bridge server (for the add-in) and the MCP server (on stdio). Everything starts and stops together.
|
|
@@ -24,15 +24,14 @@ Restart Word → Home → Add-ins → **MCP Word Bridge**
|
|
|
24
24
|
|
|
25
25
|
### 2. Add MCP config
|
|
26
26
|
|
|
27
|
-
Add to your MCP client configuration
|
|
27
|
+
Add to your MCP client configuration:
|
|
28
28
|
|
|
29
29
|
```json
|
|
30
30
|
{
|
|
31
31
|
"mcpServers": {
|
|
32
32
|
"word-bridge": {
|
|
33
33
|
"command": "npx",
|
|
34
|
-
"args": ["-y", "mcp-word-bridge"]
|
|
35
|
-
"disabled": false
|
|
34
|
+
"args": ["-y", "mcp-word-bridge"]
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
37
|
}
|
|
@@ -69,39 +68,155 @@ mcp-word-bridge/
|
|
|
69
68
|
|
|
70
69
|
## Tools (82)
|
|
71
70
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
71
|
+
### Document
|
|
72
|
+
| Tool | Description |
|
|
73
|
+
|------|-------------|
|
|
74
|
+
| `word_get_text` | Get full plain text of the document |
|
|
75
|
+
| `word_get_document_properties` | Get metadata (title, author, path, timestamps) |
|
|
76
|
+
| `word_set_document_properties` | Set metadata fields |
|
|
77
|
+
| `word_save` | Save document to disk |
|
|
78
|
+
| `word_get_word_count` | Get word, character, and paragraph counts |
|
|
79
|
+
| `word_get_styles` | List available styles |
|
|
80
|
+
| `word_get_coauthors` | Get co-authoring status and active authors |
|
|
81
|
+
| `word_set_change_tracking` | Enable/disable track changes |
|
|
82
|
+
|
|
83
|
+
### Paragraphs
|
|
84
|
+
| Tool | Description |
|
|
85
|
+
|------|-------------|
|
|
86
|
+
| `word_get_paragraphs` | Get paragraphs with style, alignment, TOC flag (paginated) |
|
|
87
|
+
| `word_get_paragraph_by_index` | Get full details of one paragraph (font, spacing, indent) |
|
|
88
|
+
| `word_insert_paragraph` | Insert a styled paragraph at Start or End |
|
|
89
|
+
| `word_delete_paragraph` | Delete a paragraph by index |
|
|
90
|
+
| `word_set_paragraph_style` | Change style or alignment of a paragraph |
|
|
91
|
+
| `word_set_paragraph_spacing` | Set line spacing, before/after, and indentation |
|
|
92
|
+
|
|
93
|
+
### Search & Text
|
|
94
|
+
| Tool | Description |
|
|
95
|
+
|------|-------------|
|
|
96
|
+
| `word_search` | Find text matches (case-insensitive by default) |
|
|
97
|
+
| `word_search_and_replace` | Find and replace all occurrences |
|
|
98
|
+
| `word_insert_text` | Insert text before or after a search match |
|
|
99
|
+
| `word_get_selection_info` | Get current selection with font details |
|
|
100
|
+
| `word_insert_text_at_selection` | Insert or replace text at cursor |
|
|
101
|
+
| `word_insert_line_break` | Insert a soft line break (Shift+Enter) |
|
|
102
|
+
|
|
103
|
+
### Formatting
|
|
104
|
+
| Tool | Description |
|
|
105
|
+
|------|-------------|
|
|
106
|
+
| `word_format_text` | Apply bold, italic, color, size, font to a text match |
|
|
107
|
+
| `word_clear_formatting` | Reset formatting to paragraph style defaults |
|
|
108
|
+
| `word_get_font_info` | Inspect font properties of a text match |
|
|
109
|
+
|
|
110
|
+
### Tables
|
|
111
|
+
| Tool | Description |
|
|
112
|
+
|------|-------------|
|
|
113
|
+
| `word_insert_table` | Insert a table with data and optional style |
|
|
114
|
+
| `word_get_tables` | Get all tables with values and styles |
|
|
115
|
+
| `word_get_table_data` | Get cell values from a specific table |
|
|
116
|
+
| `word_set_table_cell` | Set text in a cell |
|
|
117
|
+
| `word_add_table_row` | Add a row with optional values |
|
|
118
|
+
| `word_delete_table_row` | Delete a row by index |
|
|
119
|
+
| `word_merge_table_cells` | Merge a rectangular range of cells |
|
|
120
|
+
| `word_split_table_cell` | Split a cell into rows/columns |
|
|
121
|
+
| `word_set_table_style` | Apply a built-in table style |
|
|
122
|
+
| `word_set_table_cell_shading` | Set cell background color |
|
|
123
|
+
|
|
124
|
+
### Lists
|
|
125
|
+
| Tool | Description |
|
|
126
|
+
|------|-------------|
|
|
127
|
+
| `word_insert_list` | Insert a bulleted or numbered list |
|
|
128
|
+
| `word_get_list_info` | Get list level and numbering for a paragraph |
|
|
129
|
+
| `word_set_list_level` | Change indent level of a list item |
|
|
130
|
+
|
|
131
|
+
### Comments
|
|
132
|
+
| Tool | Description |
|
|
133
|
+
|------|-------------|
|
|
134
|
+
| `word_add_comment` | Add a comment anchored to text |
|
|
135
|
+
| `word_get_comments` | Get all comments with author, date, status |
|
|
136
|
+
| `word_get_comment_replies` | Get replies for a comment |
|
|
137
|
+
| `word_reply_to_comment` | Reply to a comment |
|
|
138
|
+
| `word_resolve_comment` | Mark a comment as resolved |
|
|
139
|
+
| `word_delete_comment` | Delete a comment and its replies |
|
|
140
|
+
|
|
141
|
+
### Footnotes & Endnotes
|
|
142
|
+
| Tool | Description |
|
|
143
|
+
|------|-------------|
|
|
144
|
+
| `word_insert_footnote` | Insert footnote anchored to a text match |
|
|
145
|
+
| `word_insert_footnote_at_index` | Insert footnote at end of a paragraph |
|
|
146
|
+
| `word_insert_endnote` | Insert endnote anchored to a text match |
|
|
147
|
+
| `word_get_footnotes` | Get all footnotes with index and text |
|
|
148
|
+
| `word_get_endnotes` | Get all endnotes with index and text |
|
|
149
|
+
| `word_delete_footnote` | Delete a footnote by index |
|
|
150
|
+
| `word_delete_endnote` | Delete an endnote by index |
|
|
151
|
+
|
|
152
|
+
### Track Changes
|
|
153
|
+
| Tool | Description |
|
|
154
|
+
|------|-------------|
|
|
155
|
+
| `word_get_tracked_changes` | Get all tracked changes with type, author, text |
|
|
156
|
+
| `word_accept_tracked_change` | Accept a change by index |
|
|
157
|
+
| `word_reject_tracked_change` | Reject a change by index |
|
|
158
|
+
| `word_accept_all_tracked_changes` | Accept all changes |
|
|
159
|
+
| `word_reject_all_tracked_changes` | Reject all changes |
|
|
160
|
+
|
|
161
|
+
### Content Controls
|
|
162
|
+
| Tool | Description |
|
|
163
|
+
|------|-------------|
|
|
164
|
+
| `word_get_content_controls` | Get all controls with id, tag, type, text |
|
|
165
|
+
| `word_insert_content_control` | Wrap text in a RichText, PlainText, or CheckBox control |
|
|
166
|
+
| `word_set_content_control_text` | Set text in a control by ID or tag |
|
|
167
|
+
|
|
168
|
+
### Bookmarks
|
|
169
|
+
| Tool | Description |
|
|
170
|
+
|------|-------------|
|
|
171
|
+
| `word_get_bookmarks` | List all bookmark names |
|
|
172
|
+
| `word_insert_bookmark` | Create a bookmark at a text match |
|
|
173
|
+
| `word_delete_bookmark` | Delete a bookmark by name |
|
|
174
|
+
| `word_go_to_bookmark` | Navigate to a bookmark and select it |
|
|
175
|
+
| `word_get_bookmark_text` | Get text content of a bookmark |
|
|
176
|
+
|
|
177
|
+
### Hyperlinks
|
|
178
|
+
| Tool | Description |
|
|
179
|
+
|------|-------------|
|
|
180
|
+
| `word_insert_hyperlink` | Add a hyperlink to existing text |
|
|
181
|
+
| `word_get_hyperlinks` | List all hyperlinks with URLs and text |
|
|
182
|
+
| `word_remove_hyperlink` | Remove link from text (keeps the text) |
|
|
183
|
+
|
|
184
|
+
### Headers & Footers
|
|
185
|
+
| Tool | Description |
|
|
186
|
+
|------|-------------|
|
|
187
|
+
| `word_get_header_footer` | Get header or footer text |
|
|
188
|
+
| `word_set_header_footer` | Set header or footer text |
|
|
189
|
+
|
|
190
|
+
### Images
|
|
191
|
+
| Tool | Description |
|
|
192
|
+
|------|-------------|
|
|
193
|
+
| `word_insert_image` | Insert image from base64 data |
|
|
194
|
+
| `word_get_images` | List images with dimensions and alt text |
|
|
195
|
+
| `word_delete_image` | Delete an image by index |
|
|
196
|
+
|
|
197
|
+
### Page Layout & Sections
|
|
198
|
+
| Tool | Description |
|
|
199
|
+
|------|-------------|
|
|
200
|
+
| `word_get_page_layout` | Get margins, orientation, paper size |
|
|
201
|
+
| `word_set_page_layout` | Set margins, orientation, paper size |
|
|
202
|
+
| `word_get_sections` | List all sections with page setup |
|
|
203
|
+
| `word_insert_page_break` | Insert a page break after a paragraph |
|
|
204
|
+
| `word_insert_section_break` | Insert a section break after a paragraph |
|
|
205
|
+
|
|
206
|
+
### Custom Properties
|
|
207
|
+
| Tool | Description |
|
|
208
|
+
|------|-------------|
|
|
209
|
+
| `word_get_custom_properties` | Get all custom key-value properties |
|
|
210
|
+
| `word_set_custom_property` | Create or update a custom property |
|
|
211
|
+
| `word_delete_custom_property` | Delete a custom property |
|
|
212
|
+
|
|
213
|
+
### Advanced
|
|
214
|
+
| Tool | Description |
|
|
215
|
+
|------|-------------|
|
|
216
|
+
| `word_insert_html` | Insert HTML converted to native Word formatting |
|
|
217
|
+
| `word_insert_ooxml` | Insert raw Office Open XML |
|
|
218
|
+
| `word_insert_table_of_contents` | Insert a TOC based on headings |
|
|
219
|
+
| `word_get_fields` | Get all fields (hyperlinks, TOC, page numbers) |
|
|
105
220
|
|
|
106
221
|
## How it works
|
|
107
222
|
|
|
@@ -112,21 +227,23 @@ mcp-word-bridge/
|
|
|
112
227
|
5. Changes go through Word's editing pipeline — cursor follows edits like a human typing
|
|
113
228
|
6. When the MCP client terminates the process, the bridge server stops automatically
|
|
114
229
|
|
|
115
|
-
##
|
|
116
|
-
|
|
117
|
-
A self-signed localhost certificate is **auto-generated on first run** if `certs/cert.pem` and `certs/key.pem` don't exist. No manual step needed.
|
|
230
|
+
## TLS Certificate
|
|
118
231
|
|
|
119
|
-
|
|
232
|
+
A self-signed localhost certificate is **auto-generated on first run** if `certs/cert.pem` and `certs/key.pem` don't exist. The server prints the exact trust command with the resolved path:
|
|
120
233
|
|
|
121
|
-
**macOS:**
|
|
122
|
-
```bash
|
|
123
|
-
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain node_modules/mcp-word-bridge/certs/cert.pem
|
|
124
234
|
```
|
|
235
|
+
[mcp-word-bridge] ✓ Certificate generated.
|
|
236
|
+
[mcp-word-bridge]
|
|
237
|
+
[mcp-word-bridge] To trust the certificate (required once for Word to connect):
|
|
238
|
+
[mcp-word-bridge] security add-trusted-cert -r trustRoot -k ~/Library/Keychains/login.keychain-db "/path/to/certs/cert.pem"
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
Run the printed command once. No `sudo` required — it adds to your user login keychain.
|
|
125
242
|
|
|
126
|
-
**To regenerate
|
|
243
|
+
**To regenerate:**
|
|
127
244
|
```bash
|
|
128
245
|
rm certs/cert.pem certs/key.pem
|
|
129
|
-
|
|
246
|
+
# restart the MCP server — it will regenerate and print the trust command again
|
|
130
247
|
```
|
|
131
248
|
|
|
132
249
|
## Known Limitations & Word API Behavior
|
package/index.js
CHANGED
|
@@ -40,8 +40,17 @@ function ensureCerts() {
|
|
|
40
40
|
].join('\n'));
|
|
41
41
|
}
|
|
42
42
|
execSync('openssl req -x509 -newkey rsa:2048 -keyout "' + keyPath + '" -out "' + certPath + '" -days 3650 -nodes -config "' + confPath + '"', { stdio: 'pipe' });
|
|
43
|
-
process.stderr.write('[mcp-word-bridge] Certificate generated
|
|
44
|
-
process.stderr.write('[mcp-word-bridge]
|
|
43
|
+
process.stderr.write('[mcp-word-bridge] ✓ Certificate generated.\n');
|
|
44
|
+
process.stderr.write('[mcp-word-bridge]\n');
|
|
45
|
+
process.stderr.write('[mcp-word-bridge] To trust the certificate (required once for Word to connect):\n');
|
|
46
|
+
if (process.platform === 'darwin') {
|
|
47
|
+
process.stderr.write('[mcp-word-bridge] security add-trusted-cert -r trustRoot -k ~/Library/Keychains/login.keychain-db "' + certPath + '"\n');
|
|
48
|
+
} else if (process.platform === 'win32') {
|
|
49
|
+
process.stderr.write('[mcp-word-bridge] certutil -user -addstore Root "' + certPath + '"\n');
|
|
50
|
+
} else {
|
|
51
|
+
process.stderr.write('[mcp-word-bridge] sudo cp "' + certPath + '" /usr/local/share/ca-certificates/ && sudo update-ca-certificates\n');
|
|
52
|
+
}
|
|
53
|
+
process.stderr.write('[mcp-word-bridge]\n');
|
|
45
54
|
}
|
|
46
55
|
|
|
47
56
|
ensureCerts();
|