Skip to content

Commit 43367ab

Browse files
Michael CliffordGkrumbach07
authored andcommitted
Add google workspace MCP to runner with necessary oauth additions (#469)
Signed-off-by: Michael Clifford
1 parent 01cef5d commit 43367ab

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

components/runners/claude-code-runner/adapter.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ async def initialize(self, context: RunnerContext):
8484
"""Initialize the adapter with context."""
8585
self.context = context
8686
logger.info(f"Initialized Claude Code adapter for session {context.session_id}")
87+
88+
# Copy Google OAuth credentials from mounted Secret to writable workspace location
89+
await self._setup_google_credentials()
8790

8891
# Prepare workspace from input repo if provided
8992
async for event in self._prepare_workspace():
@@ -1456,3 +1459,25 @@ def _build_workspace_context_prompt(self, repos_cfg, workflow_name, artifacts_pa
14561459

14571460
return prompt
14581461

1462+
1463+
async def _setup_google_credentials(self):
1464+
"""Copy Google OAuth credentials from mounted Secret to writable workspace location."""
1465+
# Check if Google OAuth secret is mounted
1466+
secret_path = Path("/app/.google_workspace_mcp/credentials/credentials.json")
1467+
if not secret_path.exists():
1468+
logging.debug("Google OAuth credentials not found at %s, skipping setup", secret_path)
1469+
return
1470+
1471+
# Create writable credentials directory in workspace
1472+
workspace_creds_dir = Path("/workspace/.google_workspace_mcp/credentials")
1473+
workspace_creds_dir.mkdir(parents=True, exist_ok=True)
1474+
1475+
# Copy credentials from read-only Secret mount to writable workspace
1476+
dest_path = workspace_creds_dir / "credentials.json"
1477+
try:
1478+
shutil.copy2(secret_path, dest_path)
1479+
# Make it writable so workspace-mcp can update tokens
1480+
dest_path.chmod(0o644)
1481+
logging.info("✓ Copied Google OAuth credentials from Secret to writable workspace at %s", dest_path)
1482+
except Exception as e:
1483+
logging.error("Failed to copy Google OAuth credentials: %s", e)

0 commit comments

Comments
 (0)