|
1 |
| -import os |
2 |
| -import sys |
3 | 1 | import asyncio
|
| 2 | +import json |
4 | 3 | import logging
|
5 |
| -import threading |
6 |
| -from typing import Optional |
| 4 | +import os |
7 | 5 |
|
8 |
| -from gitpod import Gitpod, AsyncGitpod |
| 6 | +from gitpod import AsyncGitpod |
9 | 7 | import gitpod.lib as util
|
10 | 8 | from gitpod.types.environment_spec_param import EnvironmentSpecParam
|
11 | 9 | from gitpod.types.environment_initializer_param import Spec
|
@@ -52,22 +50,21 @@ def _setup_client(self):
|
52 | 50 |
|
53 | 51 | if not self.gitpod_api_key:
|
54 | 52 | # Try to load from claude_desktop_config.json as fallback
|
55 |
| - config_path = os.path.expanduser("~/Library/Application Support/Claude/claude_desktop_config.json") |
| 53 | + config_path = os.path.expanduser("~/Library/Application\ Support/Claude/claude_desktop_config.json") |
56 | 54 | try:
|
57 |
| - import json |
58 | 55 | with open(config_path) as f:
|
59 | 56 | config = json.load(f)
|
60 | 57 | self.gitpod_api_key = config["mcpServers"]["gitpod-mcp"]["env"]["GITPOD_API_KEY"]
|
61 | 58 | logger.info("Successfully loaded API key from claude_desktop_config.json")
|
62 | 59 | except FileNotFoundError:
|
63 | 60 | logger.error(f"Config file not found at {config_path}")
|
64 |
| - raise ValueError("GITPOD_API_KEY not found in environment or config file") |
| 61 | + raise ValueError("GITPOD_API_KEY not found in environment or config file") from None |
65 | 62 | except KeyError as e:
|
66 | 63 | logger.error(f"Missing key in config file: {e}")
|
67 |
| - raise ValueError(f"Invalid config structure: {e}") |
| 64 | + raise ValueError(f"Invalid config structure: {e}") from e |
68 | 65 | except Exception as e:
|
69 | 66 | logger.error(f"Unexpected error loading config: {str(e)}", exc_info=True)
|
70 |
| - raise ValueError("Failed to load GITPOD_API_KEY from config") |
| 67 | + raise ValueError("Failed to load GITPOD_API_KEY from config") from e |
71 | 68 |
|
72 | 69 | # Initialize Gitpod client
|
73 | 70 | try:
|
|
0 commit comments