/** * Resolving credentials, and the multi-site model. * * WordPress has no concept of an account that spans installs. Every site is its * own database with its own users, so "which site" is not a preference here, it * is part of the address. A server bound to one install would mean restarting it * to move between a blog and a client site, so every tool takes an optional * `site` and the one that acts when none is named is chosen deliberately. * * Three sources, in priority order: * 1. WORDPRESS_SITES JSON array, the readable form * 2. WP_SITES pipe-delimited, kept because existing configs use it * 3. WORDPRESS_SITE_URL + _USERNAME + _APP_PASSWORD, the single-site variables * * `configFromSites` exists for the hosted case, where credentials arrive per * request from a connector rather than from the environment. That is the whole * reason the tools take a config rather than reading `process.env` themselves. */ export type Site = { /** Short label a tool's `site` argument matches, e.g. "blog". */ name: string; /** Origin with no trailing slash, e.g. https://example.com */ url: string; username: string; /** * An application password from Users > Profile > Application Passwords. * WordPress displays it in space-separated groups and accepts it either way, * so the spaces are preserved rather than stripped: a user pasting exactly * what WordPress showed them should work. */ appPassword: string; }; export type Config = { sites: Site[]; /** Which site acts when a tool names none. Empty means "the only one". */ defaultSite?: string; /** What Slipway enforces, reported by wp_list_sites and the sites resource. */ readOnly: boolean; allowDestructive: boolean; requestTimeoutMs: number; maxRetries: number; userAgent: string; }; export declare const DEFAULT_TIMEOUT_MS = 30000; export declare const USER_AGENT = "wordpress-mcp (+https://github.com/thenavidm/wordpress-mcp-cli)"; /** Trim, force a scheme, drop any trailing slash. */ export declare function normalizeSiteUrl(raw: string): string; /** * A stable short name for a site that did not supply one. * * The host with the public suffix and any `www.` removed, which is what a * person would call it. Collisions are resolved by the caller, since two * installs on the same host is a real setup (a subdirectory multisite). */ export declare function siteNameFromUrl(url: string): string; /** Build a config directly, for a host that holds credentials of its own. */ export declare function configFromSites(sites: Array>, options?: Partial>): Config; export declare function loadConfig(env?: NodeJS.ProcessEnv): Config; /** * Pick the site a call acts on. * * Named site wins. Then WORDPRESS_DEFAULT_SITE. Then, only when exactly one is * configured, that one. With several configured and no default set, this * refuses rather than guessing: picking whichever happened to be first is how * a draft lands on a client's site instead of your own. */ export declare function selectSite(config: Config, hint?: string): Site;