'name_required'], admin_url('admin.php?page=asktam-mcp'))); exit; } global $wpdb; $table = $wpdb->prefix . 'asktam_mcp_keys'; $rawKey = \AskTamMCP\Core\Auth::generateKey(); $wpdb->insert($table, [ 'name' => $name, 'api_key' => $rawKey, 'scopes' => implode(',', $scopes), 'created_at' => current_time('mysql'), 'is_active' => 1, ]); wp_redirect(add_query_arg(['mcp_created' => 1], admin_url('admin.php?page=asktam-mcp'))); exit; } public function handleRevoke(): void { if (!current_user_can('manage_options')) wp_die('Unauthorized'); $id = (int) ($_POST['key_id'] ?? 0); check_admin_referer('asktam_mcp_revoke_' . $id, '_wpnonce_mcp'); global $wpdb; $table = $wpdb->prefix . 'asktam_mcp_keys'; $wpdb->update($table, ['is_active' => 0], ['id' => $id]); wp_redirect(add_query_arg(['mcp_revoked' => 1], admin_url('admin.php?page=asktam-mcp'))); exit; } }