outlook-mcp/utils/mock-data.js
Seton Carmichael a7886b5b2b Initial commit: Outlook MCP Server v1.0.0
MCP server providing Microsoft Outlook integration via Graph API:
- Email: list, search, read, send, thread reconstruction
- Calendar: list, create, decline, cancel, delete events
- Folders: list, create, move emails
- Inbox rules: list, create, reorder
- MSAL device code flow auth with persistent token cache
- Test mode with mock data
- Comprehensive README with setup, config, and tool reference

20 MCP tools across 5 modules. Node.js >= 14. MIT license.
2026-06-21 19:39:31 -04:00

145 lines
4.7 KiB
JavaScript

/**
* Mock data functions for test mode
*/
/**
* Simulates Microsoft Graph API responses for testing
* @param {string} method - HTTP method
* @param {string} path - API path
* @param {object} data - Request data
* @param {object} queryParams - Query parameters
* @returns {object} - Simulated API response
*/
function simulateGraphAPIResponse(method, path, data, queryParams) {
console.error(`Simulating response for: ${method} ${path}`);
if (method === 'GET') {
if (path.includes('messages') && !path.includes('sendMail')) {
// Simulate a successful email list/search response
if (path.includes('/messages/')) {
// Single email response
return {
id: "simulated-email-id",
subject: "Simulated Email Subject",
from: {
emailAddress: {
name: "Simulated Sender",
address: "sender@example.com"
}
},
toRecipients: [{
emailAddress: {
name: "Recipient Name",
address: "recipient@example.com"
}
}],
ccRecipients: [],
bccRecipients: [],
receivedDateTime: new Date().toISOString(),
bodyPreview: "This is a simulated email preview...",
body: {
contentType: "text",
content: "This is the full content of the simulated email. Since we can't connect to the real Microsoft Graph API, we're returning this placeholder content instead."
},
hasAttachments: false,
importance: "normal",
isRead: false,
internetMessageHeaders: []
};
} else {
// Email list response
return {
value: [
{
id: "simulated-email-1",
subject: "Important Meeting Tomorrow",
from: {
emailAddress: {
name: "John Doe",
address: "john@example.com"
}
},
toRecipients: [{
emailAddress: {
name: "You",
address: "you@example.com"
}
}],
ccRecipients: [],
receivedDateTime: new Date().toISOString(),
bodyPreview: "Let's discuss the project status...",
hasAttachments: false,
importance: "high",
isRead: false
},
{
id: "simulated-email-2",
subject: "Weekly Report",
from: {
emailAddress: {
name: "Jane Smith",
address: "jane@example.com"
}
},
toRecipients: [{
emailAddress: {
name: "You",
address: "you@example.com"
}
}],
ccRecipients: [],
receivedDateTime: new Date(Date.now() - 86400000).toISOString(), // Yesterday
bodyPreview: "Please find attached the weekly report...",
hasAttachments: true,
importance: "normal",
isRead: true
},
{
id: "simulated-email-3",
subject: "Question about the project",
from: {
emailAddress: {
name: "Bob Johnson",
address: "bob@example.com"
}
},
toRecipients: [{
emailAddress: {
name: "You",
address: "you@example.com"
}
}],
ccRecipients: [],
receivedDateTime: new Date(Date.now() - 172800000).toISOString(), // 2 days ago
bodyPreview: "I had a question about the timeline...",
hasAttachments: false,
importance: "normal",
isRead: false
}
]
};
}
} else if (path.includes('mailFolders')) {
// Simulate a mail folders response
return {
value: [
{ id: "inbox", displayName: "Inbox" },
{ id: "drafts", displayName: "Drafts" },
{ id: "sentItems", displayName: "Sent Items" },
{ id: "deleteditems", displayName: "Deleted Items" }
]
};
}
} else if (method === 'POST' && path.includes('sendMail')) {
// Simulate a successful email send
return {};
}
// If we get here, we don't have a simulation for this endpoint
console.error(`No simulation available for: ${method} ${path}`);
return {};
}
module.exports = {
simulateGraphAPIResponse
};