Implement mcp purge command for registry cleanup
Add PurgeComponent RPC to the agent service that removes stale registry entries for components that are both gone (observed state is removed, unknown, or exited) and unwanted (not in any current service definition). Refuses to purge components with running or stopped containers. When all components of a service are purged, the service row is deleted too. Supports --dry-run to preview without modifying the database. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -23,6 +23,9 @@ service McpAgentService {
|
||||
// Adopt
|
||||
rpc AdoptContainers(AdoptContainersRequest) returns (AdoptContainersResponse);
|
||||
|
||||
// Purge
|
||||
rpc PurgeComponent(PurgeRequest) returns (PurgeResponse);
|
||||
|
||||
// File transfer
|
||||
rpc PushFile(PushFileRequest) returns (PushFileResponse);
|
||||
rpc PullFile(PullFileRequest) returns (PullFileResponse);
|
||||
@@ -234,3 +237,30 @@ message NodeStatusResponse {
|
||||
double cpu_usage_percent = 10;
|
||||
google.protobuf.Timestamp uptime_since = 11;
|
||||
}
|
||||
|
||||
// --- Purge ---
|
||||
|
||||
message PurgeRequest {
|
||||
// Service name (empty = all services).
|
||||
string service = 1;
|
||||
// Component name (empty = all eligible in service).
|
||||
string component = 2;
|
||||
// Preview only, do not modify registry.
|
||||
bool dry_run = 3;
|
||||
// Currently-defined service/component pairs (e.g., "mcns/mcns").
|
||||
// The agent uses this to determine what is "not in any service definition".
|
||||
repeated string defined_components = 4;
|
||||
}
|
||||
|
||||
message PurgeResponse {
|
||||
repeated PurgeResult results = 1;
|
||||
}
|
||||
|
||||
message PurgeResult {
|
||||
string service = 1;
|
||||
string component = 2;
|
||||
// true if removed (or would be, in dry-run).
|
||||
bool purged = 3;
|
||||
// Why eligible, or why refused.
|
||||
string reason = 4;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user