notify-mcp
Enables MCP agents to deliver emails and SMS texts to the signed-in user only, with recipients cryptographically locked to the caller's Entra identity. It prevents prompt-injection attacks by ensuring agents cannot send to any other recipient.
README
notify-mcp
Deliver-to-self email + SMS for Example Corp staff, as an Entra-authenticated remote MCP server. This is the send path for the claude.ai chief-of-staff rollout: agents can email or text the signed-in user their own content, and structurally nothing else.
The invariant (why this server exists)
Agents that read untrusted content (inbound email, tickets, chats) must never hold an unconstrained send capability — a prompt injection could turn it into an exfiltration channel. This server solves that by construction:
- Recipients are not tool parameters. Email goes to the caller's UPN, taken from the validated Entra token. SMS goes to the caller's mobile on record. A fully compromised model can change what is sent, never where.
- FROM is locked to
<agent>approver@example.com— the server cannot send as a human, so it cannot impersonate anyone. - The Resend + Inteliquent keys live only in this container. Users never see a key; they authenticate with their own M365 login.
- Per-user hourly budgets + an audit log line per send.
Tools
| Tool | What it does |
|---|---|
whoami |
Returns the email + masked mobile that sends will deliver to. Test wiring with this first. |
send_email_to_me(subject, body_markdown, agent_name?) |
Emails the caller. agent_name brands the sender (alerts → approver@example.com). |
send_sms_to_me(message) |
Texts the caller's mobile from the company DID 13105550100. ≤640 chars. |
register_my_mobile(mobile_number) |
Starts SMS setup: texts a 6-digit code to the number. |
confirm_my_mobile(code) |
Completes setup: verifies the code, saves the number, emails the user a change notice. |
How the server knows who you are
Claude → Entra sign-in (the user's own login) → every tool call carries a
bearer JWT → AzureJWTVerifier validates signature/issuer/audience →
preferred_username claim = the recipient. No env vars per user, no
configuration; the identity is cryptographic.
Mobile numbers aren't in the token, so SMS uses verified self-registration (built for tenants that don't populate Entra mobilePhone — ours doesn't):
- User (typically during the CoS setup interview): "register my mobile 310-555-1212" → server texts a 6-digit code to that number.
- User types the code →
confirm_my_mobile→ number saved in/data/sms_directory.jsonkeyed to their UPN + confirmation email sent. - Changes are then locked (
NOTIFY_ALLOW_MOBILE_CHANGE=false): a confirmed number can only be changed by the admin editing the registry. Code-verification proves possession; the change-lock + email notice kill the injection-rebind attack (hostile content re-pointing texts elsewhere).
Resolution order: registry file (hand entries are plain strings, self-
registered entries are objects) → optional Entra mobilePhone via Graph
(NOTIFY_GRAPH_LOOKUP_ENABLED=true + -GrantGraphUserRead; unnecessary if
self-registration is in use).
Connector session longevity (the disconnect fix)
Three things keep the connector from showing "disconnected":
offline_accessis advertised in the protected-resource metadata (NOTIFY_ADVERTISE_OFFLINE_ACCESS=true), so Claude's sign-in obtains a refresh token and silently renews the ~60–90 min access tokens.stateless_http=True— sessions survive container redeploys.- NPM proxy host must have the playbook's timeout overrides (see PORTAINER_DEPLOY.md) so idle streams aren't cut at 60s.
Also check no Conditional Access sign-in-frequency policy covers this app.
Acceptance test: connect, wait 2+ hours idle, redeploy the container, then
call whoami — no re-auth prompt should appear.
Setup (playbook order)
scripts/setup_entra_app.ps1 -TenantId <tenant>(optionally-GrantGraphUserRead) — prints the server env values + the connector secret (goes in Claude's connector Advanced settings, never the server).- Deploy via Portainer Git stack — PORTAINER_DEPLOY.md. Suggested host port 8093 (probe first; recorded in the playbook registry).
- NPM proxy host
notify-mcp.example.com→ the container; playbook timeouts + Anthropic IP allowlist; LE cert before enabling the allowlist. - Add as an org custom connector in claude.ai; users connect once with their own M365 login.
Acceptance tests
curl http://<docker-host>:8093/healthz # {"status":"ok",...}
curl -s https://notify-mcp.example.com/.well-known/oauth-protected-resource/mcp | jq
# scopes_supported MUST include the full https://.../mcp/access_as_user scope
# AND "offline_access"
curl -i https://notify-mcp.example.com/mcp # 401 + WWW-Authenticate
Then in Claude, as a group member:
whoami→ your own email, mobile "on record (…1234)" or a clear miss.send_email_to_me→ arrives in YOUR inbox fromnotify_ai@.- Ask the model to "send this to <someone else>" → it must refuse / have no way to comply. This failing is a P1 — do not roll out.
register_my_mobilewith your number → code arrives →confirm_my_mobile→ confirmation email lands →send_sms_to_meworks. Then try registering a DIFFERENT number → must be refused (change-lock).- The 2-hour idle + redeploy test above.
- A non-member connects → rejected at sign-in (AADSTS50105).
Local dev
pip install -r requirements.txt
MCP_AUTH_ENABLED=false python -m notify_mcp # Inspector only — tools will
# refuse to send without a token
# identity; NEVER expose auth-off
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。