mcp-newoutlook 0.21.0 → 0.22.0

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/README.md CHANGED
@@ -79,7 +79,7 @@ Coming from a version before 0.15 (a git clone, extension loaded from the repo's
79
79
 
80
80
  ## Search syntax
81
81
 
82
- Searches go to Outlook's full-text index, the one its own search box uses: whole words in the subject, body, people and attachment contents (`search: "fulltext"` in the result). The index needs the search session Outlook sets up when you use its search box, so after the browser or the extension starts, **search once in Outlook** to turn it on. Until then, and in folders you made yourself, fields are matched as described under Limitations (`search: "substring"`, `searchNote` says why). The index can only be limited to a standard folder without its subfolders, and it gives only the first 25 matches of a search. So a search over subfolders asks the index for matches in every folder and keeps those in the chosen folders; when that first page doesn't hold enough of them, fields are matched instead. When the index answers without seeing every match, `total` is `null` (`includesLastItem` still tells whether there are more). When nothing is found, `emptyNote` says what wasn't searched: other folders, folders that couldn't be searched, or attachment contents with field matching.
82
+ Searches go to Outlook's full-text index, the one its own search box uses: whole words in the subject, body, people and attachment contents (`search: "fulltext"` in the result). The index needs the search session Outlook sets up when it loads or when you use its search box, so after the browser or the extension starts, **reload the Outlook tab or search once in Outlook** to turn it on. Until then, and in folders you made yourself, fields are matched as described under Limitations (`search: "substring"`, `searchNote` says why). The index can only be limited to a standard folder without its subfolders, and it gives only the first 25 matches of a search. So a search over subfolders asks the index for matches in every folder and keeps those in the chosen folders; when that first page doesn't hold enough of them, fields are matched instead. When the index answers without seeing every match, `total` is `null` (`includesLastItem` still tells whether there are more). When nothing is found, `emptyNote` says what wasn't searched: other folders, folders that couldn't be searched, or attachment contents with field matching.
83
83
 
84
84
 
85
85
  - Free words match the subject, body or sender. `"Quoted phrases"` match as a whole.
@@ -88,6 +88,36 @@ chrome.webRequest.onBeforeSendHeaders.addListener(
88
88
  ["requestHeaders", "extraHeaders"],
89
89
  );
90
90
 
91
+ // Every Outlook page load also calls its search API (/search/api/v1/init, then
92
+ // /suggestions) with a token the search service accepts too, so full-text search works
93
+ // before the first real search.
94
+ chrome.webRequest.onBeforeSendHeaders.addListener(
95
+ async (details) => {
96
+ const origin = new URL(details.url).origin;
97
+ const cap = earlySearchCapture(details, await getSearchCapture(origin));
98
+ if (cap) chrome.storage.session.set({ [`search:${origin}`]: cap });
99
+ },
100
+ { urls: OUTLOOK_URLS.map((u) => u.replace("/*", "/search/api/*")) },
101
+ ["requestHeaders", "extraHeaders"],
102
+ );
103
+
104
+ /**
105
+ * The search session to keep from one of Outlook's page-load search requests, or null:
106
+ * not such a request, no token, or `current` came from a real search (never replaced).
107
+ */
108
+ export function earlySearchCapture(details, current, now = Date.now()) {
109
+ const url = new URL(details.url);
110
+ if (!/^\/search\/api\/v\d+\/(init|suggestions)$/.test(url.pathname)) return null;
111
+ if (current && !current.early) return null;
112
+ const headers = {};
113
+ for (const h of details.requestHeaders ?? []) {
114
+ const name = h.name.toLowerCase();
115
+ if (SEARCH_REPLAY_HEADERS.includes(name) && h.value) headers[name] = h.value;
116
+ }
117
+ if (!headers.authorization) return null;
118
+ return { url: `${url.origin}/searchservice/api/v2/query`, headers, at: now, early: true };
119
+ }
120
+
91
121
  // Headers Outlook sends to its GraphQL gateway (which creates Teams meetings): its own token,
92
122
  // only ever replayed to that gateway on the same Outlook site. Every header Outlook sets
93
123
  // itself is kept, except per-request ids and those the browser controls.
@@ -381,7 +411,7 @@ async function fullTextSearch(params) {
381
411
  const { t: tab } = await findOutlookTab();
382
412
  const cap = await getSearchCapture(new URL(tab.url).origin);
383
413
  if (!cap) {
384
- return { result: null, reason: "Outlook's own search hasn't been used since the browser or extension started; search once in Outlook to turn on full-text search" };
414
+ return { result: null, reason: "Outlook hasn't set up its search session since the browser or extension started; reload the Outlook tab or search once in Outlook to turn on full-text search" };
385
415
  }
386
416
  const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
387
417
  const query = owa.searchQuery({ ...params, timeZone });
@@ -2,7 +2,7 @@
2
2
  "manifest_version": 3,
3
3
  "key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyYxkVrq+THOJVscuwRU4IvQ4K0VWiXVOjhDWjcwpILY3r7e/Fb+VhI813kRV149laUXLfehqI6WrQKbVs/KODArPIfiNEpm/zsb2nmgbQtoYuzMO3b5Hvsp1JNZ+IEMQGRFwHlOQt+w+qLAbSgdgLK2mtvjhGu9kWLmiK2wxKPaI0/zVAdvvthzMeGZCcC7V9tH2WX8I3RVD/PZcgmmFY38APGwgatg5AV5zz0AZEPSH7ldcAI2dHkmxuFh85k1cJJjWYEHikXc+ibTv9n1OfGbt/BzV/+QpMjbpJGmnJJrzCEqjw0WOyoabtpRKympl/jshjA5Kp+avlUvEYse12QIDAQAB",
4
4
  "name": "mcp-newoutlook bridge",
5
- "version": "0.21.0",
5
+ "version": "0.22.0",
6
6
  "description": "Lets AI assistants (via the mcp-newoutlook MCP server) read, search, draft and — with your explicit confirmation — send mail in New Outlook.",
7
7
  "minimum_chrome_version": "116",
8
8
  "icons": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-newoutlook",
3
- "version": "0.21.0",
3
+ "version": "0.22.0",
4
4
  "description": "MCP server that lets AI assistants work with New Outlook (web) through a Chrome/Edge extension bridge",
5
5
  "keywords": ["mcp", "model-context-protocol", "outlook", "office365", "email", "calendar", "claude", "chrome-extension"],
6
6
  "repository": {