MCP Server for Multiple Outlook Accounts

MCP Server for Multiple Outlook Accounts

Enables AI assistants to manage multiple Outlook/Microsoft 365 mailboxes simultaneously through MCP tools, with local OAuth token storage.

Category
访问服务器

README

MCP Server for Multiple Outlook Accounts

A local, single-connector Model Context Protocol server that lets an AI assistant operate several Outlook / Microsoft 365 mailboxes at once — searching, reading, drafting, sending, and organising mail — through one safety-annotated tool surface, with OAuth tokens that never leave your machine.

This is the Outlook / Microsoft Graph provider variant of a provider-neutral specification.


Project status: phase 1 (auth core + list_accounts)

Built with TypeScript 6.0.3; build, typecheck, tests (29), and format all green. What exists today:

  • ✅ Architecture design + requirements traceability matrix (doc/).
  • ✅ Neutral domain types + subsystem contracts; tested config loader (src/domain/, src/config.ts).
  • ✅ Auth core: Entra credential-source discovery, MSAL public-client (consent + silent refresh), secure token store (0600/0700, atomic + cross-process-locked), account-selection registry.
  • ✅ Account-management CLI: outlook-mcp-auth connect | list | remove.
  • ✅ C1 list_accounts MCP tool (with behavioural annotations), served over stdio.

Not yet implemented: capabilities C2–C8 (search, read, draft, send, labels, organise) and the Microsoft Graph client (timeout/retry/error-mapping). These are designed in doc/architecture.md §13 (build phases 2–4) and tracked as Planned in the traceability matrix.

Tests mock Microsoft Graph and MSAL. Live §13 acceptance — real browser consent and Graph calls — requires an Entra app registration + Outlook mailboxes and is run locally by the operator.


Planned capabilities (spec §5)

Tool Purpose Destructive?
list_accounts List connected mailboxes No
search_conversations Search a mailbox (paged) No
read_conversation Read a full conversation No
create_draft Compose a draft (not sent) No
send_message Send immediately Yes
list_labels List categories + folders No
create_label Create a category/folder No
organize_mail Tag / move / read-state Yes

Plus an out-of-band account-management CLI (outlook-mcp-auth connect | list | remove).


Development

Requires Node.js ≥ 18 (developed on Node 22).

npm install
npm run typecheck      # tsc --noEmit
npm run build          # compile to dist/
npm test               # vitest (Graph/MSAL mocked)
npm run format:check   # prettier

Configuration

All operational knobs are environment variables (see .env.example):

Env var Meaning Default
OUTLOOK_MCP_DATA_DIR tokens + app-registration configs ~/.outlook-mcp
OUTLOOK_OAUTH_CREDENTIALS pin one app registration (disables discovery) unset
OUTLOOK_MCP_ATTACHMENTS_DIR allow-list for path attachments unset (disabled)
OUTLOOK_MCP_LOCK_TIMEOUT_MS token-store lock wait 12000
OUTLOOK_MCP_REQUEST_TIMEOUT_MS per-Graph-call timeout 30000

Connecting a mailbox

  1. Register a public-client app in Entra ID with the redirect URI http://localhost and the delegated scopes Mail.ReadWrite, Mail.Send, User.Read, offline_access.

  2. Drop a credentials*.json into the data dir (or point OUTLOOK_OAUTH_CREDENTIALS at it):

    { "clientId": "<application-client-id>", "tenant": "common" }
    

    Multiple credentials*.json files are auto-discovered, so accounts under different app registrations each refresh with the client that authorised them.

  3. Connect, list, and remove mailboxes:

    outlook-mcp-auth connect            # opens the browser for consent
    outlook-mcp-auth connect --source acme   # pick a specific app registration
    outlook-mcp-auth list
    outlook-mcp-auth remove user@example.com
    

Security posture

OAuth tokens are stored only on the local machine (file mode 600 in a 700 data dir). Reading local files by path for attachments is disabled by default and only allowed from an explicit allow-list. The server never logs tokens, credentials, or message content. See doc/architecture.md §9.

License

MIT — see LICENSE.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选