Connect workspaces to different organizations
Give each workspace its own MassifyAI API-key connection. For example, your application can use one organization's Task Board and skills while its research workspace uses another organization's knowledge and experiments.
You'll finish with: two independently verified MCP connections, without changing the connection used by other workspaces. This guide configures MCP tool access. Recording and automatic skill sync have separate checks in Step 6.
1. Choose the destination for each folder
Write down your actual folders, organizations and MassifyAI projects before editing configuration. Here is a fictional example:
| Workspace folder | MassifyAI organization | MassifyAI project | Key environment variable |
|---|---|---|---|
projects/news-app | Acme Studio | Morning Brief | MASSIFYAI_NEWS_APP_KEY |
projects/news-research | Harbor Labs | Briefing Evaluation | MASSIFYAI_NEWS_RESEARCH_KEY |
Replace these example names with your own. The folder determines which project configuration your client loads; the API key determines which MassifyAI organization and project it can access. Renaming a sidebar entry or selecting another organization in a browser does not change an existing MCP connection.
You'll need access to both destinations, permission to create API keys, and a current Codex or Claude Code installation. The terminal examples in Step 4 use Bash on macOS or Linux. Desktop clients and other shells must receive the same named variables through their supported secure launch or secret-management mechanism.
2. Create one API key for each destination
- Open the MassifyAI console and select the first organization and project.
- Go to Settings → API keys and create a key with the permissions you need.
- Keep it in your password manager or approved secret store. Label it with its organization and project so you can distinguish it from the second key.
- Switch to the second organization and project, then create and label its key.
Use keys from the same environment as your MCP endpoint. The endpoint for this documentation environment is https://api.massifyai.com/mcp. A label in a config file cannot change a key's permitted scope.
3. Add a project-scoped MCP connection
Merge the following settings into each workspace's existing configuration; preserve unrelated settings. The files contain variable names, never the key values.
If your plugin already records sessions or automatically syncs skills, check its destination controls in Step 6 before starting a session in the other organization. Changing the MCP key does not move those features to the new destination.
Codex
Create or edit .codex/config.toml inside the application workspace:
[mcp_servers.MassifyAIWorkspace]
url = "https://api.massifyai.com/mcp"
bearer_token_env_var = "MASSIFYAI_NEWS_APP_KEY"
In the research workspace's own .codex/config.toml, use:
[mcp_servers.MassifyAIWorkspace]
url = "https://api.massifyai.com/mcp"
bearer_token_env_var = "MASSIFYAI_NEWS_RESEARCH_KEY"
Trust each project through Codex's normal trust controls; untrusted project configuration is ignored. Codex documents project-scoped MCP settings and the bearer-token variable in its MCP reference. Nested project configuration can override an ancestor, so review it when opening a nested repository or a separate worktree. See project configuration precedence.
The distinct server name MassifyAIWorkspace keeps these settings separate from an existing connection's transport settings. If a direct user-level MassifyAI server already exists, disable it only in each of these workspace configs, leaving its user-level definition available elsewhere:
[mcp_servers.MassifyAI]
enabled = false
Use the actual server name if your existing connection has another name. A plugin-supplied server is a separate configuration source. If the MassifyAI plugin supplies a competing connection, clients supporting plugin-scoped MCP policy can disable only that bundled server in this workspace's config:
[plugins."massifyai@massifyai".mcp_servers.MassifyAI]
enabled = false
Use the installed plugin's actual ID if it differs. Keep the plugin's other settings intact. This server policy does not change recording or sync destinations. See OpenAI's plugin server policy reference. If your client doesn't support that policy, resolve the duplicate through its supported workspace controls before continuing; do not disable a global connection needed elsewhere.
Claude Code
Create or edit .mcp.json at the application workspace root, merging this entry into any existing mcpServers object:
{
"mcpServers": {
"MassifyAI": {
"type": "http",
"url": "https://api.massifyai.com/mcp",
"headers": {
"Authorization": "Bearer ${MASSIFYAI_NEWS_APP_KEY}"
}
}
}
}
Use the same entry in the research workspace's .mcp.json, replacing MASSIFYAI_NEWS_APP_KEY with MASSIFYAI_NEWS_RESEARCH_KEY. Accept the project MCP trust prompt when starting each workspace.
Claude Code supports project MCP configuration and environment-variable expansion. Check /mcp for a competing local, user, managed or plugin connection. Resolve a conflicting entry in the appropriate scope without changing other workspaces; managed settings may require your administrator. These steps describe Claude Code's terminal client; don't assume a desktop client's scope precedence is identical.
4. Supply the key securely and start a fresh session
For a terminal setup, open a terminal and run bash. From the parent of the example projects folder, run the block below. It asks for the first key without displaying it and starts Codex in the application folder:
(
cd ./projects/news-app || exit 1
IFS= read -r -s -p "API key for Acme Studio / Morning Brief: " MASSIFYAI_NEWS_APP_KEY
printf '\n'
[ -n "$MASSIFYAI_NEWS_APP_KEY" ] || exit 1
export MASSIFYAI_NEWS_APP_KEY
codex
)
Paste the key only into that hidden terminal prompt, then press Enter. For Claude Code, replace the final codex command with claude. The variable is available to that client process and its children; it is not written to the configuration file or included in the command text. The subshell ends when the client exits.
In a second terminal, run bash and start the research workspace with its own key:
(
cd ./projects/news-research || exit 1
IFS= read -r -s -p "API key for Harbor Labs / Briefing Evaluation: " MASSIFYAI_NEWS_RESEARCH_KEY
printf '\n'
[ -n "$MASSIFYAI_NEWS_RESEARCH_KEY" ] || exit 1
export MASSIFYAI_NEWS_RESEARCH_KEY
codex
)
Change the folder paths to yours before running either block. For recurring use, have your approved secret manager inject the corresponding variable into the client process rather than entering the key each time. Never put the key in chat, a committed file, a screenshot or a literal --header command.
Using the desktop app? A terminal's variables are not automatically available to an app already running or launched from the Dock. Supply them through a supported secure app-launch mechanism, fully restart the app, and open a new session in each folder. If you cannot provide that environment to the app, use the terminal procedure above; do not put raw keys in project config as a workaround.
5. Verify from each actual workspace session
Paste this into the application workspace's new chat. Switch to Prompt template to use your actual expected organization and project.
Repeat in the research workspace with its expected organization and project. Also verify one unchanged workspace still reaches its original destination. The checks pass only when the actual returned identities match; changing folders inside an existing agent chat is not a new connection.
A separately opened worktree can have a different project root. Add and verify its intended project configuration rather than assuming it inherits a sibling checkout's settings.
6. Check recording and skill sync separately
API-key MCP authentication does not install hooks or select the plugin's recording and automatic skill-sync destinations. Before using these features across organizations:
- Check your released plugin's supported workspace-routing controls. Any recording/sync sign-in must match the intended organization and project. Do not copy private credential files between routes.
- Review client hook trust prompts. Keep existing recording preferences and guard hooks intact.
- If you want recording, authorize a short non-sensitive test and confirm it appears in the intended organization's Session Records.
- For automatic skill sync, verify a known eligible project skill finishes syncing to the documented scoped destination and is discoverable by that client. Check that it was not synchronized into another organization's destination.
If the installed release doesn't support separate recording/sync destinations, keep those cross-organization features unconfigured or paused through their supported controls and use the verified MCP connection for tool access. Loading a skill through MCP is still available; it does not prove automatic disk sync.
| Part | Evidence for completion |
|---|---|
| Application MCP | Fresh workspace whoami matches its expected organization and project |
| Research MCP | Fresh workspace whoami matches its different destination |
| Unchanged workspace | Its original connection still works |
| Recording, if enabled | An explicitly authorized test record arrives in the intended destination |
| Automatic skill sync, if enabled | An eligible skill finishes syncing and is discoverable in the intended scope |
7. Troubleshoot or undo the change
| Symptom | Next step |
|---|---|
| Both workspaces reach the same organization | Check each project's config, the variable name/key pairing, duplicate server sources and project trust. Start fresh sessions, then run both identity checks again |
| A workspace still uses an old key | Reconnect or restart the actual client process after replacing its key; changing a parent terminal's variables doesn't update a running process |
| Missing variable or authentication failure | Re-enter the correct environment's key using secure input, restart that client and verify the result. Do not print the variable or an Authorization header |
| Desktop works differently from the terminal | Check how the app receives variables and loads project settings. A successful terminal check doesn't establish desktop configuration |
| A nested repo or worktree uses the wrong destination | Check its own project root and closest config; add an explicit mapping if needed |
| MCP works but recording/sync doesn't | Complete Step 6; an MCP identity result alone doesn't verify either feature |
| Need to undo routing | Remove only the entries you added, restore any workspace-local bundled-server policy you changed, and restart. Preserve other configuration and verify the original connection |
8. Let your coding agent help
Use this when you want your agent to prepare the same setup. It can edit the non-secret configuration; you supply keys through secure local input.
See API keys, Supported clients, and Install and sync skills.