-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Problem
Currently gsuite-mcp uses a single global config directory (~/.config/gsuite-mcp/), which means one client_secret.json → one GCP project. This makes it impossible to simultaneously serve different Google accounts that require different GCP projects (e.g., a work Workspace account on one GCP project and a personal account on another).
Each GCP project has its own OAuth consent screen, test user list, and client credentials. A single global config can't accommodate multiple GCP projects.
Solution
Add --config-dir flag and GSUITE_MCP_CONFIG_DIR env var so each installation gets its own self-contained config directory.
Repo-local layout (gitignored)
gsuite-mcp/
├── .installations/ # gitignored
│ ├── work/
│ │ ├── client_secret.json # Work GCP project
│ │ ├── config.json
│ │ └── credentials/
│ │ └── user@work.com.json
│ └── personal/
│ ├── client_secret.json # Personal GCP project
│ ├── config.json
│ └── credentials/
│ └── user@gmail.com.json
CLI usage
gsuite-mcp --config-dir .installations/work init
gsuite-mcp --config-dir .installations/work auth
gsuite-mcp --config-dir .installations/work # MCP server modeMCP client config
{
"mcpServers": {
"gsuite-work": {
"command": "/path/to/gsuite-mcp",
"args": ["--config-dir", ".installations/work"]
},
"gsuite-personal": {
"command": "/path/to/gsuite-mcp",
"args": ["--config-dir", ".installations/personal"]
}
}
}Implementation
~25 lines of code:
-
internal/config/config.go— AddconfigDirOverridevar +SetConfigDir(). All path functions (DefaultConfigDir(),ConfigPath(),ClientSecretPath(),CredentialsDir()) already derive fromDefaultConfigDir(), so they automatically respect the override. -
cmd/gsuite-mcp/main.go— Parse--config-dirflag (orGSUITE_MCP_CONFIG_DIRenv) before subcommand dispatch, callconfig.SetConfigDir(). -
.gitignore— Add.installations/
Design properties
- Backward compatible — no flag =
~/.config/gsuite-mcp/(existing behavior) - Each installation fully independent — own GCP project, client_secret, config, credentials
- No profile registry — directory name IS the profile
- MCP clients namespace by server name — no tool name conflicts between instances
- One binary, many configs
Motivation
Running gsuite-mcp for a work Google Workspace account requires a GCP project within the Workspace org (for domain-wide access, verified consent screen). A personal account uses a separate GCP project. Today this requires maintaining separate config directories manually.