This commit is contained in:
2026-07-09 09:21:04 +03:00
parent d517162081
commit a79db30ea9
3 changed files with 45 additions and 5 deletions
+14 -2
View File
@@ -3,8 +3,10 @@ import { z } from "zod/v4";
import {
clearConfig,
EwsClient,
hasPassword,
loadConfig,
saveConfig,
setPassword,
} from "../ews_client.ts";
export function registerAuthTools(server: McpServer): void {
@@ -28,11 +30,10 @@ export function registerAuthTools(server: McpServer): void {
serverUrl: serverUrl.replace(/\/+$/, ""),
email,
username,
password,
domain: domain ?? "corp",
};
const client = new EwsClient(config);
const client = new EwsClient(config, password);
const result = await client.verifyConnection();
if (!result.ok) {
@@ -80,6 +81,17 @@ export function registerAuthTools(server: McpServer): void {
},
async () => {
try {
if (!hasPassword()) {
return {
content: [{
type: "text" as const,
text: JSON.stringify({
authenticated: false,
error: "Not logged in. Password not found in memory.",
}),
}],
};
}
const config = loadConfig();
const client = new EwsClient(config);
const result = await client.verifyConnection();