@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
47 lines • 2.51 kB
TypeScript
import type { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { Type } from "typebox";
import type { ToolDefinition } from "../../types.ts";
import type { McpCachedServerCatalog } from "./catalog-cache.ts";
import type { ServerConnection } from "./connection.ts";
import type { McpToolDetails } from "./expose/register.ts";
import type { McpOutputArtifacts } from "./guard/output-guard.ts";
import { applyMcpOutputGuard } from "./guard/output-guard.ts";
import { type McpRequestOrigin } from "./request-origin.ts";
export interface McpResourceServer {
readonly ensureFresh?: () => Promise<void>;
readonly requestOrigin?: () => McpRequestOrigin | undefined;
readonly server: string;
readonly connection: ServerConnection;
readonly agentDir?: string;
readonly artifacts?: McpOutputArtifacts;
readonly outputGuard?: Parameters<typeof applyMcpOutputGuard>[1]["outputGuard"];
readonly requestTimeoutMs?: number;
readonly resources: NonNullable<McpCachedServerCatalog["resources"]>;
}
/** Route resource updated notifications into the shared refresh path. */
export declare function subscribeMcpResourceUpdated(client: Client, onChange: () => void): void;
/** Best-effort per-resource subscriptions when the server declares support. */
export declare function ensureMcpResourceSubscriptions(client: Client, resources: ReadonlyArray<{
uri: string;
}>): Promise<void>;
/** Read one resource and flatten its contents to guarded text. */
export declare function readMcpResourceAsText(server: McpResourceServer, uri: string, signal?: AbortSignal): Promise<string>;
declare const ListParams: Type.TObject<{
server: Type.TOptional<Type.TString>;
}>;
declare const ReadParams: Type.TObject<{
server: Type.TString;
uri: Type.TString;
}>;
type McpUtilityTool = ToolDefinition<typeof ListParams | typeof ReadParams, McpToolDetails | undefined, unknown>;
/** The two model-facing utility tools. Register only when servers() is non-empty. */
export declare function createMcpResourceTools(servers: () => readonly McpResourceServer[]): McpUtilityTool[];
export interface McpMentionExpansion {
readonly text: string;
readonly changed: boolean;
readonly notices: string[];
}
/** Expand `@mcp:<server>/<uri>` mentions; failures leave the mention intact. */
export declare function expandMcpResourceMentions(text: string, servers: () => readonly McpResourceServer[]): Promise<McpMentionExpansion>;
export {};
//# sourceMappingURL=resources.d.ts.map