@mearl/mcp-server 2.8.1 → 2.9.0
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/dist/cliArgs.d.ts +6 -0
- package/dist/cliArgs.js +84 -0
- package/dist/configure.d.ts +1 -0
- package/dist/configure.js +56 -28
- package/dist/index.js +21 -5
- package/dist/uninstall.d.ts +6 -0
- package/dist/uninstall.js +47 -3
- package/package.json +7 -3
package/dist/uninstall.d.ts
CHANGED
|
@@ -33,4 +33,10 @@ export interface MCPUninstallDependencies {
|
|
|
33
33
|
}>;
|
|
34
34
|
removeNativeHost?: typeof uninstallNativeHost;
|
|
35
35
|
}
|
|
36
|
+
export interface ParsedUninstallArgs {
|
|
37
|
+
help: boolean;
|
|
38
|
+
managedBySetup: boolean;
|
|
39
|
+
yes: boolean;
|
|
40
|
+
}
|
|
41
|
+
export declare function parseUninstallArgs(argv: string[]): ParsedUninstallArgs;
|
|
36
42
|
export declare function runUninstall(argv?: string[], dependencies?: MCPUninstallDependencies): Promise<boolean>;
|
package/dist/uninstall.js
CHANGED
|
@@ -12,6 +12,7 @@ import { execFileSync } from 'child_process';
|
|
|
12
12
|
import path from 'node:path';
|
|
13
13
|
import { fileURLToPath } from 'node:url';
|
|
14
14
|
import prompts from 'prompts';
|
|
15
|
+
import { Command, CommanderError } from 'commander';
|
|
15
16
|
import { MCP_CLIENTS } from './mcp-clients.js';
|
|
16
17
|
import { uninstallNativeHost } from '@mearl/native-host';
|
|
17
18
|
// 检查是否全局安装
|
|
@@ -82,8 +83,36 @@ export function cleanMCPConfig(configPath, clientConfig) {
|
|
|
82
83
|
return 'failed';
|
|
83
84
|
}
|
|
84
85
|
}
|
|
86
|
+
export function parseUninstallArgs(argv) {
|
|
87
|
+
const program = new Command()
|
|
88
|
+
.name('mearl-mcp-uninstall')
|
|
89
|
+
.helpOption(false)
|
|
90
|
+
.allowExcessArguments(false)
|
|
91
|
+
.exitOverride()
|
|
92
|
+
.configureOutput({ writeErr: () => { }, writeOut: () => { } })
|
|
93
|
+
.option('--managed-by-setup')
|
|
94
|
+
.option('-y, --yes')
|
|
95
|
+
.option('--non-interactive')
|
|
96
|
+
.option('-h, --help');
|
|
97
|
+
try {
|
|
98
|
+
program.parse(['node', 'mearl-mcp-uninstall', ...argv]);
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
if (error instanceof CommanderError) {
|
|
102
|
+
throw new Error(error.message.replace(/^error:\s*/i, ''), { cause: error });
|
|
103
|
+
}
|
|
104
|
+
throw error;
|
|
105
|
+
}
|
|
106
|
+
const options = program.opts();
|
|
107
|
+
return {
|
|
108
|
+
help: options.help === true,
|
|
109
|
+
managedBySetup: options.managedBySetup === true,
|
|
110
|
+
yes: options.yes === true || options.nonInteractive === true,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
85
113
|
// 卸载主函数
|
|
86
114
|
export async function runUninstall(argv = process.argv.slice(2), dependencies = {}) {
|
|
115
|
+
const parsed = parseUninstallArgs(argv);
|
|
87
116
|
const log = dependencies.log ?? (message => console.log(message));
|
|
88
117
|
const logError = dependencies.logError ?? (message => console.error(message));
|
|
89
118
|
const removeNativeHost = dependencies.removeNativeHost ?? uninstallNativeHost;
|
|
@@ -92,8 +121,17 @@ export async function runUninstall(argv = process.argv.slice(2), dependencies =
|
|
|
92
121
|
const clients = dependencies.clients ?? MCP_CLIENTS;
|
|
93
122
|
const prompt = dependencies.prompt ?? prompts;
|
|
94
123
|
const cleanConfig = dependencies.cleanConfig ?? cleanMCPConfig;
|
|
95
|
-
|
|
96
|
-
|
|
124
|
+
if (parsed.help) {
|
|
125
|
+
log(`Usage: mearl-mcp-uninstall [options]
|
|
126
|
+
|
|
127
|
+
Options:
|
|
128
|
+
--managed-by-setup Suppress global uninstall guidance
|
|
129
|
+
--yes, -y Clean every discovered client without prompting
|
|
130
|
+
--non-interactive Alias for --yes
|
|
131
|
+
--help, -h Show this help`);
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
const { managedBySetup, yes } = parsed;
|
|
97
135
|
log('🗑️ Mearl MCP 卸载\n');
|
|
98
136
|
try {
|
|
99
137
|
let completed = true;
|
|
@@ -169,5 +207,11 @@ export async function runUninstall(argv = process.argv.slice(2), dependencies =
|
|
|
169
207
|
}
|
|
170
208
|
const currentFile = fileURLToPath(import.meta.url);
|
|
171
209
|
if (process.argv[1] && path.resolve(process.argv[1]) === currentFile) {
|
|
172
|
-
|
|
210
|
+
try {
|
|
211
|
+
process.exitCode = (await runUninstall()) ? 0 : 1;
|
|
212
|
+
}
|
|
213
|
+
catch (error) {
|
|
214
|
+
console.error(`Uninstall failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
215
|
+
process.exitCode = 2;
|
|
216
|
+
}
|
|
173
217
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mearl/mcp-server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "MCP Server for Mearl - enables AI to interact with Chrome browser requests and logs",
|
|
5
5
|
"mcpName": "io.github.F-loat/mearl",
|
|
6
6
|
"type": "module",
|
|
@@ -25,13 +25,17 @@
|
|
|
25
25
|
],
|
|
26
26
|
"author": "",
|
|
27
27
|
"license": "ISC",
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=22.12.0"
|
|
30
|
+
},
|
|
28
31
|
"publishConfig": {
|
|
29
32
|
"registry": "https://registry.npmjs.org"
|
|
30
33
|
},
|
|
31
34
|
"dependencies": {
|
|
35
|
+
"commander": "^15.0.0",
|
|
32
36
|
"prompts": "^2.4.2",
|
|
33
|
-
"@mearl/
|
|
34
|
-
"@mearl/
|
|
37
|
+
"@mearl/client": "2.9.0",
|
|
38
|
+
"@mearl/native-host": "2.9.0"
|
|
35
39
|
},
|
|
36
40
|
"devDependencies": {
|
|
37
41
|
"@modelcontextprotocol/sdk": "^1.0.4",
|