@tanskong/office-mcp 1.0.5 → 1.0.7

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.
Files changed (2) hide show
  1. package/bin/office-mcp.js +29 -14
  2. package/package.json +1 -1
package/bin/office-mcp.js CHANGED
@@ -4,20 +4,35 @@ const { spawn } = require('child_process');
4
4
  const path = require('path');
5
5
  const fs = require('fs');
6
6
 
7
- const scriptPath = path.join(__dirname, '..', 'src', 'office_server.py');
8
-
9
- if (!fs.existsSync(scriptPath)) {
10
- console.error('Error: office_server.py not found');
11
- process.exit(1);
12
- }
7
+ const args = process.argv.slice(2);
8
+ const isActivate = args[0] === 'activate';
13
9
 
14
10
  const python = process.platform === 'win32' ? 'python' : 'python3';
15
11
 
16
- const proc = spawn(python, [scriptPath], {
17
- cwd: path.join(__dirname, '..', 'src'),
18
- stdio: 'inherit'
19
- });
20
-
21
- proc.on('close', (code) => {
22
- process.exit(code);
23
- });
12
+ if (isActivate) {
13
+ const activatePath = path.join(__dirname, '..', 'src', 'activate.py');
14
+ if (!fs.existsSync(activatePath)) {
15
+ console.error('Error: activate.py not found');
16
+ process.exit(1);
17
+ }
18
+ const proc = spawn(python, [activatePath], {
19
+ cwd: path.join(__dirname, '..'),
20
+ stdio: 'inherit'
21
+ });
22
+ proc.on('close', (code) => {
23
+ process.exit(code);
24
+ });
25
+ } else {
26
+ const scriptPath = path.join(__dirname, '..', 'src', 'office_server.py');
27
+ if (!fs.existsSync(scriptPath)) {
28
+ console.error('Error: office_server.py not found');
29
+ process.exit(1);
30
+ }
31
+ const proc = spawn(python, [scriptPath], {
32
+ cwd: path.join(__dirname, '..', 'src'),
33
+ stdio: 'inherit'
34
+ });
35
+ proc.on('close', (code) => {
36
+ process.exit(code);
37
+ });
38
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanskong/office-mcp",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Excel实时办公助手 MCP服务器",
5
5
  "bin": {
6
6
  "office-mcp": "./bin/office-mcp.js"