@rsc-kit/mcp
Version:
An MCP server over what an rsc-kit build decided: the routes, why each one is static or not, and what it costs the browser.
66 lines (65 loc) • 2.19 kB
TypeScript
export interface ReportedRoute {
url: string;
component: string;
type: string;
reason: string | null;
warning: string | null;
/** How it was stored, when that is worth knowing - "no client components, so ships no javascript". */
note?: string | null;
clientJs: number | null;
}
export interface ReportedApiRoute {
url: string;
name: string;
type: string;
reason: string | null;
/** Stored, and froze a value that will not be the same tomorrow. Absent from older reports. */
warning?: string | null;
}
export interface ReportedAction {
id: string;
name: string;
file: string;
/** Built by createActionClient, so its middleware ran. */
client: boolean;
/** A read (GET) rather than a mutation. */
query: boolean;
}
export interface BuildReport {
version: number;
routes: ReportedRoute[];
apis: ReportedApiRoute[];
/** Absent from reports written before actions were audited. */
actions?: ReportedAction[];
/**
* Server files importing `cache` from React, relative to the source dir.
* React's memoises only inside a component render; in a guard, an action
* or an api route it calls straight through. Absent from older reports.
*/
reactCache?: string[];
/** Server files importing a client library: the packages, and who imports the file. Absent from older reports. */
clientImports?: {
file: string;
packages: string[];
from: string | null;
}[];
totals: {
static: number;
partial: number;
dynamic: number;
failed: number;
};
}
export declare class NoReport extends Error {
constructor(root: string);
}
/** The report, and how old it is. */
export declare function loadReport(root: string): {
report: BuildReport;
builtAt: Date;
from: string;
};
/** What each classification means, in one line, for an answer that has to stand alone. */
export declare const MEANING: Record<string, string>;
/** A route by url, tolerating a trailing slash either way. */
export declare function routeFor(report: BuildReport, url: string): ReportedRoute | ReportedApiRoute | null;