@@ -18,83 +18,69 @@ Issue: Claude reports `I don't have any MCP tools available`.
1818
1919Solution:
2020
21- 1 . Verify you're using the authorization header:
22-
23- ``` plaintext
24- --header "Authorization: Bearer ${mcpToken}"
25- ```
26-
27- 2 . Check you're waiting for MCP initialization:
28-
29- {{< tabs group="language" >}}
30- {{< tab name="TypeScript" >}}
31-
32- ``` typescript
33- await new Promise ((resolve ) => setTimeout (resolve , 1000 ));
34- ```
35-
36- {{< /tab >}}
37- {{< tab name="Python" >}}
38-
39- ``` python
40- await asyncio.sleep(1 )
41- ```
42-
43- {{< /tab >}}
44- {{< /tabs >}}
45-
46- 3 . Ensure credentials are in both ` envs ` and ` mcp ` configuration:
47-
48- {{< tabs group="language" >}}
49- {{< tab name="TypeScript" >}}
50-
51- ``` typescript
52- const sbx = await Sandbox .betaCreate ({
53- envs: {
54- ANTHROPIC_API_KEY: process .env .ANTHROPIC_API_KEY ! ,
55- GITHUB_TOKEN: process .env .GITHUB_TOKEN ! ,
56- SONARQUBE_TOKEN: process .env .SONARQUBE_TOKEN ! ,
57- },
58- mcp: {
59- githubOfficial: {
60- githubPersonalAccessToken: process .env .GITHUB_TOKEN ! ,
61- },
62- sonarqube: {
63- org: process .env .SONARQUBE_ORG ! ,
64- token: process .env .SONARQUBE_TOKEN ! ,
65- url: " https://sonarcloud.io" ,
66- },
67- },
68- });
69- ```
70-
71- {{< /tab >}}
72- {{< tab name="Python" >}}
73-
74- ``` python
75- sbx = await AsyncSandbox.beta_create(
76- envs = {
77- " ANTHROPIC_API_KEY" : os.getenv(" ANTHROPIC_API_KEY" ),
78- " GITHUB_TOKEN" : os.getenv(" GITHUB_TOKEN" ),
79- " SONARQUBE_TOKEN" : os.getenv(" SONARQUBE_TOKEN" ),
80- },
81- mcp = {
82- " githubOfficial" : {
83- " githubPersonalAccessToken" : os.getenv(" GITHUB_TOKEN" ),
21+ 1 . Verify you're using the authorization header:
22+
23+ ``` plaintext
24+ --header "Authorization: Bearer ${mcpToken}"
25+ ```
26+
27+ 2. Check you're waiting for MCP initialization.
28+
29+ ```typescript
30+ // typescript
31+ await new Promise((resolve) => setTimeout(resolve, 1000));
32+ ```
33+
34+ ```python
35+ # python
36+ await asyncio.sleep(1)
37+ ```
38+
39+ 3. Ensure credentials are in both `envs` and `mcp` configuration:
40+
41+ ```typescript
42+ // typescript
43+ const sbx = await Sandbox.betaCreate({
44+ envs: {
45+ ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY!,
46+ GITHUB_TOKEN: process.env.GITHUB_TOKEN!,
47+ SONARQUBE_TOKEN: process.env.SONARQUBE_TOKEN!,
48+ },
49+ mcp: {
50+ githubOfficial: {
51+ githubPersonalAccessToken: process.env.GITHUB_TOKEN!,
8452 },
85- " sonarqube" : {
86- " org" : os.getenv( " SONARQUBE_ORG" ) ,
87- " token" : os.getenv( " SONARQUBE_TOKEN" ) ,
88- " url" : " https://sonarcloud.io" ,
53+ sonarqube: {
54+ org: process.env. SONARQUBE_ORG! ,
55+ token: process.env. SONARQUBE_TOKEN! ,
56+ url: "https://sonarcloud.io",
8957 },
90- },
91- )
92- ```
93-
94- {{< /tab >}}
95- {{< /tabs >}}
58+ },
59+ });
60+ ```
61+
62+ ```python
63+ # python
64+ sbx = await AsyncSandbox.beta_create(
65+ envs={
66+ "ANTHROPIC_API_KEY": os.getenv("ANTHROPIC_API_KEY"),
67+ "GITHUB_TOKEN": os.getenv("GITHUB_TOKEN"),
68+ "SONARQUBE_TOKEN": os.getenv("SONARQUBE_TOKEN"),
69+ },
70+ mcp={
71+ "githubOfficial": {
72+ "githubPersonalAccessToken": os.getenv("GITHUB_TOKEN"),
73+ },
74+ "sonarqube": {
75+ "org": os.getenv("SONARQUBE_ORG"),
76+ "token": os.getenv("SONARQUBE_TOKEN"),
77+ "url": "https://sonarcloud.io",
78+ },
79+ },
80+ )
81+ ```
9682
97- 4 . Verify your API tokens are valid and have proper scopes.
83+ 4. Verify your API tokens are valid and have proper scopes.
9884
9985## GitHub tools work but SonarQube doesn't
10086
@@ -165,24 +151,24 @@ Solution:
1651512 . Test with a public repository first.
1661523 . Ensure the repository owner and name are correct in your ` .env ` :
167153
168- {{< tabs group="language" >}}
169- {{< tab name="TypeScript" >}}
154+ {{< tabs group="language" >}}
155+ {{< tab name="TypeScript" >}}
170156
171- ``` plaintext
172- GITHUB_OWNER=your_github_username
173- GITHUB_REPO=your_repository_name
174- ```
157+ ``` plaintext
158+ GITHUB_OWNER=your_github_username
159+ GITHUB_REPO=your_repository_name
160+ ```
175161
176- {{< /tab >}}
177- {{< tab name="Python" >}}
162+ {{< /tab >}}
163+ {{< tab name="Python" >}}
178164
179- ``` plaintext
180- GITHUB_OWNER=your_github_username
181- GITHUB_REPO=your_repository_name
182- ```
165+ ``` plaintext
166+ GITHUB_OWNER=your_github_username
167+ GITHUB_REPO=your_repository_name
168+ ```
183169
184- {{< /tab >}}
185- {{< /tabs >}}
170+ {{< /tab >}}
171+ {{< /tabs >}}
186172
187173## Workflow times out or runs too long
188174
@@ -192,34 +178,34 @@ Solutions:
192178
1931791 . Use ` timeoutMs: 0 ` (TypeScript) or ` timeout_ms=0 ` (Python) for complex workflows to allow unlimited time:
194180
195- {{< tabs group="language" >}}
196- {{< tab name="TypeScript" >}}
197-
198- ``` typescript
199- await sbx .commands .run (
200- ` echo '${prompt }' | claude -p --dangerously-skip-permissions ` ,
201- {
202- timeoutMs: 0 , // No timeout
203- onStdout: console .log ,
204- onStderr: console .log ,
205- },
206- );
207- ```
208-
209- {{< /tab >}}
210- {{< tab name="Python" >}}
211-
212- ``` python
213- await sbx.commands.run(
214- f " echo ' { prompt} ' | claude -p --dangerously-skip-permissions " ,
215- timeout_ms = 0 , # No timeout
216- on_stdout = print ,
217- on_stderr = print ,
218- )
219- ```
220-
221- {{< /tab >}}
222- {{< /tabs >}}
181+ {{< tabs group="language" >}}
182+ {{< tab name="TypeScript" >}}
183+
184+ ``` typescript
185+ await sbx .commands .run (
186+ ` echo '${prompt }' | claude -p --dangerously-skip-permissions ` ,
187+ {
188+ timeoutMs: 0 , // No timeout
189+ onStdout: console .log ,
190+ onStderr: console .log ,
191+ },
192+ );
193+ ```
194+
195+ {{< /tab >}}
196+ {{< tab name="Python" >}}
197+
198+ ``` python
199+ await sbx.commands.run(
200+ f " echo ' { prompt} ' | claude -p --dangerously-skip-permissions " ,
201+ timeout_ms = 0 , # No timeout
202+ on_stdout = print ,
203+ on_stderr = print ,
204+ )
205+ ```
206+
207+ {{< /tab >}}
208+ {{< /tabs >}}
223209
2242102 . Break complex workflows into smaller, focused tasks.
2252113 . Monitor your Anthropic API credit usage.
@@ -293,48 +279,48 @@ Solution:
293279
2942801 . Ensure ` dotenv ` is loaded at the top of your file:
295281
296- ``` typescript
297- import " dotenv/config" ;
298- ```
282+ ``` typescript
283+ import " dotenv/config" ;
284+ ```
299285
3002862 . Verify the ` .env ` file is in the same directory as your script.
301287
3022883 . Check variable names match exactly (case-sensitive):
303289
304- ``` typescript
305- // .env file
306- GITHUB_TOKEN = ghp_xxxxx ;
290+ ``` typescript
291+ // .env file
292+ GITHUB_TOKEN = ghp_xxxxx ;
307293
308- // In code
309- process .env .GITHUB_TOKEN ; // Correct
310- process .env .github_token ; // Wrong - case doesn't match
311- ```
294+ // In code
295+ process .env .GITHUB_TOKEN ; // Correct
296+ process .env .github_token ; // Wrong - case doesn't match
297+ ```
312298
313- {{< /tab >}}
314- {{< tab name="Python" >}}
299+ {{< /tab >}}
300+ {{< tab name="Python" >}}
315301
316- 1 . Ensure ` dotenv ` is loaded at the top of your file:
302+ 1 . Ensure ` dotenv ` is loaded at the top of your file:
317303
318- ``` python
319- from dotenv import load_dotenv
320- load_dotenv()
321- ```
304+ ``` python
305+ from dotenv import load_dotenv
306+ load_dotenv()
307+ ```
322308
323- 2 . Verify the ` .env ` file is in the same directory as your script.
309+ 2 . Verify the `.env` file is in the same directory as your script.
324310
325- 3 . Check variable names match exactly (case-sensitive):
311+ 3 . Check variable names match exactly (case- sensitive):
326312
327- ``` python
328- # .env file
329- GITHUB_TOKEN = ghp_xxxxx
313+ ```python
314+ # .env file
315+ GITHUB_TOKEN = ghp_xxxxx
330316
331- # In code
332- os.getenv(" GITHUB_TOKEN" ) # ✓ Correct
333- os.getenv(" github_token" ) # ✗ Wrong - case doesn't match
334- ```
317+ # In code
318+ os.getenv(" GITHUB_TOKEN" ) # Correct
319+ os.getenv(" github_token" ) # Wrong - case doesn't match
320+ ```
335321
336- {{< /tab >}}
337- {{< /tabs >}}
322+ {{< / tab > }}
323+ {{< / tabs > }}
338324
339325# # SonarQube returns empty results
340326
0 commit comments