Add optional mailbox (UPN/SMTP) routing on email/folder/thread tools via
users/{upn}/... and X-AnchorMailbox. New list-mailboxes probes primary,
OUTLOOK_SHARED_MAILBOXES seeds, cache, and candidates. Send supports
mailbox-rooted sendMail and onBehalfOf. MSAL requests Mail.*.Shared;
check-auth-status reports token scp gaps. Docs, env example, tests.
77 lines
3.1 KiB
JavaScript
77 lines
3.1 KiB
JavaScript
/**
|
|
* Configuration for Outlook MCP Server
|
|
*/
|
|
const path = require('path');
|
|
const os = require('os');
|
|
|
|
// Ensure we have a home directory path even if process.env.HOME is undefined
|
|
const homeDir = process.env.HOME || process.env.USERPROFILE || os.homedir() || '/tmp';
|
|
|
|
const enableSharedMailboxes = process.env.OUTLOOK_ENABLE_SHARED_MAILBOXES !== 'false';
|
|
|
|
const baseScopes = [
|
|
'Mail.Read',
|
|
'Mail.ReadWrite',
|
|
'Mail.Send',
|
|
'User.Read',
|
|
'Calendars.Read',
|
|
'Calendars.ReadWrite',
|
|
'MailboxSettings.ReadWrite',
|
|
'offline_access'
|
|
];
|
|
|
|
const sharedScopes = enableSharedMailboxes
|
|
? ['Mail.Read.Shared', 'Mail.ReadWrite.Shared', 'Mail.Send.Shared']
|
|
: [];
|
|
|
|
module.exports = {
|
|
// Server information
|
|
SERVER_NAME: "outlook-assistant-main",
|
|
SERVER_VERSION: "1.1.0",
|
|
|
|
// Test mode setting
|
|
USE_TEST_MODE: process.env.USE_TEST_MODE === 'true',
|
|
|
|
// Debug mode setting
|
|
DEBUG_MODE: process.env.DEBUG_MODE === 'true',
|
|
|
|
// Shared / delegated mailbox feature flag (scopes + list-mailboxes tool)
|
|
ENABLE_SHARED_MAILBOXES: enableSharedMailboxes,
|
|
|
|
// Authentication configuration
|
|
AUTH_CONFIG: {
|
|
clientId: process.env.MS_CLIENT_ID || '',
|
|
// Optional: set MS_CLIENT_SECRET for confidential client app registrations.
|
|
// Public client apps (Allow public client flows enabled, no secret) leave this blank.
|
|
clientSecret: process.env.MS_CLIENT_SECRET || '',
|
|
scopes: [...baseScopes, ...sharedScopes],
|
|
tokenStorePath: process.env.OUTLOOK_TOKEN_STORE_PATH || path.join(homeDir, '.outlook-mcp-tokens.json'),
|
|
// Device code flow: polling interval in seconds (Microsoft returns the recommended interval)
|
|
deviceCodePollingInterval: 5
|
|
},
|
|
|
|
// Microsoft Graph API
|
|
GRAPH_API_ENDPOINT: 'https://graph.microsoft.com/v1.0/',
|
|
|
|
// Calendar constants
|
|
CALENDAR_SELECT_FIELDS: 'id,subject,bodyPreview,start,end,location,organizer,attendees,isAllDay,isCancelled,recurrence',
|
|
|
|
// Email constants
|
|
EMAIL_SELECT_FIELDS: 'id,subject,from,toRecipients,ccRecipients,receivedDateTime,bodyPreview,hasAttachments,importance,isRead,conversationId',
|
|
EMAIL_DETAIL_FIELDS: 'id,subject,from,toRecipients,ccRecipients,bccRecipients,receivedDateTime,bodyPreview,body,hasAttachments,importance,isRead,internetMessageHeaders',
|
|
|
|
// Default timezone for calendar event creation and display (IANA tz name, e.g. 'America/New_York').
|
|
// Override via MS_TIMEZONE env var. Graph API accepts IANA timezone identifiers.
|
|
DEFAULT_TIMEZONE: process.env.MS_TIMEZONE || 'America/New_York',
|
|
DEFAULT_PAGE_SIZE: 25,
|
|
MAX_RESULT_COUNT: 500,
|
|
|
|
// Retry/backoff configuration for Microsoft Graph throttling.
|
|
// Honor Retry-After when Graph sends it; otherwise use exponential backoff.
|
|
MAX_RETRIES: parseInt(process.env.OUTLOOK_MAX_RETRIES, 10) || 3,
|
|
BASE_RETRY_DELAY_MS: parseInt(process.env.OUTLOOK_BASE_RETRY_DELAY_MS, 10) || 1000,
|
|
MAX_RETRY_DELAY_MS: parseInt(process.env.OUTLOOK_MAX_RETRY_DELAY_MS, 10) || 30000,
|
|
|
|
// Shared mailbox probe concurrency
|
|
MAILBOX_PROBE_CONCURRENCY: parseInt(process.env.OUTLOOK_MAILBOX_PROBE_CONCURRENCY, 10) || 4
|
|
};
|