@zortexhq/indra-v2.5 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/bin/codex-postinstall.mjs +1 -1
- package/dist/action-effect.js +1 -0
- package/dist/action-read-progress.js +1 -1
- package/dist/actions-catalog.js +1 -0
- package/dist/auto-sync.js +1 -1
- package/dist/auto-update.js +1 -1
- package/dist/automatic-updates.js +1 -0
- package/dist/bundled-handbook.js +1 -1
- package/dist/cli-run.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/codex-install.js +1 -1
- package/dist/codex-setup.js +1 -1
- package/dist/computer-use-setup.js +1 -0
- package/dist/default-root.js +1 -1
- package/dist/documentation-action.js +1 -0
- package/dist/gateway.js +1 -1
- package/dist/imessage-sync.js +1 -1
- package/dist/local-cloud-policy.js +1 -1
- package/dist/local-cloud.js +1 -1
- package/dist/mcp.js +1 -3
- package/dist/native-connect.js +1 -1
- package/dist/native-level1-setup.js +1 -1
- package/dist/native-ollama-discovery.js +1 -0
- package/dist/native-vault-discovery.js +1 -1
- package/dist/onboard-cli.js +1 -1
- package/dist/onboard.js +1 -1
- package/dist/onboarding.js +1 -1
- package/dist/profile.js +1 -1
- package/dist/public-tool.js +4 -1
- package/dist/recovery-authorization-url.js +1 -1
- package/dist/recovery-progress.js +1 -1
- package/dist/recovery.js +1 -1
- package/dist/resident-autopilot.js +1 -0
- package/dist/resident-ensure-ready.js +1 -1
- package/dist/resident-host.js +2 -2
- package/dist/resident-jobs.js +1 -1
- package/dist/resident-platform.js +2 -2
- package/dist/resident-runtime-identity.js +1 -1
- package/dist/resident-startup-state.js +1 -0
- package/dist/resident-telemetry.js +1 -1
- package/dist/shared-action-schemas.js +1 -0
- package/dist/source-data.js +1 -1
- package/dist/storage-compatibility.js +1 -0
- package/dist/supervised-sync.js +1 -1
- package/dist/tools.js +1 -1
- package/dist/update-check.js +1 -1
- package/dist/update-cli.js +1 -1
- package/dist/update-command.js +1 -1
- package/dist/update-recovery.js +1 -1
- package/node_modules/@zortexhq/plugin-auto-connect/dist/api/durable-dispatcher.js +1 -1
- package/node_modules/@zortexhq/plugin-auto-connect/dist/api/job-contract.js +1 -1
- package/node_modules/@zortexhq/plugin-autopilot/dist/api.js +1 -0
- package/node_modules/@zortexhq/plugin-autopilot/dist/cua.js +1 -0
- package/node_modules/@zortexhq/plugin-autopilot/dist/feedback.js +1 -0
- package/node_modules/@zortexhq/plugin-autopilot/dist/index.js +1 -0
- package/node_modules/@zortexhq/plugin-autopilot/dist/python-runtime.js +1 -0
- package/node_modules/@zortexhq/plugin-autopilot/dist/service.js +1 -0
- package/node_modules/@zortexhq/plugin-autopilot/dist/worker.js +1 -0
- package/node_modules/@zortexhq/plugin-autopilot/package.json +23 -0
- package/node_modules/@zortexhq/plugin-autopilot/python/jev_ultrafast/LICENSE +21 -0
- package/node_modules/@zortexhq/plugin-autopilot/python/jev_ultrafast/PROVENANCE.json +38 -0
- package/node_modules/@zortexhq/plugin-autopilot/python/jev_ultrafast/__init__.py +1 -0
- package/node_modules/@zortexhq/plugin-autopilot/python/jev_ultrafast/agent.py +178 -0
- package/node_modules/@zortexhq/plugin-autopilot/python/jev_ultrafast/browser.py +13 -0
- package/node_modules/@zortexhq/plugin-autopilot/python/jev_ultrafast/indra.patch +57 -0
- package/node_modules/@zortexhq/plugin-autopilot/python/jev_ultrafast/model.py +180 -0
- package/node_modules/@zortexhq/plugin-autopilot/python/jev_ultrafast/questions.py +26 -0
- package/node_modules/@zortexhq/plugin-autopilot/python/jev_ultrafast/transport.py +70 -0
- package/node_modules/@zortexhq/plugin-autopilot/python/strategies.py +154 -0
- package/node_modules/@zortexhq/plugin-autopilot/python/worker.py +260 -0
- package/node_modules/@zortexhq/plugin-connector-calendar/dist/actions.js +1 -1
- package/node_modules/@zortexhq/plugin-connector-computer-files/dist/catalog.js +1 -1
- package/node_modules/@zortexhq/plugin-connector-core/dist/api/action-outcome.js +1 -0
- package/node_modules/@zortexhq/plugin-connector-core/dist/api/content-acquisition.js +1 -1
- package/node_modules/@zortexhq/plugin-connector-core/dist/api/index.js +1 -1
- package/node_modules/@zortexhq/plugin-connector-core/dist/authorization-metrics.js +1 -1
- package/node_modules/@zortexhq/plugin-connector-core/dist/hub.js +1 -1
- package/node_modules/@zortexhq/plugin-connector-core/dist/native-principal.js +1 -1
- package/node_modules/@zortexhq/plugin-connector-drive/dist/actions.js +1 -1
- package/node_modules/@zortexhq/plugin-connector-drive/package.json +2 -1
- package/node_modules/@zortexhq/plugin-connector-gmail/dist/actions.js +1 -1
- package/node_modules/@zortexhq/plugin-connector-gmail/dist/connector.js +1 -1
- package/node_modules/@zortexhq/plugin-connector-gmail/package.json +2 -1
- package/node_modules/@zortexhq/plugin-connector-google-tasks/dist/compounds.js +1 -1
- package/node_modules/@zortexhq/plugin-connector-google-tasks/dist/provider.js +1 -1
- package/node_modules/@zortexhq/plugin-connector-level1/dist/apple-music-helper.js +1 -1
- package/node_modules/@zortexhq/plugin-connector-level1/dist/apple-music-server.js +6 -6
- package/node_modules/@zortexhq/plugin-connector-level1/dist/apple-native-process.mjs +1 -0
- package/node_modules/@zortexhq/plugin-connector-level1/dist/apple-notes-helper.js +1 -1
- package/node_modules/@zortexhq/plugin-connector-level1/dist/apple-notes-server.js +2 -2
- package/node_modules/@zortexhq/plugin-connector-level1/dist/apple-reminders-helper.js +1 -1
- package/node_modules/@zortexhq/plugin-connector-level1/dist/apple-reminders-server.js +2 -2
- package/node_modules/@zortexhq/plugin-connector-level1/dist/cua-runtime.js +1 -1
- package/node_modules/@zortexhq/plugin-connector-level1/dist/index.js +1 -1
- package/node_modules/@zortexhq/plugin-connector-level1/dist/macos-contacts-server.js +1 -0
- package/node_modules/@zortexhq/plugin-connector-level1/dist/prepared-apple-native.js +1 -0
- package/node_modules/@zortexhq/plugin-connector-level1/dist/prepared-local.js +1 -1
- package/node_modules/@zortexhq/plugin-connector-level1/dist/provisioning.js +1 -1
- package/node_modules/@zortexhq/plugin-connector-level1/dist/shallow.js +1 -1
- package/node_modules/@zortexhq/plugin-connector-outlook/dist/actions.js +1 -1
- package/node_modules/@zortexhq/plugin-connector-slack/dist/actions.js +1 -1
- package/node_modules/@zortexhq/plugin-connector-slack/dist/provider.js +1 -1
- package/node_modules/@zortexhq/plugin-connector-teams/dist/actions.js +1 -1
- package/node_modules/@zortexhq/plugin-connector-teams/dist/provider.js +1 -1
- package/node_modules/@zortexhq/plugin-connector-whatsapp/dist/auth-state.js +1 -1
- package/node_modules/@zortexhq/plugin-connector-whatsapp/dist/provider.js +1 -1
- package/node_modules/@zortexhq/plugin-connector-youtube/dist/source.js +1 -1
- package/node_modules/@zortexhq/plugin-context-share/dist/api/action-schemas.js +1 -0
- package/node_modules/@zortexhq/plugin-context-share/dist/api/index.js +1 -1
- package/node_modules/@zortexhq/plugin-context-share/dist/index.js +1 -1
- package/node_modules/@zortexhq/plugin-context-share/dist/share.js +1 -1
- package/node_modules/@zortexhq/plugin-galaxy-ui/dist/file-catalog.js +1 -1
- package/node_modules/@zortexhq/plugin-galaxy-ui/dist/original-adapter.js +1 -1
- package/node_modules/@zortexhq/plugin-galaxy-ui/src/integration/account.js +1 -1
- package/node_modules/@zortexhq/plugin-galaxy-ui/src/integration/app-i18n-twin.js +1 -1
- package/node_modules/@zortexhq/plugin-galaxy-ui/src/integration/app-i18n.js +1 -1
- package/node_modules/@zortexhq/plugin-galaxy-ui/src/integration/app-model.js +1 -1
- package/node_modules/@zortexhq/plugin-galaxy-ui/src/integration/app-text.js +1 -1
- package/node_modules/@zortexhq/plugin-google-auth/dist/index.js +1 -1
- package/node_modules/@zortexhq/plugin-posthog/dist/operational.js +1 -1
- package/node_modules/@zortexhq/plugin-process-local/dist/api/execution-scope.js +1 -0
- package/node_modules/@zortexhq/plugin-process-local/dist/api/stdio-transport.js +1 -0
- package/node_modules/@zortexhq/plugin-process-local/dist/index.js +1 -1
- package/node_modules/@zortexhq/plugin-process-local/dist/runner.js +1 -1
- package/node_modules/@zortexhq/plugin-process-local/dist/windows-job.js +1 -1
- package/node_modules/@zortexhq/plugin-product-account/dist/index.js +4 -1
- package/node_modules/@zortexhq/plugin-product-account/dist/session-store.js +10 -0
- package/node_modules/@zortexhq/plugin-product-account/dist/storage.js +1 -0
- package/node_modules/@zortexhq/plugin-product-account/package.json +5 -1
- package/node_modules/@zortexhq/plugin-telemetry/dist/api/operational.js +1 -1
- package/node_modules/@zortexhq/plugin-vault-sqlite/dist/api/index.js +1 -1
- package/node_modules/@zortexhq/plugin-vault-sqlite/dist/api/public-result-visibility.js +1 -0
- package/node_modules/@zortexhq/plugin-vault-sqlite/dist/content-acquisition.js +1 -1
- package/node_modules/@zortexhq/plugin-vault-sqlite/dist/credentials.js +3 -3
- package/node_modules/@zortexhq/plugin-vault-sqlite/dist/index.js +1 -1
- package/node_modules/@zortexhq/plugin-vault-sqlite/dist/keychain.js +1 -1
- package/node_modules/@zortexhq/plugin-vault-sqlite/dist/public-visibility.js +7 -0
- package/node_modules/@zortexhq/plugin-vault-sqlite/dist/recovery-guard.js +1 -1
- package/node_modules/@zortexhq/plugin-vault-sqlite/dist/runtime.js +1 -0
- package/node_modules/@zortexhq/plugin-vault-sqlite/dist/schema.js +2 -0
- package/node_modules/@zortexhq/plugin-vault-sqlite/dist/search-records.js +1 -1
- package/node_modules/@zortexhq/plugin-vault-sqlite/dist/snapshot-tables.js +1 -1
- package/node_modules/@zortexhq/plugin-vault-sqlite/dist/snapshot-worker.js +1 -1
- package/node_modules/@zortexhq/plugin-vault-sqlite/dist/snapshot.js +1 -1
- package/node_modules/@zortexhq/plugin-vault-sqlite/dist/source-sync.js +1 -1
- package/node_modules/@zortexhq/plugin-vault-sqlite/dist/sql-worker.js +2 -1
- package/node_modules/@zortexhq/plugin-vault-sqlite/dist/sql.js +1 -1
- package/package.json +13 -7
- package/profiles/core.yml +2 -0
- package/release-provenance.json +43 -36
- package/update-manifest.json +516 -275
- package/dist/content-find.js +0 -2
- package/dist/find-snapshots.js +0 -1
- package/dist/match-excerpt.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{preparedAdobeNative}from"./prepared-adobe-native.js";import{preparedGameMetadata}from"./prepared-game-metadata.js";import{preparedDeveloperHistory}from"./prepared-developer-history.js";import{preparedOfficeLocal}from"./prepared-office-local.js";import{preparedAedt}from"./prepared-aedt.js";import{preparedPremierePro}from"./prepared-premiere-pro.js";import{preparedPacketTracer}from"./prepared-packet-tracer.js";import{preparedModrinth}from"./prepared-modrinth.js";import{preparedHearthstone}from"./prepared-hearthstone.js";import{preparedVisio}from"./prepared-visio.js";import{preparedMatlab}from"./prepared-matlab.js";import{preparedIllustrator}from"./prepared-illustrator.js";import{preparedMinecraft}from"./prepared-minecraft.js";import{preparedPowerPoint}from"./prepared-powerpoint.js";import{preparedCcs}from"./prepared-ccs.js";import{preparedPscad}from"./prepared-pscad.js";import{preparedPhotoshop}from"./prepared-photoshop.js";import{preparedAutocad}from"./prepared-autocad.js";import{preparedWindowsMetadata,windowsMetadataSource,windowsMetadataGrant}from"./prepared-windows-metadata.js";import{preparedDockerDesktop}from"./prepared-docker-desktop.js";import{preparedOllama}from"./prepared-ollama.js";import{preparedQtDesigner}from"./prepared-qt-designer.js";import{preparedTdms}from"./prepared-tdms.js";import{preparedJupyter}from"./prepared-jupyter.js";import{createHash}from"node:crypto";import{pageSchema,createComputerFilesAdapter}from"./computer-files-pages.js";import{realpathSync,statSync,readFileSync}from"node:fs";import{isAbsolute}from"node:path";import{fileURLToPath,pathToFileURL}from"node:url";import{businessError,ok}from"@zortexhq/plugin-connector-framework/api";import{reviewedToolSchemaHash}from"./custodied.js";import{createVisualStudioSource}from"./prepared-visual-studio.js";import{createModelSimSource}from"./prepared-modelsim.js";import{createQuartusSource}from"./prepared-quartus.js";import{createSimulinkSource}from"./prepared-simulink.js";import{createJianyingSource}from"./prepared-jianying.js";import{createPreparedMacAptSource}from"./prepared-macapt.js";import{zoteroApiReads,zoteroRecentRecords}from"./zotero-read.js";import{preparedStm32CubeMx}from"./prepared-stm32cubemx.js";import{preparedMultisim}from"./prepared-multisim.js";import{preparedSolidWorks}from"./prepared-solidworks.js";import{preparedLattics}from"./prepared-lattics.js";import{preparedJetBrains}from"./prepared-jetbrains.js";import{preparedEclipse}from"./prepared-eclipse.js";import{preparedPlecs}from"./prepared-plecs.js";import{joplinSchemas}from"./joplin-server.js";const fastmailUrl="https://api.fastmail.com/mcp",fastmailIssuer="https://api.fastmail.com";export const fastmail={source:"fastmail",label:"Fastmail",group:"Connector / Prepared Local",readOnly:true,server:{transport:"http",url:fastmailUrl},auth:{kind:"mcp-oauth",loopbackPort:0},origin:{official:true,repo:"https://www.fastmail.help/hc/en-us/articles/15869557281295-Connecting-AI-tools-via-Fastmail-s-MCP-server",check:"Official hosted MCP and public discovery reviewed 2026-10-26: exact /mcp resource, api.fastmail.com issuer, DCR, S256, public-client none and offline_access. Shared enrollment and refresh own OAuth; the user chooses read, write and send access at Fastmail. Existing API-token stdio grants retain their original route. Attachments are not supported by the hosted service; real account Actions remain separately qualified."}};export const preparedLocalSourceIds=["solidworks","lattics","jetbrains","eclipse","multisim","stm32cubemx","plecs","obsidian","joplin","logseq","apple-notes","nextcloud","imessage","wechat","thunderbird","fastmail","proton-mail","local-audio","zotero","macos-contacts","computer-files","visual-studio","modelsim","quartus","simulink","jianying","epic-games-launcher","ryujinx","modrinth","powerpoint","ti-ccs","pscad","adobe-photoshop","autocad","microsoft-word","microsoft-excel","local-git","vscode-local-history","libreoffice","adobe-acrobat","adobe-camera-raw","adobe-media-encoder","ansys-electronics-desktop","adobe-premiere-pro","packet-tracer","qt-designer","hearthstone-deck-tracker","visio","matlab","adobe-illustrator","minecraft-java","ni-tdms","jupyter","windows-event-viewer","windows-task-scheduler","wsl","docker-desktop","ollama","owntracks","copyq","mac-apt"];const preparedLocalReadSchemas={read_note:{additionalProperties:false,type:"object",properties:{id:{type:"string",description:"The note id (32-character hex)."},offset:{type:"integer",description:"Byte offset into the body to start at. Defaults to 0.",minimum:0},max_chars:{type:"integer",description:"Maximum characters of body to return. Omit or set to 0 for the full body.",minimum:0}},required:["id"]},notes_get:{type:"object",properties:{id:{type:"string",description:"Note ID"}},required:["id"]},contacts_get:{type:"object",properties:{id:{type:"string",description:"Contact ID"}},required:["id"]},messages_read:{type:"object",properties:{chatId:{type:"string",description:"Chat ID"},limit:{type:"integer",description:"Maximum number of messages to return"},cursor:{type:"string",description:"Pagination cursor"}},required:["chatId"]},listAccounts:{type:"object",properties:{},required:[]},getMessageHeaders:{type:"object",properties:{messageId:{type:"string",description:"The id from getMessage or searchMessages; surrounding angle brackets are optional"},folderPath:{type:"string",description:"The folder URI path (from searchMessages results)"}},required:["messageId","folderPath"]},getMessage:{type:"object",properties:{messageId:{type:"string",description:"The message ID (from searchMessages results)"},folderPath:{type:"string",description:"The folder URI path (from searchMessages results)"},saveAttachments:{type:"boolean",description:"If true, save attachments to <OS temp dir>/thunderbird-mcp/<messageId>/ and include filePath in response (default: false)"},includeInlineImages:{type:"boolean",description:"If true, append supported inline email images as MCP image content blocks after the text result (default: false; max 1 MiB base64 per image and 4 MiB total). Images referenced by the rendered body are attempted first in document order, followed by remaining inline images in MIME order. Ignored when rawSource is true."},bodyFormat:{type:"string",enum:["markdown","text","html"],description:"Body output format: 'markdown' (default; HTML conversion allows only http/https/mailto links and replaces images with alt text; plain-text bodies only escape image openers, preserving other Markdown/HTML), 'text' (plain text), 'html' (unchanged, untrusted HTML). HTML input over 2 MiB is truncated before markdown/text conversion, with a notice."},rawSource:{type:"boolean",description:"If true, return untrusted raw RFC 2822 message source (all headers + MIME parts). Useful for extracting calendar invites, S/MIME data, or debugging. Other fields (body, attachments) are omitted when this is set. IMAP messages without a complete offline copy are fetched from the server."}},required:["messageId","folderPath"]},get_email:{type:"object",properties:{emailId:{type:"string",description:"The email ID to retrieve"}},required:["emailId"],additionalProperties:false,$schema:"http://json-schema.org/draft-07/schema#"},list_mailboxes:{type:"object",properties:{},$schema:"http://json-schema.org/draft-07/schema#"},getPage:{type:"object",properties:{pageName:{type:"string",description:"The page's name or uuid"}},required:["pageName"],$schema:"http://json-schema.org/draft-07/schema#"},find_details_of_current_user:{properties:{},type:"object"},get_file_content:{properties:{file_path:{type:"string"}},required:["file_path"],type:"object"}};const common=["resourceId","issuer","audience","requiredScopes"];const invalid=field=>{throw Error(`Invalid prepared local connector configuration: ${field}.`)};function record(value){return!!value&&typeof value==="object"&&!Array.isArray(value)&&[Object.prototype,null].includes(Object.getPrototypeOf(value))}function exact(options,keys){if(!record(options))invalid("unknown option");for(const key of Reflect.ownKeys(options)){if(typeof key!=="string"||!keys.includes(key))invalid("unknown option");const descriptor=Object.getOwnPropertyDescriptor(options,key);if(!("value"in descriptor))invalid("accessor option");if(!descriptor.enumerable)invalid("hidden option")}}function text(value,field,max=2048){if(typeof value!=="string"||!value||value!==value.trim()||value.length>max||/[\u0000-\u001f\u007f]/u.test(value))invalid(field);return value}function port(value,defaultValue){if(value===void 0&&defaultValue!==void 0)return defaultValue;if(!Number.isInteger(value)||Number(value)<1024||Number(value)>65535)invalid("port");return value}function path(value,field,directory){const requested=text(value,field,4096);if(!isAbsolute(requested))invalid(field);let resolved;try{resolved=realpathSync(requested);const stat=statSync(resolved);if(directory?!stat.isDirectory():!stat.isFile())invalid(field)}catch{invalid(field)}return resolved}function rootPaths(value){if(!Array.isArray(value)||value.length<1||value.length>16)invalid("roots");const roots=value.map(item=>path(item,"root",true));if(new Set(roots).size!==roots.length)invalid("duplicate root");return roots.sort()}export function preparedLocalRootsAudience(source,roots){if(!["visual-studio","modelsim","quartus","simulink","jianying","epic-games-launcher","ryujinx","modrinth","powerpoint","ti-ccs","pscad","adobe-photoshop","autocad","microsoft-word","microsoft-excel","local-git","vscode-local-history","libreoffice","adobe-acrobat","adobe-camera-raw","adobe-media-encoder","ansys-electronics-desktop","adobe-premiere-pro","packet-tracer","qt-designer","hearthstone-deck-tracker","visio","matlab","adobe-illustrator","minecraft-java","ni-tdms","jupyter","solidworks","lattics","jetbrains","eclipse","multisim","stm32cubemx","plecs","obsidian","logseq","local-audio","computer-files"].includes(source))invalid("file source");if((source==="plecs"||source==="stm32cubemx"||source==="multisim"||source==="solidworks"||source==="lattics"||source==="jetbrains"||source==="eclipse")&&roots.length!==1)invalid("Select one project folder");const canonical=rootPaths([...roots]).map(root=>pathToFileURL(root).href);return`indra-local-roots:${source}:${createHash("sha256").update(JSON.stringify(canonical)).digest("hex")}`}function authority(options,credentialKind,audience){const resourceId=text(options.resourceId,"resourceId",512),issuer=text(options.issuer,"issuer",512),selectedAudience=text(options.audience,"audience",2048);if(audience!==void 0&&selectedAudience!==audience)invalid("audience does not match selected resource");if(!Array.isArray(options.requiredScopes)||options.requiredScopes.length>32||options.requiredScopes.some(scope=>typeof scope!=="string"||!scope||scope.length>1024||/\s/u.test(scope))||new Set(options.requiredScopes).size!==options.requiredScopes.length)invalid("requiredScopes");return{kind:"custodied",resourceId,issuer,audience:selectedAudience,requiredScopes:[...options.requiredScopes],credentialKind}}function review(names){return Object.fromEntries(names.map(name=>[name,{inputSchemaSha256:reviewedToolSchemaHash(preparedLocalReadSchemas[name])}]))}const validateThunderbirdParams=(tool,params)=>{if(tool!=="getMessage")return ok(void 0);const invalidRead=()=>businessError("invalid_argument","Thunderbird full reads require a selected messageId and folderPath, rawSource=true, and disabled attachment saving and inline images.","plugin");if(!record(params))return invalidRead();for(const key of Reflect.ownKeys(params)){if(typeof key!=="string"||!["messageId","folderPath","rawSource","saveAttachments","includeInlineImages"].includes(key))return invalidRead();const descriptor=Object.getOwnPropertyDescriptor(params,key);if(!("value"in descriptor)||!descriptor.enumerable)return invalidRead()}const validReference=(value,max)=>typeof value==="string"&&value.length>0&&value.length<=max&&value===value.trim()&&!/[\u0000-\u001f\u007f]/u.test(value);if(!validReference(params.messageId,1024)||!validReference(params.folderPath,4096)||params.rawSource!==true||params.saveAttachments!==void 0&¶ms.saveAttachments!==false||params.includeInlineImages!==void 0&¶ms.includeInlineImages!==false)return invalidRead();return ok(void 0)};const validateThunderbirdResult=(tool,result,params)=>{if(tool!=="getMessage")return ok(void 0);const malformed=()=>businessError("data_loss","Thunderbird did not return the complete selected message MIME source.","plugin");if(result.structured!==void 0||params?.rawSource!==true)return malformed();let value;try{value=JSON.parse(result.text)}catch{return malformed()}if(!record(value))return malformed();if("error"in value)return businessError("unavailable","Thunderbird could not complete the protected message read.","plugin");if(value.encryptedContentWithheld===true)return businessError("permission_denied","Thunderbird withheld the selected message under its content access policy.","plugin");if(Object.keys(value).some(key=>!["id","subject","rawSource"].includes(key))||typeof value.id!=="string"||value.id!==params.messageId||typeof value.subject!=="string"||typeof value.rawSource!=="string"||!/(?:\r\n\r\n|\n\n|\r\r)/u.test(value.rawSource))return malformed();return ok(void 0)};const validateThunderbirdOutcome=(_tool,result)=>{let value=result.structured;try{if(value===void 0)value=JSON.parse(result.text)}catch{return ok(void 0)}if(record(value)&&"error"in value)return businessError("unavailable","Thunderbird could not complete the requested operation.","plugin");if(record(value)&&value.encryptedContentWithheld===true)return businessError("permission_denied","Thunderbird withheld the selected message under its content access policy.","plugin");return ok(void 0)};function numericId(value,field){const result=text(value,field,32);if(!/^[1-9][0-9]{0,19}$/.test(result))invalid(field);return result}function base(source,label){return{source,label,group:"Connector / Local and native"}}const nextcloudReady={tool:"find_details_of_current_user",done(structured,text2){let value=structured;try{if(value===void 0)value=JSON.parse(text2)}catch{return false}return record(value)&&typeof value.id==="string"&&value.id.length>0&&!("error"in value)}};const thunderbirdReady={tool:"listAccounts",done(structured,text2){if(structured!==void 0)return false;let value;try{value=JSON.parse(text2)}catch{return false}return Array.isArray(value)&&value.every(account=>record(account)&&typeof account.id==="string"&&!!account.id&&typeof account.name==="string"&&typeof account.type==="string"&&Array.isArray(account.identities)&&account.identities.every(identity=>record(identity)&&typeof identity.id==="string"&&!!identity.id&&typeof identity.email==="string"&&typeof identity.name==="string"&&typeof identity.isDefault==="boolean"))}};const protonReady={tool:"get_status",args:{folder:"INBOX"},done(structured){if(!record(structured)||"error"in structured||!Array.isArray(structured.result)||structured.result.length!==1)return false;const status=structured.result[0];return record(status)&&Object.keys(status).length===3&&status.name==="INBOX"&&Number.isSafeInteger(status.total)&&Number(status.total)>=0&&Number.isSafeInteger(status.unread)&&Number(status.unread)>=0}};const filesystemPackage="@modelcontextprotocol/server-filesystem@2.0.1";const filesystemCommit="ef9808f71090d0db3eda99e2af2ba78f1086f4fb";const appleCommit="951c11af2b621fc34debd2d57432b9ea856c7198";export const preparedProtonReadPolicy='[policy]\nmode = "read"\n\n[index]\nenabled = false\n\n[notifications]\nenabled = false\n';export function preparedLocalNativeSelection(source,input){if(windowsMetadataSource(source)){exact(input,[]);return windowsMetadataGrant(source)}if(source==="docker-desktop"){exact(input,[]);return{options:{},audience:"npipe:////./pipe/dockerDesktopLinuxEngine",scope:"images.read"}}if(source==="ollama"){exact(input,["port"]);const selectedPort=port(input.port,11434);return{options:{port:selectedPort},audience:"http://127.0.0.1:"+selectedPort,scope:"models.read"}}if(source==="owntracks"||source==="wechat"){exact(input,["port"]);const selectedPort=port(input.port,source==="owntracks"?8765:5030);return{options:{port:selectedPort},audience:`http://127.0.0.1:${selectedPort}/mcp`,scope:source==="owntracks"?"location.read":"messages.read"}}if(source==="copyq"){exact(input,["executable","session"]);const executable=path(input.executable,"executable",false),session=input.session===""?"":text(input.session,"session",16);if(!/^[\p{L}\p{N}_-]{0,16}$/u.test(session))invalid("session");return{options:{executable,session},audience:`copyq:${pathToFileURL(executable).href}?session=${encodeURIComponent(session)}`,scope:"clipboard.read"}}if(source==="zotero"){exact(input,["libraryId","libraryType","serverId"]);const libraryType=input.libraryType??"user";if(libraryType!=="user"&&libraryType!=="group")invalid("libraryType");const libraryId=libraryType==="user"&&input.libraryId==="0"?"0":numericId(input.libraryId,"libraryId");const serverId=text(input.serverId,"serverId",128);if(!/^[A-Za-z0-9_-]{1,128}$/.test(serverId))invalid("serverId");return{options:{libraryId,libraryType,serverId},audience:`http://127.0.0.1:23119/api/${libraryType==="user"?"users":"groups"}/${libraryId}?serverId=${serverId}`,scope:"library.read"}}if(["apple-notes","imessage","macos-contacts"].includes(source)){exact(input,["executable"]);const executable=path(input.executable,"executable",false);return{options:{executable},audience:`indra-apple-runtime:${source}:${pathToFileURL(executable).href}`,scope:source==="imessage"?"messages.read":source==="macos-contacts"?"contacts.read":"notes.read"}}return invalid("native source")}export function createPreparedLocalSource(source,options,policy={}){if(!preparedLocalSourceIds.includes(source)||!record(options))invalid("source or options");if(source==="stm32cubemx"){exact(options,[...common,"roots"]);const roots=rootPaths(options.roots);if(roots.length!==1||!Array.isArray(options.requiredScopes)||options.requiredScopes.length!==1||options.requiredScopes[0]!=="files.read")invalid("STM32CubeMX project permission");return preparedStm32CubeMx(roots[0],authority(options,"local-no-secret",preparedLocalRootsAudience(source,roots)))}if(source==="multisim"){exact(options,[...common,"roots"]);const roots=rootPaths(options.roots);if(roots.length!==1||!Array.isArray(options.requiredScopes)||options.requiredScopes.length!==1||options.requiredScopes[0]!=="files.read")invalid("Multisim project permission");return preparedMultisim(roots[0],authority(options,"local-no-secret",preparedLocalRootsAudience(source,roots)))}if(source==="solidworks"){exact(options,[...common,"roots"]);const roots=rootPaths(options.roots);if(roots.length!==1||!Array.isArray(options.requiredScopes)||options.requiredScopes.length!==1||options.requiredScopes[0]!=="files.read")invalid("SolidWorks project permission");return preparedSolidWorks(roots[0],authority(options,"local-no-secret",preparedLocalRootsAudience(source,roots)))}if(source==="lattics"){exact(options,[...common,"roots"]);const roots=rootPaths(options.roots);if(roots.length!==1||!Array.isArray(options.requiredScopes)||options.requiredScopes.length!==1||options.requiredScopes[0]!=="files.read")invalid("Lattics library permission");return preparedLattics(roots[0],authority(options,"local-no-secret",preparedLocalRootsAudience(source,roots)))}if(source==="jetbrains"){exact(options,[...common,"roots"]);const roots=rootPaths(options.roots);if(roots.length!==1||!Array.isArray(options.requiredScopes)||options.requiredScopes.length!==1||options.requiredScopes[0]!=="files.read")invalid("JetBrains project permission");return preparedJetBrains(roots[0],authority(options,"local-no-secret",preparedLocalRootsAudience(source,roots)))}if(source==="eclipse"){exact(options,[...common,"roots"]);const roots=rootPaths(options.roots);if(roots.length!==1||!Array.isArray(options.requiredScopes)||options.requiredScopes.length!==1||options.requiredScopes[0]!=="files.read")invalid("Eclipse project permission");return preparedEclipse(roots[0],authority(options,"local-no-secret",preparedLocalRootsAudience(source,roots)))}if(source==="plecs"){exact(options,[...common,"roots"]);authority(options,"local-no-secret");const roots=rootPaths(options.roots);if(roots.length!==1||!Array.isArray(options.requiredScopes)||options.requiredScopes.length!==1||options.requiredScopes[0]!=="files.read")invalid("PLECS project permission");return preparedPlecs(roots[0],authority(options,"local-no-secret",preparedLocalRootsAudience(source,roots)))}const fieldsMode=["nextcloud","thunderbird","proton-mail"].includes(source)&&Object.getOwnPropertyDescriptor(options,"mode")?.value==="fields";if(source==="joplin"&&Object.getOwnPropertyDescriptor(options,"mode")?.value==="paired-plugin"){exact(options,["mode","port","fingerprint"]);const selectedPort=port(options.port);if(typeof options.fingerprint!=="string"||!/^[a-f0-9]{64}$/.test(options.fingerprint))invalid("Joplin pairing fingerprint");const account=`joplin-plugin:${options.fingerprint}:127.0.0.1:${selectedPort}`;return{...base(source,"Joplin"),server:{transport:"stdio",command:process.execPath,args:[fileURLToPath(new URL("./joplin-server.js",import.meta.url))],env:fields=>{if(typeof fields.bridgeKey!=="string"||!/^[a-f0-9]{64}$/.test(fields.bridgeKey))invalid("Joplin paired bridge key");return{JOPLIN_PORT:String(selectedPort),JOPLIN_BRIDGE_KEY:fields.bridgeKey}}},auth:{kind:"fields",fields:[{key:"bridgeKey",label:"Joplin paired bridge key",secret:true}],account:()=>account,accountBinding:"endpoint",login:{ready:{tool:"check_auth",done(structured){return record(structured)&&structured.authenticated===true}}}},readOnly:true,allowedTools:Object.keys(joplinSchemas),reviewedReadTools:Object.fromEntries(Object.entries(joplinSchemas).map(([name,schema])=>[name,{inputSchemaSha256:reviewedToolSchemaHash(schema)}])),origin:{official:false,repo:"laurent22/joplin",artifact:"@zortexhq/plugin-connector-level1@0.1.0",check:"Official Joplin plugin data API through a mutually confirmed encrypted loopback bridge. Read-only Actions, bounded replies, no Web Clipper token or credential URL. Pairing must be renewed after Joplin restart."}}}if(source==="simulink"||source==="quartus"||source==="modelsim"||source==="visual-studio"){exact(options,[...common,"roots"]);authority(options,"local-no-secret");const roots=rootPaths(options.roots);if(roots.length!==1)invalid("Select one project folder");const auth=authority(options,"local-no-secret",preparedLocalRootsAudience(source,roots));if(auth.requiredScopes.length!==1||auth.requiredScopes[0]!=="files.read")invalid("This source requires the native read grant");if(source==="visual-studio")return createVisualStudioSource(roots[0],auth);if(source==="modelsim")return createModelSimSource(roots[0],auth);return source==="quartus"?createQuartusSource(roots[0],auth):createSimulinkSource(roots[0],auth)}if(source==="jianying"){exact(options,[...common,"roots"]);authority(options,"local-no-secret");const roots=rootPaths(options.roots);if(roots.length!==1)invalid("Jianying needs one draft folder");const auth=authority(options,"local-no-secret",preparedLocalRootsAudience(source,roots));if(auth.requiredScopes.length!==1||auth.requiredScopes[0]!=="files.read")invalid("Jianying needs the native read grant");return createJianyingSource(roots[0],auth)}if(source==="epic-games-launcher"||source==="ryujinx"||source==="modrinth"||source==="powerpoint"||source==="ti-ccs"||source==="pscad"||source==="adobe-photoshop"||source==="autocad"||source==="microsoft-word"||source==="microsoft-excel"||source==="local-git"||source==="vscode-local-history"||source==="libreoffice"||source==="adobe-acrobat"||source==="adobe-camera-raw"||source==="adobe-media-encoder"||source==="ansys-electronics-desktop"||source==="adobe-premiere-pro"||source==="packet-tracer"||source==="qt-designer"){exact(options,[...common,"roots"]);const roots=rootPaths(options.roots);if(roots.length!==1)invalid("Choose exactly one source folder");const auth=authority(options,"local-no-secret",preparedLocalRootsAudience(source,roots));if(auth.requiredScopes.length!==1||auth.requiredScopes[0]!=="files.read")invalid("Source needs the native read grant");if(source==="powerpoint")return preparedPowerPoint(roots[0],auth);if(source==="ti-ccs")return preparedCcs(roots[0],auth);if(source==="pscad")return preparedPscad(roots[0],auth);if(source==="adobe-photoshop")return preparedPhotoshop(roots[0],auth);if(source==="microsoft-word"||source==="microsoft-excel")return preparedOfficeLocal(source,roots[0],auth);if(source==="local-git"||source==="vscode-local-history")return preparedDeveloperHistory(source,roots[0],auth);if(source==="libreoffice")return preparedDeveloperHistory(source,roots[0],auth);if(source==="adobe-acrobat"||source==="adobe-camera-raw"||source==="adobe-media-encoder")return preparedAdobeNative(source,roots[0],auth);if(source==="ansys-electronics-desktop")return preparedAedt(roots[0],auth);if(source==="adobe-premiere-pro")return preparedPremierePro(roots[0],auth);if(source==="packet-tracer")return preparedPacketTracer(roots[0],auth);if(source==="epic-games-launcher"||source==="ryujinx")return preparedGameMetadata(source,roots[0],auth);if(source==="modrinth")return preparedModrinth(roots[0],auth);return source==="autocad"?preparedAutocad(roots[0],auth):preparedQtDesigner(roots[0],auth)}if(source==="minecraft-java"||source==="adobe-illustrator"||source==="hearthstone-deck-tracker"||source==="visio"||source==="matlab"){exact(options,[...common,"roots"]);const roots=rootPaths(options.roots);if(roots.length!==1)invalid("Select exactly one source folder");const auth=authority(options,"local-no-secret",preparedLocalRootsAudience(source,roots));if(auth.requiredScopes.length!==1||auth.requiredScopes[0]!=="files.read")invalid("The source requires the native read grant");if(source==="hearthstone-deck-tracker")return preparedHearthstone(roots[0],auth);if(source==="visio")return preparedVisio(roots[0],auth);if(source==="matlab")return preparedMatlab(roots[0],auth);return source==="adobe-illustrator"?preparedIllustrator(roots[0],auth):preparedMinecraft(roots[0],auth)}if(source==="ni-tdms"){exact(options,[...common,"roots"]);const roots=rootPaths(options.roots);if(roots.length!==1)invalid("TDMS needs exactly one measurement folder");const auth=authority(options,"local-no-secret",preparedLocalRootsAudience(source,roots));if(auth.requiredScopes.length!==1||auth.requiredScopes[0]!=="files.read")invalid("TDMS needs the native read grant");return preparedTdms(roots[0],auth)}if(source==="jupyter"){exact(options,[...common,"roots"]);const roots=rootPaths(options.roots);if(roots.length!==1)invalid("Jupyter needs exactly one notebook folder");const auth=authority(options,"local-no-secret",preparedLocalRootsAudience(source,roots));if(auth.requiredScopes.length!==1||auth.requiredScopes[0]!=="files.read")invalid("Jupyter needs the native read grant");return preparedJupyter(roots[0],auth)}if(windowsMetadataSource(source)){exact(options,common);const grant=windowsMetadataGrant(source),auth=authority(options,"local-no-secret",grant.audience);if(auth.requiredScopes.length!==1||auth.requiredScopes[0]!==grant.scope)invalid("Windows source requires its local metadata grant");return preparedWindowsMetadata(source,auth)}if(source==="joplin"&&Object.getOwnPropertyDescriptor(options,"mode")?.value==="fields")throw Error("Legacy Joplin Web Clipper authorization is disabled. Use Help encrypted plugin pairing.");if(source==="mac-apt")return createPreparedMacAptSource(source,options);if(source==="docker-desktop"){exact(options,common);const selection=preparedLocalNativeSelection(source,{});const auth=authority(options,"local-no-secret",selection.audience);if(auth.requiredScopes.length!==1||auth.requiredScopes[0]!==selection.scope)invalid("Docker Desktop requires the image metadata grant");return preparedDockerDesktop(auth)}if(source==="ollama"){exact(options,[...common,"port"]);const endpoint=preparedLocalNativeSelection(source,{port:options.port}).audience;const auth=authority(options,"local-no-secret",endpoint);if(auth.requiredScopes.length!==1||auth.requiredScopes[0]!=="models.read")invalid("Ollama requires the model metadata grant");return preparedOllama(endpoint,auth)}if(source==="owntracks"){exact(options,[...common,"port"]);const url=preparedLocalNativeSelection(source,{port:options.port}).audience;return{...base(source,"OwnTracks"),server:{transport:"http",url},auth:authority(options,"local-no-secret",url),readOnly:true,allowedTools:["owntracks_status","list_devices","get_last_location","get_location_history","get_distance","reverse_geocode"],origin:{official:false,repo:"de-niji/OwnTracksHermes",artifact:"owntracks-mcp@0.2.0",check:"MIT; source 9f005a790c388d3cd4aeb1306b3a202be917a1ff, archive SHA256 367406a8561c57657872661cc7a8d814ace162a0a21cd9214799394eb1fca63f. Existing local server must already own its selected Recorder configuration. Native Recorder queries only; Hermes reminders/history and cron are outside this route."}}}if(source==="copyq"){exact(options,[...common,"executable","session"]);authority(options,"local-no-secret");const selection=preparedLocalNativeSelection(source,{executable:options.executable,session:options.session}),{executable,session}=selection.options;const wheel="https://github.com/AutoraLabs/copyq-mcp/releases/download/v0.1.0/copyq_mcp-0.1.0-py3-none-any.whl#sha256=46e3f12eead7e9d7bd2589f6a563dba17c67a6ac6f5c4804522243a07def5746";return{...base(source,"CopyQ clipboard history"),server:{transport:"stdio",command:"uvx",args:["--from",wheel,"copyq-mcp"],env:()=>({COPYQ_MCP_EXECUTABLE:executable,COPYQ_MCP_SESSION:session})},auth:authority(options,"local-no-secret",selection.audience),readOnly:true,allowedTools:["clipboard_read","clipboard_search","clipboard_tabs"],origin:{official:false,repo:"AutoraLabs/copyq-mcp",artifact:"copyq-mcp@0.1.0",check:"MIT, active with CI/tests; exact release wheel digest verified 2026-10-26. Selected native CopyQ session only; all three text-history Actions preserved. No setup command, clipboard rewrite, dictation hook, or second clipboard store."}}}const mode=source==="logseq"?Object.getOwnPropertyDescriptor(options,"mode")?.value??"native-mcp":void 0;if(["obsidian","local-audio","computer-files"].includes(source)||source==="logseq"&&mode==="files"){exact(options,[...common,"roots",...source==="logseq"?["mode"]:[]]);authority(options,"local-no-secret");const roots=rootPaths(options.roots),audience=preparedLocalRootsAudience(source,roots);const fileAdapter=source==="computer-files"?createComputerFilesAdapter(roots):void 0;const label={obsidian:"Obsidian",logseq:"Logseq (file graph)","local-audio":"Local audio (file)","computer-files":"Local files"}[source];return{...base(source,label),server:{transport:"stdio",command:"npx",args:["-y",filesystemPackage,...roots]},auth:authority(options,"local-no-secret",audience),readOnly:true,preserveContent:true,...fileAdapter?{adaptSchema:pageSchema,adaptInvoke:(name,params,_grant,{signal})=>fileAdapter(name,params,signal)}:{},allowedTools:source==="local-audio"?["read_media_file","get_file_info"]:source==="computer-files"?["list_allowed_directories","search_files","list_directory","read_text_file","read_media_file","get_file_info"]:["read_text_file","read_media_file","get_file_info","list_directory"],origin:{official:true,repo:"modelcontextprotocol/servers",package:filesystemPackage,check:`Filesystem source reviewed at ${filesystemCommit}; exact granted roots, readonly tools, no recursive ingestion. Node >=24; license transition Apache-2.0/MIT, see pinned LICENSE.`}}}if(source==="joplin"||source==="logseq"||source==="wechat"||source==="thunderbird"){exact(options,fieldsMode?["mode","port"]:[...common,"port",...source==="logseq"?["mode"]:[]]);if(source==="logseq"&&mode!=="native-mcp")invalid("Logseq mode");const selectedPort=port(options.port,source==="logseq"?12315:source==="wechat"?5030:void 0);const url=source==="wechat"?preparedLocalNativeSelection(source,{port:selectedPort}).audience:`http://127.0.0.1:${selectedPort}${source==="thunderbird"?"/":"/mcp"}`;if(source==="joplin")throw Error("Joplin connection is temporarily disabled: upstream logs credential-bearing request URLs. Existing settings have been preserved.");if(source==="logseq")return{...base(source,"Logseq (database graph)"),server:{transport:"http",url},auth:authority(options,"mcp-token",url),readOnly:true,allowedTools:["getPage"],reviewedReadTools:review(["getPage"]),origin:{official:true,repo:"logseq/logseq",artifact:"native Logseq MCP 0.1.0",check:"getPage API/server reviewed at f8fb34b79bd5d183d22eb8f05d50173227ee2d81; native DB graph only; separately selected file graphs use filesystem route."}};if(source==="thunderbird")return{...base(source,"Thunderbird"),server:{transport:"http",url},auth:fieldsMode?{kind:"fields",fields:[{key:"apiKey",label:"Thunderbird MCP token",secret:true}],tokenField:"apiKey",account:()=>url,login:{ready:thunderbirdReady}}:authority(options,"mcp-token",url),readOnly:true,allowedTools:["listAccounts","getMessageHeaders","getMessage"],reviewedReadTools:review(["listAccounts","getMessageHeaders","getMessage"]),...policy.fullActions?{validateResult:validateThunderbirdOutcome}:{validateParams:validateThunderbirdParams,validateResult:validateThunderbirdResult},origin:{official:false,repo:"TKasperczyk/thunderbird-mcp",artifact:"thunderbird-mcp@0.10.0",check:"Extension/native MCP at 8910dbf4300a7ea7ebf1edd0bdd0d22996531b88; XPI SHA256 638b7512d4f8b30d71b1547e10372ac537f046cc05d196a867e3871684c19f8c. Exact approved profile port/token; no profile discovery or installation. getMessage admits rawSource=true only, with attachment saving and inline images disabled; complete MIME bytes remain transient. Exact stored Message-ID and folder URI; shared 1 MiB reply and 120 second bounds. Native account/content access checks remain authoritative."}};return{...base(source,"WeChat (local chatlog)"),server:{transport:"http",url},auth:authority(options,"local-no-secret",url),allowedTools:["query_contact","query_chat_room","query_recent_chat","query_chat_log"],origin:{official:false,repo:"sjzar/chatlog",artifact:"chatlog@0.0.26",check:"Retained Indra vendor pin 74e568085b8ae5aa3ec72dcd37aac6da969fa121, archive SHA256 e8affa2def64a68bc65f8eaeccd643080d18eeab29750ce9205f574adfa69cbb; /mcp Streamable HTTP. Public upstream removed. Explicit false readonly hints preserved; readonly acceptance remains blocked."}}}if(["apple-notes","imessage","macos-contacts"].includes(source)){exact(options,[...common,"executable"]);authority(options,"local-no-secret");const selection=preparedLocalNativeSelection(source,{executable:options.executable}),executable=selection.options.executable,tool={"apple-notes":"notes_get",imessage:"messages_read","macos-contacts":"contacts_get"}[source];const audience=typeof options.audience==="string"&&options.audience.startsWith("indra-apple-runtime:")?selection.audience:void 0;return{...base(source,{"apple-notes":"Apple Notes",imessage:"iMessage","macos-contacts":"macOS Contacts"}[source]),server:{transport:"stdio",command:executable,args:[],env:()=>({APPLE_BRIDGE_SKIP_PERMISSIONS:"1"})},auth:authority(options,"local-no-secret",audience),readOnly:true,allowedTools:[tool],reviewedReadTools:review([tool]),origin:{official:false,repo:"boutquin/apple-bridge",artifact:"apple-bridge@3.2.0",check:`Native readonly tools reviewed at ${appleCommit}; release macOS arm64 archive SHA256 83c64569fa8238e694ed4e30b6c32e81c7f9285b4130aaaf4e303a430dda5875. Startup permission requests disabled; existing OS permission still required. No Windows adapter.`},unavailable:()=>process.platform==="darwin"?void 0:"This reviewed Apple native adapter requires macOS; Windows qualification remains open."}}if(source==="nextcloud"){exact(options,fieldsMode?["mode","instanceUrl"]:[...common,"instanceUrl"]);const input=text(options.instanceUrl,"instanceUrl");let instance;try{instance=new URL(input);if(instance.protocol!=="https:"||instance.username||instance.password||instance.search||instance.hash)invalid("instanceUrl")}catch{invalid("instanceUrl")}const url=`${instance.href.replace(/\/$/,"")}/index.php/apps/app_api/proxy/context_agent/mcp/`;return{...base(source,"Nextcloud"),server:{transport:"http",url},auth:fieldsMode?{kind:"fields",fields:[{key:"apiKey",label:"Nextcloud app password",secret:true}],tokenField:"apiKey",account:()=>url,login:{ready:nextcloudReady}}:authority(options,"rest-token",url),readOnly:true,allowedTools:["find_details_of_current_user","get_file_content"],reviewedReadTools:review(["find_details_of_current_user","get_file_content"]),origin:{official:true,repo:"nextcloud/context_agent",artifact:"Context Agent native MCP",check:"Hosted bearer app-password contract, current-user metadata and private-file text read reviewed at 321e0943dfee7eef1a8ade118dc2aea3da0ba356. Instance AppAPI/Context Agent versions and stateless transport compatibility require installed qualification."}}}if(source==="fastmail"){exact(options,common);if(options.audience===fastmailUrl){if(options.issuer!==fastmailIssuer)invalid("hosted Fastmail issuer");return{...fastmail,auth:authority(options,"mcp-token",fastmailUrl)}}return{...base(source,"Fastmail"),server:{transport:"stdio",command:"npx",args:["-y","@jordonh19/fastmail-mcp-server@1.3.0","--transport","stdio"],tokenEnv:"FASTMAIL_API_TOKEN"},auth:authority(options,"rest-token","https://api.fastmail.com"),readOnly:true,allowedTools:["get_email","list_mailboxes"],reviewedReadTools:review(["get_email","list_mailboxes"]),origin:{official:false,repo:"Jordonh18/fastmail-mcp-server",package:"@jordonh19/fastmail-mcp-server@1.3.0",check:"MIT; source pin 68bb946fecd82b892190f0641a6b09bd4229d84c. Published package tools/list exercised with SDK1.27.1/Zod3.25.76 and zero network calls. Grant acquisition/OAuth refresh is separate; never infer account from a token label."}}}if(source==="proton-mail"){exact(options,fieldsMode?["mode","imapPort","policyFile"]:[...common,"username","imapPort","policyFile"]);if(!fieldsMode)authority(options,"rest-token");const username=fieldsMode?void 0:text(options.username,"Bridge username",320),imapPort=port(options.imapPort,fieldsMode?void 0:1143);const policyFile=path(fieldsMode&&options.policyFile===void 0?fileURLToPath(new URL("../server/proton/read.toml",import.meta.url)):options.policyFile,"policyFile",false);const policyValid=()=>{try{return readFileSync(policyFile,"utf8")===preparedProtonReadPolicy}catch{return false}};if(!policyValid())invalid("Proton readonly policy");const selectedFields=fields=>{exact(fields,["username","password"]);return{username:text(fields.username,"Bridge username",320),password:text(fields.password,"Bridge mailbox password",4096)}};const audience=selectedUsername=>`imap://127.0.0.1:${imapPort}/${encodeURIComponent(selectedUsername)}`;const environment=selectedUsername=>{if(!policyValid())invalid("Proton readonly policy");return{PROTONMAIL_BRIDGE_USERNAME:selectedUsername,PROTONMAIL_BRIDGE_HOST:"127.0.0.1",PROTONMAIL_BRIDGE_IMAP_PORT:String(imapPort),PROTONMAIL_BRIDGE_IMAP_SECURITY:"starttls",PROTONMAIL_BRIDGE_TIMEOUT:"30",PROTONMAIL_MCP_MODE:"read",PROTONMAIL_MCP_POLICY:policyFile,PROTONMAIL_MCP_AUDIT_LOG:""}};return{...base(source,"Proton Mail Bridge"),server:{transport:"stdio",command:"uvx",args:["--from","protonmail-mcp==0.4.0","protonmail-mcp"],...fieldsMode?{env:fields=>{const selected=selectedFields(fields);return{...environment(selected.username),PROTONMAIL_BRIDGE_PASSWORD:selected.password}}}:{tokenEnv:"PROTONMAIL_BRIDGE_PASSWORD",env:()=>environment(username)}},auth:fieldsMode?{kind:"fields",fields:[{key:"username",label:"Proton Bridge username"},{key:"password",label:"Proton Bridge mailbox password",secret:true}],accountBinding:"endpoint",account:fields=>audience(selectedFields(fields).username),login:{ready:protonReady}}:authority(options,"rest-token",audience(username)),readOnly:true,allowedTools:["list_folders","list_emails","read_email"],origin:{official:false,repo:"mhbxyz/protonmail-mcp",package:"protonmail-mcp==0.4.0",check:"Source pin f15d769d562de55c288a574f2a1e0946fefc9e31; fixed loopback Proton Bridge STARTTLS, immutable read preset, index/notifications/audit off. Fields mode verifies get_status for INBOX before saving the existing credential envelope and binds it to the selected port and username. Password is the Bridge mailbox credential. Python >=3.13 and an installed, signed-in Bridge remain required. Full Actions preserves upstream local-export write effects; this policy does not enable SMTP or mailbox mutations."},unavailable:()=>policyValid()?void 0:"The selected Proton readonly policy changed; requalify the connection."}}if(source==="zotero"){exact(options,[...common,"libraryId","libraryType","serverId"]);const selection=preparedLocalNativeSelection(source,{libraryId:options.libraryId,libraryType:options.libraryType,serverId:options.serverId}),{libraryId,libraryType,serverId}=selection.options,audience=selection.audience;return{...base(source,"Zotero (local library)"),server:{transport:"stdio",command:"uvx",args:["--with","fastmcp==3.4.11","--with","pydantic==2.13.4","--from","zotero-mcp-server==0.15.1","python",fileURLToPath(new URL("../server/zotero/read.py",import.meta.url))],env:()=>({ZOTERO_LOCAL:"true",ZOTERO_LIBRARY_ID:libraryId,ZOTERO_LIBRARY_TYPE:libraryType,ZOTERO_SERVER_ID:serverId,ZOTERO_LOCAL_WRITE:"false",ZOTERO_MCP_TOOLSETS:"none",ZOTERO_BACKEND:"api",ZOTERO_SEARCH_BACKEND:"api",ZOTERO_NO_CLAUDE:"1",ZOTERO_MCP_SCHEMA_REFRESH:"0",PYTHON_DOTENV_DISABLED:"1"})},auth:authority(options,"local-no-secret",audience),readOnly:true,...zoteroApiReads,liveRead:{tool:"zotero_get_recent",args:{limit:1},records:zoteroRecentRecords},origin:{official:false,repo:"54yyyu/zotero-mcp",package:"zotero-mcp-server==0.15.1",check:"Source pin f1f6cdc1ea26e04c59525f5b3ee7dd2b9d839bc3; selected library and local server identity bound, API backend forced, write/index/library-switch tools excluded. Public FastMCP3.4.11 import_server reuses unchanged tools without the upstream CLI environment discovery, reranker or startup indexing lifespan. Dotenv discovery is disabled; HOME is unchanged. Python server MIT; bundled plugin AGPL-3.0-or-later. Actual native library and OS acceptance remain separate."}}}return invalid("source")}
|
|
1
|
+
import{bundledAppleSelection,isBundledAppleSource,preparedAppleNative}from"./prepared-apple-native.js";import{preparedAdobeNative}from"./prepared-adobe-native.js";import{preparedGameMetadata}from"./prepared-game-metadata.js";import{preparedDeveloperHistory}from"./prepared-developer-history.js";import{preparedOfficeLocal}from"./prepared-office-local.js";import{preparedAedt}from"./prepared-aedt.js";import{preparedPremierePro}from"./prepared-premiere-pro.js";import{preparedPacketTracer}from"./prepared-packet-tracer.js";import{preparedModrinth}from"./prepared-modrinth.js";import{preparedHearthstone}from"./prepared-hearthstone.js";import{preparedVisio}from"./prepared-visio.js";import{preparedMatlab}from"./prepared-matlab.js";import{preparedIllustrator}from"./prepared-illustrator.js";import{preparedMinecraft}from"./prepared-minecraft.js";import{preparedPowerPoint}from"./prepared-powerpoint.js";import{preparedCcs}from"./prepared-ccs.js";import{preparedPscad}from"./prepared-pscad.js";import{preparedPhotoshop}from"./prepared-photoshop.js";import{preparedAutocad}from"./prepared-autocad.js";import{preparedWindowsMetadata,windowsMetadataSource,windowsMetadataGrant}from"./prepared-windows-metadata.js";import{preparedDockerDesktop}from"./prepared-docker-desktop.js";import{preparedOllama}from"./prepared-ollama.js";import{preparedQtDesigner}from"./prepared-qt-designer.js";import{preparedTdms}from"./prepared-tdms.js";import{preparedJupyter}from"./prepared-jupyter.js";import{createHash}from"node:crypto";import{pageSchema,createComputerFilesAdapter}from"./computer-files-pages.js";import{realpathSync,statSync,readFileSync}from"node:fs";import{isAbsolute}from"node:path";import{fileURLToPath,pathToFileURL}from"node:url";import{businessError,ok}from"@zortexhq/plugin-connector-framework/api";import{reviewedToolSchemaHash}from"./custodied.js";import{createVisualStudioSource}from"./prepared-visual-studio.js";import{createModelSimSource}from"./prepared-modelsim.js";import{createQuartusSource}from"./prepared-quartus.js";import{createSimulinkSource}from"./prepared-simulink.js";import{createJianyingSource}from"./prepared-jianying.js";import{createPreparedMacAptSource}from"./prepared-macapt.js";import{zoteroApiReads,zoteroRecentRecords}from"./zotero-read.js";import{preparedStm32CubeMx}from"./prepared-stm32cubemx.js";import{preparedMultisim}from"./prepared-multisim.js";import{preparedSolidWorks}from"./prepared-solidworks.js";import{preparedLattics}from"./prepared-lattics.js";import{preparedJetBrains}from"./prepared-jetbrains.js";import{preparedEclipse}from"./prepared-eclipse.js";import{preparedPlecs}from"./prepared-plecs.js";import{joplinSchemas}from"./joplin-server.js";const fastmailUrl="https://api.fastmail.com/mcp",fastmailIssuer="https://api.fastmail.com";export const fastmail={source:"fastmail",label:"Fastmail",group:"Connector / Prepared Local",readOnly:true,server:{transport:"http",url:fastmailUrl},auth:{kind:"mcp-oauth",loopbackPort:0},origin:{official:true,repo:"https://www.fastmail.help/hc/en-us/articles/15869557281295-Connecting-AI-tools-via-Fastmail-s-MCP-server",check:"Official hosted MCP and public discovery reviewed 2026-10-26: exact /mcp resource, api.fastmail.com issuer, DCR, S256, public-client none and offline_access. Shared enrollment and refresh own OAuth; the user chooses read, write and send access at Fastmail. Existing API-token stdio grants retain their original route. Attachments are not supported by the hosted service; real account Actions remain separately qualified."}};export const preparedLocalSourceIds=["solidworks","lattics","jetbrains","eclipse","multisim","stm32cubemx","plecs","obsidian","joplin","logseq","apple-notes","apple-reminders","apple-music","nextcloud","imessage","wechat","thunderbird","fastmail","proton-mail","local-audio","zotero","macos-contacts","computer-files","visual-studio","modelsim","quartus","simulink","jianying","epic-games-launcher","ryujinx","modrinth","powerpoint","ti-ccs","pscad","adobe-photoshop","autocad","microsoft-word","microsoft-excel","local-git","vscode-local-history","libreoffice","adobe-acrobat","adobe-camera-raw","adobe-media-encoder","ansys-electronics-desktop","adobe-premiere-pro","packet-tracer","qt-designer","hearthstone-deck-tracker","visio","matlab","adobe-illustrator","minecraft-java","ni-tdms","jupyter","windows-event-viewer","windows-task-scheduler","wsl","docker-desktop","ollama","owntracks","copyq","mac-apt"];const preparedLocalReadSchemas={read_note:{additionalProperties:false,type:"object",properties:{id:{type:"string",description:"The note id (32-character hex)."},offset:{type:"integer",description:"Byte offset into the body to start at. Defaults to 0.",minimum:0},max_chars:{type:"integer",description:"Maximum characters of body to return. Omit or set to 0 for the full body.",minimum:0}},required:["id"]},notes_get:{type:"object",properties:{id:{type:"string",description:"Note ID"}},required:["id"]},contacts_get:{type:"object",properties:{id:{type:"string",description:"Contact ID"}},required:["id"]},messages_read:{type:"object",properties:{chatId:{type:"string",description:"Chat ID"},limit:{type:"integer",description:"Maximum number of messages to return"},cursor:{type:"string",description:"Pagination cursor"}},required:["chatId"]},listAccounts:{type:"object",properties:{},required:[]},getMessageHeaders:{type:"object",properties:{messageId:{type:"string",description:"The id from getMessage or searchMessages; surrounding angle brackets are optional"},folderPath:{type:"string",description:"The folder URI path (from searchMessages results)"}},required:["messageId","folderPath"]},getMessage:{type:"object",properties:{messageId:{type:"string",description:"The message ID (from searchMessages results)"},folderPath:{type:"string",description:"The folder URI path (from searchMessages results)"},saveAttachments:{type:"boolean",description:"If true, save attachments to <OS temp dir>/thunderbird-mcp/<messageId>/ and include filePath in response (default: false)"},includeInlineImages:{type:"boolean",description:"If true, append supported inline email images as MCP image content blocks after the text result (default: false; max 1 MiB base64 per image and 4 MiB total). Images referenced by the rendered body are attempted first in document order, followed by remaining inline images in MIME order. Ignored when rawSource is true."},bodyFormat:{type:"string",enum:["markdown","text","html"],description:"Body output format: 'markdown' (default; HTML conversion allows only http/https/mailto links and replaces images with alt text; plain-text bodies only escape image openers, preserving other Markdown/HTML), 'text' (plain text), 'html' (unchanged, untrusted HTML). HTML input over 2 MiB is truncated before markdown/text conversion, with a notice."},rawSource:{type:"boolean",description:"If true, return untrusted raw RFC 2822 message source (all headers + MIME parts). Useful for extracting calendar invites, S/MIME data, or debugging. Other fields (body, attachments) are omitted when this is set. IMAP messages without a complete offline copy are fetched from the server."}},required:["messageId","folderPath"]},get_email:{type:"object",properties:{emailId:{type:"string",description:"The email ID to retrieve"}},required:["emailId"],additionalProperties:false,$schema:"http://json-schema.org/draft-07/schema#"},list_mailboxes:{type:"object",properties:{},$schema:"http://json-schema.org/draft-07/schema#"},getPage:{type:"object",properties:{pageName:{type:"string",description:"The page's name or uuid"}},required:["pageName"],$schema:"http://json-schema.org/draft-07/schema#"},find_details_of_current_user:{properties:{},type:"object"},get_file_content:{properties:{file_path:{type:"string"}},required:["file_path"],type:"object"}};const common=["resourceId","issuer","audience","requiredScopes"];const invalid=field=>{throw Error(`Invalid prepared local connector configuration: ${field}.`)};function record(value){return!!value&&typeof value==="object"&&!Array.isArray(value)&&[Object.prototype,null].includes(Object.getPrototypeOf(value))}function exact(options,keys){if(!record(options))invalid("unknown option");for(const key of Reflect.ownKeys(options)){if(typeof key!=="string"||!keys.includes(key))invalid("unknown option");const descriptor=Object.getOwnPropertyDescriptor(options,key);if(!("value"in descriptor))invalid("accessor option");if(!descriptor.enumerable)invalid("hidden option")}}function text(value,field,max=2048){if(typeof value!=="string"||!value||value!==value.trim()||value.length>max||/[\u0000-\u001f\u007f]/u.test(value))invalid(field);return value}function port(value,defaultValue){if(value===void 0&&defaultValue!==void 0)return defaultValue;if(!Number.isInteger(value)||Number(value)<1024||Number(value)>65535)invalid("port");return value}function path(value,field,directory){const requested=text(value,field,4096);if(!isAbsolute(requested))invalid(field);let resolved;try{resolved=realpathSync(requested);const stat=statSync(resolved);if(directory?!stat.isDirectory():!stat.isFile())invalid(field)}catch{invalid(field)}return resolved}function rootPaths(value){if(!Array.isArray(value)||value.length<1||value.length>16)invalid("roots");const roots=value.map(item=>path(item,"root",true));if(new Set(roots).size!==roots.length)invalid("duplicate root");return roots.sort()}export function preparedLocalRootsAudience(source,roots){if(!["visual-studio","modelsim","quartus","simulink","jianying","epic-games-launcher","ryujinx","modrinth","powerpoint","ti-ccs","pscad","adobe-photoshop","autocad","microsoft-word","microsoft-excel","local-git","vscode-local-history","libreoffice","adobe-acrobat","adobe-camera-raw","adobe-media-encoder","ansys-electronics-desktop","adobe-premiere-pro","packet-tracer","qt-designer","hearthstone-deck-tracker","visio","matlab","adobe-illustrator","minecraft-java","ni-tdms","jupyter","solidworks","lattics","jetbrains","eclipse","multisim","stm32cubemx","plecs","obsidian","logseq","local-audio","computer-files"].includes(source))invalid("file source");if((source==="plecs"||source==="stm32cubemx"||source==="multisim"||source==="solidworks"||source==="lattics"||source==="jetbrains"||source==="eclipse")&&roots.length!==1)invalid("Select one project folder");const canonical=rootPaths([...roots]).map(root=>pathToFileURL(root).href);return`indra-local-roots:${source}:${createHash("sha256").update(JSON.stringify(canonical)).digest("hex")}`}function authority(options,credentialKind,audience){const resourceId=text(options.resourceId,"resourceId",512),issuer=text(options.issuer,"issuer",512),selectedAudience=text(options.audience,"audience",2048);if(audience!==void 0&&selectedAudience!==audience)invalid("audience does not match selected resource");if(!Array.isArray(options.requiredScopes)||options.requiredScopes.length>32||options.requiredScopes.some(scope=>typeof scope!=="string"||!scope||scope.length>1024||/\s/u.test(scope))||new Set(options.requiredScopes).size!==options.requiredScopes.length)invalid("requiredScopes");return{kind:"custodied",resourceId,issuer,audience:selectedAudience,requiredScopes:[...options.requiredScopes],credentialKind}}function review(names){return Object.fromEntries(names.map(name=>[name,{inputSchemaSha256:reviewedToolSchemaHash(preparedLocalReadSchemas[name])}]))}const validateThunderbirdParams=(tool,params)=>{if(tool!=="getMessage")return ok(void 0);const invalidRead=()=>businessError("invalid_argument","Thunderbird full reads require a selected messageId and folderPath, rawSource=true, and disabled attachment saving and inline images.","plugin");if(!record(params))return invalidRead();for(const key of Reflect.ownKeys(params)){if(typeof key!=="string"||!["messageId","folderPath","rawSource","saveAttachments","includeInlineImages"].includes(key))return invalidRead();const descriptor=Object.getOwnPropertyDescriptor(params,key);if(!("value"in descriptor)||!descriptor.enumerable)return invalidRead()}const validReference=(value,max)=>typeof value==="string"&&value.length>0&&value.length<=max&&value===value.trim()&&!/[\u0000-\u001f\u007f]/u.test(value);if(!validReference(params.messageId,1024)||!validReference(params.folderPath,4096)||params.rawSource!==true||params.saveAttachments!==void 0&¶ms.saveAttachments!==false||params.includeInlineImages!==void 0&¶ms.includeInlineImages!==false)return invalidRead();return ok(void 0)};const validateThunderbirdResult=(tool,result,params)=>{if(tool!=="getMessage")return ok(void 0);const malformed=()=>businessError("data_loss","Thunderbird did not return the complete selected message MIME source.","plugin");if(result.structured!==void 0||params?.rawSource!==true)return malformed();let value;try{value=JSON.parse(result.text)}catch{return malformed()}if(!record(value))return malformed();if("error"in value)return businessError("unavailable","Thunderbird could not complete the protected message read.","plugin");if(value.encryptedContentWithheld===true)return businessError("permission_denied","Thunderbird withheld the selected message under its content access policy.","plugin");if(Object.keys(value).some(key=>!["id","subject","rawSource"].includes(key))||typeof value.id!=="string"||value.id!==params.messageId||typeof value.subject!=="string"||typeof value.rawSource!=="string"||!/(?:\r\n\r\n|\n\n|\r\r)/u.test(value.rawSource))return malformed();return ok(void 0)};const validateThunderbirdOutcome=(_tool,result)=>{let value=result.structured;try{if(value===void 0)value=JSON.parse(result.text)}catch{return ok(void 0)}if(record(value)&&"error"in value)return businessError("unavailable","Thunderbird could not complete the requested operation.","plugin");if(record(value)&&value.encryptedContentWithheld===true)return businessError("permission_denied","Thunderbird withheld the selected message under its content access policy.","plugin");return ok(void 0)};function numericId(value,field){const result=text(value,field,32);if(!/^[1-9][0-9]{0,19}$/.test(result))invalid(field);return result}function base(source,label){return{source,label,group:"Connector / Local and native"}}const nextcloudReady={tool:"find_details_of_current_user",done(structured,text2){let value=structured;try{if(value===void 0)value=JSON.parse(text2)}catch{return false}return record(value)&&typeof value.id==="string"&&value.id.length>0&&!("error"in value)}};const thunderbirdReady={tool:"listAccounts",done(structured,text2){if(structured!==void 0)return false;let value;try{value=JSON.parse(text2)}catch{return false}return Array.isArray(value)&&value.every(account=>record(account)&&typeof account.id==="string"&&!!account.id&&typeof account.name==="string"&&typeof account.type==="string"&&Array.isArray(account.identities)&&account.identities.every(identity=>record(identity)&&typeof identity.id==="string"&&!!identity.id&&typeof identity.email==="string"&&typeof identity.name==="string"&&typeof identity.isDefault==="boolean"))}};const protonReady={tool:"get_status",args:{folder:"INBOX"},done(structured){if(!record(structured)||"error"in structured||!Array.isArray(structured.result)||structured.result.length!==1)return false;const status=structured.result[0];return record(status)&&Object.keys(status).length===3&&status.name==="INBOX"&&Number.isSafeInteger(status.total)&&Number(status.total)>=0&&Number.isSafeInteger(status.unread)&&Number(status.unread)>=0}};const filesystemPackage="@modelcontextprotocol/server-filesystem@2.0.1";const filesystemCommit="ef9808f71090d0db3eda99e2af2ba78f1086f4fb";const appleCommit="951c11af2b621fc34debd2d57432b9ea856c7198";export const preparedProtonReadPolicy='[policy]\nmode = "read"\n\n[index]\nenabled = false\n\n[notifications]\nenabled = false\n';export function preparedLocalNativeSelection(source,input){if(windowsMetadataSource(source)){exact(input,[]);return windowsMetadataGrant(source)}if(source==="docker-desktop"){exact(input,[]);return{options:{},audience:"npipe:////./pipe/dockerDesktopLinuxEngine",scope:"images.read"}}if(source==="ollama"){exact(input,["port"]);const selectedPort=port(input.port,11434);return{options:{port:selectedPort},audience:"http://127.0.0.1:"+selectedPort,scope:"models.read"}}if(source==="owntracks"||source==="wechat"){exact(input,["port"]);const selectedPort=port(input.port,source==="owntracks"?8765:5030);return{options:{port:selectedPort},audience:`http://127.0.0.1:${selectedPort}/mcp`,scope:source==="owntracks"?"location.read":"messages.read"}}if(source==="copyq"){exact(input,["executable","session"]);const executable=path(input.executable,"executable",false),session=input.session===""?"":text(input.session,"session",16);if(!/^[\p{L}\p{N}_-]{0,16}$/u.test(session))invalid("session");return{options:{executable,session},audience:`copyq:${pathToFileURL(executable).href}?session=${encodeURIComponent(session)}`,scope:"clipboard.read"}}if(source==="zotero"){exact(input,["libraryId","libraryType","serverId"]);const libraryType=input.libraryType??"user";if(libraryType!=="user"&&libraryType!=="group")invalid("libraryType");const libraryId=libraryType==="user"&&input.libraryId==="0"?"0":numericId(input.libraryId,"libraryId");const serverId=text(input.serverId,"serverId",128);if(!/^[A-Za-z0-9_-]{1,128}$/.test(serverId))invalid("serverId");return{options:{libraryId,libraryType,serverId},audience:`http://127.0.0.1:23119/api/${libraryType==="user"?"users":"groups"}/${libraryId}?serverId=${serverId}`,scope:"library.read"}}if(isBundledAppleSource(source)&&input.executable===void 0){exact(input,[]);return bundledAppleSelection(source)}if(["apple-notes","imessage","macos-contacts"].includes(source)){exact(input,["executable"]);const executable=path(input.executable,"executable",false);return{options:{executable},audience:`indra-apple-runtime:${source}:${pathToFileURL(executable).href}`,scope:source==="imessage"?"messages.read":source==="macos-contacts"?"contacts.read":"notes.read"}}return invalid("native source")}export function createPreparedLocalSource(source,options,policy={}){if(!preparedLocalSourceIds.includes(source)||!record(options))invalid("source or options");if(source==="stm32cubemx"){exact(options,[...common,"roots"]);const roots=rootPaths(options.roots);if(roots.length!==1||!Array.isArray(options.requiredScopes)||options.requiredScopes.length!==1||options.requiredScopes[0]!=="files.read")invalid("STM32CubeMX project permission");return preparedStm32CubeMx(roots[0],authority(options,"local-no-secret",preparedLocalRootsAudience(source,roots)))}if(source==="multisim"){exact(options,[...common,"roots"]);const roots=rootPaths(options.roots);if(roots.length!==1||!Array.isArray(options.requiredScopes)||options.requiredScopes.length!==1||options.requiredScopes[0]!=="files.read")invalid("Multisim project permission");return preparedMultisim(roots[0],authority(options,"local-no-secret",preparedLocalRootsAudience(source,roots)))}if(source==="solidworks"){exact(options,[...common,"roots"]);const roots=rootPaths(options.roots);if(roots.length!==1||!Array.isArray(options.requiredScopes)||options.requiredScopes.length!==1||options.requiredScopes[0]!=="files.read")invalid("SolidWorks project permission");return preparedSolidWorks(roots[0],authority(options,"local-no-secret",preparedLocalRootsAudience(source,roots)))}if(source==="lattics"){exact(options,[...common,"roots"]);const roots=rootPaths(options.roots);if(roots.length!==1||!Array.isArray(options.requiredScopes)||options.requiredScopes.length!==1||options.requiredScopes[0]!=="files.read")invalid("Lattics library permission");return preparedLattics(roots[0],authority(options,"local-no-secret",preparedLocalRootsAudience(source,roots)))}if(source==="jetbrains"){exact(options,[...common,"roots"]);const roots=rootPaths(options.roots);if(roots.length!==1||!Array.isArray(options.requiredScopes)||options.requiredScopes.length!==1||options.requiredScopes[0]!=="files.read")invalid("JetBrains project permission");return preparedJetBrains(roots[0],authority(options,"local-no-secret",preparedLocalRootsAudience(source,roots)))}if(source==="eclipse"){exact(options,[...common,"roots"]);const roots=rootPaths(options.roots);if(roots.length!==1||!Array.isArray(options.requiredScopes)||options.requiredScopes.length!==1||options.requiredScopes[0]!=="files.read")invalid("Eclipse project permission");return preparedEclipse(roots[0],authority(options,"local-no-secret",preparedLocalRootsAudience(source,roots)))}if(source==="plecs"){exact(options,[...common,"roots"]);authority(options,"local-no-secret");const roots=rootPaths(options.roots);if(roots.length!==1||!Array.isArray(options.requiredScopes)||options.requiredScopes.length!==1||options.requiredScopes[0]!=="files.read")invalid("PLECS project permission");return preparedPlecs(roots[0],authority(options,"local-no-secret",preparedLocalRootsAudience(source,roots)))}const fieldsMode=["nextcloud","thunderbird","proton-mail"].includes(source)&&Object.getOwnPropertyDescriptor(options,"mode")?.value==="fields";if(source==="joplin"&&Object.getOwnPropertyDescriptor(options,"mode")?.value==="paired-plugin"){exact(options,["mode","port","fingerprint"]);const selectedPort=port(options.port);if(typeof options.fingerprint!=="string"||!/^[a-f0-9]{64}$/.test(options.fingerprint))invalid("Joplin pairing fingerprint");const account=`joplin-plugin:${options.fingerprint}:127.0.0.1:${selectedPort}`;return{...base(source,"Joplin"),server:{transport:"stdio",command:process.execPath,args:[fileURLToPath(new URL("./joplin-server.js",import.meta.url))],env:fields=>{if(typeof fields.bridgeKey!=="string"||!/^[a-f0-9]{64}$/.test(fields.bridgeKey))invalid("Joplin paired bridge key");return{JOPLIN_PORT:String(selectedPort),JOPLIN_BRIDGE_KEY:fields.bridgeKey}}},auth:{kind:"fields",fields:[{key:"bridgeKey",label:"Joplin paired bridge key",secret:true}],account:()=>account,accountBinding:"endpoint",login:{ready:{tool:"check_auth",done(structured){return record(structured)&&structured.authenticated===true}}}},readOnly:true,allowedTools:Object.keys(joplinSchemas),reviewedReadTools:Object.fromEntries(Object.entries(joplinSchemas).map(([name,schema])=>[name,{inputSchemaSha256:reviewedToolSchemaHash(schema)}])),origin:{official:false,repo:"laurent22/joplin",artifact:"@zortexhq/plugin-connector-level1@0.1.0",check:"Official Joplin plugin data API through a mutually confirmed encrypted loopback bridge. Read-only Actions, bounded replies, no Web Clipper token or credential URL. Pairing must be renewed after Joplin restart."}}}if(source==="simulink"||source==="quartus"||source==="modelsim"||source==="visual-studio"){exact(options,[...common,"roots"]);authority(options,"local-no-secret");const roots=rootPaths(options.roots);if(roots.length!==1)invalid("Select one project folder");const auth=authority(options,"local-no-secret",preparedLocalRootsAudience(source,roots));if(auth.requiredScopes.length!==1||auth.requiredScopes[0]!=="files.read")invalid("This source requires the native read grant");if(source==="visual-studio")return createVisualStudioSource(roots[0],auth);if(source==="modelsim")return createModelSimSource(roots[0],auth);return source==="quartus"?createQuartusSource(roots[0],auth):createSimulinkSource(roots[0],auth)}if(source==="jianying"){exact(options,[...common,"roots"]);authority(options,"local-no-secret");const roots=rootPaths(options.roots);if(roots.length!==1)invalid("Jianying needs one draft folder");const auth=authority(options,"local-no-secret",preparedLocalRootsAudience(source,roots));if(auth.requiredScopes.length!==1||auth.requiredScopes[0]!=="files.read")invalid("Jianying needs the native read grant");return createJianyingSource(roots[0],auth)}if(source==="epic-games-launcher"||source==="ryujinx"||source==="modrinth"||source==="powerpoint"||source==="ti-ccs"||source==="pscad"||source==="adobe-photoshop"||source==="autocad"||source==="microsoft-word"||source==="microsoft-excel"||source==="local-git"||source==="vscode-local-history"||source==="libreoffice"||source==="adobe-acrobat"||source==="adobe-camera-raw"||source==="adobe-media-encoder"||source==="ansys-electronics-desktop"||source==="adobe-premiere-pro"||source==="packet-tracer"||source==="qt-designer"){exact(options,[...common,"roots"]);const roots=rootPaths(options.roots);if(roots.length!==1)invalid("Choose exactly one source folder");const auth=authority(options,"local-no-secret",preparedLocalRootsAudience(source,roots));if(auth.requiredScopes.length!==1||auth.requiredScopes[0]!=="files.read")invalid("Source needs the native read grant");if(source==="powerpoint")return preparedPowerPoint(roots[0],auth);if(source==="ti-ccs")return preparedCcs(roots[0],auth);if(source==="pscad")return preparedPscad(roots[0],auth);if(source==="adobe-photoshop")return preparedPhotoshop(roots[0],auth);if(source==="microsoft-word"||source==="microsoft-excel")return preparedOfficeLocal(source,roots[0],auth);if(source==="local-git"||source==="vscode-local-history")return preparedDeveloperHistory(source,roots[0],auth);if(source==="libreoffice")return preparedDeveloperHistory(source,roots[0],auth);if(source==="adobe-acrobat"||source==="adobe-camera-raw"||source==="adobe-media-encoder")return preparedAdobeNative(source,roots[0],auth);if(source==="ansys-electronics-desktop")return preparedAedt(roots[0],auth);if(source==="adobe-premiere-pro")return preparedPremierePro(roots[0],auth);if(source==="packet-tracer")return preparedPacketTracer(roots[0],auth);if(source==="epic-games-launcher"||source==="ryujinx")return preparedGameMetadata(source,roots[0],auth);if(source==="modrinth")return preparedModrinth(roots[0],auth);return source==="autocad"?preparedAutocad(roots[0],auth):preparedQtDesigner(roots[0],auth)}if(source==="minecraft-java"||source==="adobe-illustrator"||source==="hearthstone-deck-tracker"||source==="visio"||source==="matlab"){exact(options,[...common,"roots"]);const roots=rootPaths(options.roots);if(roots.length!==1)invalid("Select exactly one source folder");const auth=authority(options,"local-no-secret",preparedLocalRootsAudience(source,roots));if(auth.requiredScopes.length!==1||auth.requiredScopes[0]!=="files.read")invalid("The source requires the native read grant");if(source==="hearthstone-deck-tracker")return preparedHearthstone(roots[0],auth);if(source==="visio")return preparedVisio(roots[0],auth);if(source==="matlab")return preparedMatlab(roots[0],auth);return source==="adobe-illustrator"?preparedIllustrator(roots[0],auth):preparedMinecraft(roots[0],auth)}if(source==="ni-tdms"){exact(options,[...common,"roots"]);const roots=rootPaths(options.roots);if(roots.length!==1)invalid("TDMS needs exactly one measurement folder");const auth=authority(options,"local-no-secret",preparedLocalRootsAudience(source,roots));if(auth.requiredScopes.length!==1||auth.requiredScopes[0]!=="files.read")invalid("TDMS needs the native read grant");return preparedTdms(roots[0],auth)}if(source==="jupyter"){exact(options,[...common,"roots"]);const roots=rootPaths(options.roots);if(roots.length!==1)invalid("Jupyter needs exactly one notebook folder");const auth=authority(options,"local-no-secret",preparedLocalRootsAudience(source,roots));if(auth.requiredScopes.length!==1||auth.requiredScopes[0]!=="files.read")invalid("Jupyter needs the native read grant");return preparedJupyter(roots[0],auth)}if(windowsMetadataSource(source)){exact(options,common);const grant=windowsMetadataGrant(source),auth=authority(options,"local-no-secret",grant.audience);if(auth.requiredScopes.length!==1||auth.requiredScopes[0]!==grant.scope)invalid("Windows source requires its local metadata grant");return preparedWindowsMetadata(source,auth)}if(source==="joplin"&&Object.getOwnPropertyDescriptor(options,"mode")?.value==="fields")throw Error("Legacy Joplin Web Clipper authorization is disabled. Use Help encrypted plugin pairing.");if(source==="mac-apt")return createPreparedMacAptSource(source,options);if(source==="docker-desktop"){exact(options,common);const selection=preparedLocalNativeSelection(source,{});const auth=authority(options,"local-no-secret",selection.audience);if(auth.requiredScopes.length!==1||auth.requiredScopes[0]!==selection.scope)invalid("Docker Desktop requires the image metadata grant");return preparedDockerDesktop(auth)}if(source==="ollama"){exact(options,[...common,"port"]);const endpoint=preparedLocalNativeSelection(source,{port:options.port}).audience;const auth=authority(options,"local-no-secret",endpoint);if(auth.requiredScopes.length!==1||auth.requiredScopes[0]!=="models.read")invalid("Ollama requires the model metadata grant");return preparedOllama(endpoint,auth)}if(source==="owntracks"){exact(options,[...common,"port"]);const url=preparedLocalNativeSelection(source,{port:options.port}).audience;return{...base(source,"OwnTracks"),server:{transport:"http",url},auth:authority(options,"local-no-secret",url),readOnly:true,allowedTools:["owntracks_status","list_devices","get_last_location","get_location_history","get_distance","reverse_geocode"],origin:{official:false,repo:"de-niji/OwnTracksHermes",artifact:"owntracks-mcp@0.2.0",check:"MIT; source 9f005a790c388d3cd4aeb1306b3a202be917a1ff, archive SHA256 367406a8561c57657872661cc7a8d814ace162a0a21cd9214799394eb1fca63f. Existing local server must already own its selected Recorder configuration. Native Recorder queries only; Hermes reminders/history and cron are outside this route."}}}if(source==="copyq"){exact(options,[...common,"executable","session"]);authority(options,"local-no-secret");const selection=preparedLocalNativeSelection(source,{executable:options.executable,session:options.session}),{executable,session}=selection.options;const wheel="https://github.com/AutoraLabs/copyq-mcp/releases/download/v0.1.0/copyq_mcp-0.1.0-py3-none-any.whl#sha256=46e3f12eead7e9d7bd2589f6a563dba17c67a6ac6f5c4804522243a07def5746";return{...base(source,"CopyQ clipboard history"),server:{transport:"stdio",command:"uvx",args:["--from",wheel,"copyq-mcp"],env:()=>({COPYQ_MCP_EXECUTABLE:executable,COPYQ_MCP_SESSION:session})},auth:authority(options,"local-no-secret",selection.audience),readOnly:true,allowedTools:["clipboard_read","clipboard_search","clipboard_tabs"],origin:{official:false,repo:"AutoraLabs/copyq-mcp",artifact:"copyq-mcp@0.1.0",check:"MIT, active with CI/tests; exact release wheel digest verified 2026-10-26. Selected native CopyQ session only; all three text-history Actions preserved. No setup command, clipboard rewrite, dictation hook, or second clipboard store."}}}const mode=source==="logseq"?Object.getOwnPropertyDescriptor(options,"mode")?.value??"native-mcp":void 0;if(["obsidian","local-audio","computer-files"].includes(source)||source==="logseq"&&mode==="files"){exact(options,[...common,"roots",...source==="logseq"?["mode"]:[]]);authority(options,"local-no-secret");const roots=rootPaths(options.roots),audience=preparedLocalRootsAudience(source,roots);const fileAdapter=source==="computer-files"?createComputerFilesAdapter(roots):void 0;const label={obsidian:"Obsidian",logseq:"Logseq (file graph)","local-audio":"Local audio (file)","computer-files":"Local files"}[source];return{...base(source,label),server:{transport:"stdio",command:"npx",args:["-y",filesystemPackage,...roots]},auth:authority(options,"local-no-secret",audience),readOnly:true,preserveContent:true,...fileAdapter?{adaptSchema:pageSchema,adaptInvoke:(name,params,_grant,{signal})=>fileAdapter(name,params,signal)}:{},allowedTools:source==="local-audio"?["read_media_file","get_file_info"]:source==="computer-files"?["list_allowed_directories","search_files","list_directory","read_text_file","read_media_file","get_file_info"]:["read_text_file","read_media_file","get_file_info","list_directory"],origin:{official:true,repo:"modelcontextprotocol/servers",package:filesystemPackage,check:`Filesystem source reviewed at ${filesystemCommit}; exact granted roots, readonly tools, no recursive ingestion. Node >=24; license transition Apache-2.0/MIT, see pinned LICENSE.`}}}if(source==="joplin"||source==="logseq"||source==="wechat"||source==="thunderbird"){exact(options,fieldsMode?["mode","port"]:[...common,"port",...source==="logseq"?["mode"]:[]]);if(source==="logseq"&&mode!=="native-mcp")invalid("Logseq mode");const selectedPort=port(options.port,source==="logseq"?12315:source==="wechat"?5030:void 0);const url=source==="wechat"?preparedLocalNativeSelection(source,{port:selectedPort}).audience:`http://127.0.0.1:${selectedPort}${source==="thunderbird"?"/":"/mcp"}`;if(source==="joplin")throw Error("Joplin connection is temporarily disabled: upstream logs credential-bearing request URLs. Existing settings have been preserved.");if(source==="logseq")return{...base(source,"Logseq (database graph)"),server:{transport:"http",url},auth:authority(options,"mcp-token",url),readOnly:true,allowedTools:["getPage"],reviewedReadTools:review(["getPage"]),origin:{official:true,repo:"logseq/logseq",artifact:"native Logseq MCP 0.1.0",check:"getPage API/server reviewed at f8fb34b79bd5d183d22eb8f05d50173227ee2d81; native DB graph only; separately selected file graphs use filesystem route."}};if(source==="thunderbird")return{...base(source,"Thunderbird"),server:{transport:"http",url},auth:fieldsMode?{kind:"fields",fields:[{key:"apiKey",label:"Thunderbird MCP token",secret:true}],tokenField:"apiKey",account:()=>url,login:{ready:thunderbirdReady}}:authority(options,"mcp-token",url),readOnly:true,allowedTools:["listAccounts","getMessageHeaders","getMessage"],reviewedReadTools:review(["listAccounts","getMessageHeaders","getMessage"]),...policy.fullActions?{validateResult:validateThunderbirdOutcome}:{validateParams:validateThunderbirdParams,validateResult:validateThunderbirdResult},origin:{official:false,repo:"TKasperczyk/thunderbird-mcp",artifact:"thunderbird-mcp@0.10.0",check:"Extension/native MCP at 8910dbf4300a7ea7ebf1edd0bdd0d22996531b88; XPI SHA256 638b7512d4f8b30d71b1547e10372ac537f046cc05d196a867e3871684c19f8c. Exact approved profile port/token; no profile discovery or installation. getMessage admits rawSource=true only, with attachment saving and inline images disabled; complete MIME bytes remain transient. Exact stored Message-ID and folder URI; shared 1 MiB reply and 120 second bounds. Native account/content access checks remain authoritative."}};return{...base(source,"WeChat (local chatlog)"),server:{transport:"http",url},auth:authority(options,"local-no-secret",url),allowedTools:["query_contact","query_chat_room","query_recent_chat","query_chat_log"],origin:{official:false,repo:"sjzar/chatlog",artifact:"chatlog@0.0.26",check:"Retained Indra vendor pin 74e568085b8ae5aa3ec72dcd37aac6da969fa121, archive SHA256 e8affa2def64a68bc65f8eaeccd643080d18eeab29750ce9205f574adfa69cbb; /mcp Streamable HTTP. Public upstream removed. Explicit false readonly hints preserved; readonly acceptance remains blocked."}}}if(isBundledAppleSource(source)&&options.executable===void 0){exact(options,common);const selection=bundledAppleSelection(source);if(!Array.isArray(options.requiredScopes)||options.requiredScopes.length!==1||options.requiredScopes[0]!==selection.scope)invalid("native read scope");return preparedAppleNative(source,authority(options,"local-no-secret",selection.audience))}if(["apple-notes","imessage","macos-contacts"].includes(source)){exact(options,[...common,"executable"]);authority(options,"local-no-secret");const selection=preparedLocalNativeSelection(source,{executable:options.executable}),executable=selection.options.executable,tool={"apple-notes":"notes_get",imessage:"messages_read","macos-contacts":"contacts_get"}[source];const audience=typeof options.audience==="string"&&options.audience.startsWith("indra-apple-runtime:")?selection.audience:void 0;return{...base(source,{"apple-notes":"Apple Notes",imessage:"iMessage","macos-contacts":"macOS Contacts"}[source]),server:{transport:"stdio",command:executable,args:[],env:()=>({APPLE_BRIDGE_SKIP_PERMISSIONS:"1"})},auth:authority(options,"local-no-secret",audience),readOnly:true,allowedTools:[tool],reviewedReadTools:review([tool]),origin:{official:false,repo:"boutquin/apple-bridge",artifact:"apple-bridge@3.2.0",check:`Native readonly tools reviewed at ${appleCommit}; release macOS arm64 archive SHA256 83c64569fa8238e694ed4e30b6c32e81c7f9285b4130aaaf4e303a430dda5875. Startup permission requests disabled; existing OS permission still required. No Windows adapter.`},unavailable:()=>process.platform==="darwin"?void 0:"This reviewed Apple native adapter requires macOS; Windows qualification remains open."}}if(source==="nextcloud"){exact(options,fieldsMode?["mode","instanceUrl"]:[...common,"instanceUrl"]);const input=text(options.instanceUrl,"instanceUrl");let instance;try{instance=new URL(input);if(instance.protocol!=="https:"||instance.username||instance.password||instance.search||instance.hash)invalid("instanceUrl")}catch{invalid("instanceUrl")}const url=`${instance.href.replace(/\/$/,"")}/index.php/apps/app_api/proxy/context_agent/mcp/`;return{...base(source,"Nextcloud"),server:{transport:"http",url},auth:fieldsMode?{kind:"fields",fields:[{key:"apiKey",label:"Nextcloud app password",secret:true}],tokenField:"apiKey",account:()=>url,login:{ready:nextcloudReady}}:authority(options,"rest-token",url),readOnly:true,allowedTools:["find_details_of_current_user","get_file_content"],reviewedReadTools:review(["find_details_of_current_user","get_file_content"]),origin:{official:true,repo:"nextcloud/context_agent",artifact:"Context Agent native MCP",check:"Hosted bearer app-password contract, current-user metadata and private-file text read reviewed at 321e0943dfee7eef1a8ade118dc2aea3da0ba356. Instance AppAPI/Context Agent versions and stateless transport compatibility require installed qualification."}}}if(source==="fastmail"){exact(options,common);if(options.audience===fastmailUrl){if(options.issuer!==fastmailIssuer)invalid("hosted Fastmail issuer");return{...fastmail,auth:authority(options,"mcp-token",fastmailUrl)}}return{...base(source,"Fastmail"),server:{transport:"stdio",command:"npx",args:["-y","@jordonh19/fastmail-mcp-server@1.3.0","--transport","stdio"],tokenEnv:"FASTMAIL_API_TOKEN"},auth:authority(options,"rest-token","https://api.fastmail.com"),readOnly:true,allowedTools:["get_email","list_mailboxes"],reviewedReadTools:review(["get_email","list_mailboxes"]),origin:{official:false,repo:"Jordonh18/fastmail-mcp-server",package:"@jordonh19/fastmail-mcp-server@1.3.0",check:"MIT; source pin 68bb946fecd82b892190f0641a6b09bd4229d84c. Published package tools/list exercised with SDK1.27.1/Zod3.25.76 and zero network calls. Grant acquisition/OAuth refresh is separate; never infer account from a token label."}}}if(source==="proton-mail"){exact(options,fieldsMode?["mode","imapPort","policyFile"]:[...common,"username","imapPort","policyFile"]);if(!fieldsMode)authority(options,"rest-token");const username=fieldsMode?void 0:text(options.username,"Bridge username",320),imapPort=port(options.imapPort,fieldsMode?void 0:1143);const policyFile=path(fieldsMode&&options.policyFile===void 0?fileURLToPath(new URL("../server/proton/read.toml",import.meta.url)):options.policyFile,"policyFile",false);const policyValid=()=>{try{return readFileSync(policyFile,"utf8")===preparedProtonReadPolicy}catch{return false}};if(!policyValid())invalid("Proton readonly policy");const selectedFields=fields=>{exact(fields,["username","password"]);return{username:text(fields.username,"Bridge username",320),password:text(fields.password,"Bridge mailbox password",4096)}};const audience=selectedUsername=>`imap://127.0.0.1:${imapPort}/${encodeURIComponent(selectedUsername)}`;const environment=selectedUsername=>{if(!policyValid())invalid("Proton readonly policy");return{PROTONMAIL_BRIDGE_USERNAME:selectedUsername,PROTONMAIL_BRIDGE_HOST:"127.0.0.1",PROTONMAIL_BRIDGE_IMAP_PORT:String(imapPort),PROTONMAIL_BRIDGE_IMAP_SECURITY:"starttls",PROTONMAIL_BRIDGE_TIMEOUT:"30",PROTONMAIL_MCP_MODE:"read",PROTONMAIL_MCP_POLICY:policyFile,PROTONMAIL_MCP_AUDIT_LOG:""}};return{...base(source,"Proton Mail Bridge"),server:{transport:"stdio",command:"uvx",args:["--from","protonmail-mcp==0.4.0","protonmail-mcp"],...fieldsMode?{env:fields=>{const selected=selectedFields(fields);return{...environment(selected.username),PROTONMAIL_BRIDGE_PASSWORD:selected.password}}}:{tokenEnv:"PROTONMAIL_BRIDGE_PASSWORD",env:()=>environment(username)}},auth:fieldsMode?{kind:"fields",fields:[{key:"username",label:"Proton Bridge username"},{key:"password",label:"Proton Bridge mailbox password",secret:true}],accountBinding:"endpoint",account:fields=>audience(selectedFields(fields).username),login:{ready:protonReady}}:authority(options,"rest-token",audience(username)),readOnly:true,allowedTools:["list_folders","list_emails","read_email"],origin:{official:false,repo:"mhbxyz/protonmail-mcp",package:"protonmail-mcp==0.4.0",check:"Source pin f15d769d562de55c288a574f2a1e0946fefc9e31; fixed loopback Proton Bridge STARTTLS, immutable read preset, index/notifications/audit off. Fields mode verifies get_status for INBOX before saving the existing credential envelope and binds it to the selected port and username. Password is the Bridge mailbox credential. Python >=3.13 and an installed, signed-in Bridge remain required. Full Actions preserves upstream local-export write effects; this policy does not enable SMTP or mailbox mutations."},unavailable:()=>policyValid()?void 0:"The selected Proton readonly policy changed; requalify the connection."}}if(source==="zotero"){exact(options,[...common,"libraryId","libraryType","serverId"]);const selection=preparedLocalNativeSelection(source,{libraryId:options.libraryId,libraryType:options.libraryType,serverId:options.serverId}),{libraryId,libraryType,serverId}=selection.options,audience=selection.audience;return{...base(source,"Zotero (local library)"),server:{transport:"stdio",command:"uvx",args:["--with","fastmcp==3.4.11","--with","pydantic==2.13.4","--from","zotero-mcp-server==0.15.1","python",fileURLToPath(new URL("../server/zotero/read.py",import.meta.url))],env:()=>({ZOTERO_LOCAL:"true",ZOTERO_LIBRARY_ID:libraryId,ZOTERO_LIBRARY_TYPE:libraryType,ZOTERO_SERVER_ID:serverId,ZOTERO_LOCAL_WRITE:"false",ZOTERO_MCP_TOOLSETS:"none",ZOTERO_BACKEND:"api",ZOTERO_SEARCH_BACKEND:"api",ZOTERO_NO_CLAUDE:"1",ZOTERO_MCP_SCHEMA_REFRESH:"0",PYTHON_DOTENV_DISABLED:"1"})},auth:authority(options,"local-no-secret",audience),readOnly:true,...zoteroApiReads,liveRead:{tool:"zotero_get_recent",args:{limit:1},records:zoteroRecentRecords},origin:{official:false,repo:"54yyyu/zotero-mcp",package:"zotero-mcp-server==0.15.1",check:"Source pin f1f6cdc1ea26e04c59525f5b3ee7dd2b9d839bc3; selected library and local server identity bound, API backend forced, write/index/library-switch tools excluded. Public FastMCP3.4.11 import_server reuses unchanged tools without the upstream CLI environment discovery, reranker or startup indexing lifespan. Dotenv discovery is disabled; HOME is unchanged. Python server MIT; bundled plugin AGPL-3.0-or-later. Actual native library and OS acceptance remain separate."}}}return invalid("source")}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isMcpSessionAuthority,isServerSessionAuthority,oauthCredentialResourceId}from"@zortexhq/plugin-vault-sqlite/api";import{checkResourceAllowed,resourceUrlFromServerUrl}from"@modelcontextprotocol/client";import{isSelfHostedWordPressAccount}from"./prepared-wordpress.js";import{acceptsSavedMcpScopes}from"./saved-mcp-scopes.js";import{matrixHomeserver,matrixIssuer,matrixTokenUrl,matrixUserId}from"./matrix-login.js";const helpRestartRoutes={basecamp:["https://mcp.basecamp.com/mcp","https://mcp.basecamp.com/mcp","https://app.basecamp.com","https://app.basecamp.com/oauth/tokens",["mcp","read","full"]],pipedrive:["https://mcp.pipedrive.ai/mcp","https://mcp.pipedrive.ai/mcp","https://oauth.pipedrive.com","https://oauth.pipedrive.com/oauth/token",["activities:full","admin","base","contact-fields:full","contacts:full","deal-fields:full","deals:full","leads:full","mail-sending:full","mail:full","product-fields:full","products:full","project-fields:full","projects:full","search:read","users:read"]],intercom:["https://mcp.intercom.com/mcp","https://mcp.intercom.com/mcp","https://mcp.intercom.com","https://mcp.intercom.com/token",["mcp","operator"]],figma:["https://mcp.figma.com/mcp","https://mcp.figma.com/mcp","https://api.figma.com","https://api.figma.com/v1/oauth/token",["mcp:connect"]],wordpress:["https://public-api.wordpress.com/wpcom/v2/mcp/v1","https://public-api.wordpress.com/wpcom/v2/mcp/v1","https://public-api.wordpress.com","https://public-api.wordpress.com/oauth2-1/token",["global","auth","openid","profile","email","users","sites","posts","comments","taxonomy","follow","sharing","freshly-pressed","notifications","insights","read","stats","media","menus","batch","videos"]],readwise:["https://mcp2.readwise.io/mcp","https://mcp2.readwise.io/mcp","https://readwise.io/o/","https://readwise.io/o/token/",["openid","read","write"]],raindrop:["https://api.raindrop.io/rest/v2/ai/mcp","https://api.raindrop.io/rest/v2/ai/mcp","https://api.raindrop.io","https://api.raindrop.io/v2/oauth/access_token",["read","write"]],fastmail:["https://api.fastmail.com/mcp","https://api.fastmail.com/mcp","https://api.fastmail.com","https://api.fastmail.com/oauth/refresh",["https://www.fastmail.com/dev/mcp","offline_access"]],harvest:["https://api.harvestapp.com/mcp","https://api.harvestapp.com/mcp","https://id.getharvest.com","https://id.getharvest.com/api/v2/oauth2/token",[]],cloudflare:["https://mcp.cloudflare.com/mcp","https://mcp.cloudflare.com/mcp","https://mcp.cloudflare.com","https://mcp.cloudflare.com/token",["user:read","account:read","offline_access"]],railway:["https://mcp.railway.com","https://mcp.railway.com","https://backboard.railway.com","https://backboard.railway.com/oauth/token",["workspace:member"]],calcom:["https://mcp.cal.com/mcp","https://mcp.cal.com/mcp","https://mcp.cal.com","https://mcp.cal.com/oauth/token",[]]};const record=value=>!!value&&typeof value==="object"&&!Array.isArray(value)&&[Object.prototype,null].includes(Object.getPrototypeOf(value))&&Reflect.ownKeys(value).every(key=>typeof key==="string"&&Object.getOwnPropertyDescriptor(value,key)?.enumerable&&"value"in Object.getOwnPropertyDescriptor(value,key));const selected=(value,ids)=>Array.isArray(value)&&value.length<=256&&new Set(value).size===value.length&&value.every(id=>typeof id==="string"&&ids.includes(id));export function validateLevel1Selection(input,ids){if(!record(input)||Object.keys(input).some(key=>!["sources","requestedSources","prepared","fullActions","oauthSources","bindings"].includes(key)))throw Error("Invalid level 1 setup configuration.");const sources=input.sources===void 0?[...ids]:input.sources;const requested=input.requestedSources??sources;if(!selected(sources,ids)||!selected(requested,ids)||input.requestedSources!==void 0&&(input.sources===void 0||sources.some(source=>!requested.includes(source)))||input.fullActions!==void 0&&!selected(input.fullActions,requested)||input.oauthSources!==void 0&&!selected(input.oauthSources,requested))throw Error("Invalid level 1 setup source or action selection.");if(input.prepared!==void 0&&(!record(input.prepared)||Object.entries(input.prepared).some(([source,options])=>!requested.includes(source)||!record(options))))throw Error("Invalid level 1 prepared options.");if(input.bindings!==void 0&&(!record(input.bindings)||Object.entries(input.bindings).some(([source,id])=>!requested.includes(source)||typeof id!=="string"||!id||id.length>512)))throw Error("Invalid level 1 account selection.")}export async function prepareConfiguration(vault,input,ids,resolve,preparedIds=[]){validateLevel1Selection(input,ids);const requested=input.requestedSources??input.sources??ids,fullActions=requested;const plan={configuration:{sources:[],requestedSources:[...requested],prepared:{},fullActions:[...fullActions],oauthSources:[...input.oauthSources??[]],...input.bindings?{bindings:{...input.bindings}}:{}},pending:[]};const pending=(source,reason,bindingIds)=>plan.pending.push({source,reason,next:reason==="authorization-required"?"Connect this source using its existing authorization flow.":reason==="ambiguous-account"?"Select one verified binding in bindings[source], then prepare again.":reason==="ambiguous-resource"?"Select one protected resourceId in prepared[source], then prepare again.":reason==="custody-unavailable"?"Unlock or repair credential custody, then prepare again.":"Setup is required before this source can connect. Review its connection requirements in PREPARED-SOURCES.md.",...bindingIds?{bindingIds}:{}});for(const source of requested){const options=input.prepared?.[source],actions=fullActions.includes(source)?[source]:[];let configured;if(options)try{configured=resolve({sources:[source],prepared:{[source]:options},fullActions:actions,oauthSources:input.oauthSources?.includes(source)?[source]:[]})[0];plan.configuration.prepared[source]=structuredClone(options)}catch{}let fixed;try{fixed=resolve({sources:[source],fullActions:actions})[0]}catch{}const enrollmentOptions=configured?.auth.kind==="zendesk-oauth"||configured?.auth.kind==="server-login"||configured?.auth.kind==="fields"||configured?.auth.kind==="mcp-oauth"&&configured.auth.reviewed?.registration?.kind==="pre-registered";if(enrollmentOptions)fixed=configured;const selectFixed=()=>{plan.configuration.sources.push(source)};if(fixed&&!options&&!preparedIds.includes(source)){selectFixed();continue}try{const custody=vault.bindingCustody;if(!custody?.bindingInventory){pending(source,"custody-unavailable");continue}const resolution=await custody.resolve(input.bindings?.[source]?{kind:"binding",bindingId:input.bindings[source]}:{kind:source==="matrix"||source==="wordpress"?"selected-source":"legacy-source",source});if(!("ok"in resolution)){pending(source,"custody-unavailable");continue}if(resolution.ok.kind==="ambiguous_account"){pending(source,"ambiguous-account",[...resolution.ok.bindingIds]);continue}if(resolution.ok.kind!=="resolved"){const connection=(!options||enrollmentOptions)&&!input.bindings?.[source]?await vault.connection(source):void 0;if(connection&&!("ok"in connection)){pending(source,"custody-unavailable");continue}if(connection?.ok===null){if(source==="wrike"&&resolution.ok.kind==="legacy-unattributed"&&resolution.ok.source===source&&!options&&!input.bindings?.[source]&&!input.oauthSources?.includes(source)){const pat={mode:"fields"};fixed=resolve({sources:[source],prepared:{[source]:pat},fullActions:actions})[0];plan.configuration.prepared[source]=pat}if(fixed)selectFixed();else pending(source,"configuration-required");continue}if(resolution.ok.kind==="legacy-unattributed"&&fixed?.auth.kind==="fields"&&connection?.ok&&connection.ok.source===source&&connection.ok.provider===source&&connection.ok.accountId===void 0&&connection.ok.authority===void 0){selectFixed();continue}const prior=connection?.ok;if(source==="wordpress"&&!options&&!input.bindings?.[source]&&!input.oauthSources?.includes(source)&&resolution.ok.kind==="legacy-unattributed"&&resolution.ok.source===source&&fixed?.auth.kind==="mcp-oauth"&&fixed.auth.reviewed?.registration?.kind==="dcr"&&prior?.state==="disconnected"&&prior.source===source&&prior.provider===source&&prior.accountId===void 0&&prior.authority===void 0&&prior.scopes.length===0&&isSelfHostedWordPressAccount(prior.account)){selectFixed();continue}pending(source,"authorization-required");continue}if(resolution.ok.binding.identity.source!==source||resolution.ok.binding.state!=="connected"){pending(source,"authorization-required");continue}const loaded=await custody.bindingInventory(resolution.ok.binding.id);if(!("ok"in loaded)||!loaded.ok){pending(source,"custody-unavailable");continue}const inventory=loaded.ok;if(inventory.binding.revision!==resolution.ok.binding.revision||inventory.binding.state!=="connected"){pending(source,"custody-unavailable");continue}const grants=inventory.grants.filter(grant=>grant.bindingId===inventory.binding.id&&grant.purpose==="L1"&&grant.state==="active");const resources=inventory.resources.filter(resource=>resource.bindingId===inventory.binding.id&&resource.owner.kind==="resident"&&(!options?.resourceId||options.resourceId===resource.id));if(!grants.length||!resources.length){pending(source,"authorization-required");continue}const binding=inventory.binding;if(source==="zendesk"&&fixed?.auth.kind==="zendesk-oauth"){const auth=fixed.auth,prefix=`zendesk:v1:${auth.config.subdomain}:`;if(binding.provider==="zendesk"&&binding.identity.issuer==="zendesk"&&binding.identity.tenant===null&&binding.authority===void 0&&typeof binding.identity.subject==="string"&&binding.identity.subject.startsWith(prefix)&&/^[1-9][0-9]*$/u.test(binding.identity.subject.slice(prefix.length))&&grants.length===1&&grants[0].audience==="zendesk"&&grants[0].scopes.length===auth.config.scopes.length&&grants[0].scopes.every(scope=>auth.config.scopes.includes(scope))&&resources.length===1&&resources[0].id===oauthCredentialResourceId(binding.id)&&resources[0].kind==="oauth"){selectFixed();continue}pending(source,"authorization-required");continue}if(source==="matrix"&&!options&&!input.oauthSources?.includes(source)&&fixed?.auth.kind==="fields"&&binding.authority!==void 0){const authority=binding.authority,scopes=grants[0]?.scopes??[];if(binding.identity.source===source&&binding.provider===source&&binding.identity.issuer===source&&binding.identity.tenant===null&&matrixUserId(binding.identity.subject)&&binding.account===binding.identity.subject&&isMcpSessionAuthority(authority)&&authority.issuer===matrixIssuer&&authority.resource===matrixHomeserver&&authority.tokenEndpoint===matrixTokenUrl&&authority.clientId.length>0&&grants.length===1&&grants[0].audience===matrixHomeserver&&scopes.length===2&&scopes.includes("urn:matrix:client:api:*")&&scopes.some(scope=>/^urn:matrix:client:device:[a-f0-9]{32}$/u.test(scope))&&resources.length===1&&resources[0].id===oauthCredentialResourceId(binding.id)&&resources[0].kind==="oauth"){selectFixed();continue}pending(source,"configuration-required");continue}if(source==="ticktick"&&!options&&!input.oauthSources?.includes(source)&&fixed?.auth.kind==="mcp-oauth"&&fixed.server.transport==="http"){const review=fixed.auth.reviewed,authority=binding.authority;let tokenOrigin="";try{tokenOrigin=new URL(isMcpSessionAuthority(authority)?authority.tokenEndpoint:"").origin}catch{}if(review?.registration?.kind==="dcr"&&review.identity?.kind==="ticktick-inbox-self"&&review.issuer==="https://ticktick.com"&&fixed.server.url==="https://mcp.ticktick.com"&&binding.provider===source&&binding.identity.issuer===source&&binding.identity.tenant===null&&typeof binding.identity.subject==="string"&&binding.identity.subject.length>0&&isMcpSessionAuthority(authority)&&authority.issuer===review.issuer&&authority.resource==="https://mcp.ticktick.com/"&&review.allowedOrigins.includes(tokenOrigin)&&typeof authority.clientId==="string"&&authority.clientId.length>0&&grants.length===1&&grants[0].audience===authority.resource&&grants[0].scopes.every(scope=>review.scopes.includes(scope))&&resources.length===1&&resources[0].id===oauthCredentialResourceId(binding.id)&&resources[0].kind==="oauth"){selectFixed();continue}pending(source,"configuration-required");continue}const helpRoute=helpRestartRoutes[source];if(helpRoute&&!options&&!input.oauthSources?.includes(source)&&fixed?.auth.kind==="mcp-oauth"&&fixed.server.transport==="http"&&isMcpSessionAuthority(binding.authority)){const[url,resource,issuer,tokenEndpoint,scopeCatalog]=helpRoute;const authority=binding.authority,review=fixed.auth.reviewed;const identityMatches=binding.identity.subject===void 0?binding.identity.issuer===issuer:!!review?.identity&&binding.identity.issuer===source&&typeof binding.identity.subject==="string"&&binding.identity.subject.length>0;const scopes=grants[0]?.scopes??[];const scopesMatch=review?acceptsSavedMcpScopes(fixed,scopes):scopes.every(scope=>scopeCatalog.includes(scope));if(fixed.server.url===url&&binding.id===resolution.ok.binding.id&&binding.identity.source===source&&binding.provider===source&&binding.identity.tenant===null&&identityMatches&&authority.issuer===issuer&&authority.tokenEndpoint===tokenEndpoint&&new URL(authority.resource).href===new URL(resource).href&&authority.clientId.length>0&&grants.length===1&&grants[0].audience===authority.resource&&scopesMatch&&resources.length===1&&resources[0].id===oauthCredentialResourceId(binding.id)&&resources[0].kind==="oauth"){selectFixed();continue}pending(source,"configuration-required");continue}const reviewedRestartRoutes={airtable:["https://mcp.airtable.com/mcp","https://airtable.com/oauth2/v1",void 0],gitlab:["https://gitlab.com/api/v4/mcp","https://gitlab.com","gitlab-token-info"],linear:["https://mcp.linear.app/mcp","https://mcp.linear.app","linear-openid-teams"],monday:["https://mcp.monday.com/mcp","https://auth.monday.com/mcp",void 0],miro:["https://mcp.miro.com/","https://mcp.miro.com/",void 0],webflow:["https://mcp.webflow.com/mcp","https://mcp.webflow.com",void 0],calendly:["https://mcp.calendly.com","https://calendly.com/",void 0],posthog:["https://mcp.posthog.com/mcp","https://oauth.posthog.com",void 0]};const restartRoute=reviewedRestartRoutes[source];if(restartRoute&&!options&&!input.oauthSources?.includes(source)&&fixed?.auth.kind==="mcp-oauth"&&fixed.server.transport==="http"){const review=fixed.auth.reviewed,authority=binding.authority;const sessionIdentity=binding.identity.subject===void 0?binding.identity.issuer===review?.issuer:typeof binding.identity.subject==="string"&&binding.identity.subject.length>0&&binding.identity.issuer===source;let tokenOrigin="";try{tokenOrigin=new URL(isMcpSessionAuthority(authority)?authority.tokenEndpoint:"").origin}catch{}if(fixed.server.url===restartRoute[0]&&review?.issuer===restartRoute[1]&&review.identity?.kind===restartRoute[2]&&review.registration?.kind==="dcr"&&binding.id===resolution.ok.binding.id&&binding.identity.source===source&&binding.provider===source&&binding.identity.tenant===null&&sessionIdentity&&isMcpSessionAuthority(authority)&&authority.issuer===review.issuer&&checkResourceAllowed({requestedResource:resourceUrlFromServerUrl(fixed.server.url),configuredResource:authority.resource})&&review.allowedOrigins.includes(tokenOrigin)&&typeof authority.clientId==="string"&&authority.clientId.length>0&&grants.length===1&&grants[0].audience===authority.resource&&acceptsSavedMcpScopes(fixed,grants[0].scopes)&&resources.length===1&&resources[0].id===oauthCredentialResourceId(binding.id)&&resources[0].kind==="oauth"){selectFixed();continue}if(binding.authority!==void 0){pending(source,"configuration-required");continue}}if(!options&&!input.oauthSources?.includes(source)&&fixed?.auth.kind==="oauth-device"&&(fixed.server.transport==="http"||source==="microsoft-todo"&&isMcpSessionAuthority(binding.authority)&&binding.authority.resource===fixed.auth.tokenUrl)){const auth=fixed.auth,review=auth.reviewed,authority=binding.authority;const resource=fixed.server.transport==="http"?fixed.server.url:auth.tokenUrl;const scopes=grants[0]?.scopes??[];const scopeMatches=source==="microsoft-todo"?scopes.some(scope=>scope==="Tasks.Read"||scope==="Tasks.ReadWrite")&&scopes.every(scope=>review.scopes.includes(scope)||scope==="Tasks.Read"||scope==="Tasks.ReadWrite"):scopes.every(scope=>review.scopes.includes(scope));const sessionIdentity=binding.identity.subject===void 0?binding.identity.issuer===review.issuer:typeof binding.identity.subject==="string"&&binding.identity.subject.length>0&&binding.identity.issuer===source;if(binding.id===resolution.ok.binding.id&&binding.identity.source===source&&binding.provider===source&&binding.identity.tenant===null&&sessionIdentity&&isMcpSessionAuthority(authority)&&authority.issuer===review.issuer&&authority.resource===resource&&authority.clientId===auth.clientId&&authority.tokenEndpoint===auth.tokenUrl&&grants.length===1&&grants[0].audience===authority.resource&&scopeMatches&&resources.length===1&&resources[0].id===oauthCredentialResourceId(binding.id)&&resources[0].kind==="oauth"){selectFixed();continue}if(binding.authority!==void 0){pending(source,"configuration-required");continue}}if(enrollmentOptions&&fixed?.auth.kind==="mcp-oauth"&&fixed.server.transport==="http"){const review=fixed.auth.reviewed,registration=review?.registration,authority=inventory.binding.authority;if(registration?.kind==="pre-registered"&&isMcpSessionAuthority(authority)&&authority.issuer===review.issuer&&authority.resource===(source==="front"&&fixed.server.url==="https://mcp.frontapp.com/mcp"?"https://mcp.frontapp.com/":fixed.server.url)&&authority.clientId===registration.clientId&&inventory.binding.identity.issuer===authority.issuer&&inventory.binding.identity.subject===void 0&&grants.filter(grant=>grant.audience===authority.resource).length===1&&resources.some(resource=>resource.id===oauthCredentialResourceId(inventory.binding.id)&&resource.kind==="oauth")){selectFixed();continue}pending(source,"configuration-required");continue}if(fixed?.auth.kind==="server-login"&&!fixed.auth.login.identity&&(!options||enrollmentOptions)){const binding2=inventory.binding,audience=fixed.server.transport==="http"?fixed.server.url:source;if(binding2.identity.issuer===source&&binding2.identity.subject===void 0&&binding2.identity.tenant===null&&isServerSessionAuthority(binding2.authority)&&binding2.authority.resource===audience&&grants.filter(grant=>grant.audience===audience&&grant.scopes.length===0).length===1&&resources.some(resource=>resource.id===`server-login:${binding2.id}`&&resource.kind==="local-no-secret"&&resource.encryptedRef===null)){selectFixed();continue}}const matches=new Map;if(grants.length*resources.length>256){pending(source,"ambiguous-resource");continue}for(const grant of grants)for(const resource of resources){const common={resourceId:resource.id,issuer:inventory.binding.identity.issuer,requiredScopes:[...grant.scopes],...options};for(const candidate of[common,{audience:grant.audience,...common},{resourceId:resource.id,...options},{resourceId:resource.id,expectedSubject:inventory.binding.identity.subject,...options}])try{const spec=resolve({sources:[source],prepared:{[source]:candidate},fullActions:actions,oauthSources:resource.kind==="oauth"?[source]:[]})[0],auth=spec?.auth;if(auth?.kind!=="custodied"||auth.resourceId!==resource.id||auth.credentialKind!==resource.kind||auth.issuer!==inventory.binding.identity.issuer||auth.audience!==grant.audience||auth.requiredScopes.some(scope=>!grant.scopes.includes(scope))||auth.expectedSubject!==void 0&&auth.expectedSubject!==inventory.binding.identity.subject||Object.values(auth.envResources??{}).some(ref=>!inventory.resources.some(value=>value.bindingId===inventory.binding.id&&value.owner.kind==="resident"&&value.id===ref.resourceId&&value.kind===ref.credentialKind)))continue;const key=JSON.stringify([resource.id,grant.id]);if(!matches.has(key))matches.set(key,{options:candidate,oauth:resource.kind==="oauth"})}catch{}}if(matches.size!==1){pending(source,matches.size>1?"ambiguous-resource":"configuration-required");continue}const match=[...matches.values()][0];plan.configuration.sources.push(source);plan.configuration.prepared[source]=match.options;if(match.oauth&&!plan.configuration.oauthSources.includes(source))plan.configuration.oauthSources.push(source)}catch{pending(source,"custody-unavailable")}}return plan}
|
|
1
|
+
import{isMcpSessionAuthority,isServerSessionAuthority,oauthCredentialResourceId}from"@zortexhq/plugin-vault-sqlite/api";import{checkResourceAllowed,resourceUrlFromServerUrl}from"@modelcontextprotocol/client";import{isSelfHostedWordPressAccount}from"./prepared-wordpress.js";import{isBundledAppleSource}from"./prepared-apple-native.js";import{acceptsSavedMcpScopes}from"./saved-mcp-scopes.js";import{matrixHomeserver,matrixIssuer,matrixTokenUrl,matrixUserId}from"./matrix-login.js";const helpRestartRoutes={basecamp:["https://mcp.basecamp.com/mcp","https://mcp.basecamp.com/mcp","https://app.basecamp.com","https://app.basecamp.com/oauth/tokens",["mcp","read","full"]],pipedrive:["https://mcp.pipedrive.ai/mcp","https://mcp.pipedrive.ai/mcp","https://oauth.pipedrive.com","https://oauth.pipedrive.com/oauth/token",["activities:full","admin","base","contact-fields:full","contacts:full","deal-fields:full","deals:full","leads:full","mail-sending:full","mail:full","product-fields:full","products:full","project-fields:full","projects:full","search:read","users:read"]],intercom:["https://mcp.intercom.com/mcp","https://mcp.intercom.com/mcp","https://mcp.intercom.com","https://mcp.intercom.com/token",["mcp","operator"]],figma:["https://mcp.figma.com/mcp","https://mcp.figma.com/mcp","https://api.figma.com","https://api.figma.com/v1/oauth/token",["mcp:connect"]],wordpress:["https://public-api.wordpress.com/wpcom/v2/mcp/v1","https://public-api.wordpress.com/wpcom/v2/mcp/v1","https://public-api.wordpress.com","https://public-api.wordpress.com/oauth2-1/token",["global","auth","openid","profile","email","users","sites","posts","comments","taxonomy","follow","sharing","freshly-pressed","notifications","insights","read","stats","media","menus","batch","videos"]],readwise:["https://mcp2.readwise.io/mcp","https://mcp2.readwise.io/mcp","https://readwise.io/o/","https://readwise.io/o/token/",["openid","read","write"]],raindrop:["https://api.raindrop.io/rest/v2/ai/mcp","https://api.raindrop.io/rest/v2/ai/mcp","https://api.raindrop.io","https://api.raindrop.io/v2/oauth/access_token",["read","write"]],fastmail:["https://api.fastmail.com/mcp","https://api.fastmail.com/mcp","https://api.fastmail.com","https://api.fastmail.com/oauth/refresh",["https://www.fastmail.com/dev/mcp","offline_access"]],harvest:["https://api.harvestapp.com/mcp","https://api.harvestapp.com/mcp","https://id.getharvest.com","https://id.getharvest.com/api/v2/oauth2/token",[]],cloudflare:["https://mcp.cloudflare.com/mcp","https://mcp.cloudflare.com/mcp","https://mcp.cloudflare.com","https://mcp.cloudflare.com/token",["user:read","account:read","offline_access"]],railway:["https://mcp.railway.com","https://mcp.railway.com","https://backboard.railway.com","https://backboard.railway.com/oauth/token",["workspace:member"]],calcom:["https://mcp.cal.com/mcp","https://mcp.cal.com/mcp","https://mcp.cal.com","https://mcp.cal.com/oauth/token",[]]};const record=value=>!!value&&typeof value==="object"&&!Array.isArray(value)&&[Object.prototype,null].includes(Object.getPrototypeOf(value))&&Reflect.ownKeys(value).every(key=>typeof key==="string"&&Object.getOwnPropertyDescriptor(value,key)?.enumerable&&"value"in Object.getOwnPropertyDescriptor(value,key));const selected=(value,ids)=>Array.isArray(value)&&value.length<=256&&new Set(value).size===value.length&&value.every(id=>typeof id==="string"&&ids.includes(id));export function validateLevel1Selection(input,ids){if(!record(input)||Object.keys(input).some(key=>!["sources","requestedSources","prepared","fullActions","oauthSources","bindings"].includes(key)))throw Error("Invalid level 1 setup configuration.");const sources=input.sources===void 0?[...ids]:input.sources;const requested=input.requestedSources??sources;if(!selected(sources,ids)||!selected(requested,ids)||input.requestedSources!==void 0&&(input.sources===void 0||sources.some(source=>!requested.includes(source)))||input.fullActions!==void 0&&!selected(input.fullActions,requested)||input.oauthSources!==void 0&&!selected(input.oauthSources,requested))throw Error("Invalid level 1 setup source or action selection.");if(input.prepared!==void 0&&(!record(input.prepared)||Object.entries(input.prepared).some(([source,options])=>!requested.includes(source)||!record(options))))throw Error("Invalid level 1 prepared options.");if(input.bindings!==void 0&&(!record(input.bindings)||Object.entries(input.bindings).some(([source,id])=>!requested.includes(source)||typeof id!=="string"||!id||id.length>512)))throw Error("Invalid level 1 account selection.")}export async function prepareConfiguration(vault,input,ids,resolve,preparedIds=[],selectedNativeSources=input.sources??[]){validateLevel1Selection(input,ids);const requested=input.requestedSources??input.sources??ids,fullActions=requested;const plan={configuration:{sources:[],requestedSources:[...requested],prepared:{},fullActions:[...fullActions],oauthSources:[...input.oauthSources??[]],...input.bindings?{bindings:{...input.bindings}}:{}},pending:[]};const pending=(source,reason,bindingIds)=>plan.pending.push({source,reason,next:reason==="authorization-required"?"Connect this source using its existing authorization flow.":reason==="ambiguous-account"?"Select one verified binding in bindings[source], then prepare again.":reason==="ambiguous-resource"?"Select one protected resourceId in prepared[source], then prepare again.":reason==="custody-unavailable"?"Unlock or repair credential custody, then prepare again.":"Setup is required before this source can connect. Review its connection requirements in PREPARED-SOURCES.md.",...bindingIds?{bindingIds}:{}});for(const source of requested){const options=input.prepared?.[source],actions=fullActions.includes(source)?[source]:[];let configured;if(options)try{configured=resolve({sources:[source],prepared:{[source]:options},fullActions:actions,oauthSources:input.oauthSources?.includes(source)?[source]:[]})[0];plan.configuration.prepared[source]=structuredClone(options)}catch{}let fixed;try{fixed=resolve({sources:[source],fullActions:actions})[0]}catch{}const enrollmentOptions=configured?.auth.kind==="zendesk-oauth"||configured?.auth.kind==="server-login"||configured?.auth.kind==="fields"||configured?.auth.kind==="mcp-oauth"&&configured.auth.reviewed?.registration?.kind==="pre-registered";if(enrollmentOptions)fixed=configured;const selectFixed=()=>{plan.configuration.sources.push(source)};if(fixed&&!options&&!preparedIds.includes(source)){selectFixed();continue}try{const custody=vault.bindingCustody;if(!custody?.bindingInventory){pending(source,"custody-unavailable");continue}const resolution=await custody.resolve(input.bindings?.[source]?{kind:"binding",bindingId:input.bindings[source]}:{kind:source==="matrix"||source==="wordpress"?"selected-source":"legacy-source",source});if(!("ok"in resolution)){pending(source,"custody-unavailable");continue}if(resolution.ok.kind==="ambiguous_account"){pending(source,"ambiguous-account",[...resolution.ok.bindingIds]);continue}if(resolution.ok.kind!=="resolved"){const connection=(!options||enrollmentOptions)&&!input.bindings?.[source]?await vault.connection(source):void 0;if(connection&&!("ok"in connection)){pending(source,"custody-unavailable");continue}if(connection?.ok===null){if(source==="wrike"&&resolution.ok.kind==="legacy-unattributed"&&resolution.ok.source===source&&!options&&!input.bindings?.[source]&&!input.oauthSources?.includes(source)){const pat={mode:"fields"};fixed=resolve({sources:[source],prepared:{[source]:pat},fullActions:actions})[0];plan.configuration.prepared[source]=pat}if(fixed&&!(isBundledAppleSource(source)&&!options&&!selectedNativeSources.includes(source)))selectFixed();else pending(source,"configuration-required");continue}if(resolution.ok.kind==="legacy-unattributed"&&fixed?.auth.kind==="fields"&&connection?.ok&&connection.ok.source===source&&connection.ok.provider===source&&connection.ok.accountId===void 0&&connection.ok.authority===void 0){selectFixed();continue}const prior=connection?.ok;if(source==="wordpress"&&!options&&!input.bindings?.[source]&&!input.oauthSources?.includes(source)&&resolution.ok.kind==="legacy-unattributed"&&resolution.ok.source===source&&fixed?.auth.kind==="mcp-oauth"&&fixed.auth.reviewed?.registration?.kind==="dcr"&&prior?.state==="disconnected"&&prior.source===source&&prior.provider===source&&prior.accountId===void 0&&prior.authority===void 0&&prior.scopes.length===0&&isSelfHostedWordPressAccount(prior.account)){selectFixed();continue}pending(source,"authorization-required");continue}if(resolution.ok.binding.identity.source!==source||resolution.ok.binding.state!=="connected"){pending(source,"authorization-required");continue}const loaded=await custody.bindingInventory(resolution.ok.binding.id);if(!("ok"in loaded)||!loaded.ok){pending(source,"custody-unavailable");continue}const inventory=loaded.ok;if(inventory.binding.revision!==resolution.ok.binding.revision||inventory.binding.state!=="connected"){pending(source,"custody-unavailable");continue}const grants=inventory.grants.filter(grant=>grant.bindingId===inventory.binding.id&&grant.purpose==="L1"&&grant.state==="active");const resources=inventory.resources.filter(resource=>resource.bindingId===inventory.binding.id&&resource.owner.kind==="resident"&&(!options?.resourceId||options.resourceId===resource.id));if(!grants.length||!resources.length){pending(source,"authorization-required");continue}const binding=inventory.binding;if(source==="zendesk"&&fixed?.auth.kind==="zendesk-oauth"){const auth=fixed.auth,prefix=`zendesk:v1:${auth.config.subdomain}:`;if(binding.provider==="zendesk"&&binding.identity.issuer==="zendesk"&&binding.identity.tenant===null&&binding.authority===void 0&&typeof binding.identity.subject==="string"&&binding.identity.subject.startsWith(prefix)&&/^[1-9][0-9]*$/u.test(binding.identity.subject.slice(prefix.length))&&grants.length===1&&grants[0].audience==="zendesk"&&grants[0].scopes.length===auth.config.scopes.length&&grants[0].scopes.every(scope=>auth.config.scopes.includes(scope))&&resources.length===1&&resources[0].id===oauthCredentialResourceId(binding.id)&&resources[0].kind==="oauth"){selectFixed();continue}pending(source,"authorization-required");continue}if(source==="matrix"&&!options&&!input.oauthSources?.includes(source)&&fixed?.auth.kind==="fields"&&binding.authority!==void 0){const authority=binding.authority,scopes=grants[0]?.scopes??[];if(binding.identity.source===source&&binding.provider===source&&binding.identity.issuer===source&&binding.identity.tenant===null&&matrixUserId(binding.identity.subject)&&binding.account===binding.identity.subject&&isMcpSessionAuthority(authority)&&authority.issuer===matrixIssuer&&authority.resource===matrixHomeserver&&authority.tokenEndpoint===matrixTokenUrl&&authority.clientId.length>0&&grants.length===1&&grants[0].audience===matrixHomeserver&&scopes.length===2&&scopes.includes("urn:matrix:client:api:*")&&scopes.some(scope=>/^urn:matrix:client:device:[a-f0-9]{32}$/u.test(scope))&&resources.length===1&&resources[0].id===oauthCredentialResourceId(binding.id)&&resources[0].kind==="oauth"){selectFixed();continue}pending(source,"configuration-required");continue}if(source==="ticktick"&&!options&&!input.oauthSources?.includes(source)&&fixed?.auth.kind==="mcp-oauth"&&fixed.server.transport==="http"){const review=fixed.auth.reviewed,authority=binding.authority;let tokenOrigin="";try{tokenOrigin=new URL(isMcpSessionAuthority(authority)?authority.tokenEndpoint:"").origin}catch{}if(review?.registration?.kind==="dcr"&&review.identity?.kind==="ticktick-inbox-self"&&review.issuer==="https://ticktick.com"&&fixed.server.url==="https://mcp.ticktick.com"&&binding.provider===source&&binding.identity.issuer===source&&binding.identity.tenant===null&&typeof binding.identity.subject==="string"&&binding.identity.subject.length>0&&isMcpSessionAuthority(authority)&&authority.issuer===review.issuer&&authority.resource==="https://mcp.ticktick.com/"&&review.allowedOrigins.includes(tokenOrigin)&&typeof authority.clientId==="string"&&authority.clientId.length>0&&grants.length===1&&grants[0].audience===authority.resource&&grants[0].scopes.every(scope=>review.scopes.includes(scope))&&resources.length===1&&resources[0].id===oauthCredentialResourceId(binding.id)&&resources[0].kind==="oauth"){selectFixed();continue}pending(source,"configuration-required");continue}const helpRoute=helpRestartRoutes[source];if(helpRoute&&!options&&!input.oauthSources?.includes(source)&&fixed?.auth.kind==="mcp-oauth"&&fixed.server.transport==="http"&&isMcpSessionAuthority(binding.authority)){const[url,resource,issuer,tokenEndpoint,scopeCatalog]=helpRoute;const authority=binding.authority,review=fixed.auth.reviewed;const identityMatches=binding.identity.subject===void 0?binding.identity.issuer===issuer:!!review?.identity&&binding.identity.issuer===source&&typeof binding.identity.subject==="string"&&binding.identity.subject.length>0;const scopes=grants[0]?.scopes??[];const scopesMatch=review?acceptsSavedMcpScopes(fixed,scopes):scopes.every(scope=>scopeCatalog.includes(scope));if(fixed.server.url===url&&binding.id===resolution.ok.binding.id&&binding.identity.source===source&&binding.provider===source&&binding.identity.tenant===null&&identityMatches&&authority.issuer===issuer&&authority.tokenEndpoint===tokenEndpoint&&new URL(authority.resource).href===new URL(resource).href&&authority.clientId.length>0&&grants.length===1&&grants[0].audience===authority.resource&&scopesMatch&&resources.length===1&&resources[0].id===oauthCredentialResourceId(binding.id)&&resources[0].kind==="oauth"){selectFixed();continue}pending(source,"configuration-required");continue}const reviewedRestartRoutes={airtable:["https://mcp.airtable.com/mcp","https://airtable.com/oauth2/v1",void 0],gitlab:["https://gitlab.com/api/v4/mcp","https://gitlab.com","gitlab-token-info"],linear:["https://mcp.linear.app/mcp","https://mcp.linear.app","linear-openid-teams"],monday:["https://mcp.monday.com/mcp","https://auth.monday.com/mcp",void 0],miro:["https://mcp.miro.com/","https://mcp.miro.com/",void 0],webflow:["https://mcp.webflow.com/mcp","https://mcp.webflow.com",void 0],calendly:["https://mcp.calendly.com","https://calendly.com/",void 0],posthog:["https://mcp.posthog.com/mcp","https://oauth.posthog.com",void 0]};const restartRoute=reviewedRestartRoutes[source];if(restartRoute&&!options&&!input.oauthSources?.includes(source)&&fixed?.auth.kind==="mcp-oauth"&&fixed.server.transport==="http"){const review=fixed.auth.reviewed,authority=binding.authority;const sessionIdentity=binding.identity.subject===void 0?binding.identity.issuer===review?.issuer:typeof binding.identity.subject==="string"&&binding.identity.subject.length>0&&binding.identity.issuer===source;let tokenOrigin="";try{tokenOrigin=new URL(isMcpSessionAuthority(authority)?authority.tokenEndpoint:"").origin}catch{}if(fixed.server.url===restartRoute[0]&&review?.issuer===restartRoute[1]&&review.identity?.kind===restartRoute[2]&&review.registration?.kind==="dcr"&&binding.id===resolution.ok.binding.id&&binding.identity.source===source&&binding.provider===source&&binding.identity.tenant===null&&sessionIdentity&&isMcpSessionAuthority(authority)&&authority.issuer===review.issuer&&checkResourceAllowed({requestedResource:resourceUrlFromServerUrl(fixed.server.url),configuredResource:authority.resource})&&review.allowedOrigins.includes(tokenOrigin)&&typeof authority.clientId==="string"&&authority.clientId.length>0&&grants.length===1&&grants[0].audience===authority.resource&&acceptsSavedMcpScopes(fixed,grants[0].scopes)&&resources.length===1&&resources[0].id===oauthCredentialResourceId(binding.id)&&resources[0].kind==="oauth"){selectFixed();continue}if(binding.authority!==void 0){pending(source,"configuration-required");continue}}if(!options&&!input.oauthSources?.includes(source)&&fixed?.auth.kind==="oauth-device"&&(fixed.server.transport==="http"||source==="microsoft-todo"&&isMcpSessionAuthority(binding.authority)&&binding.authority.resource===fixed.auth.tokenUrl)){const auth=fixed.auth,review=auth.reviewed,authority=binding.authority;const resource=fixed.server.transport==="http"?fixed.server.url:auth.tokenUrl;const scopes=grants[0]?.scopes??[];const scopeMatches=source==="microsoft-todo"?scopes.some(scope=>scope==="Tasks.Read"||scope==="Tasks.ReadWrite")&&scopes.every(scope=>review.scopes.includes(scope)||scope==="Tasks.Read"||scope==="Tasks.ReadWrite"):scopes.every(scope=>review.scopes.includes(scope));const sessionIdentity=binding.identity.subject===void 0?binding.identity.issuer===review.issuer:typeof binding.identity.subject==="string"&&binding.identity.subject.length>0&&binding.identity.issuer===source;if(binding.id===resolution.ok.binding.id&&binding.identity.source===source&&binding.provider===source&&binding.identity.tenant===null&&sessionIdentity&&isMcpSessionAuthority(authority)&&authority.issuer===review.issuer&&authority.resource===resource&&authority.clientId===auth.clientId&&authority.tokenEndpoint===auth.tokenUrl&&grants.length===1&&grants[0].audience===authority.resource&&scopeMatches&&resources.length===1&&resources[0].id===oauthCredentialResourceId(binding.id)&&resources[0].kind==="oauth"){selectFixed();continue}if(binding.authority!==void 0){pending(source,"configuration-required");continue}}if(enrollmentOptions&&fixed?.auth.kind==="mcp-oauth"&&fixed.server.transport==="http"){const review=fixed.auth.reviewed,registration=review?.registration,authority=inventory.binding.authority;if(registration?.kind==="pre-registered"&&isMcpSessionAuthority(authority)&&authority.issuer===review.issuer&&authority.resource===(source==="front"&&fixed.server.url==="https://mcp.frontapp.com/mcp"?"https://mcp.frontapp.com/":fixed.server.url)&&authority.clientId===registration.clientId&&inventory.binding.identity.issuer===authority.issuer&&inventory.binding.identity.subject===void 0&&grants.filter(grant=>grant.audience===authority.resource).length===1&&resources.some(resource=>resource.id===oauthCredentialResourceId(inventory.binding.id)&&resource.kind==="oauth")){selectFixed();continue}pending(source,"configuration-required");continue}if(fixed?.auth.kind==="server-login"&&!fixed.auth.login.identity&&(!options||enrollmentOptions)){const binding2=inventory.binding,audience=fixed.server.transport==="http"?fixed.server.url:source;if(binding2.identity.issuer===source&&binding2.identity.subject===void 0&&binding2.identity.tenant===null&&isServerSessionAuthority(binding2.authority)&&binding2.authority.resource===audience&&grants.filter(grant=>grant.audience===audience&&grant.scopes.length===0).length===1&&resources.some(resource=>resource.id===`server-login:${binding2.id}`&&resource.kind==="local-no-secret"&&resource.encryptedRef===null)){selectFixed();continue}}const matches=new Map;if(grants.length*resources.length>256){pending(source,"ambiguous-resource");continue}for(const grant of grants)for(const resource of resources){const common={resourceId:resource.id,issuer:inventory.binding.identity.issuer,requiredScopes:[...grant.scopes],...options};for(const candidate of[common,{audience:grant.audience,...common},{resourceId:resource.id,...options},{resourceId:resource.id,expectedSubject:inventory.binding.identity.subject,...options}])try{const spec=resolve({sources:[source],prepared:{[source]:candidate},fullActions:actions,oauthSources:resource.kind==="oauth"?[source]:[]})[0],auth=spec?.auth;if(auth?.kind!=="custodied"||auth.resourceId!==resource.id||auth.credentialKind!==resource.kind||auth.issuer!==inventory.binding.identity.issuer||auth.audience!==grant.audience||auth.requiredScopes.some(scope=>!grant.scopes.includes(scope))||auth.expectedSubject!==void 0&&auth.expectedSubject!==inventory.binding.identity.subject||Object.values(auth.envResources??{}).some(ref=>!inventory.resources.some(value=>value.bindingId===inventory.binding.id&&value.owner.kind==="resident"&&value.id===ref.resourceId&&value.kind===ref.credentialKind)))continue;const key=JSON.stringify([resource.id,grant.id]);if(!matches.has(key))matches.set(key,{options:candidate,oauth:resource.kind==="oauth"})}catch{}}if(matches.size!==1){pending(source,matches.size>1?"ambiguous-resource":"configuration-required");continue}const match=[...matches.values()][0];plan.configuration.sources.push(source);plan.configuration.prepared[source]=match.options;if(match.oauth&&!plan.configuration.oauthSources.includes(source))plan.configuration.oauthSources.push(source)}catch{pending(source,"custody-unavailable")}}return plan}
|