/** * Provider port interfaces. * * ToolRegistrar is the port that decouples providers from the concrete MCP SDK * McpServer class. Providers register their tools and resources against this * interface; the MCP server adapter (wired in Phase 4's composition root) * implements it. * * No import from @modelcontextprotocol/sdk must ever appear in this file. */ /** * Port interface for registering MCP tools and resource templates. * * Providers depend on this abstraction, not on the MCP SDK's McpServer * directly. The concrete McpServer implements ToolRegistrar and is wired in * Phase 4's composition root. * * `schema` and `handler` are typed as `unknown` so providers can pass Zod * schemas and typed MCP handlers without this interface importing from the * MCP SDK. */ export interface ToolRegistrar { /** * Register an MCP tool. * * @param name - Tool identifier exposed to MCP clients (e.g. 'gitlab_list_issues') * @param schema - Input schema (Zod schema in practice; typed as unknown to avoid SDK import) * @param handler - Request handler (typed as unknown to avoid SDK import) */ registerTool(name: string, schema: unknown, handler: unknown): void; /** * Register an MCP resource template. * * @param template - URI template or metadata describing the resource * @param handler - Resource handler (typed as unknown to avoid SDK import) */ registerResource(template: unknown, handler: unknown): void; } /** * Interface that all MCP providers must implement. * * A provider owns one external service integration (e.g. GitLab, Atlassian). * It registers its tools and resources via the ToolRegistrar port so it * remains independent of the MCP SDK. */ export interface Provider { /** Stable identifier for this provider (e.g. 'gitlab', 'atlassian'). */ readonly name: string; /** * Register all MCP tools this provider exposes. * * Called once at server startup before the first client connects. * * @param registrar - ToolRegistrar port — never the raw McpServer */ registerTools(registrar: ToolRegistrar): void; /** * Register all MCP resource templates this provider exposes. * * Called once at server startup before the first client connects. * * @param registrar - ToolRegistrar port — never the raw McpServer */ registerResources(registrar: ToolRegistrar): void; /** * Check whether this provider is ready to serve requests. * * Resolves when the provider has a valid token and the upstream API is * reachable. Rejects with a descriptive error when it is not ready. */ ready(): Promise; /** * Release provider resources on server shutdown. * * Implementations should close connections and flush any pending state. * Must not throw — rejections indicate a non-fatal cleanup failure. */ shutdown(): Promise; } //# sourceMappingURL=types.d.ts.map