Skip to content
Muse Code × Outlook 5 min setup

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: transport streamable_http, URL https://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, then muse 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.

When the PortEden sign-in opens on Muse Code's first email tool call (Step 2), you can sign up with Microsoft, Google, or email in the same flow. If you already have a PortEden account, you will be signed in instead.

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.

1
Open (or create) the settings file:
mkdir -p ~/.config/muse
$EDITOR ~/.config/muse/settings.json
2
Add the email server entry. If the file is new, this is the whole file:
~/.config/muse/settings.json
{
"schema_version": 1,
"mcp_servers": {
"outlook": {
"transport": "streamable_http",
"url": "https://mcp.porteden.com/email",
"mode": "optional"
}
}
}
3
Save the file and restart Muse Code so it picks up the new server. Continue to Step 2.

schema_version is mandatory

Muse Code refuses to start with a malformed settings file error if "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.

1
Trigger a first call from a Muse Code session, for example: "List the tools available from the outlook server." The PortEden sign-in opens in your browser.
2
Sign in, or sign up in the same flow. Approve the connection request. PortEden creates a scoped Access Token for this Muse Code connection automatically.

Beta build not opening a sign-in?

If your Muse Code build does not run a browser sign-in for remote MCP servers, create an Access Token at my.porteden.com (scoped to email only) and pass it in the server entry: "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

1
PortEden will prompt you to Connect Outlook. Click it and sign in with your Microsoft account.
2
Approve the requested Microsoft Graph scopes. PortEden asks for Mail.Read by default; Mail.Send and Mail.ReadWrite are requested only so write actions can be enabled later if you allow them.
3
The window closes. Return to your terminal and retry the prompt; the connection is now live.

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

Some Microsoft 365 tenants block third-party app consent for end users. If the consent screen says approval is required, your admin can grant tenant-wide consent for PortEden's scopes. The consent screen lists the scopes in plain language, and the token PortEden issues to Muse Code stays narrower than the Graph grant: it starts read-only regardless of the scopes approved.

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

Show me my last five unread emails, subjects and senders only.
Find messages mentioning "incident" or "outage" from the past week and list the subjects.
Summarize the most recent thread with the subject containing "deployment".
List the senders that emailed me most this month.
  • 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

PresetWhat Muse Code can doWhat it cannot do
read_only (recommended)Search, read, summarize, and quote messagesSend, draft, categorize, archive, delete
read_and_draftRead plus create drafts in the Drafts folderSend anything outside of drafts
read_sendRead plus send replies and new messagesDelete or modify folders
full_emailAll email actions including categorize and archiveTouch 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

PortEden re-evaluates the token on every tool call. Save the change in the dashboard and the very next request, from the lead agent or any sub-agent, uses the new rules.

Suggested prompts for everyday use

Bug triage

"Find customer-reported issues emailed to support this week and turn each into a numbered repro checklist."

Incidents

"Summarize the "production outage" thread: timeline, root cause hypotheses, and open action items."

Search

"Find every alert from our monitoring sender in the last 7 days and group the failures by service."

Changelog

"Read the release-review thread and draft changelog entries for the changes discussed."

Draft

"Draft a reply to the latest message in the "staging access" thread saying the fix ships Thursday. Do not send."

Follow up

"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.

SETTINGS_MALFORMED

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

Not applicable, this one fails before a session starts. Fix the JSON and rerun muse.
ADMIN_CONSENT_REQUIRED

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

Quote the exact error shown after the Microsoft consent screen, including any correlation ID.
PERMISSION_DENIED

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

Show me the full accessInfo field from the last error response, then summarize which permission, folder rule, or time window blocked the call.
CONNECTION_DROPPED

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

Quote the last provider_reauth_required error from PortEden and tell me which provider needs to be reconnected.

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