UNPKG

endfield-mcp

Version:

MCP Server for Arknights: Endfield (TypeScript / stdio + Streamable HTTP)

81 lines (80 loc) • 3.77 kB
/** * Runtime configuration for Endfield-MCP. * * Path design mirrors PRTS-MCP's config layer, adapted for the Endfield * data-source reality: * * - Wiki content is fetched live from endfield.wiki.gg (MediaWiki 1.43.6), * not from a local sync. The WAF there requires browser-like headers, * so USER_AGENT / WIKI_REFERER / WIKI_ACCEPT are first-class config. * * - GameData is mirrored to a self-hosted release repository (text-only * JSON tables, no binary assets). EF_DATA_PATH points at the on-disk * location where auto-sync writes those tables. A user-set EF_DATA_PATH * disables auto-sync exactly like PRTS-MCP's GAMEDATA_PATH. * * Path priority (highest → lowest): * 1. EF_DATA_PATH env var — user-supplied; auto-sync DISABLED. * 2. /data/endfield — Docker volume (detected via * EF_MCP_ROOT == "/app"). * 3. Per-user data dir — %LOCALAPPDATA%\endfield-mcp\ (Win) * ~/.local/share/endfield-mcp/ (Unix). */ /** * Default MediaWiki API endpoint for the Endfield Talos Wiki. * endfield.wiki.gg runs MediaWiki 1.43.6; its WAF blocks bare/curl-like * User-Agents, so requests must carry a browser UA + Referer (see * endfieldWiki.ts). */ export declare const DEFAULT_WIKI_ENDPOINT = "https://endfield.wiki.gg/api.php"; /** * Referer sent with every wiki request. wiki.gg's WAF keyed on this during * probing — without it, api.php returns the "Blocked - wiki.gg" stub. */ export declare const DEFAULT_WIKI_REFERER = "https://endfield.wiki.gg/"; /** * Browser-style User-Agent. The WAF rejects the short bot UA we use for * GitHub; a realistic Chrome UA passes cleanly. Configurable via EF_WIKI_UA. */ export declare const DEFAULT_WIKI_UA: string; /** Minimum seconds between wiki API requests (politeness, not WAF-driven). */ export declare const RATE_LIMIT_INTERVAL = 1.5; export declare const BUNDLED_DATA_PATH: string; export declare const DEFAULT_DATA_PATH: string; export type Transport = "stdio" | "http"; export declare function resolveTransport(): Transport; export interface Config { /** Wiki API endpoint (EF_WIKI_ENDPOINT override or default). */ wikiEndpoint: string; /** Referer header for wiki requests. */ wikiReferer: string; /** User-Agent header for wiki requests. */ wikiUserAgent: string; /** Sync write target for GameData (volume or user dir). */ dataPath: string; /** Bundled read-only GameData fallback path (Docker / npm bundle). */ bundledDataPath: string; /** True when EF_DATA_PATH was explicitly set by the user. */ isCustomDataPath: boolean; /** Transport selected via EF_TRANSPORT. */ transport: Transport; /** HTTP port (when transport == "http"). */ httpPort: number; /** HTTP host (when transport == "http"). */ httpHost: string; /** Mirror URL cascade for GitHub-style asset downloads. */ githubMirrors: string[]; } export declare function loadConfig(): Config; /** Parse GITHUB_MIRRORS env var into proxy base URLs (trailing slash stripped). */ /** Parse a GITHUB_MIRRORS env string into proxy base URLs (trailing slash stripped). */ export declare function parseMirrors(raw: string): string[]; /** * Files that must be present for the GameData domain to be considered * "complete". Currently unused — sync orchestration relies on each * dataset's own `requiredFiles` (see datasets.ts) rather than this * global list. Retained as an extension point in case future cross- * dataset completeness probes are needed; safe to leave empty. */ export declare const REQUIRED_DATA_FILES: readonly string[]; export declare function filesComplete(root: string): boolean;