/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/pickles2-mcp@0.1.0/dist/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
#!/usr/bin/env node
import{McpServer}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport}from"@modelcontextprotocol/sdk/server/stdio.js";import{z}from"zod";import{px2agent}from"px2agent";import{Command}from"commander";import{Logger}from"./includes/Logger/Logger.js";const version="0.1.0",program=new Command,server=new McpServer({name:"Pickles 2 MCP",version:"0.1.0"});program.version("0.1.0").description("A MCP server for Pickles 2").requiredOption("--entry-script <path>","[Required] Entry script for the Pickles 2.").option("-d, --debug","output extra debugging").option("--log-path <path>","Log output path.").action((async e=>{const t=px2agent.createProject(e.entryScript),n=new Logger({debugMode:e.debug,logPath:e.logPath});n.info("===== Pickles 2 MCP server started ====="),n.info("Entry script: "+e.entryScript),n.info("Debug mode: "+e.debug),n.info("Log path: "+e.logPath),n.info(e),server.tool("pickles2-get-version","Get Pickles 2 version.",{},(async e=>{n.info("Run command: pickles2-get-version"),n.debug(e);const o=await t.get_version();return n.debug(o),n.info("Run command: pickles2-get-version; done"),{content:[{type:"text",text:o}]}})),server.tool("pickles2-get-config","Get Pickles 2 config.",{},(async e=>{n.info("Run command: pickles2-get-config"),n.debug(e);const o=await t.get_config(),i=JSON.stringify(o);return n.debug(i),n.info("Run command: pickles2-get-config; done"),{content:[{type:"text",text:i}]}})),server.tool("pickles2-get-sitemap","Get Pickles 2 sitemap.",{},(async e=>{n.info("Run command: pickles2-get-sitemap"),n.debug(e);const o=await t.get_sitemap(),i=JSON.stringify(o);return n.debug(i),n.info("Run command: pickles2-get-sitemap; done"),{content:[{type:"text",text:i}]}})),server.tool("pickles2-get-page-info","Get page information.",{path:z.string().describe("Page path")},(async e=>{n.info("Run command: pickles2-get-page-info"),n.debug(e);const o=await t.get_page_info(e.path),i=JSON.stringify(o);return n.debug(i),n.info("Run command: pickles2-get-page-info; done"),{content:[{type:"text",text:i}]}})),server.tool("pickles2-get-parent","Get parent page.",{path:z.string().describe("Page path")},(async e=>{n.info("Run command: pickles2-get-parent"),n.debug(e);const o=await t.get_parent(e.path),i=JSON.stringify(o);return n.debug(i),n.info("Run command: pickles2-get-parent; done"),{content:[{type:"text",text:i}]}})),server.tool("pickles2-get-children","Get child pages.",{path:z.string().describe("Page path"),options:z.record(z.any()).optional().describe("Options for getting children")},(async e=>{n.info("Run command: pickles2-get-children"),n.debug(e);const o=await t.get_children(e.path,e.options),i=JSON.stringify(o);return n.debug(i),n.info("Run command: pickles2-get-children; done"),{content:[{type:"text",text:i}]}})),server.tool("pickles2-get-bros","Get sibling pages.",{path:z.string().describe("Page path"),options:z.record(z.any()).optional().describe("Options for getting brothers")},(async e=>{n.info("Run command: pickles2-get-bros"),n.debug(e);const o=await t.get_bros(e.path,e.options),i=JSON.stringify(o);return n.debug(i),n.info("Run command: pickles2-get-bros; done"),{content:[{type:"text",text:i}]}})),server.tool("pickles2-get-bros-next","Get next sibling page.",{path:z.string().describe("Page path"),options:z.record(z.any()).optional().describe("Options for getting next brother")},(async e=>{n.info("Run command: pickles2-get-bros-next"),n.debug(e);const o=await t.get_bros_next(e.path,e.options),i=JSON.stringify(o);return n.debug(i),n.info("Run command: pickles2-get-bros-next; done"),{content:[{type:"text",text:i}]}})),server.tool("pickles2-get-bros-prev","Get previous sibling page.",{path:z.string().describe("Page path"),options:z.record(z.any()).optional().describe("Options for getting previous brother")},(async e=>{n.info("Run command: pickles2-get-bros-prev"),n.debug(e);const o=await t.get_bros_prev(e.path,e.options),i=JSON.stringify(o);return n.debug(i),n.info("Run command: pickles2-get-bros-prev; done"),{content:[{type:"text",text:i}]}})),server.tool("pickles2-get-next","Get next page.",{path:z.string().describe("Page path"),options:z.record(z.any()).optional().describe("Options for getting next page")},(async e=>{n.info("Run command: pickles2-get-next"),n.debug(e);const o=await t.get_next(e.path,e.options),i=JSON.stringify(o);return n.debug(i),n.info("Run command: pickles2-get-next; done"),{content:[{type:"text",text:i}]}})),server.tool("pickles2-get-prev","Get previous page.",{path:z.string().describe("Page path"),options:z.record(z.any()).optional().describe("Options for getting previous page")},(async e=>{n.info("Run command: pickles2-get-prev"),n.debug(e);const o=await t.get_prev(e.path,e.options),i=JSON.stringify(o);return n.debug(i),n.info("Run command: pickles2-get-prev; done"),{content:[{type:"text",text:i}]}})),server.tool("pickles2-get-breadcrumb-array","Get breadcrumb array.",{path:z.string().describe("Page path")},(async e=>{n.info("Run command: pickles2-get-breadcrumb-array"),n.debug(e);const o=await t.get_breadcrumb_array(e.path),i=JSON.stringify(o);return n.debug(i),n.info("Run command: pickles2-get-breadcrumb-array; done"),{content:[{type:"text",text:i}]}})),server.tool("pickles2-get-dynamic-path-info","Get dynamic path information.",{path:z.string().describe("Page path")},(async e=>{n.info("Run command: pickles2-get-dynamic-path-info"),n.debug(e);const o=await t.get_dynamic_path_info(e.path),i=JSON.stringify(o);return n.debug(i),n.info("Run command: pickles2-get-dynamic-path-info; done"),{content:[{type:"text",text:i}]}})),server.tool("pickles2-bind-dynamic-path-param","Bind dynamic path parameters.",{path:z.string().describe("Page path"),params:z.record(z.string()).describe("Parameters to bind to the dynamic path")},(async e=>{n.info("Run command: pickles2-bind-dynamic-path-param"),n.debug(e);const o=await t.bind_dynamic_path_param(e.path,e.params);return n.debug(o),n.info("Run command: pickles2-bind-dynamic-path-param; done"),{content:[{type:"text",text:o}]}})),server.tool("pickles2-get-role","Get role.",{path:z.string().describe("Page path")},(async e=>{n.info("Run command: pickles2-get-role"),n.debug(e);const o=await t.get_role(e.path);return n.debug(o),n.info("Run command: pickles2-get-role; done"),{content:[{type:"text",text:o}]}})),server.tool("pickles2-get-actors","Get actors.",{path:z.string().describe("Page path")},(async e=>{n.info("Run command: pickles2-get-actors"),n.debug(e);const o=await t.get_actors(e.path),i=JSON.stringify(o);return n.debug(i),n.info("Run command: pickles2-get-actors; done"),{content:[{type:"text",text:i}]}})),server.tool("pickles2-get-realpath-homedir","Get home directory path.",{},(async e=>{n.info("Run command: pickles2-get-realpath-homedir"),n.debug(e);const o=await t.get_realpath_homedir();return n.debug(o),n.info("Run command: pickles2-get-realpath-homedir; done"),{content:[{type:"text",text:o}]}})),server.tool("pickles2-get-path-controot","Get content root directory path.",{},(async e=>{n.info("Run command: pickles2-get-path-controot"),n.debug(e);const o=await t.get_path_controot();return n.debug(o),n.info("Run command: pickles2-get-path-controot; done"),{content:[{type:"text",text:o}]}})),server.tool("pickles2-get-realpath-docroot","Get DOCUMENT_ROOT path.",{},(async e=>{n.info("Run command: pickles2-get-realpath-docroot"),n.debug(e);const o=await t.get_realpath_docroot();return n.debug(o),n.info("Run command: pickles2-get-realpath-docroot; done"),{content:[{type:"text",text:o}]}})),server.tool("pickles2-get-path-content","Get content path.",{path:z.string().describe("Page path")},(async e=>{n.info("Run command: pickles2-get-path-content"),n.debug(e);const o=await t.get_path_content(e.path);return n.debug(o),n.info("Run command: pickles2-get-path-content; done"),{content:[{type:"text",text:o}]}})),server.tool("pickles2-path-files","Get local resource directory path.",{path:z.string().describe("Page path"),resource:z.string().optional().describe("Resource path")},(async e=>{n.info("Run command: pickles2-path-files"),n.debug(e);const o=await t.path_files(e.path,e.resource);return n.debug(o),n.info("Run command: pickles2-path-files; done"),{content:[{type:"text",text:o}]}})),server.tool("pickles2-realpath-files","Get local resource directory server path.",{path:z.string().describe("Page path"),resource:z.string().optional().describe("Resource path")},(async e=>{n.info("Run command: pickles2-realpath-files"),n.debug(e);const o=await t.realpath_files(e.path,e.resource);return n.debug(o),n.info("Run command: pickles2-realpath-files; done"),{content:[{type:"text",text:o}]}})),server.tool("pickles2-path-files-cache","Get local resource cache directory path.",{path:z.string().describe("Page path"),resource:z.string().optional().describe("Resource path")},(async e=>{n.info("Run command: pickles2-path-files-cache"),n.debug(e);const o=await t.path_files_cache(e.path,e.resource);return n.debug(o),n.info("Run command: pickles2-path-files-cache; done"),{content:[{type:"text",text:o}]}})),server.tool("pickles2-realpath-files-cache","Get local resource cache directory server path.",{path:z.string().describe("Page path"),resource:z.string().optional().describe("Resource path")},(async e=>{n.info("Run command: pickles2-realpath-files-cache"),n.debug(e);const o=await t.realpath_files_cache(e.path,e.resource);return n.debug(o),n.info("Run command: pickles2-realpath-files-cache; done"),{content:[{type:"text",text:o}]}})),server.tool("pickles2-realpath-files-private-cache","Get content-specific private cache directory server path.",{path:z.string().describe("Page path"),resource:z.string().optional().describe("Resource path")},(async e=>{n.info("Run command: pickles2-realpath-files-private-cache"),n.debug(e);const o=await t.realpath_files_private_cache(e.path,e.resource);return n.debug(o),n.info("Run command: pickles2-realpath-files-private-cache; done"),{content:[{type:"text",text:o}]}})),server.tool("pickles2-get-domain","Get domain.",{},(async e=>{n.info("Run command: pickles2-get-domain"),n.debug(e);const o=await t.get_domain();return n.debug(o),n.info("Run command: pickles2-get-domain; done"),{content:[{type:"text",text:o}]}})),server.tool("pickles2-get-directory-index","Get directory index list.",{},(async e=>{n.info("Run command: pickles2-get-directory-index"),n.debug(e);const o=await t.get_directory_index(),i=JSON.stringify(o);return n.debug(i),n.info("Run command: pickles2-get-directory-index; done"),{content:[{type:"text",text:i}]}})),server.tool("pickles2-get-directory-index-primary","Get primary directory index.",{},(async e=>{n.info("Run command: pickles2-get-directory-index-primary"),n.debug(e);const o=await t.get_directory_index_primary();return n.debug(o),n.info("Run command: pickles2-get-directory-index-primary; done"),{content:[{type:"text",text:o}]}})),server.tool("pickles2-get-path-proc-type","Get path processing type.",{path:z.string().describe("File path")},(async e=>{n.info("Run command: pickles2-get-path-proc-type"),n.debug(e);const o=await t.get_path_proc_type(e.path);return n.debug(o),n.info("Run command: pickles2-get-path-proc-type; done"),{content:[{type:"text",text:o}]}})),server.tool("pickles2-href","Generate link path.",{path:z.string().describe("Link to path")},(async e=>{n.info("Run command: pickles2-href"),n.debug(e);const o=await t.href(e.path);return n.debug(o),n.info("Run command: pickles2-href; done"),{content:[{type:"text",text:o}]}})),server.tool("pickles2-is-match-dynamic-path","Check if path matches dynamic path.",{path:z.string().describe("Path to check")},(async e=>{n.info("Run command: pickles2-is-match-dynamic-path"),n.debug(e);const o=(await t.is_match_dynamic_path(e.path)).toString();return n.debug(o),n.info("Run command: pickles2-is-match-dynamic-path; done"),{content:[{type:"text",text:o}]}})),server.tool("pickles2-is-page-in-breadcrumb","Check if page exists in breadcrumb.",{path:z.string().describe("Page path"),path_in:z.string().describe("Path to check in breadcrumb")},(async e=>{n.info("Run command: pickles2-is-page-in-breadcrumb"),n.debug(e);const o=(await t.is_page_in_breadcrumb(e.path,e.path_in)).toString();return n.debug(o),n.info("Run command: pickles2-is-page-in-breadcrumb; done"),{content:[{type:"text",text:o}]}})),server.tool("pickles2-is-ignore-path","Check if path is ignore path.",{path:z.string().describe("Path to check")},(async e=>{n.info("Run command: pickles2-is-ignore-path"),n.debug(e);const o=(await t.is_ignore_path(e.path)).toString();return n.debug(o),n.info("Run command: pickles2-is-ignore-path; done"),{content:[{type:"text",text:o}]}})),server.tool("pickles2-publish","Publish Pickles 2 project.",{options:z.object({path_region:z.string().optional().describe("Path region to publish"),paths_region:z.array(z.string()).optional().describe("Path regions to publish"),paths_ignore:z.array(z.string()).optional().describe("Paths to ignore"),keep_cache:z.boolean().optional().describe("Keep cache")}).optional().describe("Publish options")},(async e=>{n.info("Run command: pickles2-publish"),n.debug(e);const o=await t.publish(e?.options);return n.debug(o),n.info("Run command: pickles2-publish; done"),{content:[{type:"text",text:o}]}})),server.tool("pickles2-clearcache","Clear the Pickles 2 cache.",{},(async e=>{n.info("Run command: pickles2-clearcache"),n.debug(e);const o=await t.clearcache();return n.debug(o),n.info("Run command: pickles2-clearcache; done"),{content:[{type:"text",text:o}]}})),server.tool("pickles2-query","Execute a custom query to Pickles 2.",{path:z.string().describe("Query path"),options:z.object({method:z.string().optional().describe("HTTP method"),body:z.string().optional().describe("Request body"),bodyFile:z.string().optional().describe("Path to request body file")}).optional().describe("Query options")},(async e=>{n.info("Run command: pickles2-query"),n.debug(e);const o=await t.query(e.path,e.options);return n.debug(o),n.info("Run command: pickles2-query; done"),{content:[{type:"text",text:o}]}})),server.tool("pickles2-px-command","Execute a PX command.",{command:z.string().describe("PX command"),path:z.string().optional().describe("Path"),params:z.record(z.string()).optional().describe("Command parameters")},(async e=>{n.info("Run command: pickles2-px-command"),n.debug(e);const o=await t.px_command(e.command,e.path,e.params),i=JSON.stringify(o);return n.debug(i),n.info("Run command: pickles2-px-command; done"),{content:[{type:"text",text:i}]}}));const o=new StdioServerTransport;await server.connect(o)})),program.parse(process.argv);
//# sourceMappingURL=/sm/37808b810e7d80e16ee9502d5f17add7bfc5a30d86be504befdd22277afc5d58.map