Secure Muse Code Google Docs Connection with PortEden
This guide gives Meta's Muse Code coding agent scoped Google Docs access with PortEden as the data firewall. You add one MCP server entry to ~/.config/muse/settings.json, sign in, and Muse Code can read, summarize, and (if you allow it) edit the docs in folders you explicitly scope, with sensitive fields redacted before content reaches Meta's model and every tool call recorded in the PortEden audit log.
Image needed
Diagram showing Google Docs 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-google-docs-cover.png
- Spec:
- 1200x630. Google Docs 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/google-docs - Restart Muse Code and authenticate to PortEden on the first docs tool call.
- Scope the folders whose docs Muse Code may see; specs and design docs in, everything else out.
- Verify with a read prompt. Edits stay behind confirm-before-write if you enable them at all.
What you get
Specs live in Docs, and coding agents need them: the API design the client must match, the architecture decision record, the release plan. When the connection is live, Muse Code reads them directly instead of you copy-pasting. Every tool call, from the lead agent or any parallel sub-agent, routes through PortEden, which applies:
Per-folder scope
Only docs in allowed folders are visible. HR docs, contracts, and board material stay out of reach by default.
Per-action permissions
Search, read, create, and edit are separate scopes. A read-only token cannot change a doc, and edits keep confirm-before-write on.
Redaction on content
Names, emails, and other identifiers inside allowed docs are stripped or tokenized before content reaches Meta's model.
Audit trail
Every tool call from Muse Code is logged centrally: the requested action, the decision, 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 Google account with the docs you want Muse Code to use.
No PortEden account yet? That is fine.
Step 1: Add the PortEden MCP server to settings.json
mkdir -p ~/.config/muse $EDITOR ~/.config/muse/settings.json { "schema_version": 1, "mcp_servers": { "google-docs": { "transport": "streamable_http", "url": "https://mcp.porteden.com/google-docs", "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
Beta build not opening a sign-in?
"headers": { "Authorization": "Bearer pe_your_token" }.Step 3: Connect Google and scope the folders
If your PortEden account does not have Google connected yet, complete the OAuth consent when prompted (skipped automatically if it is). Then scope which folders' docs the token can reach from my.porteden.com.
Step 4: Verify the connection
Try one of these
- Muse Code reads docs inside allowed folders and nothing outside them.
- 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)
Adjust the token from my.porteden.com under Access Tokens. Every sub-agent Muse Code spawns uses this same token and folder scope.
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, and summarize docs in allowed folders | Create or edit anything |
| read_and_create | Read plus create new docs in allowed folders | Edit or delete existing docs |
| read_edit | Read plus edit existing docs, with confirmation per edit | Delete docs or touch other capabilities |
Recommended rules for a Muse Code token
- Read-only first: let the agent read specs and draft content in the terminal; you paste what survives review.
- Narrow folder scope: specs and design docs in, everything else out.
- Confirm before write: if you enable editing, keep the per-edit preview on. A doc edit has no worktree isolation to save you.
- Redaction: leave on; design docs often quote customer names and emails that the model does not need.
Suggested prompts for everyday use
"Read the payments API spec doc and implement the endpoints it defines. Quote the sections you rely on."
"Compare the design doc against the code in this repo and list where the implementation drifted."
"Summarize the architecture decision records in the specs folder into a one-page overview."
"Draft a migration guide for the v2 API based on the design doc. Show it in the terminal; do not write to Docs."
"List the open questions and TODO markers across the docs in the specs folder."
"Read the release-plan doc and generate changelog entries for the items marked done."
Troubleshooting and error handling
Match the message you see to the entries below. For settings-file and auth errors, the full troubleshooting table in the Gmail guide applies to any PortEden connection in Muse Code.
Doc searches return nothing
Symptoms
- Muse Code reports no docs found for queries that should match.
Checks
- The doc most likely lives outside the allowed folders. Check the token's folder scope in PortEden.
- Folder scope applies to a folder and its children; a sibling folder needs its own entry.
Debug prompt for Muse Code
403 Permission denied on an edit
Symptoms
- Muse Code says it lacks permission to create or edit a doc.
Checks
- The token is likely read_only, which is the recommended default. Enable read_edit only for a workflow that needs it.
- Edits also require the doc to be inside the allowed folder scope.
Debug prompt for Muse Code
Muse Code fails at startup after editing settings.json
Symptoms
- Every muse command fails with "malformed settings file".
Checks
- Validate the JSON: jq . ~/.config/muse/settings.json
- Confirm "schema_version": 1 is present at the top level.
Debug prompt for Muse Code
Google returned reauth required
Symptoms
- Calls were working, then all docs tools start failing.
- Audit log shows a provider_reauth_required entry.
Checks
- Open Connections in PortEden and click Reconnect on the Google connection.
Debug prompt for Muse Code
Security best practices
Remember the fleet. Every parallel sub-agent shares this connection; the folder scope bounds all of them.
Read-only is the right default. A coding agent that drafts in the terminal, with a human pasting into Docs, loses almost nothing and risks much less.
Keep confirm-before-write on for edits. Unlike code, a doc edit has no git worktree protecting the original.
One token per AI client. Do not reuse a token across Muse Code, Claude, and ChatGPT.
Keep redaction on. Meta's contributor API tier documents training rights on submitted data; redacted fields never reach the model on any tier.
Review the audit log weekly and revoke tokens promptly when an experiment ends.
FAQ
Can Muse Code edit my Google Docs?
Only if you enable write permissions on the token, and edits keep confirm-before-write on by default so a preview surfaces before the doc changes. The recommended coding-agent setup is read-only: the agent reads specs and drafts content for you to paste.
Which docs can Muse Code see?
Only docs in the folders you allow. Scope starts narrow; add the engineering folders that hold your specs and design docs and leave everything else out.
Do Muse Code's sub-agents get the same Docs access?
Yes. Sub-agents use the session's MCP connections, so the PortEden token's folder scope bounds the whole fleet, up to 16 parallel agents.
What is the difference between this and the Drive connection?
The drive server covers file search, metadata, and file operations across allowed folders. The google-docs server adds structured reading and editing of Docs content. Many setups use drive for discovery and google-docs for content work; each has its own scoped token.
Will Meta train on my documents?
It depends on the Meta Model API tier behind your session; the standard tier does not include training rights, while the discounted contributor tier documents them. PortEden limits what reaches Meta on any tier through folder scope and redaction. Check Meta's current terms for your tier.
Next steps
Connect Google Sheets to Muse Code
Read and append to spreadsheets with per-file scoping.
Connect Google Drive to Muse Code
File search and operations under folder-level Drive Rules.
MCP Google Docs tool reference
All docs tools exposed by the PortEden MCP server, with arguments and responses.
Muse Code MCP servers, explained
What Muse Code can reach over MCP and what Meta's docs say about sandboxing and tiers.