#!/usr/bin/env node import { DuckDBService } from '../duckdb/service.js'; import { MCPClient } from '../client/MCPClient.js'; import { SpaceContext, SpaceContextFactory } from '../context/SpaceContext.js'; /** * DuckDB MCP Server * Exposes DuckDB functionality through Model Context Protocol */ declare class DuckDBMCPServer { private server; private duckdb; private mcpClient; private virtualTables; private federation; private spaceFactory?; private currentSpace?; private embeddedMode; private ducklakeHandlers; private motherduckHandlers; constructor(config?: { embeddedMode?: boolean; duckdbService?: DuckDBService; spaceFactory?: SpaceContextFactory; }); /** * Setup MCP request handlers */ private setupHandlers; /** * Validate SQL query for security */ private validateQuery; /** * Classify whether a SQL query is destructive, returning the operation type or null if safe. */ private classifyDestructiveQuery; /** * Request user confirmation for destructive SQL via MCP elicitation. * Returns true if the user confirms, false otherwise (including when elicitation is unsupported). */ private requestDestructiveQueryConfirmation; /** * Get native tool handlers for embedding in other MCP servers * This is the main API for using DuckDB MCP as a library */ getNativeHandlers(): { [k: string]: (args: any) => Promise<{ success: boolean; rowCount: number; executionTime: number; data: any[]; error?: undefined; } | { success: boolean; error: string; rowCount?: undefined; executionTime?: undefined; data?: undefined; }> | Promise<{ success: boolean; schema: string; tables: any[]; error?: undefined; } | { success: boolean; error: string; schema?: undefined; tables?: undefined; }> | Promise<{ success: boolean; table: string; schema: string; columns: any[]; error?: undefined; } | { success: boolean; error: string; table?: undefined; schema?: undefined; columns?: undefined; }> | Promise<{ success: boolean; message: string; rowCount: any; error?: undefined; } | { success: boolean; error: string; message?: undefined; rowCount?: undefined; }> | Promise<{ success: boolean; message: string; path: string; format: "csv" | "json" | "parquet"; error?: undefined; } | { success: boolean; error: string; message?: undefined; path?: undefined; format?: undefined; }>; }; /** * Get native tool definitions for MCP registration */ getNativeToolDefinitions(): ({ name: string; description: string; inputSchema: { type: string; properties: { sql: { type: string; description: string; }; limit: { type: string; description: string; default: number; }; schema?: undefined; table_name?: undefined; path?: undefined; options?: undefined; query?: undefined; format?: undefined; }; required: string[]; }; } | { name: string; description: string; inputSchema: { type: string; properties: { schema: { type: string; description: string; default: string; }; sql?: undefined; limit?: undefined; table_name?: undefined; path?: undefined; options?: undefined; query?: undefined; format?: undefined; }; required?: undefined; }; } | { name: string; description: string; inputSchema: { type: string; properties: { table_name: { type: string; description: string; }; schema: { type: string; description: string; default: string; }; sql?: undefined; limit?: undefined; path?: undefined; options?: undefined; query?: undefined; format?: undefined; }; required: string[]; }; } | { name: string; description: string; inputSchema: { type: string; properties: { path: { type: string; description: string; }; table_name: { type: string; description: string; }; options: { type: string; properties: { header: { type: string; description: string; }; delimiter: { type: string; description: string; }; quote: { type: string; description: string; }; }; }; sql?: undefined; limit?: undefined; schema?: undefined; query?: undefined; format?: undefined; }; required: string[]; }; } | { name: string; description: string; inputSchema: { type: string; properties: { path: { type: string; description: string; }; table_name: { type: string; description: string; }; sql?: undefined; limit?: undefined; schema?: undefined; options?: undefined; query?: undefined; format?: undefined; }; required: string[]; }; } | { name: string; description: string; inputSchema: { type: string; properties: { query: { type: string; description: string; }; path: { type: string; description: string; }; format: { type: string; enum: string[]; description: string; default: string; }; sql?: undefined; limit?: undefined; schema?: undefined; table_name?: undefined; options?: undefined; }; required: string[]; }; })[]; /** * Switch to a different space context (hidden feature) * @internal */ switchSpace(spaceId: string, config?: any): Promise; /** * Get the DuckDB service instance */ getDuckDBService(): DuckDBService; /** * Get the MCP client instance */ getMCPClient(): MCPClient; /** * Start the MCP server */ start(): Promise; } export { DuckDBMCPServer }; //# sourceMappingURL=mcp-server.d.ts.map