Replicate MCP Server

# MCP Server for Replicate - Simplified Implementation Plan ## Core Philosophy - Minimize complexity by focusing on tools over resources - Follow MCP spec for core functionality - Keep transport layer simple (stdio for local, SSE for remote) - Implement only essential features ## Current Status ✓ Basic functionality implemented: - Tool-based access to models and predictions - Type-safe interactions with protocol compliance - Simple error handling - Basic rate limiting - SSE transport layer for remote connections ## Implementation Plan ### Phase 1: Core Simplification (✓ Complete) 1. Replace Resource System with Tools - [x] Convert model listing to search_models tool - [x] Convert prediction access to get_prediction tool - [x] Remove resource-based URI schemes - [x] Simplify server initialization 2. Streamline Client Implementation - [x] Simplify ReplicateClient class - [x] Remove complex caching layers - [x] Implement basic error handling - [x] Add simple rate limiting 3. Transport Layer - [x] Keep stdio for local communication - [x] Implement basic SSE for remote (no complex retry logic) - [x] Remove unnecessary transport abstractions ### Phase 2: Essential Tools (✓ Complete) 1. Model Management - [x] search_models - Find models by query - [x] get_model - Get model details - [x] list_versions - List model versions 2. Prediction Handling - [x] create_prediction - Run model inference - [x] get_prediction - Check prediction status - [x] cancel_prediction - Stop running prediction 3. Image Tools - [x] view_image - Display result in browser - [x] save_image - Save to local filesystem ### Phase 3: Testing & Documentation (🚧 In Progress) 1. Testing - [x] Add basic protocol compliance tests - [x] Test core tool functionality - [x] Add integration tests 2. Documentation - [x] Update API reference for simplified interface - [ ] Add clear usage examples - [ ] Create troubleshooting guide ### Phase 4: Optional Enhancements (🚧 In Progress) 1. Webhook Support - [x] Simple webhook configuration - [x] Basic retry logic - [x] Event formatting 2. Template System - [ ] Basic parameter templates - [ ] Simple validation - [ ] Example presets ## Next Steps 1. Documentation: - Add clear usage examples - Create troubleshooting guide - Document common error cases 2. Template System: - Design parameter template format - Implement validation logic - Create example presets 3. Testing: - Add more edge case tests - Improve error handling coverage - Add performance benchmarks Legend: - [x] Completed - [ ] Not started - ✓ Phase complete - 🚧 Phase in progress - ❌ Phase not started