Fix gateway bot Claude Code cwd so MCP tools are discovered

In gateway mode the bot's Claude Code CLI was spawned with cwd set to
a nonexistent project subdirectory (gateway_config_dir/project_name).
This meant it couldn't find .mcp.json and had no MCP tools available.

Now the bot uses the gateway config directory as cwd in gateway mode,
where the auto-generated .mcp.json points to the gateway's MCP proxy.

Also fixes cargo fmt formatting.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Timmy
2026-04-21 12:15:04 +01:00
co-authored by Claude Opus 4.6
parent e7deb65e45
commit 09151e37ef
2 changed files with 20 additions and 9 deletions
@@ -114,7 +114,10 @@ impl BotContext {
match client.post(&url).json(&body).send().await {
Ok(resp) if resp.status().is_success() => {
match resp.json::<serde_json::Value>().await {
Ok(json) => json.get("response").and_then(|v| v.as_str()).map(String::from),
Ok(json) => json
.get("response")
.and_then(|v| v.as_str())
.map(String::from),
Err(e) => Some(format!("Failed to parse response from project server: {e}")),
}
}