Compare commits
8 Commits
main
..
a4741b6820
| Author | SHA1 | Date | |
|---|---|---|---|
| a4741b6820 | |||
| 07db914ca0 | |||
| 2f0bfba1cf | |||
| 8dcdab97ce | |||
| afa2bf5126 | |||
| 979e974521 | |||
| 1599bf3981 | |||
| 17a6f91b3f |
@@ -2,17 +2,17 @@ import { XMLParser } from "fast-xml-parser";
|
|||||||
import https from "node:https";
|
import https from "node:https";
|
||||||
import { createRequire } from "node:module";
|
import { createRequire } from "node:module";
|
||||||
import { promisify } from "node:util";
|
import { promisify } from "node:util";
|
||||||
import { initDataDir } from "../utils/data.ts";
|
import { extractEmail, type Email } from "../utils/extract_email.ts";
|
||||||
import { type Email, extractEmail } from "../utils/extract_email.ts";
|
|
||||||
import { extractFolders, type Folder } from "../utils/extract_folder.ts";
|
import { extractFolders, type Folder } from "../utils/extract_folder.ts";
|
||||||
|
import { initDataDir } from "../utils/data.ts";
|
||||||
import {
|
import {
|
||||||
|
loadConfig,
|
||||||
|
saveConfig,
|
||||||
clearConfig,
|
clearConfig,
|
||||||
|
setPassword,
|
||||||
getPassword,
|
getPassword,
|
||||||
hasPassword,
|
hasPassword,
|
||||||
loadConfig,
|
|
||||||
type LoginConfig,
|
type LoginConfig,
|
||||||
saveConfig,
|
|
||||||
setPassword,
|
|
||||||
} from "../utils/login.ts";
|
} from "../utils/login.ts";
|
||||||
|
|
||||||
const ntlm: any = createRequire(import.meta.url)("httpntlm");
|
const ntlm: any = createRequire(import.meta.url)("httpntlm");
|
||||||
@@ -130,8 +130,7 @@ export class EwsClient {
|
|||||||
|
|
||||||
async getFolderId(folderName: string): Promise<string> {
|
async getFolderId(folderName: string): Promise<string> {
|
||||||
const lower = folderName.toLowerCase();
|
const lower = folderName.toLowerCase();
|
||||||
const distinguished =
|
const distinguished = (DISTINGUISHED_FOLDERS as Record<string, string>)[lower];
|
||||||
(DISTINGUISHED_FOLDERS as Record<string, string>)[lower];
|
|
||||||
|
|
||||||
if (distinguished) {
|
if (distinguished) {
|
||||||
const soap = buildSoapEnvelope(`\
|
const soap = buildSoapEnvelope(`\
|
||||||
@@ -206,8 +205,7 @@ export class EwsClient {
|
|||||||
} = options;
|
} = options;
|
||||||
|
|
||||||
const isDistinguished =
|
const isDistinguished =
|
||||||
(DISTINGUISHED_FOLDERS as Record<string, string>)[folderId.toLowerCase()]
|
(DISTINGUISHED_FOLDERS as Record<string, string>)[folderId.toLowerCase()] !== undefined;
|
||||||
!== undefined;
|
|
||||||
|
|
||||||
const folderIdXml = isDistinguished
|
const folderIdXml = isDistinguished
|
||||||
? `<t:DistinguishedFolderId Id="${folderId}"/>`
|
? `<t:DistinguishedFolderId Id="${folderId}"/>`
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|||||||
import { Command } from "commander";
|
import { Command } from "commander";
|
||||||
import crypto from "node:crypto";
|
import crypto from "node:crypto";
|
||||||
import http from "node:http";
|
import http from "node:http";
|
||||||
|
import { initDataDir } from "./utils/data.ts";
|
||||||
import { registerAuthTools } from "./tools/auth.ts";
|
import { registerAuthTools } from "./tools/auth.ts";
|
||||||
import { registerAvailabilityTools } from "./tools/availability.ts";
|
import { registerAvailabilityTools } from "./tools/availability.ts";
|
||||||
import { registerCalendarTools } from "./tools/calendar.ts";
|
import { registerCalendarTools } from "./tools/calendar.ts";
|
||||||
import { registerEmailTools } from "./tools/email.ts";
|
import { registerEmailTools } from "./tools/email.ts";
|
||||||
import { registerFolderTools } from "./tools/folders.ts";
|
import { registerFolderTools } from "./tools/folders.ts";
|
||||||
import { registerPeopleTools } from "./tools/people.ts";
|
import { registerPeopleTools } from "./tools/people.ts";
|
||||||
import { initDataDir } from "./utils/data.ts";
|
|
||||||
|
|
||||||
const program = new Command()
|
const program = new Command()
|
||||||
.name("exchange-mcp")
|
.name("exchange-mcp")
|
||||||
|
|||||||
+1
-7
@@ -1,13 +1,7 @@
|
|||||||
import { type McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
import { type McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
||||||
import { z } from "zod/v4";
|
import { z } from "zod/v4";
|
||||||
|
import { clearConfig, hasPassword, loadConfig, saveConfig, setPassword } from "../utils/login.ts";
|
||||||
import { EwsClient } from "../client/ews_client.ts";
|
import { EwsClient } from "../client/ews_client.ts";
|
||||||
import {
|
|
||||||
clearConfig,
|
|
||||||
hasPassword,
|
|
||||||
loadConfig,
|
|
||||||
saveConfig,
|
|
||||||
setPassword,
|
|
||||||
} from "../utils/login.ts";
|
|
||||||
import { type LoginConfig } from "../utils/login.ts";
|
import { type LoginConfig } from "../utils/login.ts";
|
||||||
|
|
||||||
export function registerAuthTools(server: McpServer): void {
|
export function registerAuthTools(server: McpServer): void {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { type McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
import { type McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
||||||
import { z } from "zod/v4";
|
import { z } from "zod/v4";
|
||||||
import { EwsClient } from "../client/ews_client.ts";
|
|
||||||
import { loadConfig } from "../utils/login.ts";
|
import { loadConfig } from "../utils/login.ts";
|
||||||
|
import { EwsClient } from "../client/ews_client.ts";
|
||||||
|
|
||||||
export function registerAvailabilityTools(server: McpServer): void {
|
export function registerAvailabilityTools(server: McpServer): void {
|
||||||
server.registerTool(
|
server.registerTool(
|
||||||
|
|||||||
+1
-1
@@ -2,8 +2,8 @@ import { type McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|||||||
import fs from "node:fs";
|
import fs from "node:fs";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import { z } from "zod/v4";
|
import { z } from "zod/v4";
|
||||||
import { EwsClient } from "../client/ews_client.ts";
|
|
||||||
import { loadConfig } from "../utils/login.ts";
|
import { loadConfig } from "../utils/login.ts";
|
||||||
|
import { EwsClient } from "../client/ews_client.ts";
|
||||||
|
|
||||||
export function registerCalendarTools(server: McpServer): void {
|
export function registerCalendarTools(server: McpServer): void {
|
||||||
server.registerTool(
|
server.registerTool(
|
||||||
|
|||||||
+1
-1
@@ -2,8 +2,8 @@ import { type McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|||||||
import fs from "node:fs";
|
import fs from "node:fs";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import { z } from "zod/v4";
|
import { z } from "zod/v4";
|
||||||
import { EwsClient } from "../client/ews_client.ts";
|
|
||||||
import { loadConfig } from "../utils/login.ts";
|
import { loadConfig } from "../utils/login.ts";
|
||||||
|
import { EwsClient } from "../client/ews_client.ts";
|
||||||
|
|
||||||
function getClient(): EwsClient {
|
function getClient(): EwsClient {
|
||||||
return new EwsClient(loadConfig());
|
return new EwsClient(loadConfig());
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
import { type McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
import { type McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
||||||
import { z } from "zod/v4";
|
import { z } from "zod/v4";
|
||||||
import { EwsClient } from "../client/ews_client.ts";
|
|
||||||
import { loadConfig } from "../utils/login.ts";
|
import { loadConfig } from "../utils/login.ts";
|
||||||
|
import { EwsClient } from "../client/ews_client.ts";
|
||||||
|
|
||||||
export function registerFolderTools(server: McpServer): void {
|
export function registerFolderTools(server: McpServer): void {
|
||||||
server.registerTool(
|
server.registerTool(
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
import { type McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
import { type McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
||||||
import { z } from "zod/v4";
|
import { z } from "zod/v4";
|
||||||
import { EwsClient } from "../client/ews_client.ts";
|
|
||||||
import { loadConfig } from "../utils/login.ts";
|
import { loadConfig } from "../utils/login.ts";
|
||||||
|
import { EwsClient } from "../client/ews_client.ts";
|
||||||
|
|
||||||
export function registerPeopleTools(server: McpServer): void {
|
export function registerPeopleTools(server: McpServer): void {
|
||||||
server.registerTool(
|
server.registerTool(
|
||||||
|
|||||||
Reference in New Issue
Block a user