mcp-word-bridge 3.2.0 → 3.2.2
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 +21 -0
- package/README.md +27 -17
- package/index.js +25 -0
- package/install-manifest.js +45 -0
- package/package.json +9 -3
- package/certs/cert.pem +0 -19
- package/certs/key.pem +0 -28
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
|
@@ -12,14 +12,16 @@ Single process. The MCP client spawns `index.js`, which starts both the HTTPS br
|
|
|
12
12
|
|
|
13
13
|
## Setup
|
|
14
14
|
|
|
15
|
-
### 1.
|
|
16
|
-
|
|
17
|
-
Copy the manifest to Word's sideload directory:
|
|
15
|
+
### 1. Install and sideload the add-in
|
|
18
16
|
|
|
19
17
|
```bash
|
|
20
|
-
|
|
18
|
+
npx mcp-word-bridge-install
|
|
21
19
|
```
|
|
22
20
|
|
|
21
|
+
This copies the manifest into Word's sideload directory. On macOS it's automatic; on Windows it attempts the standard location and prints manual steps if needed.
|
|
22
|
+
|
|
23
|
+
Restart Word → Home → Add-ins → **MCP Word Bridge**
|
|
24
|
+
|
|
23
25
|
### 2. Add MCP config
|
|
24
26
|
|
|
25
27
|
Add to your MCP client configuration (e.g. `.kiro/settings/mcp.json`):
|
|
@@ -28,8 +30,8 @@ Add to your MCP client configuration (e.g. `.kiro/settings/mcp.json`):
|
|
|
28
30
|
{
|
|
29
31
|
"mcpServers": {
|
|
30
32
|
"word-bridge": {
|
|
31
|
-
"command": "
|
|
32
|
-
"args": ["
|
|
33
|
+
"command": "npx",
|
|
34
|
+
"args": ["-y", "mcp-word-bridge"],
|
|
33
35
|
"disabled": false
|
|
34
36
|
}
|
|
35
37
|
}
|
|
@@ -51,15 +53,16 @@ That's it. The MCP server starts automatically when your MCP client loads the co
|
|
|
51
53
|
## File Layout
|
|
52
54
|
|
|
53
55
|
```
|
|
54
|
-
word-
|
|
55
|
-
├── index.js
|
|
56
|
-
├──
|
|
57
|
-
├── taskpane
|
|
56
|
+
mcp-word-bridge/
|
|
57
|
+
├── index.js # Single entry point (MCP + bridge server)
|
|
58
|
+
├── install-manifest.js # Manifest sideloader (npx mcp-word-bridge-install)
|
|
59
|
+
├── taskpane.html # Served to Word add-in
|
|
60
|
+
├── taskpane-app.js # Client-side Word JS API logic
|
|
58
61
|
├── certs/
|
|
59
|
-
│ ├── cert.pem
|
|
60
|
-
│
|
|
61
|
-
|
|
62
|
-
├──
|
|
62
|
+
│ ├── cert.pem # Self-signed TLS cert
|
|
63
|
+
│ ├── key.pem # TLS private key
|
|
64
|
+
│ └── cert.conf # OpenSSL config for cert regeneration
|
|
65
|
+
├── manifest.xml # Office add-in manifest
|
|
63
66
|
├── package.json
|
|
64
67
|
└── README.md
|
|
65
68
|
```
|
|
@@ -111,13 +114,20 @@ word-addin/
|
|
|
111
114
|
|
|
112
115
|
## Regenerating TLS Certificates
|
|
113
116
|
|
|
114
|
-
|
|
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.
|
|
115
118
|
|
|
119
|
+
To trust the cert (required for Word to connect without warnings):
|
|
120
|
+
|
|
121
|
+
**macOS:**
|
|
116
122
|
```bash
|
|
117
|
-
|
|
123
|
+
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain node_modules/mcp-word-bridge/certs/cert.pem
|
|
118
124
|
```
|
|
119
125
|
|
|
120
|
-
|
|
126
|
+
**To regenerate manually:**
|
|
127
|
+
```bash
|
|
128
|
+
rm certs/cert.pem certs/key.pem
|
|
129
|
+
node index.js # will regenerate on startup
|
|
130
|
+
```
|
|
121
131
|
|
|
122
132
|
## Known Limitations & Word API Behavior
|
|
123
133
|
|
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'))
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Sideload the Word add-in manifest.
|
|
4
|
+
* Run manually: npx mcp-word-bridge-install
|
|
5
|
+
* Or: node node_modules/mcp-word-bridge/install-manifest.js
|
|
6
|
+
*/
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
const os = require('os');
|
|
10
|
+
|
|
11
|
+
const manifestSrc = path.join(__dirname, 'manifest.xml');
|
|
12
|
+
|
|
13
|
+
if (process.platform === 'darwin') {
|
|
14
|
+
const wefDir = path.join(os.homedir(), 'Library/Containers/com.microsoft.Word/Data/Documents/wef');
|
|
15
|
+
const dest = path.join(wefDir, 'manifest.xml');
|
|
16
|
+
|
|
17
|
+
if (!fs.existsSync(wefDir)) {
|
|
18
|
+
fs.mkdirSync(wefDir, { recursive: true });
|
|
19
|
+
}
|
|
20
|
+
fs.copyFileSync(manifestSrc, dest);
|
|
21
|
+
console.log('✓ Manifest installed to: ' + dest);
|
|
22
|
+
console.log(' Restart Word, then: Home → Add-ins → MCP Word Bridge');
|
|
23
|
+
} else if (process.platform === 'win32') {
|
|
24
|
+
const wefDir = path.join(os.homedir(), 'AppData', 'Local', 'Microsoft', 'Office', '16.0', 'Wef');
|
|
25
|
+
try {
|
|
26
|
+
if (!fs.existsSync(wefDir)) {
|
|
27
|
+
fs.mkdirSync(wefDir, { recursive: true });
|
|
28
|
+
}
|
|
29
|
+
const dest = path.join(wefDir, 'manifest.xml');
|
|
30
|
+
fs.copyFileSync(manifestSrc, dest);
|
|
31
|
+
console.log('✓ Manifest installed to: ' + dest);
|
|
32
|
+
console.log(' Restart Word, then: Insert → My Add-ins → Developer Add-ins');
|
|
33
|
+
} catch (e) {
|
|
34
|
+
console.log('Could not auto-install manifest on Windows.');
|
|
35
|
+
console.log('Manual steps:');
|
|
36
|
+
console.log(' 1. Copy this file to a local folder: ' + manifestSrc);
|
|
37
|
+
console.log(' 2. In Word: File → Options → Trust Center → Trusted Add-in Catalogs');
|
|
38
|
+
console.log(' 3. Add the folder path as a catalog');
|
|
39
|
+
console.log(' 4. Insert → My Add-ins → Shared Folder → MCP Word Bridge');
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
console.log('Platform not supported for local sideloading.');
|
|
43
|
+
console.log('For Word on the Web, upload the manifest via the admin center.');
|
|
44
|
+
console.log('Manifest location: ' + manifestSrc);
|
|
45
|
+
}
|
package/package.json
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-word-bridge",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"description": "MCP server for live Word document editing via Office Add-in",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
7
|
-
"mcp-word-bridge": "index.js"
|
|
7
|
+
"mcp-word-bridge": "index.js",
|
|
8
|
+
"mcp-word-bridge-install": "install-manifest.js"
|
|
8
9
|
},
|
|
9
10
|
"scripts": {
|
|
10
|
-
"start": "node index.js"
|
|
11
|
+
"start": "node index.js",
|
|
12
|
+
"install-manifest": "node install-manifest.js"
|
|
11
13
|
},
|
|
12
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
|
+
},
|
|
13
19
|
"author": "Leonid Mokrushin <likelion@gmail.com>",
|
|
14
20
|
"license": "MIT",
|
|
15
21
|
"dependencies": {
|
package/certs/cert.pem
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
-----BEGIN CERTIFICATE-----
|
|
2
|
-
MIIDATCCAemgAwIBAgIUXHIdF3kFBwDnYn+HtAfpiihdkx4wDQYJKoZIhvcNAQEL
|
|
3
|
-
BQAwFDESMBAGA1UEAwwJbG9jYWxob3N0MB4XDTI2MDYwMTEzMDQxMFoXDTI3MDYw
|
|
4
|
-
MTEzMDQxMFowFDESMBAGA1UEAwwJbG9jYWxob3N0MIIBIjANBgkqhkiG9w0BAQEF
|
|
5
|
-
AAOCAQ8AMIIBCgKCAQEA30z83NusMTz0TTHfQN2lb7vQsBR+RcI6fNMEu9Diz2lO
|
|
6
|
-
+NyvMhCY44esfr/h/LaT2t49HcuQF/1BN0UlbtKxRHU7Ex8lu6cPwYrYZgwcL+0p
|
|
7
|
-
jyYdHeCb10kzGagOn86PLt6Q6TG+Rmiqi1P4Q6+bfsXGRj6tQkR5SxgMZFC4claM
|
|
8
|
-
O7o9h1IibstyN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