diff --git a/profiles/sets/coding/agents/mcp.nix b/profiles/sets/coding/agents/mcp.nix index 16770bc..c3b7516 100644 --- a/profiles/sets/coding/agents/mcp.nix +++ b/profiles/sets/coding/agents/mcp.nix @@ -5,7 +5,7 @@ # (claude-code.nix, enableMcpIntegration). ai-memory adds its own entry in # ai-memory.nix. Hosts that do not load the whole coding set (servers running # T3 Code) import this file directly. -{...}: { +{pkgs, ...}: { programs.mcp = { enable = true; servers = { @@ -29,6 +29,11 @@ Outline = { url = "https://wiki.az-gruppe.com/mcp"; }; + # Outlook mail, calendar and contacts via Microsoft Graph. First use: + # call the `auth` tool (start, then complete) for the device-code login. + Outlook = { + command = "${pkgs.callPackage ./microsoft-graph-mcp-server.nix {}}/bin/microsoft-graph-mcp-server"; + }; Playwright = { command = "bash"; args = ["-c" "exec bunx @playwright/mcp@latest"]; diff --git a/profiles/sets/coding/agents/microsoft-graph-mcp-server.nix b/profiles/sets/coding/agents/microsoft-graph-mcp-server.nix new file mode 100644 index 0000000..cac3659 --- /dev/null +++ b/profiles/sets/coding/agents/microsoft-graph-mcp-server.nix @@ -0,0 +1,57 @@ +# Microsoft Graph MCP server (mail, calendar, contacts of the signed-in M365 +# account) by marlonluo2018. Chosen over the author's outlook-mcp-server, +# which drives the Outlook desktop client through win32COM and therefore only +# runs on Windows; this one talks to the Graph API and is plain Python. +# +# Not on PyPI, so it is built from the GitHub source. Auth is the device-code +# flow against Microsoft's public client id (no Azure app registration); +# tokens land in ~/.microsoft_graph_mcp_tokens.json. Settings come from env +# vars (CLIENT_ID, TENANT_ID, USER_TIMEZONE, ...); the optional .env the +# upstream README mentions would sit inside the store and is not used. +{ + lib, + python3Packages, + fetchFromGitHub, +}: +python3Packages.buildPythonApplication { + pname = "microsoft-graph-mcp-server"; + version = "0.1.0-unstable-2026-11-12"; + pyproject = true; + + src = fetchFromGitHub { + owner = "marlonluo2018"; + repo = "microsoft_graph_mcp_server"; + rev = "b4c2725ee9e3d47dce8641d5ca90434aca16c9db"; + hash = "sha256-RSPyjq3Zu9WBbihI4yuB3PhxgRaF9G2gl+xaslnBdJI="; + }; + + build-system = with python3Packages; [hatchling]; + + dependencies = with python3Packages; [ + mcp_1 # upstream targets the 1.x low-level Server API (list_tools decorators); mcp 2.x removed it + msal + httpx + pydantic + pydantic-settings + python-dotenv + click + rich + typing-extensions + tzdata + pillow # optional image attachments (MULTIMODAL_SUPPORTED) + ]; + + # Upstream defaults USER_TIMEZONE to Asia/Shanghai; the env still wins. + makeWrapperArgs = ["--set-default" "USER_TIMEZONE" "Europe/Berlin"]; + + # server.py builds an MSAL client at import time, which hits the network, + # so only the config module is import-checked in the sandbox. + pythonImportsCheck = ["microsoft_graph_mcp_server.config"]; + + meta = { + description = "MCP server for Microsoft Graph (Outlook mail, calendar, contacts)"; + homepage = "https://github.com/marlonluo2018/microsoft_graph_mcp_server"; + license = lib.licenses.mit; + mainProgram = "microsoft-graph-mcp-server"; + }; +}