mcp-newoutlook

v0.37.0
mcp-newoutlook Checked 3 days ago Published 2 days ago

MCP server that lets AI assistants work with New Outlook (web) through a Chrome/Edge extension bridge

Supports work/school (Microsoft 365) and personal (outlook.com) accounts. Email and folder ids can be Outlook's own or Microsoft Graph's (with - and _ in place of / and +). to, cc and bcc (in create_draft, create_reply_draft, create_forward_draft, update_draft and compose_and_send) take email addresses or names, e.g. ["Daniel Kowalski", "bob@example.com"]. Each name is looked up in your contacts and the directory first (a few seconds); your mail is searched too only when they don't give exactly one exact full-name match, so an outside sender with the same name as a colleague isn't considered.

Summary extracted from the README.

mcp-newoutlook

v0.1.0. An MCP server that lets AI assistants (Claude Code, Claude Desktop, Cursor and others) work with New Outlook on the web in Chrome or Edge. It needs no Azure app registration and no admin consent, because it uses the session of the Outlook tab you already have open.

Supports work/school (Microsoft 365) and personal (outlook.com) accounts.

AI app ────stdio(MCP)──► mcp-newoutlook server ──ws://127.0.0.1:47391──► browser extension ──► New Outlook tab
                          (saves downloads,          (loopback only; our      (runs Outlook's own
                           reads local files)         extension's fixed id)    web API in the tab)

Tools

Tool What it does
get_version Server and extension versions, and the connection/session status. Per Outlook site, fullTextSearch and teamsMeetings show whether its search and Teams sessions are there and, for search, still usable. outlookTabsAsleep counts Outlook tabs Chrome has frozen or discarded, and outlookTabsVisible those that are the active tab of a window that isn't minimized (one covered by another app still counts, as Chrome can't tell)
reload_extension Reloads the browser extension from disk after an update and waits until it is back, reporting the version before and after
list_folders Every mail folder, including subfolders, with its path (Inbox/Projects/Northwind) and counts (include_ids: true adds folder ids)
search_emails Lists emails, or searches them with Outlook-style syntax (from:alice, subject:report, cc:bob, hasattachment:yes, after:2026-09-01, received:today; see below) in Outlook's full-text index, newest first or by relevance (order). By default it covers Inbox, Sent Items and all their subfolders. folder takes a standard name (inbox, sentitems…), a path or id from list_folders, a list of these, or all for every folder; each folder is searched with its subfolders (subfolders: false leaves them out). Results carry their folder path. preview: true adds each email's To line and the start of its body. Each result carries its conversationId
read_email One email, or several at once (a list of ids): headers, recipients, body (text/html) and the attachment list. Text bodies drop the quoted history and repeated disclaimers by default (include_quoted: true keeps them); bodies are capped at max_length (20 000 characters). webLink opens the email in Outlook on the web; conversationId is the same for every email of a thread.
read_thread The whole conversation an email belongs to, across folders (Sent Items included), oldest first, each message without the quoted history
list_events Calendar appointments and meetings in a date range (default: the next 7 days), optionally only those whose subject, location, organizer or attendees match query (searchNote says when attendees couldn't be read), recurring meetings expanded, with location, organizer, your response and free/busy. Times in UTC and local time.
find_meeting_times Suggests times when you and the attendees (addresses or names) are all free, from their free/busy and your calendar, inside working hours (default 09:00–17:00 local, weekdays). Tentative meetings count as busy unless allow_tentative
read_event One event with its attendees and their responses, and the description
find_contacts Looks people up by name, email or domain in your personal contacts, the organization directory and the people you exchange email with (external partners). Contacts and directory give job title, department, company, office and phone numbers where stored; people from mail come with how many emails were found, the latest one, the folders they're filed in and the signature of their latest email (usually title, company, phone and address). source picks contacts, directory, mail or all (mail only when contacts and the directory find nobody, since it scans every folder). If Outlook is throttling, the mail part can be incomplete; the answer then says partial: true.
respond_to_event Accept, tentatively accept or decline a meeting, optionally with a note to the organizer. You must confirm.
create_event Your own appointment (created at once, nothing is sent), or a meeting with attendees by address or name, whose invitation you must confirm. Meetings get a Microsoft Teams link by default (teams_meeting), made the way Outlook makes it. Outlook sets up its Teams session when its tab loads. If there is none, the extension loads a hidden frame of the Outlook site in the tab, which sets it up, and waits up to 30 s for it; if it still doesn't come, reload the Outlook tab (or give teams_meeting: false)
create_draft Writes an email into Drafts. Never sends.
create_reply_draft Reply or reply all to an email, as a draft with the original quoted. Never sends.
create_forward_draft Forward an email with its attachments, as a draft. Never sends.
update_draft Change a draft's recipients, subject or body, or remove attachments
mark_emails Mark one or more emails read/unread, flag them (flagged, complete, none)
move_emails Move one or more emails to another folder. Moving to deleteditems deletes them (recoverable from Deleted Items).
add_attachment Attaches one or more local files (≤ 25 MB each) to a draft
download_email Saves one or more emails as .eml files
download_attachments Saves all file attachments of one or more emails (inline images optional). Attached emails are saved as .eml files. With several emails, each email's files go into their own subfolder named after its subject.
send_draft Asks to send a draft. The user must click Send.
compose_and_send Write, attach and send in one step. The user must click Send.

Email and folder ids can be Outlook's own or Microsoft Graph's (with - and _ in place of / and +).

Recipients by name

to, cc and bcc (in create_draft, create_reply_draft, create_forward_draft, update_draft and compose_and_send) take email addresses or names, e.g. ["Daniel Kowalski", "bob@example.com"]. Each name is looked up in your contacts and the directory first (a few seconds); your mail is searched too only when they don't give exactly one exact full-name match, so an outside sender with the same name as a colleague isn't considered. A name must mean exactly one person: an exact full-name match wins among several ("Kowalski, Daniel (ENG)" matches "Daniel Kowalski"). Otherwise nothing is created and the matching people are listed. The result's resolvedRecipients shows what each name became.

Sending always needs your click

The same goes for meeting answers (respond_to_event) and meeting invitations (create_event with attendees): the window shows the meeting, the answer or the invitation, and nothing happens until you click its button.

The AI can only request a send. The extension then opens its own window showing the recipients, subject, body and attachments. The email is sent only if you click Send there. The draft is re-read just before sending, and if anything changed since you saw it, nothing is sent. Closing the window, clicking Don't send, or waiting 5 minutes all mean nothing is sent, and the draft stays in Drafts.

Setup

You need Node.js 20 or later, and Chrome or Edge. Then, in a terminal:

npx mcp-newoutlook setup

Run it from any folder other than a clone of this repo, e.g. cd ~ && npx mcp-newoutlook setup: inside a clone, npx uses the clone's own package.json instead of downloading the package, and fails with mcp-newoutlook: command not found.

setup does the rest and can be run again at any time:

  • puts this release in ~/.mcp-newoutlook/versions/ and installs the launcher ~/.mcp-newoutlook/launch.cjs, which starts the current release in about a second, without the network;
  • registers the server with the AI apps it finds: Claude Code, Claude Desktop, Cursor, VS Code (Copilot), Windsurf, Gemini CLI and Codex. They start ~/.mcp-newoutlook/launch.cjs with the Node that ran setup, both by absolute path. It shows what it will change and asks first (--yes skips the question), only ever adds or updates its own newoutlook entry, and keeps a .mcp-newoutlook.bak copy of each file it changes. If the launcher can't be set up (no npm to fetch a missing piece, say), setup says why and registers npx --prefer-online -y mcp-newoutlook@latest instead. Other MCP clients: register <node> <home>/.mcp-newoutlook/launch.cjs as a stdio server, with absolute paths (e.g. C:\Program Files\nodejs\node.exe C:\Users\you\.mcp-newoutlook\launch.cjs), or npx -y mcp-newoutlook if a slow start (20–45 s on Windows) doesn't matter to them. ChatGPT and claude.ai on the web can't use local servers;
  • installs the extension in ~/.mcp-newoutlook/extension;
  • registers the native-messaging host for the Chrome and Edge profiles it finds (see The native host);
  • opens the Extensions page of Chrome and/or Edge, and that folder. The one manual step, in the browser you use Outlook in: turn on Developer mode and click Load unpacked on the folder;
  • waits until the extension connects and Outlook answers, then says Ready.

Restart the AI apps it registered (in Claude Code: /mcp), and ask about your mail.

The extension can be in Chrome and Edge (or several profiles) at the same time. Calls go to the browser where Outlook is signed in and stay with it; get_version lists the connected browsers.

There is nothing to pair: the extension has a fixed id that the server trusts. You don't need to keep Outlook open either. When no Outlook tab is open, the extension opens one itself (pinned, in the background) at the Outlook site you last used, and waits up to a minute for it to sign in.

Updating

Nothing to do:

  • New releases download in the background, at most twice a day, once a session has started. Startup never waits for them. A new release takes effect the next time each AI app (or session) starts the server; the running server keeps its version. That server updates ~/.mcp-newoutlook/extension and takes over from servers of older versions still running in other sessions.
  • The extension is reloaded from that folder once no Outlook tab is visible (the active tab of a window that isn't minimized; a window covered by another app still counts), since a reload loses the captured Outlook session and a visible tab isn't reloaded to get it back. It's reloaded sooner if no Outlook session of any kind is captured, and after 24 hours in any case. A reload refused because a send confirmation is open is tried again every minute, and a second browser that has reached the new version by then is left alone. Until the reload, get_version shows the older extension, and the native host keeps its older version too (see The native host). The wait outlasts the server: ~/.mcp-newoutlook/pending-extension-reload.json holds the version and when the wait began (and, while a server is reloading, when it started, so the others don't reload as well), and any server started later carries on from it.
  • get_version shows the version running, and under launcher, nextStart: the version the next start runs, when it differs. It also shows whether updates are on and how the last check went.
  • A release that fails to start 3 times in a row is set aside automatically. The launcher then runs the newest installed release that isn't set aside.
  • To go back by hand: npx mcp-newoutlook rollback, or node ~/.mcp-newoutlook/launch.cjs rollback [version]. Then restart the AI apps.
  • To turn background updates off: set NEWOUTLOOK_MCP_NO_UPDATE=1, or "autoUpdate": false in config.json. The launcher keeps working; run npx mcp-newoutlook setup to move to a new release yourself.
  • After a rollback the extension stays at the newer version: the server never downgrades it.

If Node moves, run setup again. The AI apps and the native host start Node by the absolute path setup saw. Switching Node with nvm or fnm, or reinstalling Node somewhere else, breaks those registrations until you run npx mcp-newoutlook setup again. Background updates don't rewrite them, and neither does npm run update.

Coming from 0.25.x or earlier (AI apps start the server through npx, which takes 20–45 s on Windows): run npx mcp-newoutlook setup once. It shows each app as will update and switches it to the launcher. Until then a server started through npx prepares the launcher's store in the background, but doesn't change any app's settings.

Coming from a version before 0.15 (a git clone, extension loaded from the repo's extension/ folder, pairing token): run npx mcp-newoutlook setup once, load the extension from ~/.mcp-newoutlook/extension, and remove the old one. Until then the old one keeps working with its token.

Sessions on a tab you can see

The extension uses the sessions Outlook itself sets up: one for mail, one for full-text search and one for Teams meetings. They're lost when the extension reloads (reload_extension, npm run update, setup). A tab you can see isn't reloaded to get them back, as that could lose what you're writing, and a quiet Outlook tab sends a request of its own only every several minutes. So the extension adds a hidden, 1×1 frame of the same Outlook site to the tab: Outlook in that frame sends what it sends whenever a tab of it loads, which brings back all three sessions, usually within seconds. The page you see isn't reloaded or changed. The frame is removed as soon as all three sessions are back, and after a minute in any case (the page removes it itself), and isn't added again for 2 minutes. A call waits up to 45 s for the mail session, stopping 10 s before its deadline: Outlook took about 15 s to load in the frame on a quiet Mac, and about 50 s on one at a load average of 300. If none comes, the call fails and says to open another email in the tab or reload it. A search doesn't wait: it matches fields at once, and says full-text search is being set up. get_version shows the last frame as hiddenFrame (when it was asked for, whether it was added, and when it was removed).

Search syntax

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. That session is lost when the extension reloads, and its token runs out after about an hour, so a search that finds none reloads the Outlook tab to get a new one, and the search waits up to 30 s for it (also when another reload just happened, as that brings it too), within the time the request has. It does so only if no automatic reload of that Outlook site happened in the last 10 minutes (others can follow sooner: a reload to wake a tab Chrome put to sleep or to renew a refused session after 1 minute, one for a stuck tab after 5). A tab you can see (the active tab of a window that isn't minimized, focused or not, since Chrome can't tell whether another app covers it) is never reloaded by itself, and neither is an awake one with requests still running, unless those were given up on and the page doesn't answer a check within 3 s. A tab you can see gets a hidden frame of the Outlook site instead (see Sessions on a tab you can see), and the search waits up to 30 s for the session it brings; if none comes, reload it or search once in Outlook to turn the index 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. In standard folders, a limit above 25 still gives only those 25 matches, with a searchNote saying more exist; to see the rest, narrow the query (e.g. with dates) or page on with offset, which matches fields from offset 25 on (and earlier when the first page can't fill the page asked for). 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.

  • Free words match the subject, body or sender. "Quoted phrases" match as a whole.
  • subject:, body:, from:, to:, cc: search one field; hasattachment:yes|no.
  • Dates use the computer's local time zone and YYYY-MM-DD, today or yesterday:
    • received:D that day; after:D / received>=D on or after D; received>D after D
    • before:D / received<D before D; received<=D up to and including D
  • All terms must match: from:gamboa after:2026-09-01 hasattachment:yes.

Several sessions at once

Every AI session starts its own mcp-newoutlook server, and they share the one extension connection:

  • The first server to start owns the bridge port and the extension connection (role: "hub" in get_version).
  • Servers started later connect to the hub with the same pairing token and send their tool calls through it (role: "peer").
  • When the hub's session ends, it first lets the other sessions' running calls (and open confirmation windows) finish, for up to 5 seconds; calls they make meanwhile go to the next hub. Then a peer takes over the port within a second. The extension reconnects to it within 30 seconds; calls made in that gap fail with "Browser extension is not connected".

The native host

setup also registers a native-messaging host (com.mcp_newoutlook.hub) for each Chrome or Edge profile folder it finds: a host manifest and a small host launcher that starts this Node with ~/.mcp-newoutlook/launch.cjs hub, so the host runs the current release (a clone's host runs its own dist/hub.js). A running host keeps its version; a new release reaches it when the browser reconnects the extension (browser restart or extension reload). Like the AI apps, the host names Node by its absolute path: if Node moves (nvm, fnm, a reinstall), run npx mcp-newoutlook setup again. On macOS and Linux both go in the browser's NativeMessagingHosts folder; on Windows they go in %LOCALAPPDATA%\mcp-newoutlook\, with a registry key under HKCU\Software\…\NativeMessagingHosts. Chrome starts the host only for this extension. The hub then lives as long as the browser, not as long as the first AI session, so closing a session doesn't fail the others' calls. npm run update (in a clone) rewrites the host files of a host that runs a copy's own dist/hub.js (a clone, or one registered before the launcher), so they point at the current copy and Node. It leaves a host that runs launch.cjs hub alone: that one follows the current release by itself, and only setup rewrites it. Details: docs/native-messaging.md.

The extension tries the native host first. Where it isn't installed, or a policy blocks native messaging, the extension uses the TCP port as described above, and tries native again the next time it reconnects. get_version shows which one is in use: transport: "native" or "websocket" in the extension's status.

Connections from web pages are always refused, and peers need the pairing token. While the extension with the fixed id is connected, other copies of it (e.g. an older one loaded from another folder) are turned away.

Configuration

~/.mcp-newoutlook/config.json is created on first run:

Key Env override Default
token — random, generated once; used by peers (and extensions before 0.15)
port NEWOUTLOOK_MCP_PORT 47391 (also set it in the extension popup)
downloadDir NEWOUTLOOK_MCP_DOWNLOAD_DIR ~/Downloads/mcp-newoutlook
confirmTimeoutMs — 300000
autoUpdate NEWOUTLOOK_MCP_NO_UPDATE=1 turns it off true

Security notes

  • The bridge listens only on 127.0.0.1. Web pages can't connect to it: browsers send their Origin, and only extension origins are accepted. This extension is recognized by its fixed id (from the key in its manifest), which other extensions can't take; any other extension, and local programs, need the pairing token in ~/.mcp-newoutlook/config.json. A local program able to read that file could connect either way, so the token was never a defense against those.
  • Downloaded file names come from emails and are sanitized, so they can't escape the target folder.
  • Emails can contain prompt injection. The send-confirmation window is the safeguard, so read it before clicking Send. Its first line, From, shows which mailbox the email or invitation goes out from: a draft's own sender if it has one (a shared mailbox), else the mailbox signed in on that Outlook site now. If a draft's sender, or an invitation's Outlook site or mailbox, changes after the window was shown, nothing is sent. An invitation also stops when the mailbox From showed can't be read again at the click, which can happen after a routine token refresh: try again. Only when From itself said the mailbox couldn't be read is the Outlook site alone checked.
  • A change retried with the same content from the same mailbox and Outlook site within 10 minutes (drafts, attachments, events, and answers or invitations you approved) returns the first result instead of acting twice. When the mailbox can't be read, nothing is reused, so another account's result is never handed back; a retry then may act twice, and still asks you where a window applies. The same goes for an appointment if the mailbox can't be read again after the session changed while it was made. This is kept only in the extension's memory, as SHA-256 hashes and outcomes (ids, flags), never bodies, file contents or tokens, and is cleared when the extension reloads. It never skips a confirmation window: a retry after you declined or closed one asks again.
  • If you also give an AI direct control of your browser or desktop (for example browser automation), it could click the confirmation button itself. Don't combine the two if you rely on the confirmation step.

Limitations

  • It relies on Outlook on the web's internal JSON API (/owa/service.svc), which Microsoft doesn't document and can change. All request shapes live in extension/owa.js.
  • Without full-text search (see Search syntax), search matches substrings in fields (subject, body, sender, To/Cc display names).
  • Emails can't be permanently deleted, only moved to Deleted Items.
  • Teams invitations made through create_event have the join link and meeting ID but no passcode: Outlook fetches that from a Teams service this extension doesn't have access to; people join from the link, which carries it.
  • Outlook doesn't hand out an attached email's original MIME, so its .eml is rebuilt from the original headers, body and attachments. It opens normally in mail clients, but isn't byte-identical to the original (e.g. signatures can't be verified).
  • download_email and attached emails in download_attachments are limited to 30 MB per email (Outlook's size of the item). A larger one is refused before it is fetched; the error gives its size and a link to open it in Outlook.

Development

git clone https://github.com/HeeyunCho/mcp-newoutlook.git
cd mcp-newoutlook
npm install && npm run build
node dist/index.js setup   # registers this copy (node dist/index.js and its dist/hub.js), never the launcher; it never updates itself
npm run update  # on main with no local changes: pulls, builds, reloads the extension
npm test        # builds, typechecks the tests, scans fixtures, then runs every test layer
npm run smoke   # read-only live check against your real mailbox (needs Chrome with the extension and Outlook open)

In a clone, use node dist/index.js for its commands. npx mcp-newoutlook … run inside the clone fails (command not found), because npx resolves the clone's own package.json; to set up the published release instead, run it from another folder, e.g. cd ~ && npx mcp-newoutlook setup.

Tests are written first, one layer per folder (see docs/testing.md): test/unit (pure functions; npm run test:unit), test/integration (the extension's handlers on a fake chrome, and the bridge on real sockets; npm run test:integration), test/system (the built server over stdio, including a snapshot of every tool's description and schema; npm run test:system). A bug fix starts with a failing test named after its issue. Versions are bumped automatically. On every push to main (except Markdown-only changes), the Version bump GitHub Action runs the tests, then bumps package.json, package-lock.json and extension/manifest.json, commits chore(release): vX.Y.Z and tags it. The bump level comes from the pushed commit messages:

Commit message Bump
a line starting with BREAKING CHANGE: in the body, or type!: (e.g. feat!: …) major
starts with feat: / feat(scope): minor
anything else patch

The same workflow runs the tests on Windows and publishes the new version to npm only if they pass. If they fail, the release commit and tag stay but nothing is published; the next merge publishes a newer version, or gh workflow run version.yml retries the current one. Publishing uses npm trusted publishing, so no npm token is stored anywhere; the package's npm settings name version.yml in this repository as its only trusted publisher. Run git pull afterwards to get the release commit locally. To bump by hand: node scripts/bump-version.mjs patch|minor|major. A test checks that the three files agree.