Skip to content

Commit 743fed8

Browse files
lint fix
1 parent 2f62b34 commit 743fed8

File tree

2 files changed

+302
-10
lines changed

2 files changed

+302
-10
lines changed

examples/mcp-server/server.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import os
2-
import sys
31
import asyncio
2+
import json
43
import logging
5-
import threading
6-
from typing import Optional
4+
import os
75

8-
from gitpod import Gitpod, AsyncGitpod
6+
from gitpod import AsyncGitpod
97
import gitpod.lib as util
108
from gitpod.types.environment_spec_param import EnvironmentSpecParam
119
from gitpod.types.environment_initializer_param import Spec
@@ -52,22 +50,21 @@ def _setup_client(self):
5250

5351
if not self.gitpod_api_key:
5452
# 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")
5654
try:
57-
import json
5855
with open(config_path) as f:
5956
config = json.load(f)
6057
self.gitpod_api_key = config["mcpServers"]["gitpod-mcp"]["env"]["GITPOD_API_KEY"]
6158
logger.info("Successfully loaded API key from claude_desktop_config.json")
6259
except FileNotFoundError:
6360
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
6562
except KeyError as e:
6663
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
6865
except Exception as e:
6966
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
7168

7269
# Initialize Gitpod client
7370
try:

0 commit comments

Comments
 (0)