Add an MCP full-access permission that runs every action without local confirmation
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:
SucukdeluxeandClaude Opus 5.5 committed 2026-10-21 23:02:18 +02:00
1 parent 432c0e01b8
commit 08f375621a
6 files changed
+42 -13

No files matched your search

+21 -2
View File
@@ -25,7 +25,10 @@ class McpService {
this.protocol = null;
this.generation = 0;
}
capabilities() { return this.active ? this.store.value.capabilities : []; }
capabilities() {
if (!this.active) return [];
return this.store.value.capabilities.includes('full_access') ? [...CAPABILITIES] : this.store.value.capabilities;
}
state() {
const { name, capabilities, grants, enabled, identity, revocations } = this.store.value;
return { name, capabilities, grants, enabled: this.active && enabled, connection: this.connection, installationId: identity?.installationId || null,
@@ -86,7 +89,7 @@ class McpService {
}
configure(args) {
validateInput(args, { type: 'object', additionalProperties: false, required: ['enabled', 'name', 'capabilities'], properties: {
enabled: { type: 'boolean' }, name: { type: 'string', minLength: 1, maxLength: 100 }, capabilities: { type: 'array', maxItems: 5, items: { type: 'string', enum: CAPABILITIES } }
enabled: { type: 'boolean' }, name: { type: 'string', minLength: 1, maxLength: 100 }, capabilities: { type: 'array', maxItems: CAPABILITIES.length, items: { type: 'string', enum: CAPABILITIES } }
} });
if (!args.name.trim()) throw new McpAccessError('INVALID_ARGUMENTS');
this.active = false;
@@ -143,6 +146,22 @@ class McpService {
this.publish(); return this.state();
});
}
grantDirectory(directory, { readOnly = true, allowTransfer = false } = {}) {
return this.serialize(async () => {
if (!this.ready) throw new McpAccessError('ACCESS_STORE_UNAVAILABLE');
if (typeof directory !== 'string' || !path.isAbsolute(directory)) throw new McpAccessError('PATH_NOT_GRANTED');
const resolved = await fs.realpath(directory).catch(() => { throw new McpAccessError('PATH_NOT_GRANTED'); });
const stat = await fs.stat(resolved);
if (!stat.isDirectory() || path.parse(resolved).root === resolved) throw new McpAccessError('PATH_NOT_GRANTED');
const existing = this.store.value.grants.find(grant => grant.path === resolved);
if (existing && ((existing.readOnly === false && readOnly) || (existing.allowTransfer === true && !allowTransfer))) throw new McpAccessError('GRANT_NARROWING_LOCAL_ONLY');
if (!existing && this.store.value.grants.length >= 30) throw new McpAccessError('GRANT_LIMIT');
const grant = existing ? { ...existing, readOnly, allowTransfer } : { id: randomUUID(), label: path.basename(resolved), path: resolved, readOnly, allowTransfer };
await this.store.save({ ...this.store.value, grants: existing ? this.store.value.grants.map(item => item.id === existing.id ? grant : item) : [...this.store.value.grants, grant] });
this.publish();
return { id: grant.id, label: grant.label, readOnly: grant.readOnly, allowTransfer: grant.allowTransfer };
});
}
updateGrant(id, remove, readOnly = true, allowTransfer) {
const generation = this.generation;
return this.serialize(async () => {