@proteo-mcp/cli 0.1.0 → 0.1.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/dist/commands/login.js +17 -3
- package/dist/index.js +8 -1
- package/package.json +2 -2
package/dist/commands/login.js
CHANGED
|
@@ -18,12 +18,25 @@ export async function loginCommand(options) {
|
|
|
18
18
|
if (!password) {
|
|
19
19
|
throw new Error("Informe a senha Proteo.");
|
|
20
20
|
}
|
|
21
|
+
const tenantId = (options.tenant?.trim() ||
|
|
22
|
+
(await promptLine(" Tenant InsureMO (ex: unica): "))).trim();
|
|
23
|
+
if (!tenantId) {
|
|
24
|
+
throw new Error("Informe o código do tenant InsureMO (ex: unica). Sem ele o configurador de produto recebe 401 no portal GIMO.");
|
|
25
|
+
}
|
|
26
|
+
if (tenantId.toLowerCase() === username.toLowerCase()) {
|
|
27
|
+
throw new Error("O tenant não pode ser igual ao usuário. Use o código do portal InsureMO (ex: unica).");
|
|
28
|
+
}
|
|
21
29
|
console.log("");
|
|
22
30
|
console.log(" " + kleur.dim("Autenticando..."));
|
|
23
31
|
const res = await fetch(`${mcpUrl}/v1/clients/register`, {
|
|
24
32
|
method: "POST",
|
|
25
33
|
headers: { "Content-Type": "application/json", Accept: "application/json" },
|
|
26
|
-
body: JSON.stringify({
|
|
34
|
+
body: JSON.stringify({
|
|
35
|
+
username,
|
|
36
|
+
password,
|
|
37
|
+
tenantId,
|
|
38
|
+
toolProfile: options.profile?.trim() || "all",
|
|
39
|
+
}),
|
|
27
40
|
});
|
|
28
41
|
const body = (await res.json().catch(() => ({})));
|
|
29
42
|
if (!res.ok) {
|
|
@@ -33,11 +46,12 @@ export async function loginCommand(options) {
|
|
|
33
46
|
if (!apiKey?.startsWith("mcp_live_")) {
|
|
34
47
|
throw new Error("Resposta inválida do servidor: apiKey ausente.");
|
|
35
48
|
}
|
|
36
|
-
const
|
|
37
|
-
saveCredentials({ url: mcpUrl, apiKey, tenantId, username });
|
|
49
|
+
const savedTenant = body.tenantId?.trim() || tenantId;
|
|
50
|
+
saveCredentials({ url: mcpUrl, apiKey, tenantId: savedTenant, username });
|
|
38
51
|
console.log("");
|
|
39
52
|
console.log(kleur.green(" ✔ Autenticado com sucesso!"));
|
|
40
53
|
console.log(` ${kleur.dim("Usuário:")} ${kleur.bold(username)}`);
|
|
54
|
+
console.log(` ${kleur.dim("Tenant:")} ${kleur.bold(savedTenant)}`);
|
|
41
55
|
console.log(` ${kleur.dim("Servidor:")} ${kleur.bold(mcpUrl)}`);
|
|
42
56
|
console.log("");
|
|
43
57
|
console.log(` ${kleur.dim("Sessão salva em")} ${kleur.bold("~/.proteo/mcp-proteo.json")}`);
|
package/dist/index.js
CHANGED
|
@@ -13,8 +13,15 @@ program
|
|
|
13
13
|
.description("Autenticar com usuário e senha Proteo")
|
|
14
14
|
.option("-u, --url <url>", "URL do servidor mcp-proteo", process.env.MCP_PROTEO_URL)
|
|
15
15
|
.option("--username <username>", "Usuário Proteo (senão, pergunta no terminal)")
|
|
16
|
+
.option("--tenant <tenantCode>", "Código do tenant InsureMO (ex: unica) — necessário para produto/GIMO")
|
|
17
|
+
.option("--profile <profile>", "Perfil de tools: produto | sinistros | chatbot | all (default all)")
|
|
16
18
|
.action((options) => {
|
|
17
|
-
loginCommand({
|
|
19
|
+
loginCommand({
|
|
20
|
+
url: options.url,
|
|
21
|
+
username: options.username,
|
|
22
|
+
tenant: options.tenant,
|
|
23
|
+
profile: options.profile,
|
|
24
|
+
}).catch((err) => {
|
|
18
25
|
process.stderr.write(`\n Erro: ${err instanceof Error ? err.message : String(err)}\n\n`);
|
|
19
26
|
process.exit(1);
|
|
20
27
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proteo-mcp/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "CLI e bridge stdio do mcp-proteo. Use `npx @proteo/mcp-proteo login` para autenticar e configure no seu cliente MCP.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"node": ">=18.17"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
26
|
+
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
27
27
|
"commander": "^12.1.0",
|
|
28
28
|
"kleur": "^4.1.5"
|
|
29
29
|
},
|