This commit is contained in:
1 parent
d3cba015b5
commit
c4439480bd
6 files changed
+224
-17
No files matched your search
+20
-4
@@ -17,7 +17,9 @@ const file = { rootId: id, relativePath: text() };
|
||||
|
||||
const definitions = [
|
||||
['app_info', 'Read application version and runtime information.', 'read', {}, []],
|
||||
['capabilities', 'Read effective permissions, the supported action catalog and local security boundaries. This cannot grant permissions or approve actions.', 'read', {}, []],
|
||||
['performance_get', 'Read bounded in-memory main-thread, renderer, CPU, memory, I/O and transfer-slot measurements. Missing samples do not prove a freeze.', 'read', {}, []],
|
||||
['system_metrics', 'Read cached system CPU, RAM, disk activity, read/write throughput, cumulative byte counters and volume capacity. No shell commands. Samples every 10 seconds; null or stale values are not freeze evidence.', 'read', { limit: integer(1, 60) }, []],
|
||||
['app_state', 'Read live transfer and automation summary.', 'read', {}, []],
|
||||
['queue_list', 'Read a bounded page of upload jobs.', 'read', { ...page, status: text(40) }, []],
|
||||
['queue_job_log', 'Read a bounded, secret-filtered log for one upload job.', 'read', { jobId: id, ...page }, ['jobId']],
|
||||
@@ -44,12 +46,15 @@ const definitions = [
|
||||
language: enumeration(['de', 'en']), globalMaxSpeedKbs: integer(0, 100000000), parallelUploadCount: integer(0, 100),
|
||||
autoRetryRounds: integer(0, 5), autoRetryDelayMin: integer(1, 1440), autoHealthCheckEnabled: boolean,
|
||||
resumeQueueOnLaunch: boolean, autoStartRestoredQueue: boolean, removeFromQueueOnDone: boolean,
|
||||
logMode: enumeration(['single', 'daily', 'session']), logVerbose: boolean
|
||||
logMode: enumeration(['single', 'daily', 'session']), logVerbose: boolean,
|
||||
scaleParallelUploads: boolean, historyRetention: retention,
|
||||
deleteSourceAfterSuccessfulUpload: boolean, shutdownAfterFinish: enumeration(['nothing', 'sleep', 'shutdown', 'restart']),
|
||||
scramble: object({ active: boolean, prefix: text(200), suffix: text(200), chars: enumeration(['letters', 'numbers', 'both']), length: integer(0, 200) })
|
||||
}, []],
|
||||
['hoster_settings_update', 'Update one hoster transfer configuration.', 'settings', {
|
||||
hoster, retries: integer(0, 20), parallelCount: integer(1, 100), maxSpeedKbs: integer(0, 100000000),
|
||||
restartBelowKbs: integer(0, 100000000), timeIntervalSec: integer(0, 86400), maxSizeMb: integer(0, 100000000),
|
||||
rotateAccounts: boolean, logToFile: boolean
|
||||
rotateAccounts: boolean, logToFile: boolean, sizeMemoEnabled: boolean
|
||||
}, ['hoster']],
|
||||
['automation_status', 'Read folder-monitor and automatic retry state.', 'read', {}, []],
|
||||
['automation_update', 'Configure monitoring for an explicitly granted directory.', 'settings', {
|
||||
@@ -58,6 +63,8 @@ const definitions = [
|
||||
queueLimitJobs: integer(0, 100000), reconcileIntervalMinutes: integer(1, 1440)
|
||||
}, ['rootId'], true],
|
||||
['automation_start', 'Start configured folder monitoring.', 'control', {}, []],
|
||||
['automation_pause', 'Pause the shared upload queue and folder automation after active transfers. Does not disable the configured monitor.', 'control', {}, []],
|
||||
['automation_resume', 'Resume the shared upload queue and configured folder automation. Use this for paused=true, not automation_start. Does not enable a disabled monitor.', 'control', {}, []],
|
||||
['automation_stop', 'Stop folder monitoring without removing queued jobs.', 'control', {}, []],
|
||||
['automation_scan', 'Run a read-only folder monitoring test scan.', 'read', {}, []],
|
||||
['automation_reconcile', 'Reconcile the monitored directory with the queue.', 'control', {}, []],
|
||||
@@ -99,6 +106,7 @@ const definitions = [
|
||||
['update_status', 'Read an owned persistent update job, including progress and post-restart version verification.', 'read', { jobId: id }, []],
|
||||
['app_restart', 'Restart the application after persisting its state.', 'lifecycle', {}, [], true],
|
||||
['app_quit', 'Close the application after persisting its state.', 'lifecycle', {}, [], true],
|
||||
['shutdown_cancel', 'Cancel a pending automatic shutdown/restart/sleep countdown and persist the disabled completion action.', 'control', {}, []],
|
||||
['secrets_read', 'Explicitly reveal credentials for one account; disabled by default.', 'secrets.read', account, ['accountId']]
|
||||
];
|
||||
|
||||
@@ -107,7 +115,7 @@ const MCP_TOOLS = Object.freeze(definitions.map(([name, description, scope, prop
|
||||
name: 'mhu_' + name, description, scope: capabilities[scope] || scope, destructive, inputSchema: object(properties, required),
|
||||
requiredScopes: [...new Set([capabilities[scope] || scope, ...(['queue_add', 'automation_update'].includes(name) ? ['files'] : []), ...(name === 'files_delete' ? ['control'] : []), ...(name.startsWith('files_transfer_') ? ['read'] : [])])],
|
||||
annotations: { readOnlyHint: ['read', 'diagnostics', 'files', 'secrets.read'].includes(scope) && !['files_transfer_open', 'files_transfer_close'].includes(name), destructiveHint: destructive,
|
||||
idempotentHint: ['read', 'diagnostics', 'files', 'secrets.read'].includes(scope) && name !== 'files_transfer_open', openWorldHint: /^(?:queue_(?:start|retry|resume)|accounts_(?:check|otp|request_otp)|automation_(?:start|reconcile)|cloud_|backup_|update_)/.test(name) }
|
||||
idempotentHint: ['read', 'diagnostics', 'files', 'secrets.read'].includes(scope) && name !== 'files_transfer_open', openWorldHint: /^(?:queue_(?:start|retry|resume)|accounts_(?:check|otp|request_otp)|automation_(?:start|resume|reconcile)|cloud_|backup_|update_)/.test(name) }
|
||||
})));
|
||||
|
||||
function createMcpToolAdapter({ handlers, authorizeConfirmation, sanitize, audit = () => {}, getCapabilities, requiresConfirmation = () => false }) {
|
||||
@@ -160,4 +168,12 @@ function createMcpToolAdapter({ handlers, authorizeConfirmation, sanitize, audit
|
||||
return { list: () => MCP_TOOLS.filter(tool => typeof handlers[tool.name] === 'function'), call };
|
||||
}
|
||||
|
||||
module.exports = { MCP_TOOLS, createMcpToolAdapter };
|
||||
function requiresMcpConfirmation(name, args, settings) {
|
||||
if (name === 'mhu_settings_update') return args.deleteSourceAfterSuccessfulUpload === true
|
||||
|| (Object.hasOwn(args, 'shutdownAfterFinish') && args.shutdownAfterFinish !== 'nothing')
|
||||
|| (Object.hasOwn(args, 'historyRetention') && args.historyRetention !== 'all');
|
||||
if (!['mhu_queue_start', 'mhu_queue_retry', 'mhu_automation_start', 'mhu_automation_reconcile'].includes(name)) return false;
|
||||
return settings.deleteSourceAfterSuccessfulUpload === true || !['nothing', undefined, null].includes(settings.shutdownAfterFinish);
|
||||
}
|
||||
|
||||
module.exports = { MCP_TOOLS, createMcpToolAdapter, requiresMcpConfirmation };
|
||||
Reference in new issue
Block a user