@linkegringo/mcp 1.0.1 → 1.0.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/dist/index.d.ts +15 -6
- package/dist/index.js +108 -27
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -38,20 +38,29 @@ interface CdpStatus {
|
|
|
38
38
|
|
|
39
39
|
declare function checkChromeCdp(port?: number, host?: string, timeoutMs?: number): Promise<CdpStatus>;
|
|
40
40
|
|
|
41
|
+
interface McpTarget {
|
|
42
|
+
id: string;
|
|
43
|
+
client: string;
|
|
44
|
+
configPath: string;
|
|
45
|
+
detected: boolean;
|
|
46
|
+
}
|
|
41
47
|
interface InstallResult {
|
|
42
48
|
client: string;
|
|
43
49
|
configPath: string;
|
|
44
50
|
status: 'created' | 'updated' | 'skipped' | 'error';
|
|
45
51
|
message?: string;
|
|
46
52
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
interface InstallerOptions {
|
|
54
|
+
all?: boolean;
|
|
55
|
+
local?: boolean;
|
|
56
|
+
client?: string;
|
|
57
|
+
}
|
|
58
|
+
declare function getMcpConfigsForSystem(): McpTarget[];
|
|
51
59
|
declare function installMcpServerConfig(configPath: string): {
|
|
52
60
|
status: 'created' | 'updated';
|
|
53
61
|
path: string;
|
|
54
62
|
};
|
|
55
|
-
declare function
|
|
63
|
+
declare function parseArgs(args?: string[]): InstallerOptions;
|
|
64
|
+
declare function runInstaller(args?: string[]): InstallResult[];
|
|
56
65
|
|
|
57
|
-
export { type CdpStatus, type ChromeTabInfo, type ChromeVersionResponse, type InstallResult, checkChromeCdp, createLinkeGringoMcpServer, getMcpConfigsForSystem, installMcpServerConfig, runInstaller };
|
|
66
|
+
export { type CdpStatus, type ChromeTabInfo, type ChromeVersionResponse, type InstallResult, type InstallerOptions, type McpTarget, checkChromeCdp, createLinkeGringoMcpServer, getMcpConfigsForSystem, installMcpServerConfig, parseArgs, runInstaller };
|
package/dist/index.js
CHANGED
|
@@ -1164,37 +1164,49 @@ function getMcpConfigsForSystem() {
|
|
|
1164
1164
|
const home = os.homedir();
|
|
1165
1165
|
const platform = os.platform();
|
|
1166
1166
|
const configs = [];
|
|
1167
|
+
const antigravityPath = path.join(home, ".gemini", "config", "mcp_config.json");
|
|
1167
1168
|
configs.push({
|
|
1169
|
+
id: "antigravity",
|
|
1168
1170
|
client: "Google Antigravity",
|
|
1169
|
-
configPath:
|
|
1171
|
+
configPath: antigravityPath,
|
|
1172
|
+
detected: fs.existsSync(path.join(home, ".gemini")) || fs.existsSync(antigravityPath)
|
|
1170
1173
|
});
|
|
1174
|
+
let claudePath;
|
|
1175
|
+
let claudeDir;
|
|
1171
1176
|
if (platform === "darwin") {
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
configPath: path.join(
|
|
1175
|
-
home,
|
|
1176
|
-
"Library",
|
|
1177
|
-
"Application Support",
|
|
1178
|
-
"Claude",
|
|
1179
|
-
"claude_desktop_config.json"
|
|
1180
|
-
)
|
|
1181
|
-
});
|
|
1177
|
+
claudeDir = path.join(home, "Library", "Application Support", "Claude");
|
|
1178
|
+
claudePath = path.join(claudeDir, "claude_desktop_config.json");
|
|
1182
1179
|
} else if (platform === "win32") {
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
client: "Claude Desktop (Windows)",
|
|
1186
|
-
configPath: path.join(appData, "Claude", "claude_desktop_config.json")
|
|
1187
|
-
});
|
|
1180
|
+
claudeDir = path.join(process.env.APPDATA || path.join(home, "AppData", "Roaming"), "Claude");
|
|
1181
|
+
claudePath = path.join(claudeDir, "claude_desktop_config.json");
|
|
1188
1182
|
} else {
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
configPath: path.join(home, ".config", "Claude", "claude_desktop_config.json")
|
|
1192
|
-
});
|
|
1183
|
+
claudeDir = path.join(home, ".config", "Claude");
|
|
1184
|
+
claudePath = path.join(claudeDir, "claude_desktop_config.json");
|
|
1193
1185
|
}
|
|
1194
1186
|
configs.push({
|
|
1187
|
+
id: "claude",
|
|
1188
|
+
client: `Claude Desktop (${platform === "darwin" ? "macOS" : platform === "win32" ? "Windows" : "Linux"})`,
|
|
1189
|
+
configPath: claudePath,
|
|
1190
|
+
detected: fs.existsSync(claudeDir) || fs.existsSync(claudePath)
|
|
1191
|
+
});
|
|
1192
|
+
const cursorDir = path.join(home, ".cursor");
|
|
1193
|
+
const cursorPath = path.join(cursorDir, "mcp.json");
|
|
1194
|
+
configs.push({
|
|
1195
|
+
id: "cursor",
|
|
1195
1196
|
client: "Cursor AI",
|
|
1196
|
-
configPath:
|
|
1197
|
+
configPath: cursorPath,
|
|
1198
|
+
detected: fs.existsSync(cursorDir) || fs.existsSync(cursorPath)
|
|
1197
1199
|
});
|
|
1200
|
+
const windsurfDir = path.join(home, ".codeium", "windsurf");
|
|
1201
|
+
const windsurfPath = path.join(windsurfDir, "mcp_config.json");
|
|
1202
|
+
if (fs.existsSync(windsurfDir) || fs.existsSync(windsurfPath)) {
|
|
1203
|
+
configs.push({
|
|
1204
|
+
id: "windsurf",
|
|
1205
|
+
client: "Windsurf",
|
|
1206
|
+
configPath: windsurfPath,
|
|
1207
|
+
detected: true
|
|
1208
|
+
});
|
|
1209
|
+
}
|
|
1198
1210
|
return configs;
|
|
1199
1211
|
}
|
|
1200
1212
|
function installMcpServerConfig(configPath) {
|
|
@@ -1232,13 +1244,68 @@ function installMcpServerConfig(configPath) {
|
|
|
1232
1244
|
path: configPath
|
|
1233
1245
|
};
|
|
1234
1246
|
}
|
|
1235
|
-
function
|
|
1247
|
+
function parseArgs(args = []) {
|
|
1248
|
+
const options = {};
|
|
1249
|
+
for (const arg of args) {
|
|
1250
|
+
if (arg === "--all" || arg === "--force") {
|
|
1251
|
+
options.all = true;
|
|
1252
|
+
} else if (arg === "--local" || arg === "-l") {
|
|
1253
|
+
options.local = true;
|
|
1254
|
+
} else if (arg.startsWith("--client=")) {
|
|
1255
|
+
options.client = arg.split("=")[1]?.toLowerCase().trim();
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
return options;
|
|
1259
|
+
}
|
|
1260
|
+
function runInstaller(args = process.argv) {
|
|
1236
1261
|
console.log("\n\u{1F680} LinkeGringo MCP - Instalador Autom\xE1tico");
|
|
1237
1262
|
console.log("================================================");
|
|
1238
|
-
console.log("
|
|
1263
|
+
console.log("\u2139\uFE0F Modo 100% Aut\xF4nomo: N\xE3o requer o c\xF3digo-fonte do LinkeGringo na m\xE1quina.\n");
|
|
1264
|
+
const options = parseArgs(args);
|
|
1239
1265
|
const targets = getMcpConfigsForSystem();
|
|
1240
1266
|
const results = [];
|
|
1267
|
+
if (options.local) {
|
|
1268
|
+
const cwd = process.cwd();
|
|
1269
|
+
const localCursorDir = path.join(cwd, ".cursor");
|
|
1270
|
+
const localPath = path.join(localCursorDir, "mcp.json");
|
|
1271
|
+
try {
|
|
1272
|
+
const res = installMcpServerConfig(localPath);
|
|
1273
|
+
results.push({
|
|
1274
|
+
client: "Workspace Local (Cursor)",
|
|
1275
|
+
configPath: localPath,
|
|
1276
|
+
status: res.status
|
|
1277
|
+
});
|
|
1278
|
+
console.log(`\u2705 [Workspace Local]`);
|
|
1279
|
+
console.log(` Arquivo: ${localPath} (${res.status === "created" ? "Criado" : "Atualizado"})
|
|
1280
|
+
`);
|
|
1281
|
+
} catch (err) {
|
|
1282
|
+
results.push({
|
|
1283
|
+
client: "Workspace Local",
|
|
1284
|
+
configPath: localPath,
|
|
1285
|
+
status: "error",
|
|
1286
|
+
message: err.message
|
|
1287
|
+
});
|
|
1288
|
+
console.warn(`\u26A0\uFE0F [Workspace Local] Erro ao configurar: ${err.message}
|
|
1289
|
+
`);
|
|
1290
|
+
}
|
|
1291
|
+
return results;
|
|
1292
|
+
}
|
|
1293
|
+
const detectedTargets = targets.filter((t) => t.detected);
|
|
1294
|
+
const shouldInstallAll = options.all || detectedTargets.length === 0;
|
|
1241
1295
|
for (const target of targets) {
|
|
1296
|
+
if (options.client && !target.id.includes(options.client)) {
|
|
1297
|
+
continue;
|
|
1298
|
+
}
|
|
1299
|
+
if (!shouldInstallAll && !target.detected) {
|
|
1300
|
+
results.push({
|
|
1301
|
+
client: target.client,
|
|
1302
|
+
configPath: target.configPath,
|
|
1303
|
+
status: "skipped",
|
|
1304
|
+
message: "Cliente n\xE3o detectado nesta m\xE1quina (use --all para for\xE7ar)"
|
|
1305
|
+
});
|
|
1306
|
+
console.log(`\u23ED\uFE0F [${target.client}] N\xE3o detectado nesta m\xE1quina (pulado. Use --all para criar)`);
|
|
1307
|
+
continue;
|
|
1308
|
+
}
|
|
1242
1309
|
try {
|
|
1243
1310
|
const res = installMcpServerConfig(target.configPath);
|
|
1244
1311
|
results.push({
|
|
@@ -1246,7 +1313,8 @@ function runInstaller() {
|
|
|
1246
1313
|
configPath: target.configPath,
|
|
1247
1314
|
status: res.status
|
|
1248
1315
|
});
|
|
1249
|
-
|
|
1316
|
+
const tag = target.detected ? "(Detectado)" : "(Padr\xE3o)";
|
|
1317
|
+
console.log(`\u2705 [${target.client}] ${tag}`);
|
|
1250
1318
|
console.log(` Arquivo: ${target.configPath} (${res.status === "created" ? "Criado" : "Atualizado"})
|
|
1251
1319
|
`);
|
|
1252
1320
|
} catch (err) {
|
|
@@ -1267,14 +1335,16 @@ function runInstaller() {
|
|
|
1267
1335
|
console.log(" \u2022 Claude Code CLI: claude mcp add linkegringo npx -y @linkegringo/mcp");
|
|
1268
1336
|
console.log(' \u2022 Goose CLI: goose configure --add-extension "npx -y @linkegringo/mcp"');
|
|
1269
1337
|
console.log("================================================");
|
|
1270
|
-
console.log("\u{1F389} Instala\xE7\xE3o conclu\xEDda! Reinicie o
|
|
1338
|
+
console.log("\u{1F389} Instala\xE7\xE3o conclu\xEDda! Reinicie o seu cliente de IA para ativar.\n");
|
|
1271
1339
|
return results;
|
|
1272
1340
|
}
|
|
1273
1341
|
|
|
1274
1342
|
// src/index.ts
|
|
1343
|
+
import fs2 from "fs";
|
|
1344
|
+
import { fileURLToPath } from "url";
|
|
1275
1345
|
async function main() {
|
|
1276
1346
|
if (process.argv.includes("install") || process.argv.includes("setup") || process.argv.includes("--install")) {
|
|
1277
|
-
runInstaller();
|
|
1347
|
+
runInstaller(process.argv);
|
|
1278
1348
|
return;
|
|
1279
1349
|
}
|
|
1280
1350
|
const server = createLinkeGringoMcpServer();
|
|
@@ -1282,7 +1352,17 @@ async function main() {
|
|
|
1282
1352
|
await server.connect(transport);
|
|
1283
1353
|
console.error("[LinkeGringo MCP] Servidor iniciado com sucesso via stdio.");
|
|
1284
1354
|
}
|
|
1285
|
-
|
|
1355
|
+
function isDirectExecution() {
|
|
1356
|
+
if (!process.argv[1]) return false;
|
|
1357
|
+
try {
|
|
1358
|
+
const currentFilePath = fileURLToPath(import.meta.url);
|
|
1359
|
+
const scriptPath = fs2.existsSync(process.argv[1]) ? fs2.realpathSync(process.argv[1]) : process.argv[1];
|
|
1360
|
+
return currentFilePath === scriptPath || process.argv[1].endsWith("index.js") || process.argv[1].endsWith("linkegringo-mcp") || process.argv[1].endsWith("mcp") || process.argv[1].endsWith("linkegringo");
|
|
1361
|
+
} catch {
|
|
1362
|
+
return true;
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
if (isDirectExecution()) {
|
|
1286
1366
|
main().catch((err) => {
|
|
1287
1367
|
console.error("[LinkeGringo MCP] Erro fatal na inicializa\xE7\xE3o:", err);
|
|
1288
1368
|
process.exit(1);
|
|
@@ -1293,5 +1373,6 @@ export {
|
|
|
1293
1373
|
createLinkeGringoMcpServer,
|
|
1294
1374
|
getMcpConfigsForSystem,
|
|
1295
1375
|
installMcpServerConfig,
|
|
1376
|
+
parseArgs,
|
|
1296
1377
|
runInstaller
|
|
1297
1378
|
};
|