Skip to content

Support multiple installations via --config-dir flag #85

@aliwatters

Description

@aliwatters

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 mode

MCP 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:

  1. internal/config/config.go — Add configDirOverride var + SetConfigDir(). All path functions (DefaultConfigDir(), ConfigPath(), ClientSecretPath(), CredentialsDir()) already derive from DefaultConfigDir(), so they automatically respect the override.

  2. cmd/gsuite-mcp/main.go — Parse --config-dir flag (or GSUITE_MCP_CONFIG_DIR env) before subcommand dispatch, call config.SetConfigDir().

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions