w
This commit is contained in:
+14
-2
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user