Secure Muse Code Outlook Connection with PortEden
This guide gives Meta's Muse Code coding agent scoped access to Outlook and Microsoft 365 email with PortEden as the data firewall. You add one MCP server entry to ~/.config/muse/settings.json, sign in, and Muse Code can read and act on your mailbox through scoped permissions, with PII redacted before content reaches Meta's model and every tool call recorded in the PortEden audit log. Works with Microsoft 365, Outlook.com, and Exchange Online.
Image needed
Diagram showing Outlook connecting to PortEden, with PortEden labeled REDACT AUDIT SCOPE, then forwarding to Muse Code in a terminal window
- File:
- public/images/guides/muse-code/muse-code-outlook-cover.png
- Spec:
- 1200x630. Outlook icon on the left, PortEden shield in the middle labeled REDACT / AUDIT / SCOPE, terminal window with the Muse Code prompt on the right, arrows left to right.
- Used as:
- Guide cover + OpenGraph image
In short
- Add one MCP server to
~/.config/muse/settings.json: transportstreamable_http, URLhttps://mcp.porteden.com/email - Restart Muse Code and authenticate to PortEden on the first email tool call. Sign up in the same flow if needed.
- If Outlook is already connected to your PortEden account, the Microsoft authorization step is skipped automatically.
- Verify with a read prompt. Tighten permissions, folder exclusions, and contact rules later from my.porteden.com.
What you get
When the connection is live, Muse Code can search, read, summarize, and draft through your Microsoft 365 mailbox in the middle of a coding session: incident threads into postmortems, customer reports into repro steps. Every tool call, from the lead agent or any parallel sub-agent, routes through PortEden, which applies:
Real-time redaction
Names, emails, phone numbers, account IDs, and 50+ other identifier types are stripped or tokenized before content reaches Meta's model, on any pricing tier.
Per-action permissions
Grant read, draft, send, archive, delete, or categorize as separate scopes. A read-only token replaces the broad Mail.ReadWrite grant a direct Graph integration would need.
Folder, contact, and time rules
Exclude entire folders (HR, Legal, client matters), block specific senders or domains, and cap access to recent mail so the agent sees the engineering slice of the mailbox.
Audit trail
Every tool call from Muse Code is logged centrally: the requested action, the decision (allow, redact, or block), and the response shape returned. SIEM-exportable.
Prerequisites
- Muse Code (beta) installed and authenticated:
curl -fsSL https://dev.meta.ai/install.sh | bash, thenmuse login. macOS and Linux; on Windows use WSL2. - A Microsoft 365, Outlook.com, or Exchange Online mailbox you want Muse Code to use.
- If your tenant restricts third-party app consent, an admin who can approve PortEden's Microsoft Graph scopes (see Step 3).
No PortEden account yet? That is fine.
Step 1: Add the PortEden MCP server to settings.json
PortEden's email capability covers Gmail and Microsoft mailboxes through the same hosted MCP endpoint, connected over the streamable_http transport. Nothing to install, nothing to host.
mkdir -p ~/.config/muse $EDITOR ~/.config/muse/settings.json { "schema_version": 1, "mcp_servers": { "outlook": { "transport": "streamable_http", "url": "https://mcp.porteden.com/email", "mode": "optional" } } } schema_version is mandatory
"schema_version": 1 is missing. "mode": "optional" keeps an unreachable server from aborting your coding run.Step 2: Sign in to PortEden
The first time Muse Code calls an email tool, the PortEden server requires authentication. This is the single setup screen you will see.
Beta build not opening a sign-in?
"headers": { "Authorization": "Bearer pe_your_token" }. Scoping, redaction, and audit behave identically.Step 3: Connect Outlook (first-time only)
This step runs only if your PortEden account does not already have a Microsoft mailbox connected. If it does, PortEden reuses the existing connection and you can jump straight to Step 4.
If Outlook is not connected yet
Mail.Read by default; Mail.Send and Mail.ReadWrite are requested only so write actions can be enabled later if you allow them.If Outlook is already connected to PortEden
You will not see a Microsoft authorization prompt at all. PortEden detects the existing connection, attaches it to the new Muse Code token, and the next tool call just works.
Tenant admin consent
Step 4: Verify the connection
In a Muse Code session, run a low-risk read prompt. Then check the PortEden audit log to confirm the request shows up.
Try one of these
- Muse Code returns real data from your mailbox, not a refusal or an error.
- Sensitive identifiers appear redacted or tokenized if you left redaction enabled.
- The PortEden audit log at my.porteden.com shows the request with a green allow decision.
Step 5: Tighten what Muse Code can do (optional)
The token PortEden created uses conservative defaults: email scope only, redaction on, confirm-before-write for send and delete. Tighten or relax it from my.porteden.com under Access Tokens. Every sub-agent Muse Code spawns uses this same token, so its scope is the boundary for the whole fleet.
Permission presets for a coding agent
Pick the action set that matches what you want Muse Code to do
| Preset | What Muse Code can do | What it cannot do |
|---|---|---|
| read_only (recommended) | Search, read, summarize, and quote messages | Send, draft, categorize, archive, delete |
| read_and_draft | Read plus create drafts in the Drafts folder | Send anything outside of drafts |
| read_send | Read plus send replies and new messages | Delete or modify folders |
| full_email | All email actions including categorize and archive | Touch other PortEden capabilities (calendar, drive) |
Recommended rules for a Muse Code token
- Start read-only: grant write actions only when a workflow proves it needs them.
- Folder exclusions: block HR, Legal, and client-matter folders entirely.
- Contact blocklist: add executive, HR, and personal aliases or whole domains.
- Time window: restrict to the last 90 days unless a workflow needs history.
- Redaction: leave on; what the model never receives cannot be retained or trained on, whatever Meta tier the session runs on.
- Confirm before write: keep on for send and delete.
Changes apply immediately
Suggested prompts for everyday use
"Find customer-reported issues emailed to support this week and turn each into a numbered repro checklist."
"Summarize the "production outage" thread: timeline, root cause hypotheses, and open action items."
"Find every alert from our monitoring sender in the last 7 days and group the failures by service."
"Read the release-review thread and draft changelog entries for the changes discussed."
"Draft a reply to the latest message in the "staging access" thread saying the fix ships Thursday. Do not send."
"List threads where I was asked a technical question more than three days ago and have not replied."
Troubleshooting and error handling
Match the message you see to the entries below. For settings-file and connection errors, see also the full troubleshooting table in the Gmail guide, which applies to any PortEden email connection.
Muse Code fails at startup after editing settings.json
Symptoms
- Every muse command fails with "malformed settings file" or "unsupported settings schema version".
Checks
- Validate the JSON: jq . ~/.config/muse/settings.json
- Confirm "schema_version": 1 is present at the top level.
- streamable_http entries accept only url and headers (plus enabled/mode).
Debug prompt for Muse Code
Microsoft consent screen says approval needed
Symptoms
- The Microsoft sign-in completes but consent shows 'Need admin approval'.
- The Outlook connection never reaches Active in PortEden.
Checks
- Your tenant restricts third-party app consent. Forward the request to your Microsoft 365 admin.
- The admin can grant tenant-wide consent for PortEden's Graph scopes (Mail.Read at minimum).
- After consent is granted, click Reconnect in PortEden's Connections page.
Debug prompt for Muse Code
403 Permission denied on a specific action
Symptoms
- Muse Code says it lacks permission, or returns an accessInfo string explaining the rejection.
- Audit log shows a block decision with a rule name.
Checks
- Open the Access Token in PortEden and read the permission set (a read_only token cannot send).
- Check folder exclusions and contact rules; excluded folders deny matching messages.
- Adjust the token, save, then retry. The new policy applies on the next request.
Debug prompt for Muse Code
Microsoft returned reauth required
Symptoms
- Calls were working, then all email tools start failing.
- Audit log shows a provider_reauth_required entry.
Checks
- Open Connections in PortEden. Outlook will show a yellow Needs reauth badge.
- Click Reconnect and complete the Microsoft sign-in again. Common after a password change, MFA reset, or conditional-access policy change.
Debug prompt for Muse Code
Security best practices
Remember the fleet. Muse Code fans out to parallel sub-agents that all use this connection. Scope the token for the widest thing the session might do.
Keep coding-agent tokens read-only, and exclude HR, Legal, and client-matter folders before the first session, not after.
One token per AI client. Do not reuse a token across Muse Code, Claude, and ChatGPT; revoke just the one that misbehaves.
Keep redaction on. Meta's contributor API tier documents training rights on submitted data; redacted fields never reach the model on any tier.
MCP is outside Muse Code's sandbox by Meta's own design. PortEden's server-side policy keeps enforcing even under muse --yolo.
Review the audit log weekly, filtered by the Muse Code token, and revoke tokens promptly when an experiment ends.
FAQ
Does this work with Outlook.com as well as Microsoft 365?
Yes. PortEden's email capability covers Microsoft 365, Outlook.com, and Exchange Online through the same endpoint, https://mcp.porteden.com/email. You choose the Microsoft account during the auth flow.
Does my Microsoft 365 admin need to approve anything?
Possibly. Some tenants restrict third-party app consent, in which case an admin must grant consent for PortEden's Graph scopes (Mail.Read by default; Mail.Send and Mail.ReadWrite only for write actions). PortEden supports tenant-wide admin consent.
Does Muse Code store my Microsoft credentials?
No. Microsoft OAuth credentials stay inside PortEden. Muse Code only holds a PortEden Access Token scoped to email, revocable at any time without breaking the underlying Microsoft connection.
Will Meta train on my Outlook content?
It depends on the Meta Model API tier behind your session. Meta's standard tier does not include training rights and offers zero data retention on request; the discounted contributor tier documents training rights on submitted data. PortEden reduces what reaches Meta on any tier through redaction, minimization, and scope. Check Meta's current terms for your tier.
Do Muse Code's sub-agents get the same mailbox access?
Yes. Sub-agents use the session's MCP connections, so the PortEden token's scope is the boundary for the whole fleet, up to 16 parallel agents. Keep the token read-only by default and exclude sensitive folders.
Can I connect both Gmail and Outlook?
Yes. PortEden's email capability handles both providers behind the same endpoint. Connect each account once in PortEden; use distinct server names in settings.json if you want the agent to address them separately.
Next steps
Connect PortEden to Muse Code
The general setup reference: all endpoints, settings fields, and troubleshooting.
MCP Email tool reference
All email tools exposed by the PortEden MCP server, with arguments and responses.
Muse Code sub-agents and your data
Why parallel sub-agents multiply exposure, and what to scope.
Risks of connecting email to AI
A regulator-aware look at what can go wrong, and how PortEden mitigates each risk.