Commit 4678ca5
authored
Switch from ATXP proxy to @atxp/client for direct MCP connections (#2)
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 names1 parent 5545c16 commit 4678ca5
5 files changed
Lines changed: 16360 additions & 6750 deletions
0 commit comments