mcp-word-bridge 3.2.1 → 3.2.3

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Leonid Mokrushin
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 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 ←stdio→ index.js ←WebSocket→ Taskpane (Office Add-in) ←→ Word JS API ←→ Word Document
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 (e.g. `.kiro/settings/mcp.json`):
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
- **Document:** get_text, get_document_properties, set_document_properties, save, get_word_count, get_styles, get_coauthors, set_change_tracking
73
-
74
- **Paragraphs:** get_paragraphs, get_paragraph_by_index, insert_paragraph, delete_paragraph, set_paragraph_style, set_paragraph_spacing
75
-
76
- **Search & Text:** search, search_and_replace, insert_text, get_selection_info, insert_text_at_selection, insert_line_break
77
-
78
- **Formatting:** format_text, clear_formatting, get_font_info
79
-
80
- **Tables:** insert_table, get_tables, get_table_data, set_table_cell, add_table_row, delete_table_row, merge_table_cells, split_table_cell, set_table_style, set_table_cell_shading
81
-
82
- **Lists:** insert_list, get_list_info, set_list_level
83
-
84
- **Comments:** add_comment, get_comments, get_comment_replies, reply_to_comment, resolve_comment, delete_comment
85
-
86
- **Footnotes/Endnotes:** insert_footnote, insert_footnote_at_index, insert_endnote, get_footnotes, get_endnotes, delete_footnote, delete_endnote
87
-
88
- **Track Changes:** get_tracked_changes, accept_tracked_change, reject_tracked_change, accept_all_tracked_changes, reject_all_tracked_changes
89
-
90
- **Content Controls:** get_content_controls, insert_content_control, set_content_control_text
91
-
92
- **Bookmarks:** get_bookmarks, insert_bookmark, delete_bookmark, go_to_bookmark, get_bookmark_text
93
-
94
- **Hyperlinks:** insert_hyperlink, get_hyperlinks, remove_hyperlink
95
-
96
- **Headers/Footers:** get_header_footer, set_header_footer
97
-
98
- **Images:** insert_image, get_images, delete_image
99
-
100
- **Page Layout:** get_page_layout, set_page_layout, get_sections, insert_page_break, insert_section_break
101
-
102
- **Custom Properties:** get_custom_properties, set_custom_property, delete_custom_property
103
-
104
- **Advanced:** insert_html, insert_ooxml, insert_table_of_contents, get_fields
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
 
@@ -114,13 +229,20 @@ mcp-word-bridge/
114
229
 
115
230
  ## Regenerating TLS Certificates
116
231
 
117
- The self-signed cert is required for the HTTPS connection to the taskpane. To regenerate:
232
+ 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.
233
+
234
+ To trust the cert (required for Word to connect without warnings):
118
235
 
236
+ **macOS:**
119
237
  ```bash
120
- openssl req -x509 -newkey rsa:2048 -keyout certs/key.pem -out certs/cert.pem -days 3650 -nodes -config certs/cert.conf
238
+ sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain node_modules/mcp-word-bridge/certs/cert.pem
121
239
  ```
122
240
 
123
- Then trust the cert in Keychain Access (macOS) to avoid browser warnings.
241
+ **To regenerate manually:**
242
+ ```bash
243
+ rm certs/cert.pem certs/key.pem
244
+ node index.js # will regenerate on startup
245
+ ```
124
246
 
125
247
  ## Known Limitations & Word API Behavior
126
248
 
package/index.js CHANGED
@@ -21,6 +21,31 @@ const CERTS_DIR = path.join(__dirname, 'certs');
21
21
  // PART 1: HTTPS + WebSocket Bridge Server
22
22
  // ═══════════════════════════════════════════════════════════════════════════════
23
23
 
24
+ // Generate self-signed certs if they don't exist
25
+ function ensureCerts() {
26
+ const certPath = path.join(CERTS_DIR, 'cert.pem');
27
+ const keyPath = path.join(CERTS_DIR, 'key.pem');
28
+ if (fs.existsSync(certPath) && fs.existsSync(keyPath)) return;
29
+ process.stderr.write('[mcp-word-bridge] Generating self-signed TLS certificate for localhost...\n');
30
+ if (!fs.existsSync(CERTS_DIR)) fs.mkdirSync(CERTS_DIR, { recursive: true });
31
+ const { execSync } = require('child_process');
32
+ const confPath = path.join(CERTS_DIR, 'cert.conf');
33
+ if (!fs.existsSync(confPath)) {
34
+ fs.writeFileSync(confPath, [
35
+ '[req]', 'default_bits = 2048', 'prompt = no', 'default_md = sha256',
36
+ 'distinguished_name = dn', 'x509_extensions = v3_req', '',
37
+ '[dn]', 'CN = localhost', '',
38
+ '[v3_req]', 'basicConstraints = CA:TRUE', 'subjectAltName = @alt_names', '',
39
+ '[alt_names]', 'DNS.1 = localhost', 'IP.1 = 127.0.0.1', ''
40
+ ].join('\n'));
41
+ }
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 at ' + CERTS_DIR + '\n');
44
+ process.stderr.write('[mcp-word-bridge] NOTE: You may need to trust this cert in your OS keychain for Word to connect.\n');
45
+ }
46
+
47
+ ensureCerts();
48
+
24
49
  const sslOptions = {
25
50
  key: fs.readFileSync(path.join(CERTS_DIR, 'key.pem')),
26
51
  cert: fs.readFileSync(path.join(CERTS_DIR, 'cert.pem'))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-word-bridge",
3
- "version": "3.2.1",
3
+ "version": "3.2.3",
4
4
  "description": "MCP server for live Word document editing via Office Add-in",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -12,6 +12,10 @@
12
12
  "install-manifest": "node install-manifest.js"
13
13
  },
14
14
  "keywords": ["mcp", "word", "office", "add-in", "document", "editing"],
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/likelion/mcp-word-bridge.git"
18
+ },
15
19
  "author": "Leonid Mokrushin <likelion@gmail.com>",
16
20
  "license": "MIT",
17
21
  "dependencies": {
package/certs/cert.pem DELETED
@@ -1,19 +0,0 @@
1
- -----BEGIN CERTIFICATE-----
2
- MIIDATCCAemgAwIBAgIUXHIdF3kFBwDnYn+HtAfpiihdkx4wDQYJKoZIhvcNAQEL
3
- BQAwFDESMBAGA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