Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/HenkDz/selfhosted-supabase-mcp
/ functions
Functions
54 in github.com/HenkDz/selfhosted-supabase-mcp
⨍
Functions
54
◇
Types & classes
19
↓ 64 callers
Function
createMockClient
(options: MockClientOptions = {})
src/__tests__/helpers/mocks.ts:66
↓ 57 callers
Function
createMockContext
(client?: SelfhostedSupabaseClient)
src/__tests__/helpers/mocks.ts:110
↓ 56 callers
Function
executeSqlWithFallback
( client: SelfhostedSupabaseClient, sql: string, readOnly: boolean = true )
src/tools/utils.ts:119
↓ 36 callers
Function
handleSqlResponse
(result: SqlExecutionResult, schema: z.ZodSchema<T>)
src/tools/utils.ts:68
↓ 31 callers
Method
create
* Factory function to create and asynchronously initialize the client. * Checks for the existence of the helper RPC function.
src/client/index.ts:82
↓ 25 callers
Function
createSuccessResponse
(rows: Record<string, unknown>[])
src/__tests__/helpers/mocks.ts:121
↓ 18 callers
Method
executeSqlWithPg
* Executes SQL directly against the database using the pg library. * Requires DATABASE_URL to be configured. * Useful for simple queries w
src/client/index.ts:246
↓ 17 callers
Function
createMocks
()
src/__tests__/server/auth-middleware.test.ts:23
↓ 14 callers
Method
isPgAvailable
* Checks if the direct database connection (pg) is configured.
src/client/index.ts:463
↓ 13 callers
Method
executeTransactionWithPg
* Executes a series of operations within a single database transaction using the pg library. * Requires DATABASE_URL to be configured. * @
src/client/index.ts:314
↓ 13 callers
Function
isSqlErrorResponse
(result: SqlExecutionResult)
src/tools/utils.ts:60
↓ 12 callers
Function
createToken
(payload: Record<string, unknown>, options?: jwt.SignOptions)
src/__tests__/server/auth-middleware.test.ts:48
↓ 10 callers
Function
createErrorResponse
( message: string, code?: string, details?: string, hint?: string )
src/__tests__/helpers/mocks.ts:128
↓ 8 callers
Method
executeSqlViaRpc
* Executes SQL using the preferred RPC method.
src/client/index.ts:110
↓ 6 callers
Function
runExternalCommand
(command: string)
src/tools/utils.ts:89
↓ 3 callers
Function
createAuthMiddleware
(jwtSecret: string)
src/server/auth-middleware.ts:50
↓ 3 callers
Method
getSupabaseUrl
()
src/client/index.ts:434
↓ 2 callers
Method
ensurePgPool
* Ensures the pg connection pool is initialized. * Should be called before accessing this.pgPool.
src/client/index.ts:278
↓ 2 callers
Method
getAllowedOrigins
* Gets the list of allowed origins from configuration.
src/server/http-server.ts:141
↓ 2 callers
Method
getAnonKey
()
src/client/index.ts:438
↓ 2 callers
Method
getDbUrl
* Gets the configured direct database connection URL, if provided.
src/client/index.ts:456
↓ 2 callers
Method
getJwtSecret
* Gets the configured JWT secret, if provided.
src/client/index.ts:449
↓ 2 callers
Method
getServiceRoleKey
()
src/client/index.ts:442
↓ 2 callers
Method
isServiceRoleAvailable
* Checks if the service role client is available for privileged operations. * Required for execute_sql RPC since it's restricted to service_role
src/client/index.ts:471
↓ 2 callers
Method
stop
()
src/server/http-server.ts:454
↓ 1 callers
Function
canAccessTool
( userRole: string, toolPrivilegeLevel: ToolPrivilegeLevel )
src/tools/types.ts:49
↓ 1 callers
Method
checkAndCreateRpcFunction
()
src/client/index.ts:346
↓ 1 callers
Method
checkRateLimit
* Simple in-memory rate limiter. * Returns rate limit status and info for response headers.
src/server/http-server.ts:84
↓ 1 callers
Method
cleanupExpiredRateLimitEntries
* Cleans up expired rate limit entries to prevent unbounded memory growth. * Called periodically by the cleanup interval.
src/server/http-server.ts:66
↓ 1 callers
Function
createMcpServer
(userContext?: UserContext)
src/index.ts:266
↓ 1 callers
Function
createMockSupabaseClient
(overrides?: Partial<MockSupabaseClient>)
src/__tests__/helpers/mocks.ts:46
↓ 1 callers
Function
detectWriteQuery
(sql: string)
src/tools/explain_query.ts:92
↓ 1 callers
Method
executeSqlViaServiceRoleRpc
* Executes SQL using the service role client (privileged). * Required because execute_sql RPC is restricted to service_role only. * SECURI
src/client/index.ts:176
↓ 1 callers
Method
getClientKey
* Get client identifier for rate limiting (IP address).
src/server/http-server.ts:129
↓ 1 callers
Method
getCorsAllowOriginValue
* Gets the appropriate Access-Control-Allow-Origin header value for a request. * Returns the origin if it's in the allowlist, '*' for same-origi
src/server/http-server.ts:190
↓ 1 callers
Method
initialize
* Initializes the client by checking for the required RPC function. * Attempts to create the function if it doesn't exist and a service role key
src/client/index.ts:92
↓ 1 callers
Function
isWithinWorkspace
* Validates that a resolved path is within a workspace boundary. * This is the security check that prevents path traversal attacks. * * @param norm
src/tools/generate_typescript_types.ts:64
↓ 1 callers
Function
main
()
src/index.ts:83
↓ 1 callers
Function
normalizeOutputPath
* Normalizes and validates the output path for cross-platform compatibility. * Includes path traversal protection when workspacePath is provided. *
src/tools/generate_typescript_types.ts:78
↓ 1 callers
Function
redactDatabaseUrl
(url: string)
src/tools/utils.ts:20
↓ 1 callers
Method
setCorsHeaders
* Sets CORS headers on the response. * The allowOrigin parameter comes from getCorsAllowOriginValue() which * validates against our allowl
src/server/http-server.ts:339
↓ 1 callers
Method
setupMiddleware
()
src/server/http-server.ts:231
↓ 1 callers
Method
setupRoutes
()
src/server/http-server.ts:352
↓ 1 callers
Method
start
()
src/server/http-server.ts:433
↓ 1 callers
Function
tryAnalyticsLogs
( client: ToolContext['selfhostedClient'], service: LogService, limit: number, context: To
src/tools/get_logs.ts:86
↓ 1 callers
Function
tryPostgresCsvLogs
( client: ToolContext['selfhostedClient'], limit: number, context: ToolContext )
src/tools/get_logs.ts:180
Method
constructor
* Creates an instance of SelfhostedSupabaseClient. * Note: Call initialize() after creating the instance to check for RPC functions. * @pa
src/client/index.ts:57
Method
constructor
(options: HttpMcpServerOptions, mcpServerFactory: McpServerFactory)
src/server/http-server.ts:47
Function
createMockExpressReqRes
()
src/__tests__/helpers/mocks.ts:243
Function
getDirectory
* Gets the directory portion of a path.
src/tools/generate_typescript_types.ts:51
Method
isOriginAllowed
* Check if origin is allowed by CORS configuration.
src/server/http-server.ts:152
Function
sanitizeErrorForLogging
(error: unknown)
src/tools/utils.ts:41
Function
sanitizeSchemaName
* Sanitizes a schema name to prevent command injection. * Only allows alphanumeric characters, underscores, and hyphens. * * @param schema - The sc
src/tools/generate_typescript_types.ts:18
Function
toAbsolute
* Resolves a path to an absolute path. * The caller MUST validate the result before using it for file operations. * * SECURITY: Path tr
src/tools/generate_typescript_types.ts:42