feat: inject freshell MCP server into freshclaude SDK sessions#269
feat: inject freshell MCP server into freshclaude SDK sessions#269danshapiro merged 3 commits intomainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 948653e903
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| env: { | ||
| FRESHELL_URL: process.env.FRESHELL_URL || `http://localhost:${Number(process.env.PORT || 3001)}`, | ||
| FRESHELL_TOKEN: process.env.AUTH_TOKEN || '', |
There was a problem hiding this comment.
Propagate pane context into SDK MCP environment
The injected MCP env only includes FRESHELL_URL and FRESHELL_TOKEN, so SDK-spawned MCP servers have no FRESHELL_TAB_ID/FRESHELL_PANE_ID identity. In server/mcp/freshell-tool.ts, untargeted actions intentionally fall back to the caller tab/pane and otherwise use the currently active viewport tab/pane; with these vars missing, a background freshclaude session can execute send-keys/split-pane/etc. against whichever tab the user is currently viewing instead of its own pane. This is a functional regression introduced by enabling MCP in SDK sessions without caller context propagation.
Useful? React with 👍 / 👎.
| mcpServers: { | ||
| freshell: { | ||
| command: 'node', | ||
| args: buildMcpServerCommandArgs(), |
There was a problem hiding this comment.
Pass target platform when building MCP server args
buildMcpServerCommandArgs only converts paths to Windows-compatible UNC form when called with platform: 'windows'. Calling it with no platform here hardcodes Unix-style paths, so in WSL setups where CLAUDE_CMD points to a Windows Claude executable, the SDK process receives MCP args like Linux paths that the Windows-side process cannot resolve, and the freshell MCP server fails to launch.
Useful? React with 👍 / 👎.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Freshclaude (agent-chat) sessions now get the freshell MCP tool automatically, matching what terminal-mode Claude already gets via --mcp-config. The MCP server config includes FRESHELL_URL and FRESHELL_TOKEN env vars so the subprocess can connect back. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
948653e to
b4e70de
Compare
Summary
buildMcpServerCommandArgsfromserver/mcp/config-writer.tsso it can be reused outside terminal-mode config generationmcpServersinto SDKquery()call inserver/sdk-bridge.ts— freshclaude (agent-chat) sessions now get the freshell MCP tool automatically, matching what terminal-mode Claude already gets via--mcp-configFRESHELL_URLandFRESHELL_TOKENenv vars so the subprocess can connect back to the Freshell serverTest plan
buildMcpServerCommandArgs(dev + production paths)mcpServersinjection (config shape, env vars, PORT derivation, FRESHELL_URL override, AUTH_TOKEN passthrough, defaults)🤖 Generated with Claude Code