outlook-reader-mcp 1.0.0 → 1.0.1
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/LICENSE +674 -674
- package/dist/auth.d.ts +26 -0
- package/dist/files.d.ts +8 -0
- package/dist/mail.d.ts +34 -0
- package/dist/mcp-server.d.ts +2 -0
- package/dist/tools/authenticate/definition.d.ts +8 -0
- package/dist/tools/authenticate/index.d.ts +2 -0
- package/dist/tools/authenticate/key.d.ts +1 -0
- package/dist/tools/authenticate/schema.d.ts +3 -0
- package/dist/tools/download-attachment/definition.d.ts +8 -0
- package/dist/tools/download-attachment/index.d.ts +2 -0
- package/dist/tools/download-attachment/key.d.ts +1 -0
- package/dist/tools/download-attachment/schema.d.ts +7 -0
- package/dist/tools/download-attachments/definition.d.ts +8 -0
- package/dist/tools/download-attachments/index.d.ts +2 -0
- package/dist/tools/download-attachments/key.d.ts +1 -0
- package/dist/tools/download-attachments/schema.d.ts +8 -0
- package/dist/tools/get-email/definition.d.ts +8 -0
- package/dist/tools/get-email/index.d.ts +2 -0
- package/dist/tools/get-email/key.d.ts +1 -0
- package/dist/tools/get-email/schema.d.ts +5 -0
- package/dist/tools/get-emails/definition.d.ts +8 -0
- package/dist/tools/get-emails/index.d.ts +2 -0
- package/dist/tools/get-emails/key.d.ts +1 -0
- package/dist/tools/get-emails/schema.d.ts +5 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/list-attachments/definition.d.ts +8 -0
- package/dist/tools/list-attachments/index.d.ts +2 -0
- package/dist/tools/list-attachments/key.d.ts +1 -0
- package/dist/tools/list-attachments/schema.d.ts +5 -0
- package/dist/tools/list-emails/definition.d.ts +8 -0
- package/dist/tools/list-emails/index.d.ts +2 -0
- package/dist/tools/list-emails/key.d.ts +1 -0
- package/dist/tools/list-emails/schema.d.ts +9 -0
- package/dist/tools/list-folders/definition.d.ts +7 -0
- package/dist/tools/list-folders/index.d.ts +2 -0
- package/dist/tools/list-folders/key.d.ts +1 -0
- package/dist/tools/list-folders/schema.d.ts +3 -0
- package/dist/tools/search-emails/definition.d.ts +8 -0
- package/dist/tools/search-emails/index.d.ts +2 -0
- package/dist/tools/search-emails/key.d.ts +1 -0
- package/dist/tools/search-emails/schema.d.ts +6 -0
- package/dist/tools/sign-out/definition.d.ts +8 -0
- package/dist/tools/sign-out/index.d.ts +2 -0
- package/dist/tools/sign-out/key.d.ts +1 -0
- package/dist/tools/sign-out/schema.d.ts +3 -0
- package/dist/tools/wrap.d.ts +13 -0
- package/package.json +5 -1
package/dist/auth.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare function getConfig(): {
|
|
2
|
+
clientId: string;
|
|
3
|
+
tenantId: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Thrown when a request needs the user to sign in. Tool handlers surface the
|
|
7
|
+
* message as tool output so the model can tell the user exactly what to do —
|
|
8
|
+
* auth must never silently block inside a tool call.
|
|
9
|
+
*/
|
|
10
|
+
export declare class AuthRequiredError extends Error {
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Kicks off the device code flow and resolves as soon as the verification
|
|
14
|
+
* URL + code are available, while MSAL keeps polling in the background.
|
|
15
|
+
* Calling again while a code is still valid returns the same code.
|
|
16
|
+
*/
|
|
17
|
+
export declare function startDeviceCodeAuth(): Promise<string>;
|
|
18
|
+
/**
|
|
19
|
+
* Signs out: cancels any in-flight device code flow, drops the in-memory
|
|
20
|
+
* token, and removes all accounts from the persistent cache. Returns the
|
|
21
|
+
* usernames that were removed.
|
|
22
|
+
*/
|
|
23
|
+
export declare function clearAuth(): Promise<string[]>;
|
|
24
|
+
/** Username of the signed-in account, or null when not authenticated. */
|
|
25
|
+
export declare function getSignedInAccount(): Promise<string | null>;
|
|
26
|
+
export declare function getAccessToken(): Promise<string>;
|
package/dist/files.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Attachment names come from the email sender, so they must be treated as
|
|
3
|
+
* untrusted input: strip any path components (prevents `..\` traversal),
|
|
4
|
+
* control characters, and characters Windows rejects in filenames.
|
|
5
|
+
*/
|
|
6
|
+
export declare function sanitizeFilename(name: string): string;
|
|
7
|
+
/** Returns a path in `dir` that doesn't collide with an existing file. */
|
|
8
|
+
export declare function uniquePath(dir: string, filename: string): string;
|
package/dist/mail.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { MailFolder, Message } from '@microsoft/microsoft-graph-types';
|
|
2
|
+
export interface ListEmailsOptions {
|
|
3
|
+
top?: number;
|
|
4
|
+
skip?: number;
|
|
5
|
+
filter?: string;
|
|
6
|
+
folder?: string;
|
|
7
|
+
orderby?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function listEmails(options?: ListEmailsOptions): Promise<Message[]>;
|
|
10
|
+
export declare function listFolders(): Promise<MailFolder[]>;
|
|
11
|
+
export declare function getEmail(id: string): Promise<Message>;
|
|
12
|
+
export type BatchEmailResult = {
|
|
13
|
+
ok: true;
|
|
14
|
+
message: Message;
|
|
15
|
+
} | {
|
|
16
|
+
ok: false;
|
|
17
|
+
id: string;
|
|
18
|
+
error: string;
|
|
19
|
+
};
|
|
20
|
+
export declare function getEmails(ids: string[]): Promise<BatchEmailResult[]>;
|
|
21
|
+
export declare function searchEmails(query: string, top?: number): Promise<Message[]>;
|
|
22
|
+
export interface AttachmentInfo {
|
|
23
|
+
id: string;
|
|
24
|
+
name: string;
|
|
25
|
+
size: number;
|
|
26
|
+
contentType: string;
|
|
27
|
+
isInline: boolean;
|
|
28
|
+
}
|
|
29
|
+
export declare function listAttachments(messageId: string): Promise<AttachmentInfo[]>;
|
|
30
|
+
export declare function downloadAttachment(messageId: string, attachmentId: string): Promise<{
|
|
31
|
+
name: string;
|
|
32
|
+
contentBytes: string;
|
|
33
|
+
contentType: string;
|
|
34
|
+
}>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Input } from './schema.js';
|
|
2
|
+
export declare const description = "Sign in to the Microsoft account used by the other tools. Returns a URL and a one-time code: show both to the user and tell them to complete the sign-in in their browser. Run this when other tools report that authentication is required. Safe to call anytime \u2014 reports the current account if already signed in.";
|
|
3
|
+
export declare function handler(_input: Input): Promise<{
|
|
4
|
+
content: {
|
|
5
|
+
type: "text";
|
|
6
|
+
text: string;
|
|
7
|
+
}[];
|
|
8
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const KEY = "authenticate";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Input } from './schema.js';
|
|
2
|
+
export declare const description = "Download a specific email attachment and save it to disk. Use list_attachments first to get the attachment ID. To save several (or all) attachments from an email in one call, use download_attachments instead. Returns the full path where the file was saved.";
|
|
3
|
+
export declare function handler({ messageId, attachmentId, saveTo }: Input): Promise<{
|
|
4
|
+
content: {
|
|
5
|
+
type: "text";
|
|
6
|
+
text: string;
|
|
7
|
+
}[];
|
|
8
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const KEY = "download_attachment";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Input } from './schema.js';
|
|
2
|
+
export declare const description = "Download multiple attachments from an email in a single call and save them to disk. Omit attachmentIds to download all file attachments. Returns the saved path for each file.";
|
|
3
|
+
export declare function handler({ messageId, attachmentIds, saveTo, includeInline, }: Input): Promise<{
|
|
4
|
+
content: {
|
|
5
|
+
type: "text";
|
|
6
|
+
text: string;
|
|
7
|
+
}[];
|
|
8
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const KEY = "download_attachments";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const schema: z.ZodObject<{
|
|
3
|
+
messageId: z.ZodString;
|
|
4
|
+
attachmentIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
5
|
+
saveTo: z.ZodOptional<z.ZodString>;
|
|
6
|
+
includeInline: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
export type Input = z.infer<typeof schema>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Input } from './schema.js';
|
|
2
|
+
export declare const description = "Get the full content of a specific email by its ID, including the complete body. To fetch several emails at once, use get_emails instead.";
|
|
3
|
+
export declare function handler({ id }: Input): Promise<{
|
|
4
|
+
content: {
|
|
5
|
+
type: "text";
|
|
6
|
+
text: string;
|
|
7
|
+
}[];
|
|
8
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const KEY: "get_email";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Input } from './schema.js';
|
|
2
|
+
export declare const description = "Get the full content of multiple emails by their IDs in a single batched request. Much faster than calling get_email repeatedly. Returns subject, sender, recipients, and complete body for each.";
|
|
3
|
+
export declare function handler({ ids }: Input): Promise<{
|
|
4
|
+
content: {
|
|
5
|
+
type: "text";
|
|
6
|
+
text: string;
|
|
7
|
+
}[];
|
|
8
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const KEY = "get_emails";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Input } from './schema.js';
|
|
2
|
+
export declare const description = "List all attachments for a specific email. Returns attachment IDs, names, sizes, and content types. Use download_attachment for one file, or download_attachments to save several (or all) in a single call.";
|
|
3
|
+
export declare function handler({ messageId }: Input): Promise<{
|
|
4
|
+
content: {
|
|
5
|
+
type: "text";
|
|
6
|
+
text: string;
|
|
7
|
+
}[];
|
|
8
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const KEY = "list_attachments";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Input } from './schema.js';
|
|
2
|
+
export declare const description = "List emails from an Outlook mailbox folder. Supports filtering by read status, sender, date range, and more using OData filter syntax. Use skip to page through results.";
|
|
3
|
+
export declare function handler({ folder, top, skip, filter, orderby }: Input): Promise<{
|
|
4
|
+
content: {
|
|
5
|
+
type: "text";
|
|
6
|
+
text: string;
|
|
7
|
+
}[];
|
|
8
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const KEY: "list_emails";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const schema: z.ZodObject<{
|
|
3
|
+
folder: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
4
|
+
top: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
5
|
+
skip: z.ZodOptional<z.ZodNumber>;
|
|
6
|
+
filter: z.ZodOptional<z.ZodString>;
|
|
7
|
+
orderby: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export type Input = z.infer<typeof schema>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const KEY: "list_folders";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Input } from './schema.js';
|
|
2
|
+
export declare const description = "Search emails using a keyword query. Searches across subject, body, sender, and recipients.";
|
|
3
|
+
export declare function handler({ query, top }: Input): Promise<{
|
|
4
|
+
content: {
|
|
5
|
+
type: "text";
|
|
6
|
+
text: string;
|
|
7
|
+
}[];
|
|
8
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const KEY: "search_emails";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Input } from './schema.js';
|
|
2
|
+
export declare const description = "Sign out of the Microsoft account: removes the cached session from this machine and cancels any pending sign-in. After this, the authenticate tool must be run again before other tools work. Note: this clears the local token cache but does not revoke app consent in the Microsoft account.";
|
|
3
|
+
export declare function handler(_input: Input): Promise<{
|
|
4
|
+
content: {
|
|
5
|
+
type: "text";
|
|
6
|
+
text: string;
|
|
7
|
+
}[];
|
|
8
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const KEY = "sign_out";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type ToolResult = {
|
|
2
|
+
content: {
|
|
3
|
+
type: 'text';
|
|
4
|
+
text: string;
|
|
5
|
+
}[];
|
|
6
|
+
isError?: boolean;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Wraps a tool handler so Graph/network errors come back as readable tool
|
|
10
|
+
* output instead of a raw stack trace.
|
|
11
|
+
*/
|
|
12
|
+
export declare function wrapHandler<I>(fn: (input: I) => Promise<ToolResult>): (input: I) => Promise<ToolResult>;
|
|
13
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "outlook-reader-mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "MCP server for reading Outlook mail via Microsoft Graph: list, search, and fetch emails (batched), and download attachments.",
|
|
5
|
+
"main": "dist/mcp-server.js",
|
|
6
|
+
"types": "dist/mcp-server.d.ts",
|
|
7
|
+
"sideEffects": false,
|
|
5
8
|
"bin": {
|
|
6
9
|
"outlook-reader-mcp": "dist/mcp-server.js"
|
|
7
10
|
},
|
|
@@ -12,6 +15,7 @@
|
|
|
12
15
|
"mcp": "tsx src/mcp-server.ts",
|
|
13
16
|
"build": "tsc",
|
|
14
17
|
"prepublishOnly": "npm run format:check && npm run build",
|
|
18
|
+
"postversion": "git push --follow-tags",
|
|
15
19
|
"format": "prettier --write .",
|
|
16
20
|
"format:check": "prettier --check ."
|
|
17
21
|
},
|