fix mcp tools by passing pullfrog_temp_dir to server and handling home directory correctly for codex and cursor

This commit is contained in:
Colin McDonnell
2025-11-20 18:56:45 -08:00
parent 8298cdd07c
commit 550a162ca6
3 changed files with 21 additions and 12 deletions
+10 -1
View File
@@ -1,4 +1,6 @@
import { spawnSync } from "node:child_process";
import { mkdirSync } from "node:fs";
import { join } from "node:path";
import { Codex, type CodexOptions, type ThreadEvent } from "@openai/codex-sdk";
import { log } from "../utils/cli.ts";
import { addInstructions } from "./instructions.ts";
@@ -16,7 +18,13 @@ export const codex = agent({
run: async ({ payload, mcpServers, apiKey, cliPath, githubInstallationToken }) => {
process.env.OPENAI_API_KEY = apiKey;
process.env.GITHUB_INSTALLATION_TOKEN = githubInstallationToken;
process.env.HOME = process.env.PULLFROG_TEMP_DIR;
// create config directory for codex before setting HOME
const tempHome = process.env.PULLFROG_TEMP_DIR!;
const configDir = join(tempHome, ".config", "codex");
mkdirSync(configDir, { recursive: true });
process.env.HOME = tempHome;
configureCodexMcpServers({ mcpServers, cliPath });
@@ -45,6 +53,7 @@ export const codex = agent({
let finalOutput = "";
for await (const event of streamedTurn.events) {
const handler = messageHandlers[event.type];
console.log(event as never);
if (handler) {
handler(event as never);
}