Add an MCP full-access permission that runs every action without local confirmation
CI / verify (push) Canceled after 0s
CI / verify (push) Canceled after 0s
With full access the installation grants every capability, destructive and conditionally confirmed actions (queue retry/remove with source deletion, history clear, app restart, ...) run without the local dialog, and the new mhu_files_grant tool can add or widen directory grants. Narrowing or removing grants and changing permissions stay local. Enabling full access in the settings asks for local confirmation once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
432c0e01b8
commit
08f375621a
6 files changed
+42
-13
No files matched your search
+10
-4
@@ -16,7 +16,7 @@ function page(items, args) {
|
||||
}
|
||||
|
||||
function createMcpApp({ loadConfig, invoke, invokeGuarded = (_context, channel, ...args) => invoke(channel, ...args), renderer, collectors, getGrants, trashFile, canWrite,
|
||||
getCapabilities, getProtectedPaths, getInstallationId, getDiagnosticSources, getRuntimeDiagnostics = () => null, getPerformance = () => null, getSystemMetrics = () => null, profile, updates }) {
|
||||
getCapabilities, getProtectedPaths, getInstallationId, getDiagnosticSources, getRuntimeDiagnostics = () => null, getPerformance = () => null, getSystemMetrics = () => null, profile, updates, grantDirectory }) {
|
||||
const transfers = createMcpTransfers({ getGrants, getCapabilities, getProtectedPaths, getInstallationId });
|
||||
const sanitize = createMcpSanitizer(loadConfig);
|
||||
const guard = context => {
|
||||
@@ -67,15 +67,21 @@ function createMcpApp({ loadConfig, invoke, invokeGuarded = (_context, channel,
|
||||
...createMcpFiles({ getGrants, trashFile }),
|
||||
...transfers.handlers,
|
||||
...createMcpDiagnostics({ getSources: getDiagnosticSources, redact: text => sanitize(redactLogText(text, collectSecretValues(loadConfig()))) }),
|
||||
mhu_files_grant: async ({ path: directory, readOnly, allowTransfer }, context) => {
|
||||
canWrite(); guard(context);
|
||||
if (typeof grantDirectory !== 'function') throw new McpAccessError('ACTION_UNAVAILABLE');
|
||||
return grantDirectory(directory, { readOnly: readOnly !== false, allowTransfer: allowTransfer === true });
|
||||
},
|
||||
mhu_app_info: () => invoke('get-app-info'),
|
||||
mhu_capabilities: () => {
|
||||
const permissions = getCapabilities?.() || [];
|
||||
const settings = loadConfig().globalSettings;
|
||||
return { permissions, tools: MCP_TOOLS.filter(tool => tool.requiredScopes.every(scope => permissions.includes(scope))).map(tool => ({
|
||||
const fullAccess = permissions.includes('full_access');
|
||||
return { permissions, tools: MCP_TOOLS.filter(tool => fullAccess || tool.requiredScopes.every(scope => permissions.includes(scope))).map(tool => ({
|
||||
name: tool.name, readOnly: tool.annotations.readOnlyHint, requiredScopes: tool.requiredScopes,
|
||||
localConfirmation: tool.destructive || requiresMcpConfirmation(tool.name, {}, settings),
|
||||
localConfirmation: !fullAccess && (tool.destructive || requiresMcpConfirmation(tool.name, {}, settings)),
|
||||
conditionalConfirmation: tool.name === 'mhu_settings_update'
|
||||
})), boundaries: ['Permissions and directory grants can only be changed locally.', 'Destructive actions require an exact local confirmation; MCP cannot approve it.', 'No arbitrary shell, SQL, mouse/keyboard or screen control.', 'Paused automation is resumed with mhu_automation_resume. A disabled monitor requires mhu_automation_start.'] };
|
||||
})), boundaries: [fullAccess ? 'Full access: actions run without local confirmation. Permissions, and narrowing or removing directory grants, can only be changed locally.' : 'Permissions and directory grants can only be changed locally.', fullAccess ? 'mhu_files_grant can add or widen directory grants.' : 'Destructive actions require an exact local confirmation; MCP cannot approve it.', 'No arbitrary shell, SQL, mouse/keyboard or screen control.', 'Paused automation is resumed with mhu_automation_resume. A disabled monitor requires mhu_automation_start.'] };
|
||||
},
|
||||
mhu_performance_get: () => getPerformance(),
|
||||
mhu_profile_start: args => profile.start(args.seconds),
|
||||
|
||||
Reference in new issue
Block a user