{"record":{"id":"f8d14831df95115e","repo":"Hmbown/CodeWhale","slug":"refusing-to-operation-mcp-server-server-name","errorCode":null,"errorMessage":"Refusing to {operation} MCP server '{server_name}' from plugin bundle `{}`: {reason}. {remediation}","messagePattern":"Refusing to (.+?) MCP server '(.+?)' from plugin bundle `(.+?)`: (.+?)\\. (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/mcp.rs","lineNumber":772,"sourceCode":"    fn required_capability(&self) -> crate::plugins::activation::PluginActivationCapability {\n        if self.approved_remote_endpoint.is_some() {\n            crate::plugins::activation::PluginActivationCapability::McpRemote\n        } else {\n            crate::plugins::activation::PluginActivationCapability::McpStdio\n        }\n    }\n\n    fn validate_before_use(&self, server_name: &str, operation: &str) -> Result<()> {\n        let remediation = format!(\n            \"Run `/plugin reload`, inspect `/plugin show {0}`, then repeat the displayed trust command and `/plugin enable {0}` before retrying\",\n            self.authority.plugin_name\n        );\n        crate::plugins::registry::verify_plugin_component_authority(\n            &self.authority,\n            self.required_capability(),\n        )\n        .map_err(|reason| {\n            anyhow::anyhow!(\n                \"Refusing to {operation} MCP server '{server_name}' from plugin bundle `{}`: {reason}. {remediation}\",\n                self.authority.plugin_name\n            )\n        })\n    }\n\n    fn validate_remote_endpoint(&self, server_name: &str, endpoint: &str) -> Result<()> {\n        let (endpoint, origin) = reviewed_remote_endpoint_identity(endpoint)?;\n        if self.approved_remote_endpoint.as_deref() != Some(endpoint.as_str())\n            || self.approved_remote_origin.as_deref() != Some(origin.as_str())\n        {\n            anyhow::bail!(\n                \"Refusing MCP server '{server_name}': its remote endpoint no longer matches the reviewed plugin origin\"\n            );\n        }\n        Ok(())\n    }\n","sourceCodeStart":754,"sourceCodeEnd":790,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/mcp.rs#L754-L790","documentation":"validate_before_use calls verify_plugin_component_authority to confirm the plugin bundle still has the authority (signed/approved component identity matching the required capability) it had at review time. On failure it builds a user-facing refusal message naming the operation, server, plugin bundle, the authority reason, and remediation. It is a security gate: a plugin whose bundle no longer matches its reviewed authority is blocked from being used or spawned.","triggerScenarios":"validate_before_stdio_spawn → validate_before_use with a plugin whose bundle content or capability hashes no longer match the recorded authority — modified plugin files after review, a capability requirement not granted to the component, or a bundle swapped on disk.","commonSituations":"User hand-edited a plugin bundle after install, plugin upgraded out-of-band while the old authority record persisted, a manifest added a new capability that wasn't part of the reviewed grant, or bundle hash drift from a broken sync/restore.","solutions":["Reinstall or re-review the plugin so authority is recomputed over the current bundle (follow the {remediation} text in the message).","Revert local modifications to the plugin bundle so its content/capability hashes match the reviewed record.","Update the plugin's capability grant if a legitimately new capability is required.","Check for concurrent writers to the plugin directory and lock/serialize plugin updates."],"exampleFix":"// before\ncodewhale plugin edit ~/.plugins/mybundle/plugin.toml  # drifts from reviewed authority\n// after\ncodewhale plugin review ~/.plugins/mybundle && codewhale plugin enable mybundle  # re-establish authority","handlingStrategy":"validation","validationCode":"// confirm bundle integrity against recorded authority before use\nlet validated = PluginManifest::validate_from_path(&bundle.manifest_path)?;\nassert_eq!(validated.content_hash, authority.content_hash, \"bundle drifted\");\nassert_eq!(validated.capability_hash, authority.capability_hash, \"capabilities changed\");","typeGuard":"fn authority_intact(bundle: &PluginBundle, authority: &Authority) -> bool {\n    PluginManifest::validate_from_path(&bundle.manifest_path)\n        .map(|v| v.content_hash == authority.content_hash\n                && v.capability_hash == authority.capability_hash)\n        .unwrap_or(false)\n}","tryCatchPattern":"match validate_before_use(&authority, op).await {\n    Err(e) if e.to_string().starts_with(\"Refusing to\") => {\n        // follow the remediation in the message: re-review/reinstall the plugin\n        registry.reinstall(&authority.plugin_name).await?;\n        retry(op).await\n    }\n    other => other,\n}","preventionTips":["Never hand-edit installed plugin bundles; go through the review flow","Re-review after every plugin upgrade","Grant new capabilities through the review process, not by editing manifests","Serialize plugin updates to avoid concurrent writes corrupting the bundle"],"tags":["mcp","plugin","security","authority","integrity"],"backgroundTag":"checksum-mismatch","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}