Compare commits
2 Commits
a4741b6820
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 057897daf5 | |||
| a6a288103c |
@@ -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 { extractEmail, type Email } from "../utils/extract_email.ts";
|
|
||||||
import { extractFolders, type Folder } from "../utils/extract_folder.ts";
|
|
||||||
import { initDataDir } from "../utils/data.ts";
|
import { initDataDir } from "../utils/data.ts";
|
||||||
|
import { type Email, extractEmail } from "../utils/extract_email.ts";
|
||||||
|
import { extractFolders, type Folder } from "../utils/extract_folder.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,7 +130,8 @@ 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 = (DISTINGUISHED_FOLDERS as Record<string, string>)[lower];
|
const distinguished =
|
||||||
|
(DISTINGUISHED_FOLDERS as Record<string, string>)[lower];
|
||||||
|
|
||||||
if (distinguished) {
|
if (distinguished) {
|
||||||
const soap = buildSoapEnvelope(`\
|
const soap = buildSoapEnvelope(`\
|
||||||
@@ -205,7 +206,8 @@ export class EwsClient {
|
|||||||
} = options;
|
} = options;
|
||||||
|
|
||||||
const isDistinguished =
|
const isDistinguished =
|
||||||
(DISTINGUISHED_FOLDERS as Record<string, string>)[folderId.toLowerCase()] !== undefined;
|
(DISTINGUISHED_FOLDERS as Record<string, string>)[folderId.toLowerCase()]
|
||||||
|
!== 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")
|
||||||
|
|||||||
+7
-1
@@ -1,7 +1,13 @@
|
|||||||
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 { loadConfig } from "../utils/login.ts";
|
|
||||||
import { EwsClient } from "../client/ews_client.ts";
|
import { EwsClient } from "../client/ews_client.ts";
|
||||||
|
import { loadConfig } from "../utils/login.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 { loadConfig } from "../utils/login.ts";
|
|
||||||
import { EwsClient } from "../client/ews_client.ts";
|
import { EwsClient } from "../client/ews_client.ts";
|
||||||
|
import { loadConfig } from "../utils/login.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 { loadConfig } from "../utils/login.ts";
|
|
||||||
import { EwsClient } from "../client/ews_client.ts";
|
import { EwsClient } from "../client/ews_client.ts";
|
||||||
|
import { loadConfig } from "../utils/login.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 { loadConfig } from "../utils/login.ts";
|
|
||||||
import { EwsClient } from "../client/ews_client.ts";
|
import { EwsClient } from "../client/ews_client.ts";
|
||||||
|
import { loadConfig } from "../utils/login.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 { loadConfig } from "../utils/login.ts";
|
|
||||||
import { EwsClient } from "../client/ews_client.ts";
|
import { EwsClient } from "../client/ews_client.ts";
|
||||||
|
import { loadConfig } from "../utils/login.ts";
|
||||||
|
|
||||||
export function registerPeopleTools(server: McpServer): void {
|
export function registerPeopleTools(server: McpServer): void {
|
||||||
server.registerTool(
|
server.registerTool(
|
||||||
|
|||||||
Reference in New Issue
Block a user