@supabase/mcp-server-supabase 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-TJWN2AAW.cjs → chunk-536WYGSZ.cjs} +2 -2
- package/dist/{chunk-TJWN2AAW.cjs.map → chunk-536WYGSZ.cjs.map} +1 -1
- package/dist/chunk-BAHK6DOT.js +280 -0
- package/dist/chunk-BAHK6DOT.js.map +1 -0
- package/dist/{chunk-R42L3CIR.cjs → chunk-ETDG2YWQ.cjs} +3 -3
- package/dist/chunk-ETDG2YWQ.cjs.map +1 -0
- package/dist/chunk-HJCSISZG.cjs +280 -0
- package/dist/chunk-HJCSISZG.cjs.map +1 -0
- package/dist/{chunk-Q7RZ5JID.js → chunk-LGYQEOKZ.js} +2 -2
- package/dist/{chunk-Q7RZ5JID.js.map → chunk-LGYQEOKZ.js.map} +1 -1
- package/dist/chunk-MGV6E7CY.js +17 -0
- package/dist/chunk-MGV6E7CY.js.map +1 -0
- package/dist/chunk-UY7NVUDB.cjs +17 -0
- package/dist/chunk-UY7NVUDB.cjs.map +1 -0
- package/dist/{chunk-B4JQTSBD.js → chunk-ZKX2YAIQ.js} +3 -3
- package/dist/chunk-ZKX2YAIQ.js.map +1 -0
- package/dist/cli.cjs +3 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.js +3 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +94 -8
- package/dist/index.d.ts +94 -8
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/platform/api-platform.cjs +1 -1
- package/dist/platform/api-platform.js +1 -1
- package/dist/platform/index.cjs +1 -1
- package/dist/platform/index.d.cts +11 -3
- package/dist/platform/index.d.ts +11 -3
- package/dist/platform/index.js +1 -1
- package/package.json +4 -3
- package/dist/chunk-54OF3SOV.js +0 -17
- package/dist/chunk-54OF3SOV.js.map +0 -1
- package/dist/chunk-A547ZGK6.cjs +0 -17
- package/dist/chunk-A547ZGK6.cjs.map +0 -1
- package/dist/chunk-B4JQTSBD.js.map +0 -1
- package/dist/chunk-LVRTD44F.js +0 -259
- package/dist/chunk-LVRTD44F.js.map +0 -1
- package/dist/chunk-R42L3CIR.cjs.map +0 -1
- package/dist/chunk-YOFEI5MG.cjs +0 -259
- package/dist/chunk-YOFEI5MG.cjs.map +0 -1
- package/dist/transports/stdio.cjs +0 -3
- package/dist/transports/stdio.cjs.map +0 -1
- package/dist/transports/stdio.js +0 -3
- package/dist/transports/stdio.js.map +0 -1
- /package/dist/{transports/stdio.d.cts → cli.d.cts} +0 -0
- /package/dist/{transports/stdio.d.ts → cli.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/platform/api-platform.ts","../src/logs.ts","../src/management-api/index.ts","../src/password.ts"],"sourcesContent":["import {\n getMultipartBoundary,\n parseMultipartStream,\n} from '@mjackson/multipart-parser';\nimport type { InitData } from '@supabase/mcp-utils';\nimport { fileURLToPath } from 'node:url';\nimport packageJson from '../../package.json' with { type: 'json' };\nimport { getDeploymentId, normalizeFilename } from '../edge-function.js';\nimport { getClickHouseLogQuery } from '../logs.js';\nimport {\n assertProjectScopedSuccess,\n assertSuccess,\n createManagementApiClient,\n} from '../management-api/index.js';\nimport { generatePassword } from '../password.js';\nimport {\n applyMigrationOptionsSchema,\n createBranchOptionsSchema,\n createProjectOptionsSchema,\n deployEdgeFunctionOptionsSchema,\n executeSqlOptionsSchema,\n getLogsOptionsSchema,\n queryLogsOptionsSchema,\n resetBranchOptionsSchema,\n type AccountOperations,\n type ApiKey,\n type ApiKeyType,\n type ApplyMigrationOptions,\n type BranchingOperations,\n type CreateBranchOptions,\n type CreateProjectOptions,\n type DatabaseOperations,\n type DebuggingOperations,\n type DeployEdgeFunctionOptions,\n type DevelopmentOperations,\n type SuccessResponse,\n type EdgeFunction,\n type EdgeFunctionsOperations,\n type EdgeFunctionWithBody,\n type ExecuteSqlOptions,\n type GetLogsOptions,\n type QueryLogsOptions,\n type ResetBranchOptions,\n type SecretOperations,\n type StorageConfig,\n type StorageOperations,\n type SupabasePlatform,\n} from './index.js';\n\nconst { version } = packageJson;\n\nconst SUCCESS_RESPONSE: SuccessResponse = { success: true };\n\nexport type SupabaseApiPlatformOptions = {\n /**\n * The access token for the Supabase Management API.\n */\n accessToken: string;\n\n /**\n * The API URL for the Supabase Management API.\n */\n apiUrl?: string;\n};\n\n/**\n * Creates a Supabase platform implementation using the Supabase Management API.\n */\nexport function createSupabaseApiPlatform(\n options: SupabaseApiPlatformOptions\n): SupabasePlatform {\n const { accessToken, apiUrl } = options;\n\n const managementApiUrl = apiUrl ?? 'https://api.supabase.com';\n\n let managementApiClient = createManagementApiClient(\n managementApiUrl,\n accessToken\n );\n\n const account: AccountOperations = {\n async listOrganizations() {\n const response = await managementApiClient.GET('/v1/organizations');\n\n assertSuccess(response, 'Failed to fetch organizations');\n\n return response.data;\n },\n async getOrganization(organizationId: string) {\n const response = await managementApiClient.GET(\n '/v1/organizations/{slug}',\n {\n params: {\n path: {\n slug: organizationId,\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to fetch organization');\n\n return response.data;\n },\n async listProjects() {\n const response = await managementApiClient.GET('/v1/projects');\n\n assertSuccess(response, 'Failed to fetch projects');\n\n return response.data;\n },\n async getProject(projectId: string) {\n const response = await managementApiClient.GET('/v1/projects/{ref}', {\n params: {\n path: {\n ref: projectId,\n },\n },\n });\n assertSuccess(response, 'Failed to fetch project');\n return response.data;\n },\n async createProject(options: CreateProjectOptions) {\n const { name, organization_id, region, db_pass } =\n createProjectOptionsSchema.parse(options);\n\n const response = await managementApiClient.POST('/v1/projects', {\n body: {\n name,\n region,\n organization_slug: organization_id,\n db_pass:\n db_pass ??\n generatePassword({\n length: 16,\n numbers: true,\n uppercase: true,\n lowercase: true,\n }),\n },\n });\n\n assertSuccess(response, 'Failed to create project');\n\n return response.data;\n },\n async pauseProject(projectId: string) {\n const response = await managementApiClient.POST(\n '/v1/projects/{ref}/pause',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to pause project');\n },\n async restoreProject(projectId: string) {\n const response = await managementApiClient.POST(\n '/v1/projects/{ref}/restore',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to restore project');\n },\n };\n\n const database: DatabaseOperations = {\n async executeSql<T>(projectId: string, options: ExecuteSqlOptions) {\n const { query, parameters, read_only } =\n executeSqlOptionsSchema.parse(options);\n\n const response = await managementApiClient.POST(\n '/v1/projects/{ref}/database/query',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n body: {\n query,\n parameters,\n read_only,\n },\n }\n );\n\n assertProjectScopedSuccess(\n response,\n 'Failed to execute SQL query',\n projectId\n );\n\n return response.data as unknown as T[];\n },\n async listMigrations(projectId: string) {\n const response = await managementApiClient.GET(\n '/v1/projects/{ref}/database/migrations',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n }\n );\n\n assertProjectScopedSuccess(\n response,\n 'Failed to fetch migrations',\n projectId\n );\n\n return response.data;\n },\n async applyMigration(projectId: string, options: ApplyMigrationOptions) {\n const { name, query } = applyMigrationOptionsSchema.parse(options);\n\n const response = await managementApiClient.POST(\n '/v1/projects/{ref}/database/migrations',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n body: {\n name,\n query,\n },\n }\n );\n\n assertProjectScopedSuccess(\n response,\n 'Failed to apply migration',\n projectId\n );\n\n // Intentionally don't return the result of the migration\n // to avoid prompt injection attacks. If the migration failed,\n // it will throw an error.\n },\n };\n\n const debugging: DebuggingOperations = {\n logsDialect: 'clickhouse',\n async getLogs(projectId: string, options: GetLogsOptions) {\n const { service, iso_timestamp_start, iso_timestamp_end } =\n getLogsOptionsSchema.parse(options);\n\n const sql = getClickHouseLogQuery(service);\n\n const response = await managementApiClient.GET(\n '/v1/projects/{ref}/analytics/endpoints/logs',\n {\n params: {\n path: {\n ref: projectId,\n },\n query: {\n sql,\n iso_timestamp_start,\n iso_timestamp_end,\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to fetch logs');\n\n return response.data;\n },\n async queryLogs(projectId: string, options: QueryLogsOptions) {\n const { sql, iso_timestamp_start, iso_timestamp_end } =\n queryLogsOptionsSchema.parse(options);\n\n const response = await managementApiClient.GET(\n '/v1/projects/{ref}/analytics/endpoints/logs',\n {\n params: {\n path: {\n ref: projectId,\n },\n query: {\n sql,\n iso_timestamp_start,\n iso_timestamp_end,\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to query logs');\n\n return response.data;\n },\n async getSecurityAdvisors(projectId: string) {\n const response = await managementApiClient.GET(\n '/v1/projects/{ref}/advisors/security',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to fetch security advisors');\n\n return response.data;\n },\n async getPerformanceAdvisors(projectId: string) {\n const response = await managementApiClient.GET(\n '/v1/projects/{ref}/advisors/performance',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to fetch performance advisors');\n\n return response.data;\n },\n };\n\n const development: DevelopmentOperations = {\n async getProjectUrl(projectId: string): Promise<string> {\n const apiUrl = new URL(managementApiUrl);\n return `https://${projectId}.${getProjectDomain(apiUrl.hostname)}`;\n },\n async getPublishableKeys(projectId: string): Promise<ApiKey[]> {\n const response = await managementApiClient.GET(\n '/v1/projects/{ref}/api-keys',\n {\n params: {\n path: {\n ref: projectId,\n },\n query: {\n reveal: 'false',\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to fetch API keys');\n\n // Try to check if legacy JWT-based keys are enabled\n // If this fails, we'll continue without the disabled field\n let legacyKeysEnabled: boolean | undefined = undefined;\n try {\n const legacyKeysResponse = await managementApiClient.GET(\n '/v1/projects/{ref}/api-keys/legacy',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n }\n );\n\n if (legacyKeysResponse.response.ok) {\n legacyKeysEnabled = legacyKeysResponse.data?.enabled ?? true;\n }\n } catch (error) {\n // If we can't fetch legacy key status, continue without it\n legacyKeysEnabled = undefined;\n }\n\n // Filter for client-safe keys: legacy 'anon' or publishable type\n const clientKeys =\n response.data?.filter(\n (key) => key.name === 'anon' || key.type === 'publishable'\n ) ?? [];\n\n if (clientKeys.length === 0) {\n throw new Error(\n 'No client-safe API keys (anon or publishable) found. Please create a publishable key in your project settings.'\n );\n }\n\n return clientKeys.map((key) => ({\n api_key: key.api_key!,\n name: key.name,\n type: (key.type === 'publishable'\n ? 'publishable'\n : 'legacy') satisfies ApiKeyType,\n // Only include disabled field if we successfully fetched legacy key status\n ...(legacyKeysEnabled !== undefined && {\n disabled: key.type === 'legacy' && !legacyKeysEnabled,\n }),\n description: key.description ?? undefined,\n id: key.id ?? undefined,\n }));\n },\n async generateTypescriptTypes(projectId: string) {\n const response = await managementApiClient.GET(\n '/v1/projects/{ref}/types/typescript',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to fetch TypeScript types');\n\n return response.data;\n },\n };\n\n const functions: EdgeFunctionsOperations = {\n async listEdgeFunctions(projectId: string) {\n const response = await managementApiClient.GET(\n '/v1/projects/{ref}/functions',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to fetch Edge Functions');\n\n return response.data.map((edgeFunction) => {\n const deploymentId = getDeploymentId(\n projectId,\n edgeFunction.id,\n edgeFunction.version\n );\n\n const entrypoint_path = edgeFunction.entrypoint_path\n ? normalizeFilename({\n deploymentId,\n filename: fileURLToPath(edgeFunction.entrypoint_path, {\n windows: false,\n }),\n })\n : undefined;\n\n const import_map_path = edgeFunction.import_map_path\n ? normalizeFilename({\n deploymentId,\n filename: fileURLToPath(edgeFunction.import_map_path, {\n windows: false,\n }),\n })\n : undefined;\n\n return {\n ...edgeFunction,\n entrypoint_path,\n import_map_path,\n };\n });\n },\n async getEdgeFunction(projectId: string, functionSlug: string) {\n const functionResponse = await managementApiClient.GET(\n '/v1/projects/{ref}/functions/{function_slug}',\n {\n params: {\n path: {\n ref: projectId,\n function_slug: functionSlug,\n },\n },\n }\n );\n\n if (functionResponse.error) {\n throw functionResponse.error;\n }\n\n assertSuccess(functionResponse, 'Failed to fetch Edge Function');\n\n const edgeFunction = functionResponse.data;\n\n const deploymentId = getDeploymentId(\n projectId,\n edgeFunction.id,\n edgeFunction.version\n );\n\n const entrypoint_path = edgeFunction.entrypoint_path\n ? normalizeFilename({\n deploymentId,\n filename: fileURLToPath(edgeFunction.entrypoint_path, {\n windows: false,\n }),\n })\n : undefined;\n\n const import_map_path = edgeFunction.import_map_path\n ? normalizeFilename({\n deploymentId,\n filename: fileURLToPath(edgeFunction.import_map_path, {\n windows: false,\n }),\n })\n : undefined;\n\n const bodyResponse = await managementApiClient.GET(\n '/v1/projects/{ref}/functions/{function_slug}/body',\n {\n params: {\n path: {\n ref: projectId,\n function_slug: functionSlug,\n },\n },\n headers: {\n Accept: 'multipart/form-data',\n },\n parseAs: 'stream',\n }\n );\n\n assertSuccess(bodyResponse, 'Failed to fetch Edge Function files');\n\n const contentType = bodyResponse.response.headers.get('content-type');\n\n if (!contentType || !contentType.startsWith('multipart/form-data')) {\n throw new Error(\n `Unexpected content type: ${contentType}. Expected multipart/form-data.`\n );\n }\n\n const boundary = getMultipartBoundary(contentType);\n\n if (!boundary) {\n throw new Error('No multipart boundary found in response headers');\n }\n\n if (!bodyResponse.data) {\n throw new Error('No data received from Edge Function body');\n }\n\n const files: EdgeFunctionWithBody['files'] = [];\n const parts = parseMultipartStream(bodyResponse.data, { boundary });\n\n for await (const part of parts) {\n if (part.isFile && part.filename) {\n files.push({\n name: normalizeFilename({\n deploymentId,\n filename: part.filename,\n }),\n content: part.text,\n });\n }\n }\n\n return {\n ...edgeFunction,\n entrypoint_path,\n import_map_path,\n files,\n };\n },\n async deployEdgeFunction(\n projectId: string,\n options: DeployEdgeFunctionOptions\n ) {\n let {\n name,\n entrypoint_path,\n import_map_path,\n verify_jwt,\n files: inputFiles,\n } = deployEdgeFunctionOptionsSchema.parse(options);\n\n let existingEdgeFunction: EdgeFunction | undefined;\n try {\n existingEdgeFunction = await functions.getEdgeFunction(projectId, name);\n } catch (error) {}\n\n const import_map_file = inputFiles.find((file) =>\n ['deno.json', 'import_map.json'].includes(file.name)\n );\n\n // Use existing import map path or file name heuristic if not provided\n import_map_path ??=\n existingEdgeFunction?.import_map_path ?? import_map_file?.name;\n\n const response = await managementApiClient.POST(\n '/v1/projects/{ref}/functions/deploy',\n {\n params: {\n path: {\n ref: projectId,\n },\n query: { slug: name },\n },\n body: {\n metadata: {\n name,\n entrypoint_path,\n import_map_path,\n verify_jwt,\n },\n file: inputFiles as any, // We need to pass file name and content to our serializer\n },\n bodySerializer(body) {\n const formData = new FormData();\n\n const blob = new Blob([JSON.stringify(body.metadata)], {\n type: 'application/json',\n });\n formData.append('metadata', blob);\n\n body.file?.forEach((f: any) => {\n const file: { name: string; content: string } = f;\n const blob = new Blob([file.content], {\n type: 'application/typescript',\n });\n formData.append('file', blob, file.name);\n });\n\n return formData;\n },\n }\n );\n\n assertSuccess(response, 'Failed to deploy Edge Function');\n\n return response.data;\n },\n };\n\n const branching: BranchingOperations = {\n async listBranches(projectId: string) {\n const response = await managementApiClient.GET(\n '/v1/projects/{ref}/branches',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n }\n );\n\n // There are no branches if branching is disabled\n if (response.response.status === 422) return [];\n assertSuccess(response, 'Failed to list branches');\n\n return response.data;\n },\n async createBranch(projectId: string, options: CreateBranchOptions) {\n const { name } = createBranchOptionsSchema.parse(options);\n\n const createBranchResponse = await managementApiClient.POST(\n '/v1/projects/{ref}/branches',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n body: {\n branch_name: name,\n },\n }\n );\n\n assertSuccess(createBranchResponse, 'Failed to create branch');\n\n return createBranchResponse.data;\n },\n async deleteBranch(branchId: string) {\n const response = await managementApiClient.DELETE(\n '/v1/branches/{branch_id_or_ref}',\n {\n params: {\n path: {\n branch_id_or_ref: branchId,\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to delete branch');\n },\n async mergeBranch(branchId: string) {\n const response = await managementApiClient.POST(\n '/v1/branches/{branch_id_or_ref}/merge',\n {\n params: {\n path: {\n branch_id_or_ref: branchId,\n },\n },\n body: {},\n }\n );\n\n assertSuccess(response, 'Failed to merge branch');\n },\n async resetBranch(branchId: string, options: ResetBranchOptions) {\n const { migration_version } = resetBranchOptionsSchema.parse(options);\n\n const response = await managementApiClient.POST(\n '/v1/branches/{branch_id_or_ref}/reset',\n {\n params: {\n path: {\n branch_id_or_ref: branchId,\n },\n },\n body: {\n migration_version,\n },\n }\n );\n\n assertSuccess(response, 'Failed to reset branch');\n },\n async rebaseBranch(branchId: string) {\n const response = await managementApiClient.POST(\n '/v1/branches/{branch_id_or_ref}/push',\n {\n params: {\n path: {\n branch_id_or_ref: branchId,\n },\n },\n body: {},\n }\n );\n\n assertSuccess(response, 'Failed to rebase branch');\n },\n };\n\n const storage: StorageOperations = {\n // Storage methods\n async listAllBuckets(project_id: string) {\n const response = await managementApiClient.GET(\n '/v1/projects/{ref}/storage/buckets',\n {\n params: {\n path: {\n ref: project_id,\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to list storage buckets');\n\n return response.data;\n },\n\n async getStorageConfig(project_id: string) {\n const response = await managementApiClient.GET(\n '/v1/projects/{ref}/config/storage',\n {\n params: {\n path: {\n ref: project_id,\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to get storage config');\n\n return response.data;\n },\n\n async updateStorageConfig(projectId: string, config: StorageConfig) {\n const response = await managementApiClient.PATCH(\n '/v1/projects/{ref}/config/storage',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n body: {\n fileSizeLimit: config.fileSizeLimit,\n features: {\n imageTransformation: {\n enabled: config.features.imageTransformation.enabled,\n },\n s3Protocol: {\n enabled: config.features.s3Protocol.enabled,\n },\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to update storage config');\n },\n };\n\n const secrets: SecretOperations = {\n async getUpdatedAt(projectId: string, name: string) {\n const response = await managementApiClient.GET(\n '/v1/projects/{ref}/secrets',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to fetch secrets');\n\n const secret = response.data.find((s) => s.name === name);\n if (!secret || !secret.updated_at) {\n return undefined;\n }\n\n return new Date(secret.updated_at);\n },\n };\n\n const platform: SupabasePlatform = {\n async init(info: InitData) {\n const { clientInfo } = info;\n if (!clientInfo) {\n throw new Error('Client info is required');\n }\n\n // Re-initialize the management API client with the user agent\n managementApiClient = createManagementApiClient(\n managementApiUrl,\n accessToken,\n {\n 'User-Agent': `supabase-mcp/${version} (${clientInfo.name}/${clientInfo.version})`,\n }\n );\n },\n account,\n database,\n debugging,\n development,\n functions,\n branching,\n storage,\n secrets,\n };\n\n return platform;\n}\n\nfunction getProjectDomain(apiHostname: string) {\n switch (apiHostname) {\n case 'api.supabase.com':\n return 'supabase.co';\n case 'api.supabase.green':\n return 'supabase.green';\n default:\n return 'supabase.red';\n }\n}\n","import { stripIndent } from 'common-tags';\nimport type { LogsService } from './platform/types.js';\n\nexport function getClickHouseLogQuery(\n service: LogsService,\n limit: number = 100\n) {\n switch (service) {\n case 'api':\n return stripIndent`\n select id, log_attributes['identifier'] as identifier, timestamp, event_message, log_attributes['request.method'] as method, log_attributes['request.path'] as path, log_attributes['response.status_code'] as status_code\n from logs\n where source = 'edge_logs'\n order by timestamp desc\n limit ${limit}\n `;\n case 'branch-action':\n return stripIndent`\n select log_attributes['workflow_run'] as workflow_run, timestamp, id, event_message\n from logs\n where source = 'workflow_run_logs'\n order by timestamp desc\n limit ${limit}\n `;\n case 'postgres':\n return stripIndent`\n select log_attributes['identifier'] as identifier, timestamp, id, event_message, log_attributes['parsed.error_severity'] as error_severity\n from logs\n where source = 'postgres_logs'\n order by timestamp desc\n limit ${limit}\n `;\n case 'edge-function':\n return stripIndent`\n select id, timestamp, event_message, log_attributes['response.status_code'] as status_code, log_attributes['request.method'] as method, log_attributes['function_id'] as function_id, log_attributes['execution_time_ms'] as execution_time_ms, log_attributes['deployment_id'] as deployment_id, log_attributes['version'] as version\n from logs\n where source = 'function_edge_logs'\n order by timestamp desc\n limit ${limit}\n `;\n case 'edge-function-runtime':\n return stripIndent`\n select id, timestamp, event_message, severity_text, log_attributes['level'] as level, log_attributes['event_type'] as event_type, log_attributes['function_id'] as function_id, log_attributes['execution_id'] as execution_id, log_attributes['deployment_id'] as deployment_id, log_attributes['version'] as version\n from logs\n where source = 'function_logs'\n order by timestamp desc\n limit ${limit}\n `;\n case 'auth':\n return stripIndent`\n select id, timestamp, event_message, log_attributes['level'] as level, log_attributes['status'] as status, log_attributes['path'] as path, log_attributes['msg'] as msg, log_attributes['error'] as error\n from logs\n where source = 'auth_logs'\n order by timestamp desc\n limit ${limit}\n `;\n case 'storage':\n return stripIndent`\n select id, timestamp, event_message\n from logs\n where source = 'storage_logs'\n order by timestamp desc\n limit ${limit}\n `;\n case 'realtime':\n return stripIndent`\n select id, timestamp, event_message\n from logs\n where source = 'realtime_logs'\n order by timestamp desc\n limit ${limit}\n `;\n default:\n throw new Error(`unsupported log service type: ${service}`);\n }\n}\n","import createClient, {\n type Client,\n type FetchResponse,\n type ParseAsResponse,\n} from 'openapi-fetch';\nimport type {\n MediaType,\n ResponseObjectMap,\n SuccessResponse,\n} from 'openapi-typescript-helpers';\nimport { z } from 'zod/v4';\nimport type { paths } from './types.js';\n\nexport function createManagementApiClient(\n baseUrl: string,\n accessToken: string,\n headers: Record<string, string> = {}\n) {\n return createClient<paths>({\n baseUrl,\n headers: {\n Authorization: `Bearer ${accessToken}`,\n ...headers,\n },\n });\n}\n\nexport type ManagementApiClient = Client<paths>;\n\nexport type SuccessResponseType<\n T extends Record<string | number, any>,\n Options,\n Media extends MediaType,\n> = {\n data: ParseAsResponse<SuccessResponse<ResponseObjectMap<T>, Media>, Options>;\n error?: never;\n response: Response;\n};\n\nconst errorSchema = z.object({\n message: z.string(),\n});\n\nexport function assertSuccess<\n T extends Record<string | number, any>,\n Options,\n Media extends MediaType,\n>(\n response: FetchResponse<T, Options, Media>,\n fallbackMessage: string\n): asserts response is SuccessResponseType<T, Options, Media> {\n if ('error' in response) {\n if (response.response.status === 401) {\n throw new Error(\n 'Unauthorized. Please provide a valid access token to the MCP server via the --access-token flag or SUPABASE_ACCESS_TOKEN.'\n );\n }\n\n const { data: errorContent } = errorSchema.safeParse(response.error);\n\n if (errorContent) {\n throw new Error(errorContent.message);\n }\n\n throw new Error(fallbackMessage);\n }\n}\n\n/**\n * Asserts success for project-scoped endpoints, mapping 403 responses to an\n * actionable message. A permission error on a specific project most commonly\n * means the access token is scoped to an organization that doesn't own the\n * project (e.g. the wrong organization was selected during OAuth login).\n *\n * Currently applied only to database operations (see AI-178). Before adopting\n * for other endpoints, check that a 403 there isn't better explained by plan\n * or role restrictions, where org-selection advice would mislead.\n */\nexport function assertProjectScopedSuccess<\n T extends Record<string | number, any>,\n Options,\n Media extends MediaType,\n>(\n response: FetchResponse<T, Options, Media>,\n fallbackMessage: string,\n projectId: string\n): asserts response is SuccessResponseType<T, Options, Media> {\n if ('error' in response && response.response.status === 403) {\n const { data: errorContent } = errorSchema.safeParse(response.error);\n const apiMessage = (errorContent?.message ?? fallbackMessage).replace(\n /\\.$/,\n ''\n );\n\n throw new Error(\n `${apiMessage}. Access to project '${projectId}' was denied. If this project exists, your access token may be scoped to a different organization: re-authenticate with the MCP server and select the organization that owns this project.`\n );\n }\n\n assertSuccess(response, fallbackMessage);\n}\n","const UPPERCASE_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\nconst LOWERCASE_CHARS = 'abcdefghijklmnopqrstuvwxyz';\nconst NUMBER_CHARS = '0123456789';\nconst SYMBOL_CHARS = '!@#$%^&*()_+~`|}{[]:;?><,./-=';\n\nexport type GeneratePasswordOptions = {\n length?: number;\n numbers?: boolean;\n uppercase?: boolean;\n lowercase?: boolean;\n symbols?: boolean;\n};\n\n/**\n * Generates a cryptographically secure random password.\n *\n * @returns The generated password\n */\nexport const generatePassword = ({\n length = 10,\n numbers = false,\n symbols = false,\n uppercase = true,\n lowercase = true,\n} = {}) => {\n // Build the character set based on options\n let chars = '';\n if (uppercase) {\n chars += UPPERCASE_CHARS;\n }\n if (lowercase) {\n chars += LOWERCASE_CHARS;\n }\n if (numbers) {\n chars += NUMBER_CHARS;\n }\n if (symbols) {\n chars += SYMBOL_CHARS;\n }\n\n if (chars.length === 0) {\n throw new Error('at least one character set must be selected');\n }\n\n const randomValues = new Uint32Array(length);\n crypto.getRandomValues(randomValues);\n\n // Map random values to our character set\n let password = '';\n for (let i = 0; i < length; i++) {\n const randomIndex = randomValues[i]! % chars.length;\n password += chars.charAt(randomIndex);\n }\n\n return password;\n};\n"],"mappings":"+IAAA,OACE,wBAAAA,EACA,wBAAAC,MACK,6BAEP,OAAS,iBAAAC,MAAqB,MCL9B,OAAS,eAAAC,MAAmB,cAGrB,SAASC,EACdC,EACAC,EAAgB,IAChB,CACA,OAAQD,EAAS,CACf,IAAK,MACH,OAAOF;AAAA;AAAA;AAAA;AAAA;AAAA,gBAKGG,CAAK;AAAA,QAEjB,IAAK,gBACH,OAAOH;AAAA;AAAA;AAAA;AAAA;AAAA,gBAKGG,CAAK;AAAA,QAEjB,IAAK,WACH,OAAOH;AAAA;AAAA;AAAA;AAAA;AAAA,gBAKGG,CAAK;AAAA,QAEjB,IAAK,gBACH,OAAOH;AAAA;AAAA;AAAA;AAAA;AAAA,gBAKGG,CAAK;AAAA,QAEjB,IAAK,wBACH,OAAOH;AAAA;AAAA;AAAA;AAAA;AAAA,gBAKGG,CAAK;AAAA,QAEjB,IAAK,OACH,OAAOH;AAAA;AAAA;AAAA;AAAA;AAAA,gBAKGG,CAAK;AAAA,QAEjB,IAAK,UACH,OAAOH;AAAA;AAAA;AAAA;AAAA;AAAA,gBAKGG,CAAK;AAAA,QAEjB,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F,CACF,EAEA,OAAAlE,EAAcD,EAAU,8BAA8B,EAE/CA,EAAS,IAClB,EAEA,MAAM,oBAAoBG,EAAmBiE,EAAuB,CAClE,IAAMpE,EAAW,MAAMH,EAAoB,MACzC,oCACA,CACE,OAAQ,CACN,KAAM,CACJ,IAAKM,CACP,CACF,EACA,KAAM,CACJ,cAAeiE,EAAO,cACtB,SAAU,CACR,oBAAqB,CACnB,QAASA,EAAO,SAAS,oBAAoB,OAC/C,EACA,WAAY,CACV,QAASA,EAAO,SAAS,WAAW,OACtC,CACF,CACF,CACF,CACF,EAEAnE,EAAcD,EAAU,iCAAiC,CAC3D,CACF,EAiDE,QA/CgC,CAChC,MAAM,aAAaG,EAAmBC,EAAc,CAClD,IAAMJ,EAAW,MAAMH,EAAoB,IACzC,6BACA,CACE,OAAQ,CACN,KAAM,CACJ,IAAKM,CACP,CACF,CACF,CACF,EAEAF,EAAcD,EAAU,yBAAyB,EAEjD,IAAMqE,EAASrE,EAAS,KAAK,KAAMsE,GAAMA,EAAE,OAASlE,CAAI,EACxD,GAAI,GAACiE,GAAU,CAACA,EAAO,YAIvB,OAAO,IAAI,KAAKA,EAAO,UAAU,CACnC,CACF,CA0BA,CAGF,CAEA,SAAS3C,GAAiB6C,EAAqB,CAC7C,OAAQA,EAAa,CACnB,IAAK,mBACH,MAAO,cACT,IAAK,qBACH,MAAO,iBACT,QACE,MAAO,cACX,CACF","names":["getMultipartBoundary","parseMultipartStream","fileURLToPath","stripIndent","getClickHouseLogQuery","service","limit","createClient","z","createManagementApiClient","baseUrl","accessToken","headers","errorSchema","assertSuccess","response","fallbackMessage","errorContent","assertProjectScopedSuccess","projectId","apiMessage","UPPERCASE_CHARS","LOWERCASE_CHARS","NUMBER_CHARS","SYMBOL_CHARS","generatePassword","length","numbers","symbols","uppercase","lowercase","chars","randomValues","password","i","randomIndex","version","package_default","createSupabaseApiPlatform","options","accessToken","apiUrl","managementApiUrl","managementApiClient","createManagementApiClient","account","response","assertSuccess","organizationId","projectId","name","organization_id","region","db_pass","createProjectOptionsSchema","generatePassword","database","query","parameters","read_only","executeSqlOptionsSchema","assertProjectScopedSuccess","applyMigrationOptionsSchema","debugging","service","iso_timestamp_start","iso_timestamp_end","getLogsOptionsSchema","sql","getClickHouseLogQuery","queryLogsOptionsSchema","development","getProjectDomain","legacyKeysEnabled","legacyKeysResponse","clientKeys","key","functions","edgeFunction","deploymentId","getDeploymentId","entrypoint_path","normalizeFilename","fileURLToPath","import_map_path","functionSlug","functionResponse","bodyResponse","contentType","boundary","getMultipartBoundary","files","parts","parseMultipartStream","part","verify_jwt","inputFiles","deployEdgeFunctionOptionsSchema","existingEdgeFunction","import_map_file","file","body","formData","blob","f","info","clientInfo","version","createBranchOptionsSchema","createBranchResponse","branchId","migration_version","resetBranchOptionsSchema","project_id","config","secret","s","apiHostname"]}
|
package/dist/cli.cjs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict"; function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkHJCSISZGcjs = require('./chunk-HJCSISZG.cjs');var _chunkETDG2YWQcjs = require('./chunk-ETDG2YWQ.cjs');var _chunkUY7NVUDBcjs = require('./chunk-UY7NVUDB.cjs');require('./chunk-PHWSETKC.cjs');require('./chunk-536WYGSZ.cjs');var _util = require('util');var _stdio = require('@modelcontextprotocol/server/stdio');var _crypto = require('crypto');var _events = require('events');var _http = require('http');var _node = require('@modelcontextprotocol/node');var _server = require('@modelcontextprotocol/server');var _v4 = require('zod/v4');function g(r,a=","){return r.split(a).map(t=>t.trim()).filter(t=>t!=="")}var z=_v4.z.object({project_ref:_v4.z.string().optional(),read_only:_v4.z.stringbool().default(!1),features:_v4.z.string().transform(r=>g(r)).optional(),skip_elicitations:_v4.z.string().transform(r=>g(r)).optional().pipe(_v4.z.array(_v4.z.enum(_chunkHJCSISZGcjs.a)).optional())});function G(r){let a=Array.isArray(r)?r:[r],s,t,m,n;for(let e of a){if(!_server.isJSONRPCRequest.call(void 0, e)&&!_server.isJSONRPCNotification.call(void 0, e))continue;t??=_server.isSpecType.CallToolRequest(e)?`${e.method} ${e.params.name}`:e.method;let i=_optionalChain([e, 'access', _2 => _2.params, 'optionalAccess', _3 => _3._meta]),o=_optionalChain([i, 'optionalAccess', _4 => _4[_server.CLIENT_INFO_META_KEY]]);_server.isSpecType.Implementation(o)&&(s??=o);let c=_optionalChain([i, 'optionalAccess', _5 => _5[_server.PROTOCOL_VERSION_META_KEY]]);if(typeof c=="string"&&(m??=c),_server.isSpecType.InitializeRequest(e))s??=e.params.clientInfo,m??=e.params.protocolVersion,n??=_nullishCoalesce(JSON.stringify(e.params.capabilities.elicitation), () => ("absent"));else if(_server.isSpecType.CallToolRequest(e)&&(e.params.name==="create_edge_function_secret"||_chunkHJCSISZGcjs.a.includes(e.params.name))){let p=_optionalChain([i, 'optionalAccess', _6 => _6[_server.CLIENT_CAPABILITIES_META_KEY]]);n??=_nullishCoalesce(JSON.stringify(_optionalChain([p, 'optionalAccess', _7 => _7.elicitation])), () => ("absent"))}}let d=s?[s.name,s.version].filter(Boolean).join("/"):"unknown",f=[(_nullishCoalesce(t, () => ("unknown"))).padEnd(28),d.padEnd(24),`(${_nullishCoalesce(m, () => ("legacy"))})`].join(" ");return n===void 0?f:`${f} elicitation=${n}`}async function R({port:r,apiUrl:a,contentApiUrl:s,secretUrlTemplate:t,log:m=n=>console.error(`[${new Date().toLocaleTimeString("en-GB")}] ${n}`)}){if(t===void 0)switch(new URL(_nullishCoalesce(a, () => ("https://api.supabase.com"))).origin){case"https://api.supabase.com":t="https://supabase.com/dashboard/mcp/secrets?ref={ref}&name={name}";break;case"https://api.supabase.green":t="https://supabase.green/dashboard/mcp/secrets?ref={ref}&name={name}";break;default:throw new Error("A custom --api-url requires an explicit --secret-url-template.")}_chunkHJCSISZGcjs.d.call(void 0, t);let n={connectUrlTemplate:t},d=_crypto.randomBytes.call(void 0, 32),f=_server.localhostAllowedHostnames.call(void 0, ),e=_http.createServer.call(void 0, _node.toNodeHandler.call(void 0, {fetch:async o=>{let c=_server.hostHeaderValidationResponse.call(void 0, o,f);if(c)return c;let p=_optionalChain([o, 'access', _8 => _8.headers, 'access', _9 => _9.get, 'call', _10 => _10("authorization"), 'optionalAccess', _11 => _11.match, 'call', _12 => _12(/^Bearer (.+)$/i), 'optionalAccess', _13 => _13[1]]);if(!p)return Response.json({error:"missing bearer token"},{status:401});let y=new URL(o.url),u=0;for(let h of y.searchParams.keys())if(h==="skip_elicitations"&&u++,u>1||/^skip_elicitations\[[^[\]]*\]/.test(h))return Response.json({error:"skip_elicitations must be a single CSV string"},{status:400});let k=z.safeParse(Object.fromEntries(y.searchParams));if(!k.success)return Response.json({error:_v4.z.prettifyError(k.error)},{status:400});let{project_ref:I,read_only:P,features:C,skip_elicitations:N}=k.data;m(G(await o.clone().json().catch(()=>{})));let T=_chunkETDG2YWQcjs.a.call(void 0, {accessToken:p,apiUrl:a});C&&_chunkHJCSISZGcjs.c.call(void 0, T,C);let w=_server.createMcpHandler.call(void 0, ()=>_chunkHJCSISZGcjs.g.call(void 0, {platform:T,projectId:I,readOnly:P,features:C,contentApiUrl:s,elicitation:{requestState:{key:d,ttlSeconds:120,principal:_crypto.createHash.call(void 0, "sha256").update(p).digest("hex")},confirmation:{enabledTools:_chunkHJCSISZGcjs.a.filter(h=>!_optionalChain([N, 'optionalAccess', _14 => _14.includes, 'call', _15 => _15(h)]))},secretCollection:n}}),{legacy:"stateless",onerror:console.error});return o.signal.addEventListener("abort",()=>w.close(),{once:!0}),w.fetch(o)}},{onerror:console.error}));e.listen(r,"127.0.0.1"),await _events.once.call(void 0, e,"listening");let i=e.address();if(!i||typeof i=="string")throw new Error("expected a TCP address");return{url:`http://127.0.0.1:${i.port}/mcp`,close:async()=>{e.close(),e.closeAllConnections(),await _events.once.call(void 0, e,"close")}}}var{version:Q}=_chunkUY7NVUDBcjs.a;async function W(){let{values:{["access-token"]:r,["project-ref"]:a,["read-only"]:s,["api-url"]:t,["content-api-url"]:m,["secret-url-template"]:n,["version"]:d,["features"]:f,["http"]:e,["port"]:i}}=_util.parseArgs.call(void 0, {options:{"access-token":{type:"string"},"project-ref":{type:"string"},"read-only":{type:"boolean",default:!1},"api-url":{type:"string"},"content-api-url":{type:"string"},"secret-url-template":{type:"string"},version:{type:"boolean"},features:{type:"string"},http:{type:"boolean",default:!1},port:{type:"string",default:"3111"}}});if(d&&(console.log(Q),process.exit(0)),n!==void 0&&!e){console.error("--secret-url-template requires --http."),process.exitCode=1;return}let o=f?g(f):void 0,c=_nullishCoalesce(m, () => (process.env.SUPABASE_CONTENT_API_URL));if(e){try{let u=await R({port:Number(i),apiUrl:t,contentApiUrl:c,secretUrlTemplate:n});console.error(`Supabase MCP server listening on ${u.url}`)}catch(u){console.error(u),process.exitCode=1}return}let p=_nullishCoalesce(r, () => (process.env.SUPABASE_ACCESS_TOKEN));p||(console.error("Please provide a personal access token (PAT) with the --access-token flag or set the SUPABASE_ACCESS_TOKEN environment variable"),process.exit(1));let y=_chunkETDG2YWQcjs.a.call(void 0, {accessToken:p,apiUrl:t});o&&_chunkHJCSISZGcjs.c.call(void 0, y,o),_stdio.serveStdio.call(void 0, ()=>_chunkHJCSISZGcjs.g.call(void 0, {platform:y,projectId:a,readOnly:s,features:o,contentApiUrl:c}),{onerror:console.error})}W().catch(console.error);
|
|
3
|
+
//# sourceMappingURL=cli.cjs.map
|
package/dist/cli.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/mcp/mcp/packages/mcp-server-supabase/dist/cli.cjs","../src/cli.ts","../src/transports/local-http-entry.ts","../src/transports/util.ts"],"names":["parseList","list","delimiter","feature","querySchema","z","value","CURRENT_ELICITATION_TOOLS","describeRequest","body","messages","client","method","protocolVersion","elicitation","message","isJSONRPCRequest","isJSONRPCNotification","isSpecType"],"mappings":"AAAA;AACA,6qBAA6D,wDAAyC,wDAAyC,gCAA6B,gCAA6B,4BCA/K,2DACC,gCCFa,gCACnB,4BACQ,kDACC,sDAYvB,4BACW,SCVFA,CAAAA,CAAUC,CAAAA,CAAcC,CAAAA,CAAY,GAAA,CAAe,CAEjE,OADcD,CAAAA,CAAK,KAAA,CAAMC,CAAS,CAAA,CAAE,GAAA,CAAKC,CAAAA,EAAYA,CAAAA,CAAQ,IAAA,CAAK,CAAC,CAAA,CACtD,MAAA,CAAQA,CAAAA,EAAYA,CAAAA,GAAY,EAAE,CACjD,CDyBA,IAAMC,CAAAA,CAAcC,KAAAA,CAAE,MAAA,CAAO,CAC3B,WAAA,CAAaA,KAAAA,CAAE,MAAA,CAAO,CAAA,CAAE,QAAA,CAAS,CAAA,CACjC,SAAA,CAAWA,KAAAA,CAAE,UAAA,CAAW,CAAA,CAAE,OAAA,CAAQ,CAAA,CAAK,CAAA,CACvC,QAAA,CAAUA,KAAAA,CACP,MAAA,CAAO,CAAA,CACP,SAAA,CAAWC,CAAAA,EAAUN,CAAAA,CAAUM,CAAK,CAAC,CAAA,CACrC,QAAA,CAAS,CAAA,CACZ,iBAAA,CAAmBD,KAAAA,CAChB,MAAA,CAAO,CAAA,CACP,SAAA,CAAWC,CAAAA,EAAUN,CAAAA,CAAUM,CAAK,CAAC,CAAA,CACrC,QAAA,CAAS,CAAA,CACT,IAAA,CAAKD,KAAAA,CAAE,KAAA,CAAMA,KAAAA,CAAE,IAAA,CAAKE,mBAAyB,CAAC,CAAA,CAAE,QAAA,CAAS,CAAC,CAC/D,CAAC,CAAA,CAGM,SAASC,CAAAA,CAAgBC,CAAAA,CAAuB,CACrD,IAAMC,CAAAA,CAAsB,KAAA,CAAM,OAAA,CAAQD,CAAI,CAAA,CAAIA,CAAAA,CAAO,CAACA,CAAI,CAAA,CAC1DE,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACJ,GAAA,CAAA,IAAWC,EAAAA,GAAWL,CAAAA,CAAU,CAC9B,EAAA,CAAI,CAACM,sCAAAA,CAAwB,CAAA,EAAK,CAACC,2CAAAA,CAA6B,CAAA,CAAG,QAAA,CACnEL,CAAAA,GAAWM,kBAAAA,CAAW,eAAA,CAAgBH,CAAO,CAAA,CACzC,CAAA,EAAA","file":"/home/runner/work/mcp/mcp/packages/mcp-server-supabase/dist/cli.cjs","sourcesContent":[null,"#!/usr/bin/env node\nimport { parseArgs } from 'node:util';\nimport { serveStdio } from '@modelcontextprotocol/server/stdio';\n\nimport packageJson from '../package.json' with { type: 'json' };\nimport { createSupabaseApiPlatform } from './platform/api-platform.js';\nimport { createSupabaseMcpServer } from './server.js';\nimport { startLocalHttpEntry } from './transports/local-http-entry.js';\nimport { parseList } from './transports/util.js';\nimport { parseFeatureGroups } from './util.js';\n\nconst { version } = packageJson;\n\nasync function main() {\n const {\n values: {\n ['access-token']: cliAccessToken,\n ['project-ref']: projectId,\n ['read-only']: readOnly,\n ['api-url']: apiUrl,\n ['content-api-url']: cliContentApiUrl,\n ['secret-url-template']: secretUrlTemplate,\n ['version']: showVersion,\n ['features']: cliFeatures,\n ['http']: http,\n ['port']: cliPort,\n },\n } = parseArgs({\n options: {\n ['access-token']: {\n type: 'string',\n },\n ['project-ref']: {\n type: 'string',\n },\n ['read-only']: {\n type: 'boolean',\n default: false,\n },\n ['api-url']: {\n type: 'string',\n },\n ['content-api-url']: {\n type: 'string',\n },\n ['secret-url-template']: {\n type: 'string',\n },\n ['version']: {\n type: 'boolean',\n },\n ['features']: {\n type: 'string',\n },\n ['http']: {\n type: 'boolean',\n default: false,\n },\n ['port']: {\n type: 'string',\n default: '3111',\n },\n },\n });\n\n if (showVersion) {\n console.log(version);\n process.exit(0);\n }\n\n if (secretUrlTemplate !== undefined && !http) {\n console.error('--secret-url-template requires --http.');\n process.exitCode = 1;\n return;\n }\n\n const features = cliFeatures ? parseList(cliFeatures) : undefined;\n\n const contentApiUrl =\n cliContentApiUrl ?? process.env.SUPABASE_CONTENT_API_URL;\n\n if (http) {\n try {\n const entry = await startLocalHttpEntry({\n port: Number(cliPort),\n apiUrl,\n contentApiUrl,\n secretUrlTemplate,\n });\n console.error(`Supabase MCP server listening on ${entry.url}`);\n } catch (error) {\n console.error(error);\n process.exitCode = 1;\n }\n return;\n }\n\n const accessToken = cliAccessToken ?? process.env.SUPABASE_ACCESS_TOKEN;\n\n if (!accessToken) {\n console.error(\n 'Please provide a personal access token (PAT) with the --access-token flag or set the SUPABASE_ACCESS_TOKEN environment variable'\n );\n process.exit(1);\n }\n\n const platform = createSupabaseApiPlatform({\n accessToken,\n apiUrl,\n });\n\n if (features) {\n parseFeatureGroups(platform, features);\n }\n\n // `serveStdio` reports transport startup and out-of-band wire errors only\n // through `onerror`, and swallows them otherwise, so this keeps the stderr\n // output the previous awaited `server.connect()` got from `main().catch`.\n serveStdio(\n () =>\n createSupabaseMcpServer({\n platform,\n projectId,\n readOnly,\n features,\n contentApiUrl,\n }),\n { onerror: console.error }\n );\n}\n\nmain().catch(console.error);\n","import { createHash, randomBytes } from 'node:crypto';\nimport { once } from 'node:events';\nimport { createServer } from 'node:http';\nimport { toNodeHandler } from '@modelcontextprotocol/node';\nimport {\n CLIENT_CAPABILITIES_META_KEY,\n CLIENT_INFO_META_KEY,\n createMcpHandler,\n hostHeaderValidationResponse,\n type Implementation,\n isJSONRPCNotification,\n isJSONRPCRequest,\n isSpecType,\n localhostAllowedHostnames,\n PROTOCOL_VERSION_META_KEY,\n} from '@modelcontextprotocol/server';\nimport { z } from 'zod/v4';\n\nimport { createSupabaseApiPlatform } from '../platform/api-platform.js';\nimport { createSupabaseMcpServer } from '../server.js';\nimport { assertValidConnectUrlTemplate } from '../tools/secret-tools.js';\nimport { CURRENT_ELICITATION_TOOLS } from '../types.js';\nimport { parseFeatureGroups } from '../util.js';\nimport { parseList } from './util.js';\n\nexport type LocalHttpEntryOptions = {\n port: number;\n apiUrl?: string;\n contentApiUrl?: string;\n secretUrlTemplate?: string;\n log?: (line: string) => void;\n};\n\n// https://supabase.com/docs/guides/ai-tools/mcp#configuration-options\nconst querySchema = z.object({\n project_ref: z.string().optional(),\n read_only: z.stringbool().default(false),\n features: z\n .string()\n .transform((value) => parseList(value))\n .optional(),\n skip_elicitations: z\n .string()\n .transform((value) => parseList(value))\n .optional()\n .pipe(z.array(z.enum(CURRENT_ELICITATION_TOOLS)).optional()),\n});\n\n/** e.g. `tools/call create_branch claude-code/2.1.260 (2026-07-28)` */\nexport function describeRequest(body: unknown): string {\n const messages: unknown[] = Array.isArray(body) ? body : [body];\n let client: Implementation | undefined;\n let method: string | undefined;\n let protocolVersion: string | undefined;\n let elicitation: string | undefined;\n for (const message of messages) {\n if (!isJSONRPCRequest(message) && !isJSONRPCNotification(message)) continue;\n method ??= isSpecType.CallToolRequest(message)\n ? `${message.method} ${message.params.name}`\n : message.method;\n const meta = message.params?._meta;\n const metaClient = meta?.[CLIENT_INFO_META_KEY];\n if (isSpecType.Implementation(metaClient)) client ??= metaClient;\n const metaVersion = meta?.[PROTOCOL_VERSION_META_KEY];\n if (typeof metaVersion === 'string') protocolVersion ??= metaVersion;\n if (isSpecType.InitializeRequest(message)) {\n client ??= message.params.clientInfo;\n protocolVersion ??= message.params.protocolVersion;\n elicitation ??=\n JSON.stringify(message.params.capabilities.elicitation) ?? 'absent';\n } else if (\n isSpecType.CallToolRequest(message) &&\n (message.params.name === 'create_edge_function_secret' ||\n (CURRENT_ELICITATION_TOOLS as readonly string[]).includes(\n message.params.name\n ))\n ) {\n const capabilities = meta?.[CLIENT_CAPABILITIES_META_KEY] as\n | { elicitation?: unknown }\n | undefined;\n elicitation ??= JSON.stringify(capabilities?.elicitation) ?? 'absent';\n }\n }\n const name = client\n ? [client.name, client.version].filter(Boolean).join('/')\n : 'unknown';\n const description = [\n (method ?? 'unknown').padEnd(28),\n name.padEnd(24),\n `(${protocolVersion ?? 'legacy'})`,\n ].join(' ');\n return elicitation === undefined\n ? description\n : `${description} elicitation=${elicitation}`;\n}\n\nexport async function startLocalHttpEntry({\n port,\n apiUrl,\n contentApiUrl,\n secretUrlTemplate,\n log = (line) =>\n console.error(`[${new Date().toLocaleTimeString('en-GB')}] ${line}`),\n}: LocalHttpEntryOptions) {\n if (secretUrlTemplate === undefined) {\n switch (new URL(apiUrl ?? 'https://api.supabase.com').origin) {\n case 'https://api.supabase.com':\n secretUrlTemplate =\n 'https://supabase.com/dashboard/mcp/secrets?ref={ref}&name={name}';\n break;\n case 'https://api.supabase.green':\n secretUrlTemplate =\n 'https://supabase.green/dashboard/mcp/secrets?ref={ref}&name={name}';\n break;\n default:\n throw new Error(\n 'A custom --api-url requires an explicit --secret-url-template.'\n );\n }\n }\n assertValidConnectUrlTemplate(secretUrlTemplate);\n const secretCollection = { connectUrlTemplate: secretUrlTemplate };\n const requestStateKey = randomBytes(32);\n const allowedHostnames = localhostAllowedHostnames();\n\n const server = createServer(\n toNodeHandler(\n {\n fetch: async (request) => {\n const rejected = hostHeaderValidationResponse(\n request,\n allowedHostnames\n );\n if (rejected) return rejected;\n\n const accessToken = request.headers\n .get('authorization')\n ?.match(/^Bearer (.+)$/i)?.[1];\n if (!accessToken) {\n return Response.json(\n { error: 'missing bearer token' },\n { status: 401 }\n );\n }\n\n const url = new URL(request.url);\n // Hosted query parsing turns repeated or bracketed skips into\n // non-string values. Reject those before flattening query parameters.\n let skipCount = 0;\n for (const key of url.searchParams.keys()) {\n if (key === 'skip_elicitations') skipCount++;\n if (skipCount > 1 || /^skip_elicitations\\[[^[\\]]*\\]/.test(key)) {\n return Response.json(\n { error: 'skip_elicitations must be a single CSV string' },\n { status: 400 }\n );\n }\n }\n const query = querySchema.safeParse(\n Object.fromEntries(url.searchParams)\n );\n if (!query.success) {\n return Response.json(\n { error: z.prettifyError(query.error) },\n { status: 400 }\n );\n }\n const {\n project_ref: projectId,\n read_only: readOnly,\n features,\n skip_elicitations: skipElicitations,\n } = query.data;\n\n log(\n describeRequest(\n await request\n .clone()\n .json()\n .catch(() => undefined)\n )\n );\n\n const platform = createSupabaseApiPlatform({ accessToken, apiUrl });\n if (features) parseFeatureGroups(platform, features);\n const handler = createMcpHandler(\n () =>\n createSupabaseMcpServer({\n platform,\n projectId,\n readOnly,\n features,\n contentApiUrl,\n elicitation: {\n requestState: {\n key: requestStateKey,\n ttlSeconds: 120,\n // One process can serve several PATs, so the principal is the token's hash.\n principal: createHash('sha256')\n .update(accessToken)\n .digest('hex'),\n },\n confirmation: {\n enabledTools: CURRENT_ELICITATION_TOOLS.filter(\n (tool) => !skipElicitations?.includes(tool)\n ),\n },\n secretCollection,\n },\n }),\n { legacy: 'stateless', onerror: console.error }\n );\n request.signal.addEventListener('abort', () => handler.close(), {\n once: true,\n });\n return handler.fetch(request);\n },\n },\n { onerror: console.error }\n )\n );\n\n server.listen(port, '127.0.0.1');\n await once(server, 'listening');\n const address = server.address();\n if (!address || typeof address === 'string') {\n throw new Error('expected a TCP address');\n }\n\n return {\n url: `http://127.0.0.1:${address.port}/mcp`,\n close: async () => {\n server.close();\n server.closeAllConnections();\n await once(server, 'close');\n },\n };\n}\n\nexport type LocalHttpEntry = Awaited<ReturnType<typeof startLocalHttpEntry>>;\n","/**\n * Parses a delimited list of items into an array,\n * trimming whitespace and filtering out empty items.\n *\n * Default delimiter is a comma (`,`).\n */\nexport function parseList(list: string, delimiter = ','): string[] {\n const items = list.split(delimiter).map((feature) => feature.trim());\n return items.filter((feature) => feature !== '');\n}\n"]}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as S,c as b,d as O,g as _}from"./chunk-BAHK6DOT.js";import{a as E}from"./chunk-ZKX2YAIQ.js";import{a as L}from"./chunk-MGV6E7CY.js";import"./chunk-LU6L7C36.js";import"./chunk-LGYQEOKZ.js";import{parseArgs as Y}from"util";import{serveStdio as D}from"@modelcontextprotocol/server/stdio";import{createHash as j,randomBytes as x}from"crypto";import{once as v}from"events";import{createServer as H}from"http";import{toNodeHandler as U}from"@modelcontextprotocol/node";import{CLIENT_CAPABILITIES_META_KEY as $,CLIENT_INFO_META_KEY as B,createMcpHandler as V,hostHeaderValidationResponse as M,isJSONRPCNotification as q,isJSONRPCRequest as K,isSpecType as A,localhostAllowedHostnames as J,PROTOCOL_VERSION_META_KEY as F}from"@modelcontextprotocol/server";import{z as l}from"zod/v4";function g(r,a=","){return r.split(a).map(t=>t.trim()).filter(t=>t!=="")}var z=l.object({project_ref:l.string().optional(),read_only:l.stringbool().default(!1),features:l.string().transform(r=>g(r)).optional(),skip_elicitations:l.string().transform(r=>g(r)).optional().pipe(l.array(l.enum(S)).optional())});function G(r){let a=Array.isArray(r)?r:[r],s,t,m,n;for(let e of a){if(!K(e)&&!q(e))continue;t??=A.CallToolRequest(e)?`${e.method} ${e.params.name}`:e.method;let i=e.params?._meta,o=i?.[B];A.Implementation(o)&&(s??=o);let c=i?.[F];if(typeof c=="string"&&(m??=c),A.InitializeRequest(e))s??=e.params.clientInfo,m??=e.params.protocolVersion,n??=JSON.stringify(e.params.capabilities.elicitation)??"absent";else if(A.CallToolRequest(e)&&(e.params.name==="create_edge_function_secret"||S.includes(e.params.name))){let p=i?.[$];n??=JSON.stringify(p?.elicitation)??"absent"}}let d=s?[s.name,s.version].filter(Boolean).join("/"):"unknown",f=[(t??"unknown").padEnd(28),d.padEnd(24),`(${m??"legacy"})`].join(" ");return n===void 0?f:`${f} elicitation=${n}`}async function R({port:r,apiUrl:a,contentApiUrl:s,secretUrlTemplate:t,log:m=n=>console.error(`[${new Date().toLocaleTimeString("en-GB")}] ${n}`)}){if(t===void 0)switch(new URL(a??"https://api.supabase.com").origin){case"https://api.supabase.com":t="https://supabase.com/dashboard/mcp/secrets?ref={ref}&name={name}";break;case"https://api.supabase.green":t="https://supabase.green/dashboard/mcp/secrets?ref={ref}&name={name}";break;default:throw new Error("A custom --api-url requires an explicit --secret-url-template.")}O(t);let n={connectUrlTemplate:t},d=x(32),f=J(),e=H(U({fetch:async o=>{let c=M(o,f);if(c)return c;let p=o.headers.get("authorization")?.match(/^Bearer (.+)$/i)?.[1];if(!p)return Response.json({error:"missing bearer token"},{status:401});let y=new URL(o.url),u=0;for(let h of y.searchParams.keys())if(h==="skip_elicitations"&&u++,u>1||/^skip_elicitations\[[^[\]]*\]/.test(h))return Response.json({error:"skip_elicitations must be a single CSV string"},{status:400});let k=z.safeParse(Object.fromEntries(y.searchParams));if(!k.success)return Response.json({error:l.prettifyError(k.error)},{status:400});let{project_ref:I,read_only:P,features:C,skip_elicitations:N}=k.data;m(G(await o.clone().json().catch(()=>{})));let T=E({accessToken:p,apiUrl:a});C&&b(T,C);let w=V(()=>_({platform:T,projectId:I,readOnly:P,features:C,contentApiUrl:s,elicitation:{requestState:{key:d,ttlSeconds:120,principal:j("sha256").update(p).digest("hex")},confirmation:{enabledTools:S.filter(h=>!N?.includes(h))},secretCollection:n}}),{legacy:"stateless",onerror:console.error});return o.signal.addEventListener("abort",()=>w.close(),{once:!0}),w.fetch(o)}},{onerror:console.error}));e.listen(r,"127.0.0.1"),await v(e,"listening");let i=e.address();if(!i||typeof i=="string")throw new Error("expected a TCP address");return{url:`http://127.0.0.1:${i.port}/mcp`,close:async()=>{e.close(),e.closeAllConnections(),await v(e,"close")}}}var{version:Q}=L;async function W(){let{values:{["access-token"]:r,["project-ref"]:a,["read-only"]:s,["api-url"]:t,["content-api-url"]:m,["secret-url-template"]:n,["version"]:d,["features"]:f,["http"]:e,["port"]:i}}=Y({options:{"access-token":{type:"string"},"project-ref":{type:"string"},"read-only":{type:"boolean",default:!1},"api-url":{type:"string"},"content-api-url":{type:"string"},"secret-url-template":{type:"string"},version:{type:"boolean"},features:{type:"string"},http:{type:"boolean",default:!1},port:{type:"string",default:"3111"}}});if(d&&(console.log(Q),process.exit(0)),n!==void 0&&!e){console.error("--secret-url-template requires --http."),process.exitCode=1;return}let o=f?g(f):void 0,c=m??process.env.SUPABASE_CONTENT_API_URL;if(e){try{let u=await R({port:Number(i),apiUrl:t,contentApiUrl:c,secretUrlTemplate:n});console.error(`Supabase MCP server listening on ${u.url}`)}catch(u){console.error(u),process.exitCode=1}return}let p=r??process.env.SUPABASE_ACCESS_TOKEN;p||(console.error("Please provide a personal access token (PAT) with the --access-token flag or set the SUPABASE_ACCESS_TOKEN environment variable"),process.exit(1));let y=E({accessToken:p,apiUrl:t});o&&b(y,o),D(()=>_({platform:y,projectId:a,readOnly:s,features:o,contentApiUrl:c}),{onerror:console.error})}W().catch(console.error);
|
|
3
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli.ts","../src/transports/local-http-entry.ts","../src/transports/util.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { parseArgs } from 'node:util';\nimport { serveStdio } from '@modelcontextprotocol/server/stdio';\n\nimport packageJson from '../package.json' with { type: 'json' };\nimport { createSupabaseApiPlatform } from './platform/api-platform.js';\nimport { createSupabaseMcpServer } from './server.js';\nimport { startLocalHttpEntry } from './transports/local-http-entry.js';\nimport { parseList } from './transports/util.js';\nimport { parseFeatureGroups } from './util.js';\n\nconst { version } = packageJson;\n\nasync function main() {\n const {\n values: {\n ['access-token']: cliAccessToken,\n ['project-ref']: projectId,\n ['read-only']: readOnly,\n ['api-url']: apiUrl,\n ['content-api-url']: cliContentApiUrl,\n ['secret-url-template']: secretUrlTemplate,\n ['version']: showVersion,\n ['features']: cliFeatures,\n ['http']: http,\n ['port']: cliPort,\n },\n } = parseArgs({\n options: {\n ['access-token']: {\n type: 'string',\n },\n ['project-ref']: {\n type: 'string',\n },\n ['read-only']: {\n type: 'boolean',\n default: false,\n },\n ['api-url']: {\n type: 'string',\n },\n ['content-api-url']: {\n type: 'string',\n },\n ['secret-url-template']: {\n type: 'string',\n },\n ['version']: {\n type: 'boolean',\n },\n ['features']: {\n type: 'string',\n },\n ['http']: {\n type: 'boolean',\n default: false,\n },\n ['port']: {\n type: 'string',\n default: '3111',\n },\n },\n });\n\n if (showVersion) {\n console.log(version);\n process.exit(0);\n }\n\n if (secretUrlTemplate !== undefined && !http) {\n console.error('--secret-url-template requires --http.');\n process.exitCode = 1;\n return;\n }\n\n const features = cliFeatures ? parseList(cliFeatures) : undefined;\n\n const contentApiUrl =\n cliContentApiUrl ?? process.env.SUPABASE_CONTENT_API_URL;\n\n if (http) {\n try {\n const entry = await startLocalHttpEntry({\n port: Number(cliPort),\n apiUrl,\n contentApiUrl,\n secretUrlTemplate,\n });\n console.error(`Supabase MCP server listening on ${entry.url}`);\n } catch (error) {\n console.error(error);\n process.exitCode = 1;\n }\n return;\n }\n\n const accessToken = cliAccessToken ?? process.env.SUPABASE_ACCESS_TOKEN;\n\n if (!accessToken) {\n console.error(\n 'Please provide a personal access token (PAT) with the --access-token flag or set the SUPABASE_ACCESS_TOKEN environment variable'\n );\n process.exit(1);\n }\n\n const platform = createSupabaseApiPlatform({\n accessToken,\n apiUrl,\n });\n\n if (features) {\n parseFeatureGroups(platform, features);\n }\n\n // `serveStdio` reports transport startup and out-of-band wire errors only\n // through `onerror`, and swallows them otherwise, so this keeps the stderr\n // output the previous awaited `server.connect()` got from `main().catch`.\n serveStdio(\n () =>\n createSupabaseMcpServer({\n platform,\n projectId,\n readOnly,\n features,\n contentApiUrl,\n }),\n { onerror: console.error }\n );\n}\n\nmain().catch(console.error);\n","import { createHash, randomBytes } from 'node:crypto';\nimport { once } from 'node:events';\nimport { createServer } from 'node:http';\nimport { toNodeHandler } from '@modelcontextprotocol/node';\nimport {\n CLIENT_CAPABILITIES_META_KEY,\n CLIENT_INFO_META_KEY,\n createMcpHandler,\n hostHeaderValidationResponse,\n type Implementation,\n isJSONRPCNotification,\n isJSONRPCRequest,\n isSpecType,\n localhostAllowedHostnames,\n PROTOCOL_VERSION_META_KEY,\n} from '@modelcontextprotocol/server';\nimport { z } from 'zod/v4';\n\nimport { createSupabaseApiPlatform } from '../platform/api-platform.js';\nimport { createSupabaseMcpServer } from '../server.js';\nimport { assertValidConnectUrlTemplate } from '../tools/secret-tools.js';\nimport { CURRENT_ELICITATION_TOOLS } from '../types.js';\nimport { parseFeatureGroups } from '../util.js';\nimport { parseList } from './util.js';\n\nexport type LocalHttpEntryOptions = {\n port: number;\n apiUrl?: string;\n contentApiUrl?: string;\n secretUrlTemplate?: string;\n log?: (line: string) => void;\n};\n\n// https://supabase.com/docs/guides/ai-tools/mcp#configuration-options\nconst querySchema = z.object({\n project_ref: z.string().optional(),\n read_only: z.stringbool().default(false),\n features: z\n .string()\n .transform((value) => parseList(value))\n .optional(),\n skip_elicitations: z\n .string()\n .transform((value) => parseList(value))\n .optional()\n .pipe(z.array(z.enum(CURRENT_ELICITATION_TOOLS)).optional()),\n});\n\n/** e.g. `tools/call create_branch claude-code/2.1.260 (2026-07-28)` */\nexport function describeRequest(body: unknown): string {\n const messages: unknown[] = Array.isArray(body) ? body : [body];\n let client: Implementation | undefined;\n let method: string | undefined;\n let protocolVersion: string | undefined;\n let elicitation: string | undefined;\n for (const message of messages) {\n if (!isJSONRPCRequest(message) && !isJSONRPCNotification(message)) continue;\n method ??= isSpecType.CallToolRequest(message)\n ? `${message.method} ${message.params.name}`\n : message.method;\n const meta = message.params?._meta;\n const metaClient = meta?.[CLIENT_INFO_META_KEY];\n if (isSpecType.Implementation(metaClient)) client ??= metaClient;\n const metaVersion = meta?.[PROTOCOL_VERSION_META_KEY];\n if (typeof metaVersion === 'string') protocolVersion ??= metaVersion;\n if (isSpecType.InitializeRequest(message)) {\n client ??= message.params.clientInfo;\n protocolVersion ??= message.params.protocolVersion;\n elicitation ??=\n JSON.stringify(message.params.capabilities.elicitation) ?? 'absent';\n } else if (\n isSpecType.CallToolRequest(message) &&\n (message.params.name === 'create_edge_function_secret' ||\n (CURRENT_ELICITATION_TOOLS as readonly string[]).includes(\n message.params.name\n ))\n ) {\n const capabilities = meta?.[CLIENT_CAPABILITIES_META_KEY] as\n | { elicitation?: unknown }\n | undefined;\n elicitation ??= JSON.stringify(capabilities?.elicitation) ?? 'absent';\n }\n }\n const name = client\n ? [client.name, client.version].filter(Boolean).join('/')\n : 'unknown';\n const description = [\n (method ?? 'unknown').padEnd(28),\n name.padEnd(24),\n `(${protocolVersion ?? 'legacy'})`,\n ].join(' ');\n return elicitation === undefined\n ? description\n : `${description} elicitation=${elicitation}`;\n}\n\nexport async function startLocalHttpEntry({\n port,\n apiUrl,\n contentApiUrl,\n secretUrlTemplate,\n log = (line) =>\n console.error(`[${new Date().toLocaleTimeString('en-GB')}] ${line}`),\n}: LocalHttpEntryOptions) {\n if (secretUrlTemplate === undefined) {\n switch (new URL(apiUrl ?? 'https://api.supabase.com').origin) {\n case 'https://api.supabase.com':\n secretUrlTemplate =\n 'https://supabase.com/dashboard/mcp/secrets?ref={ref}&name={name}';\n break;\n case 'https://api.supabase.green':\n secretUrlTemplate =\n 'https://supabase.green/dashboard/mcp/secrets?ref={ref}&name={name}';\n break;\n default:\n throw new Error(\n 'A custom --api-url requires an explicit --secret-url-template.'\n );\n }\n }\n assertValidConnectUrlTemplate(secretUrlTemplate);\n const secretCollection = { connectUrlTemplate: secretUrlTemplate };\n const requestStateKey = randomBytes(32);\n const allowedHostnames = localhostAllowedHostnames();\n\n const server = createServer(\n toNodeHandler(\n {\n fetch: async (request) => {\n const rejected = hostHeaderValidationResponse(\n request,\n allowedHostnames\n );\n if (rejected) return rejected;\n\n const accessToken = request.headers\n .get('authorization')\n ?.match(/^Bearer (.+)$/i)?.[1];\n if (!accessToken) {\n return Response.json(\n { error: 'missing bearer token' },\n { status: 401 }\n );\n }\n\n const url = new URL(request.url);\n // Hosted query parsing turns repeated or bracketed skips into\n // non-string values. Reject those before flattening query parameters.\n let skipCount = 0;\n for (const key of url.searchParams.keys()) {\n if (key === 'skip_elicitations') skipCount++;\n if (skipCount > 1 || /^skip_elicitations\\[[^[\\]]*\\]/.test(key)) {\n return Response.json(\n { error: 'skip_elicitations must be a single CSV string' },\n { status: 400 }\n );\n }\n }\n const query = querySchema.safeParse(\n Object.fromEntries(url.searchParams)\n );\n if (!query.success) {\n return Response.json(\n { error: z.prettifyError(query.error) },\n { status: 400 }\n );\n }\n const {\n project_ref: projectId,\n read_only: readOnly,\n features,\n skip_elicitations: skipElicitations,\n } = query.data;\n\n log(\n describeRequest(\n await request\n .clone()\n .json()\n .catch(() => undefined)\n )\n );\n\n const platform = createSupabaseApiPlatform({ accessToken, apiUrl });\n if (features) parseFeatureGroups(platform, features);\n const handler = createMcpHandler(\n () =>\n createSupabaseMcpServer({\n platform,\n projectId,\n readOnly,\n features,\n contentApiUrl,\n elicitation: {\n requestState: {\n key: requestStateKey,\n ttlSeconds: 120,\n // One process can serve several PATs, so the principal is the token's hash.\n principal: createHash('sha256')\n .update(accessToken)\n .digest('hex'),\n },\n confirmation: {\n enabledTools: CURRENT_ELICITATION_TOOLS.filter(\n (tool) => !skipElicitations?.includes(tool)\n ),\n },\n secretCollection,\n },\n }),\n { legacy: 'stateless', onerror: console.error }\n );\n request.signal.addEventListener('abort', () => handler.close(), {\n once: true,\n });\n return handler.fetch(request);\n },\n },\n { onerror: console.error }\n )\n );\n\n server.listen(port, '127.0.0.1');\n await once(server, 'listening');\n const address = server.address();\n if (!address || typeof address === 'string') {\n throw new Error('expected a TCP address');\n }\n\n return {\n url: `http://127.0.0.1:${address.port}/mcp`,\n close: async () => {\n server.close();\n server.closeAllConnections();\n await once(server, 'close');\n },\n };\n}\n\nexport type LocalHttpEntry = Awaited<ReturnType<typeof startLocalHttpEntry>>;\n","/**\n * Parses a delimited list of items into an array,\n * trimming whitespace and filtering out empty items.\n *\n * Default delimiter is a comma (`,`).\n */\nexport function parseList(list: string, delimiter = ','): string[] {\n const items = list.split(delimiter).map((feature) => feature.trim());\n return items.filter((feature) => feature !== '');\n}\n"],"mappings":";qMACA,OAAS,aAAAA,MAAiB,OAC1B,OAAS,cAAAC,MAAkB,qCCF3B,OAAS,cAAAC,EAAY,eAAAC,MAAmB,SACxC,OAAS,QAAAC,MAAY,SACrB,OAAS,gBAAAC,MAAoB,OAC7B,OAAS,iBAAAC,MAAqB,6BAC9B,OACE,gCAAAC,EACA,wBAAAC,EACA,oBAAAC,EACA,gCAAAC,EAEA,yBAAAC,EACA,oBAAAC,EACA,cAAAC,EACA,6BAAAC,EACA,6BAAAC,MACK,+BACP,OAAS,KAAAC,MAAS,SCVX,SAASC,EAAUC,EAAcC,EAAY,IAAe,CAEjE,OADcD,EAAK,MAAMC,CAAS,EAAE,IAAKC,GAAYA,EAAQ,KAAK,CAAC,EACtD,OAAQA,GAAYA,IAAY,EAAE,CACjD,CDyBA,IAAMC,EAAcC,EAAE,OAAO,CAC3B,YAAaA,EAAE,OAAO,EAAE,SAAS,EACjC,UAAWA,EAAE,WAAW,EAAE,QAAQ,EAAK,EACvC,SAAUA,EACP,OAAO,EACP,UAAWC,GAAUC,EAAUD,CAAK,CAAC,EACrC,SAAS,EACZ,kBAAmBD,EAChB,OAAO,EACP,UAAWC,GAAUC,EAAUD,CAAK,CAAC,EACrC,SAAS,EACT,KAAKD,EAAE,MAAMA,EAAE,KAAKG,CAAyB,CAAC,EAAE,SAAS,CAAC,CAC/D,CAAC,EAGM,SAASC,EAAgBC,EAAuB,CACrD,IAAMC,EAAsB,MAAM,QAAQD,CAAI,EAAIA,EAAO,CAACA,CAAI,EAC1DE,EACAC,EACAC,EACAC,EACJ,QAAWC,KAAWL,EAAU,CAC9B,GAAI,CAACM,EAAiBD,CAAO,GAAK,CAACE,EAAsBF,CAAO,EAAG,SACnEH,IAAWM,EAAW,gBAAgBH,CAAO,EACzC,GAAGA,EAAQ,MAAM,IAAIA,EAAQ,OAAO,IAAI,GACxCA,EAAQ,OACZ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nB,KAAM,QACR,EACC,sBAAwB,CACvB,KAAM,QACR,EACC,QAAY,CACX,KAAM,SACR,EACC,SAAa,CACZ,KAAM,QACR,EACC,KAAS,CACR,KAAM,UACN,QAAS,EACX,EACC,KAAS,CACR,KAAM,SACN,QAAS,MACX,CACF,CACF,CAAC,EAOD,GALIJ,IACF,QAAQ,IAAIT,CAAO,EACnB,QAAQ,KAAK,CAAC,GAGZQ,IAAsB,QAAa,CAACG,EAAM,CAC5C,QAAQ,MAAM,wCAAwC,EACtD,QAAQ,SAAW,EACnB,MACF,CAEA,IAAMG,EAAWJ,EAAcK,EAAUL,CAAW,EAAI,OAElDM,EACJT,GAAoB,QAAQ,IAAI,yBAElC,GAAII,EAAM,CACR,GAAI,CACF,IAAMM,EAAQ,MAAMC,EAAoB,CACtC,KAAM,OAAON,CAAO,EACpB,OAAAN,EACA,cAAAU,EACA,kBAAAR,CACF,CAAC,EACD,QAAQ,MAAM,oCAAoCS,EAAM,GAAG,EAAE,CAC/D,OAASE,EAAO,CACd,QAAQ,MAAMA,CAAK,EACnB,QAAQ,SAAW,CACrB,CACA,MACF,CAEA,IAAMC,EAAcjB,GAAkB,QAAQ,IAAI,sBAE7CiB,IACH,QAAQ,MACN,iIACF,EACA,QAAQ,KAAK,CAAC,GAGhB,IAAMC,EAAWC,EAA0B,CACzC,YAAAF,EACA,OAAAd,CACF,CAAC,EAEGQ,GACFS,EAAmBF,EAAUP,CAAQ,EAMvCU,EACE,IACEC,EAAwB,CACtB,SAAAJ,EACA,UAAAjB,EACA,SAAAC,EACA,SAAAS,EACA,cAAAE,CACF,CAAC,EACH,CAAE,QAAS,QAAQ,KAAM,CAC3B,CACF,CAEAd,EAAK,EAAE,MAAM,QAAQ,KAAK","names":["parseArgs","serveStdio","createHash","randomBytes","once","createServer","toNodeHandler","CLIENT_CAPABILITIES_META_KEY","CLIENT_INFO_META_KEY","createMcpHandler","hostHeaderValidationResponse","isJSONRPCNotification","isJSONRPCRequest","isSpecType","localhostAllowedHostnames","PROTOCOL_VERSION_META_KEY","z","parseList","list","delimiter","feature","querySchema","z","value","parseList","CURRENT_ELICITATION_TOOLS","describeRequest","body","messages","client","method","protocolVersion","elicitation","message","isJSONRPCRequest","isJSONRPCNotification","isSpecType","meta","metaClient","CLIENT_INFO_META_KEY","metaVersion","PROTOCOL_VERSION_META_KEY","capabilities","CLIENT_CAPABILITIES_META_KEY","name","description","startLocalHttpEntry","port","apiUrl","contentApiUrl","secretUrlTemplate","log","line","assertValidConnectUrlTemplate","secretCollection","requestStateKey","randomBytes","allowedHostnames","localhostAllowedHostnames","server","createServer","toNodeHandler","request","rejected","hostHeaderValidationResponse","accessToken","url","skipCount","key","query","projectId","readOnly","features","skipElicitations","platform","createSupabaseApiPlatform","parseFeatureGroups","handler","createMcpHandler","createSupabaseMcpServer","createHash","tool","once","address","version","package_default","main","cliAccessToken","projectId","readOnly","apiUrl","cliContentApiUrl","secretUrlTemplate","showVersion","cliFeatures","http","cliPort","parseArgs","features","parseList","contentApiUrl","entry","startLocalHttpEntry","error","accessToken","platform","createSupabaseApiPlatform","parseFeatureGroups","serveStdio","createSupabaseMcpServer"]}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkHJCSISZGcjs = require('./chunk-HJCSISZG.cjs');var _chunkUY7NVUDBcjs = require('./chunk-UY7NVUDB.cjs');require('./chunk-536WYGSZ.cjs');var _server = require('@modelcontextprotocol/server');function m(p){return _server.createMcpHandler.call(void 0, ()=>_chunkHJCSISZGcjs.g.call(void 0, p),{legacy:"reject"})}var u=_chunkUY7NVUDBcjs.a.version;exports.CURRENT_ELICITATION_TOOLS = _chunkHJCSISZGcjs.a; exports.CURRENT_FEATURE_GROUPS = _chunkHJCSISZGcjs.b; exports.createSupabaseMcpHandler = m; exports.createSupabaseMcpServer = _chunkHJCSISZGcjs.g; exports.createToolSchemas = _chunkHJCSISZGcjs.f; exports.supabaseMcpToolSchemas = _chunkHJCSISZGcjs.e; exports.version = u;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/mcp/mcp/packages/mcp-server-supabase/dist/index.cjs","../src/transports/http.ts","../src/index.ts"],"names":["createSupabaseMcpHandler","options","createMcpHandler","createSupabaseMcpServer","version","package_default"],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/mcp/mcp/packages/mcp-server-supabase/dist/index.cjs","../src/transports/http.ts","../src/index.ts"],"names":["createSupabaseMcpHandler","options","createMcpHandler","createSupabaseMcpServer","version","package_default"],"mappings":"AAAA,iIAA+D,wDAAyC,gCAA6B,sDCApG,SASjBA,CAAAA,CAAyBC,CAAAA,CAAmC,CAC1E,OAAOC,sCAAAA,CAAiB,CAAA,EAAMC,iCAAAA,CAA+B,CAAA,CAAG,CAC9D,MAAA,CAAQ,QACV,CAAC,CACH,CCEO,IAAMC,CAAAA,CAAUC,mBAAAA,CAAY,OAAA,CAAA,uUAAA","file":"/home/runner/work/mcp/mcp/packages/mcp-server-supabase/dist/index.cjs","sourcesContent":[null,"import { createMcpHandler } from '@modelcontextprotocol/server';\n\nimport {\n createSupabaseMcpServer,\n type SupabaseMcpServerOptions,\n} from '../server.js';\n\n// Modern protocol only: created with `legacy: 'reject'`, so a client that\n// speaks just the 2025-era protocol gets an HTTP 400 instead of being served.\nexport function createSupabaseMcpHandler(options: SupabaseMcpServerOptions) {\n return createMcpHandler(() => createSupabaseMcpServer(options), {\n legacy: 'reject',\n });\n}\n","import packageJson from '../package.json' with { type: 'json' };\n\nexport type { ToolCallCallback } from '@supabase/mcp-utils';\nexport type { SupabasePlatform } from './platform/index.js';\nexport {\n createSupabaseMcpServer,\n type SupabaseMcpServerOptions,\n} from './server.js';\nexport { createSupabaseMcpHandler } from './transports/http.js';\nexport {\n CURRENT_ELICITATION_TOOLS,\n CURRENT_FEATURE_GROUPS,\n type ElicitationToolName,\n type FeatureGroup,\n} from './types.js';\nexport const version = packageJson.version;\n\nexport {\n createToolSchemas,\n supabaseMcpToolSchemas,\n} from './tools/tool-schemas.js';\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -4,11 +4,12 @@ import { SupabasePlatform } from './platform/index.cjs';
|
|
|
4
4
|
import * as _modelcontextprotocol_server from '@modelcontextprotocol/server';
|
|
5
5
|
import { z } from 'zod/v4';
|
|
6
6
|
|
|
7
|
+
declare const CURRENT_ELICITATION_TOOLS: readonly ["create_project", "create_branch", "execute_sql", "apply_migration"];
|
|
8
|
+
type ElicitationToolName = (typeof CURRENT_ELICITATION_TOOLS)[number];
|
|
7
9
|
declare const CURRENT_FEATURE_GROUPS: readonly ["docs", "account", "database", "debugging", "development", "functions", "branching", "storage"];
|
|
8
10
|
declare const featureGroupSchema: z.ZodPipe<z.ZodUnion<readonly [z.ZodEnum<{
|
|
9
11
|
debug: "debug";
|
|
10
12
|
}>, z.ZodEnum<{
|
|
11
|
-
storage: "storage";
|
|
12
13
|
docs: "docs";
|
|
13
14
|
account: "account";
|
|
14
15
|
database: "database";
|
|
@@ -16,7 +17,8 @@ declare const featureGroupSchema: z.ZodPipe<z.ZodUnion<readonly [z.ZodEnum<{
|
|
|
16
17
|
development: "development";
|
|
17
18
|
functions: "functions";
|
|
18
19
|
branching: "branching";
|
|
19
|
-
|
|
20
|
+
storage: "storage";
|
|
21
|
+
}>]>, z.ZodTransform<"docs" | "account" | "database" | "debugging" | "development" | "functions" | "branching" | "storage", "debug" | "docs" | "account" | "database" | "debugging" | "development" | "functions" | "branching" | "storage">>;
|
|
20
22
|
type FeatureGroup = z.infer<typeof featureGroupSchema>;
|
|
21
23
|
|
|
22
24
|
type SupabaseMcpServerOptions = {
|
|
@@ -48,6 +50,44 @@ type SupabaseMcpServerOptions = {
|
|
|
48
50
|
* Callback for after a supabase tool is called.
|
|
49
51
|
*/
|
|
50
52
|
onToolCall?: ToolCallCallback;
|
|
53
|
+
/**
|
|
54
|
+
* Signed multi-round-trip elicitation config. `requestState` is the shared
|
|
55
|
+
* HMAC codec config used by every elicitation feature this server issues;
|
|
56
|
+
* enable features by setting their sub-options.
|
|
57
|
+
*/
|
|
58
|
+
elicitation?: {
|
|
59
|
+
requestState: {
|
|
60
|
+
/** HMAC key for the `requestState` codec. MUST be at least 32 bytes. */
|
|
61
|
+
key: string | Uint8Array;
|
|
62
|
+
/** The authenticated principal `requestState` is bound to. */
|
|
63
|
+
principal: string;
|
|
64
|
+
/** How long a minted `requestState` stays valid, in seconds. */
|
|
65
|
+
ttlSeconds?: number;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Form confirmation for the listed cost and destructive SQL tools. Clients
|
|
69
|
+
* without form capability keep the existing SQL behavior and legacy
|
|
70
|
+
* `get_cost` -> `confirm_cost` -> `confirm_cost_id` flow.
|
|
71
|
+
*/
|
|
72
|
+
confirmation?: {
|
|
73
|
+
/** Tools that accept a confirmation elicitation. Empty disables all forms. */
|
|
74
|
+
enabledTools: readonly ElicitationToolName[];
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* URL-mode secret collection for `create_edge_function_secret`. Requires
|
|
78
|
+
* `platform.secrets` and the functions feature group. Only URL-capable
|
|
79
|
+
* clients get the tool.
|
|
80
|
+
*/
|
|
81
|
+
secretCollection?: {
|
|
82
|
+
/**
|
|
83
|
+
* URL template of the dashboard page that collects the secret value.
|
|
84
|
+
* MUST contain the `{ref}` and `{name}` placeholders; each is replaced
|
|
85
|
+
* with the percent-encoded project ref and secret name.
|
|
86
|
+
* Example: `https://supabase.com/dashboard/mcp/secrets?ref={ref}&name={name}`.
|
|
87
|
+
*/
|
|
88
|
+
connectUrlTemplate: string;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
51
91
|
};
|
|
52
92
|
/**
|
|
53
93
|
* Creates an MCP server for interacting with Supabase.
|
|
@@ -508,7 +548,7 @@ declare const databaseToolDefs: {
|
|
|
508
548
|
};
|
|
509
549
|
};
|
|
510
550
|
readonly apply_migration: {
|
|
511
|
-
readonly description:
|
|
551
|
+
readonly description: string;
|
|
512
552
|
readonly parameters: z.ZodObject<{
|
|
513
553
|
project_id: z.ZodString;
|
|
514
554
|
name: z.ZodString;
|
|
@@ -526,7 +566,7 @@ declare const databaseToolDefs: {
|
|
|
526
566
|
};
|
|
527
567
|
};
|
|
528
568
|
readonly execute_sql: {
|
|
529
|
-
readonly description:
|
|
569
|
+
readonly description: string;
|
|
530
570
|
readonly parameters: z.ZodObject<{
|
|
531
571
|
project_id: z.ZodString;
|
|
532
572
|
query: z.ZodString;
|
|
@@ -551,13 +591,13 @@ declare const debuggingToolDefs: {
|
|
|
551
591
|
readonly parameters: z.ZodObject<{
|
|
552
592
|
project_id: z.ZodString;
|
|
553
593
|
service: z.ZodEnum<{
|
|
594
|
+
storage: "storage";
|
|
554
595
|
api: "api";
|
|
555
596
|
"branch-action": "branch-action";
|
|
556
597
|
postgres: "postgres";
|
|
557
598
|
"edge-function": "edge-function";
|
|
558
599
|
"edge-function-runtime": "edge-function-runtime";
|
|
559
600
|
auth: "auth";
|
|
560
|
-
storage: "storage";
|
|
561
601
|
realtime: "realtime";
|
|
562
602
|
}>;
|
|
563
603
|
iso_timestamp_start: z.ZodOptional<z.ZodISODateTime>;
|
|
@@ -792,6 +832,30 @@ ${string}`;
|
|
|
792
832
|
};
|
|
793
833
|
};
|
|
794
834
|
|
|
835
|
+
declare const secretToolDefs: {
|
|
836
|
+
readonly create_edge_function_secret: {
|
|
837
|
+
readonly description: "Creates or updates an Edge Function secret for the project. The user enters the value in the Supabase dashboard; it never passes through the AI client.";
|
|
838
|
+
readonly parameters: z.ZodObject<{
|
|
839
|
+
project_id: z.ZodString;
|
|
840
|
+
name: z.ZodString;
|
|
841
|
+
replace: z.ZodOptional<z.ZodBoolean>;
|
|
842
|
+
}, z.core.$strip>;
|
|
843
|
+
readonly outputSchema: z.ZodObject<{
|
|
844
|
+
name: z.ZodOptional<z.ZodString>;
|
|
845
|
+
stored: z.ZodOptional<z.ZodBoolean>;
|
|
846
|
+
updated_seconds_ago: z.ZodOptional<z.ZodNumber>;
|
|
847
|
+
status: z.ZodOptional<z.ZodString>;
|
|
848
|
+
}, z.core.$strip>;
|
|
849
|
+
readonly annotations: {
|
|
850
|
+
readonly title: "Create Edge Function secret";
|
|
851
|
+
readonly readOnlyHint: false;
|
|
852
|
+
readonly destructiveHint: false;
|
|
853
|
+
readonly idempotentHint: true;
|
|
854
|
+
readonly openWorldHint: false;
|
|
855
|
+
};
|
|
856
|
+
};
|
|
857
|
+
};
|
|
858
|
+
|
|
795
859
|
declare const storageToolDefs: {
|
|
796
860
|
readonly list_storage_buckets: {
|
|
797
861
|
readonly description: "Lists all storage buckets in a Supabase project.";
|
|
@@ -963,6 +1027,28 @@ declare const supabaseMcpToolSchemas: {
|
|
|
963
1027
|
readOnlyBehavior: undefined;
|
|
964
1028
|
hidden: undefined;
|
|
965
1029
|
};
|
|
1030
|
+
create_edge_function_secret: {
|
|
1031
|
+
inputSchema: z.ZodObject<{
|
|
1032
|
+
project_id: z.ZodString;
|
|
1033
|
+
name: z.ZodString;
|
|
1034
|
+
replace: z.ZodOptional<z.ZodBoolean>;
|
|
1035
|
+
}, z.core.$strip>;
|
|
1036
|
+
outputSchema: z.ZodObject<{
|
|
1037
|
+
name: z.ZodOptional<z.ZodString>;
|
|
1038
|
+
stored: z.ZodOptional<z.ZodBoolean>;
|
|
1039
|
+
updated_seconds_ago: z.ZodOptional<z.ZodNumber>;
|
|
1040
|
+
status: z.ZodOptional<z.ZodString>;
|
|
1041
|
+
}, z.core.$strip>;
|
|
1042
|
+
annotations: {
|
|
1043
|
+
readonly title: "Create Edge Function secret";
|
|
1044
|
+
readonly readOnlyHint: false;
|
|
1045
|
+
readonly destructiveHint: false;
|
|
1046
|
+
readonly idempotentHint: true;
|
|
1047
|
+
readonly openWorldHint: false;
|
|
1048
|
+
};
|
|
1049
|
+
readOnlyBehavior: undefined;
|
|
1050
|
+
hidden: undefined;
|
|
1051
|
+
};
|
|
966
1052
|
list_edge_functions: {
|
|
967
1053
|
inputSchema: z.ZodObject<{
|
|
968
1054
|
project_id: z.ZodString;
|
|
@@ -1141,13 +1227,13 @@ declare const supabaseMcpToolSchemas: {
|
|
|
1141
1227
|
inputSchema: z.ZodObject<{
|
|
1142
1228
|
project_id: z.ZodString;
|
|
1143
1229
|
service: z.ZodEnum<{
|
|
1230
|
+
storage: "storage";
|
|
1144
1231
|
api: "api";
|
|
1145
1232
|
"branch-action": "branch-action";
|
|
1146
1233
|
postgres: "postgres";
|
|
1147
1234
|
"edge-function": "edge-function";
|
|
1148
1235
|
"edge-function-runtime": "edge-function-runtime";
|
|
1149
1236
|
auth: "auth";
|
|
1150
|
-
storage: "storage";
|
|
1151
1237
|
realtime: "realtime";
|
|
1152
1238
|
}>;
|
|
1153
1239
|
iso_timestamp_start: z.ZodOptional<z.ZodISODateTime>;
|
|
@@ -1720,7 +1806,7 @@ declare const FEATURE_TOOL_MAP: {
|
|
|
1720
1806
|
database: readonly (keyof typeof databaseToolDefs)[];
|
|
1721
1807
|
debugging: readonly (keyof typeof debuggingToolDefs)[];
|
|
1722
1808
|
development: readonly (keyof typeof developmentToolDefs)[];
|
|
1723
|
-
functions: readonly (keyof typeof edgeFunctionToolDefs)[];
|
|
1809
|
+
functions: readonly (keyof typeof edgeFunctionToolDefs | keyof typeof secretToolDefs)[];
|
|
1724
1810
|
branching: readonly (keyof typeof branchingToolDefs)[];
|
|
1725
1811
|
storage: readonly (keyof typeof storageToolDefs)[];
|
|
1726
1812
|
};
|
|
@@ -1792,4 +1878,4 @@ declare function createToolSchemas<const Features extends readonly FeatureGroup[
|
|
|
1792
1878
|
|
|
1793
1879
|
declare const version: string;
|
|
1794
1880
|
|
|
1795
|
-
export { CURRENT_FEATURE_GROUPS, type FeatureGroup, type SupabaseMcpServerOptions, SupabasePlatform, createSupabaseMcpHandler, createSupabaseMcpServer, createToolSchemas, supabaseMcpToolSchemas, version };
|
|
1881
|
+
export { CURRENT_ELICITATION_TOOLS, CURRENT_FEATURE_GROUPS, type ElicitationToolName, type FeatureGroup, type SupabaseMcpServerOptions, SupabasePlatform, createSupabaseMcpHandler, createSupabaseMcpServer, createToolSchemas, supabaseMcpToolSchemas, version };
|