Switch from ATXP proxy to @atxp/client for direct MCP connections#2
Merged
robdimarco-atxp merged 1 commit intoOct 14, 2025
Conversation
This PR implements direct ATXP MCP client connections replacing the proxy-based approach, as specified in Linear issue ATXP-410. ## Changes Made ### Core Implementation - **Added @atxp/client dependency** to package.json - **Created src/tools/atxp-tools.ts** with 9 ATXP tools for image, video, and browse operations - **Updated src/server.ts** to remove proxy initialization and update system prompt - **Updated src/tools.ts** to export new ATXP tools ### Key Features #### Image Generation Tools - `generateImageAsync`: Start async image generation, returns task ID - `getImageGenerationStatus`: Check status with user-friendly completion/failure messages #### Video Generation Tools - `generateVideoAsync`: Start async video generation, returns task ID - `getVideoGenerationStatus`: Check status with timeout parameter for quick checks #### Web Browsing Tools - `browseRunTask`: Start browser automation task with natural language instructions - `browseGetTask`: Get detailed task status, steps, and output - `browseStopTask`: Stop running tasks - `browseGetTaskScreenshots`: Retrieve screenshots from completed tasks - `browseGetTaskGif`: Get GIF recording from completed tasks ### Technical Improvements #### Cloudflare Workers Compatibility - Added `cloudflareWorkersFetch` using `globalThis.fetch` for Workers environment - Pass `fetchFn` to both `ATXPAccount` and `atxpClient` for proper execution context - Use `oAuthChannelFetch` for OAuth operations #### MCP Response Handling - Parse JSON from MCP tool result format: `content[0].text` - Handle all response types with proper error checking - Extract correct field names (e.g., `id` for browse tasks, `taskId` for image/video) #### Error Handling & User Feedback - All tools return structured objects with `type`, `taskId`, and user-friendly `message` - Comprehensive try-catch blocks with descriptive error messages - Status-specific messages (completed ✅, failed ❌, in progress 🔄) - Clear instructions for next steps in each message #### System Prompt Updates - Updated to reflect async workflow with scheduled status checks - Added examples for image, video, and browse operations - Includes instructions for informing users about task IDs and status checks - Documents all tool parameters and return formats ## Testing - ✅ TypeScript compilation passes - ✅ All linter checks pass (9 expected warnings for `any` usage) - ✅ Image generation tested and working - ✅ Browse tools tested and working with correct field names 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements direct ATXP MCP client connections replacing the proxy-based approach, as specified in Linear issue ATXP-410.
Key Benefits:
Changes Made
Core Implementation
Tools Implemented
Image Generation:
generateImageAsync- Start async image generation, returns task IDgetImageGenerationStatus- Check image status with user-friendly messagesVideo Generation:
generateVideoAsync- Start async video generation, returns task IDgetVideoGenerationStatus- Check video statusBrowser Automation:
browseRunTask- Start browser automation taskbrowseGetTask- Get browser task status and resultsbrowseStopTask- Stop a running browser taskbrowseGetTaskScreenshots- Get screenshots from completed taskbrowseGetTaskGif- Get GIF recording from completed taskTechnical Improvements
Cloudflare Workers Compatibility:
cloudflareWorkersFetchusingglobalThis.fetchATXPAccountandatxpClientMCP Response Handling:
parseMCPResult()helper extracts JSON fromcontent[0].textformatMCPToolResultinterfaceError Handling:
Status Feedback:
System Prompt Updates:
Testing
Related Issues
Closes https://linear.app/circuitandchisel/issue/ATXP-410/switch-to-using-atxpclient-rather-than-the-proxy-server
Test Plan
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com