-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Description
Summary
Add the ability to delete servers from the MCP Gateway Registry, including removing them from local storage, FAISS index, and updating the UI with a delete button.
Problem
Currently, the registry only supports registering, updating, and toggling servers on/off. There's no way to permanently remove a server from the registry once it's been added. This creates issues when:
- Servers are no longer needed
- Test servers need to be cleaned up
- Incorrect server configurations need to be removed entirely
- Managing server lifecycle in development/testing environments
Proposed Solution
Backend Changes
1. Add Delete Method to ServerService (registry/services/server_service.py
)
def delete_server(self, path: str) -> bool:
"""
Delete a server from the registry.
Args:
path: The server path to delete
Returns:
bool: True if deletion was successful, False otherwise
"""
# Implementation needed:
# 1. Check if server exists
# 2. Remove from local file storage
# 3. Remove from in-memory registry
# 4. Remove from service state
# 5. Save updated service state
# 6. Regenerate nginx config if server was enabled
# 7. Update FAISS index
2. Add Delete API Endpoint (registry/api/server_routes.py
)
- Add DELETE endpoint:
/api/servers/{path:path}
- Include proper authentication and authorization checks
- Return appropriate HTTP status codes (204 for success, 404 for not found, etc.)
- Handle cascade operations (FAISS index, nginx config updates)
3. Integration with FAISS Service
- Add method to remove server from FAISS index
- Ensure index is updated after server deletion
Frontend Changes
1. Add Delete Button to Server UI
- Add delete button to server management interface
- Include confirmation dialog to prevent accidental deletions
- Disable delete button for currently enabled servers (require disable first)
- Show appropriate success/error messages
2. Update Templates
- Modify
registry/templates/index.html
and/orregistry/templates/edit_server.html
- Add JavaScript for delete confirmation and AJAX calls
Technical Requirements
File System Operations
- Remove server JSON file from
settings.servers_dir
- Handle file permission errors gracefully
- Log all deletion operations
State Management
- Remove server from
self.registered_servers
- Remove server from
self.service_state
- Persist updated state to disk
Nginx Configuration
- Regenerate nginx config if deleted server was enabled
- Reload nginx service after configuration update
FAISS Index
- Remove server embeddings from search index
- Rebuild index if necessary
Error Handling
- Validate server exists before deletion
- Handle concurrent access scenarios
- Provide meaningful error messages
- Ensure atomic operations (rollback on failure)
Security Considerations
- Require appropriate authentication for delete operations
- Implement authorization checks (user permissions)
- Add audit logging for server deletions
- Consider soft delete vs hard delete options
Testing Requirements
- Unit tests for
ServerService.delete_server()
- Integration tests for DELETE API endpoint
- UI tests for delete button functionality
- Test error scenarios (file permissions, concurrent access, etc.)
Implementation Checklist
- Add
delete_server()
method toServerService
- Add DELETE API endpoint with proper routing
- Update FAISS service with delete capability
- Add delete button to UI templates
- Implement confirmation dialogs
- Add proper error handling and logging
- Write comprehensive tests
- Update API documentation
- Add audit logging for deletions
Files to Modify
registry/services/server_service.py
- Add delete methodregistry/api/server_routes.py
- Add DELETE endpointregistry/search/service.py
- Add FAISS removal methodregistry/templates/index.html
- Add delete UItests/unit/services/test_server_service.py
- Add delete teststests/integration/test_server_routes.py
- Add delete endpoint tests
User Experience
- Delete button should be clearly marked as destructive action
- Confirmation dialog should show server name and warn about permanent deletion
- Provide option to disable server first if currently enabled
- Show loading state during deletion process
- Display success/failure feedback
This enhancement will complete the CRUD operations for server management and improve the overall usability of the registry system.
Metadata
Metadata
Assignees
Labels
No labels