UNPKG

endfield-mcp

Version:

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

54 lines (53 loc) • 2.36 kB
/** * Endfield Talos Wiki (endfield.wiki.gg) API client. * * Ported from PRTS-MCP's `ts/src/api/prtsWiki.ts`. Two substantive * differences from the PRTS client: * * 1. WAF handling — wiki.gg blocks bare/curl-like User-Agents. Every * request carries a browser UA + Referer + Accept header. These are * pulled from the loaded Config so they can be overridden per-deployment * (EF_WIKI_UA / EF_WIKI_REFERER / EF_WIKI_ENDPOINT). * * 2. Content language — endfield.wiki.gg is primarily English. Snippets * and page text come back in English by default; the calling LLM is * responsible for bridging into the user's language. Tool descriptions * stay Chinese (the project's user-facing language), but the strings * returned by this client are whatever language the wiki page is in. * * All MediaWiki action=parse / action=query shapes are identical to PRTS, * so the response parsing ports verbatim. */ import { type Config } from "../config.js"; export declare function bindWikiConfig(cfg: Config): void; export interface SearchResult { title: string; snippet: string; } export interface SearchResponse { totalHits: number; results: SearchResult[]; } /** Search endfield.wiki.gg. */ export declare function searchWiki(query: string, limit?: number, searchMode?: "text" | "title", filterTechnical?: boolean): Promise<SearchResponse>; /** Fetch rendered plain-text content for a wiki page. */ export declare function readPage(title: string, sectionIndex?: number): Promise<string>; /** List section table of contents for a page. */ export declare function listSections(title: string): Promise<Array<{ index: string; level: string; line: string; fromTitle: string; }>>; /** Get category tags for a page. */ export declare function getCategories(title: string): Promise<string[]>; export interface LinksResult { title: string; links: string[]; total: number; hasMore: boolean; } /** Get outbound links (parse prop=links) or inbound backlinks (list=backlinks). */ export declare function getLinks(title: string, direction?: "outbound" | "inbound", limit?: number): Promise<LinksResult>; /** Extract structured template data (parsetree) from a page. */ export declare function getTemplateData(title: string): Promise<Record<string, Record<string, unknown>>>;