@@ -25,6 +25,7 @@ import {
25
25
import { createSupabaseApiPlatform } from './platform/api-platform.js' ;
26
26
import { BRANCH_COST_HOURLY , PROJECT_COST_MONTHLY } from './pricing.js' ;
27
27
import { createSupabaseMcpServer } from './server.js' ;
28
+ import type { SupabasePlatform } from './platform/types.js' ;
28
29
29
30
beforeEach ( async ( ) => {
30
31
mockOrgs . clear ( ) ;
@@ -38,6 +39,7 @@ beforeEach(async () => {
38
39
type SetupOptions = {
39
40
accessToken ?: string ;
40
41
projectId ?: string ;
42
+ platform ?: SupabasePlatform ;
41
43
readOnly ?: boolean ;
42
44
features ?: string [ ] ;
43
45
} ;
@@ -63,10 +65,12 @@ async function setup(options: SetupOptions = {}) {
63
65
}
64
66
) ;
65
67
66
- const platform = createSupabaseApiPlatform ( {
67
- accessToken,
68
- apiUrl : API_URL ,
69
- } ) ;
68
+ const platform =
69
+ options . platform ??
70
+ createSupabaseApiPlatform ( {
71
+ accessToken,
72
+ apiUrl : API_URL ,
73
+ } ) ;
70
74
71
75
const server = createSupabaseMcpServer ( {
72
76
platform,
@@ -2243,6 +2247,35 @@ describe('feature groups', () => {
2243
2247
'restore_project' ,
2244
2248
] ) ;
2245
2249
} ) ;
2250
+
2251
+ test ( 'tools filtered to available platform operations' , async ( ) => {
2252
+ const platform : SupabasePlatform = {
2253
+ database : {
2254
+ executeSql ( ) {
2255
+ throw new Error ( 'Not implemented' ) ;
2256
+ } ,
2257
+ listMigrations ( ) {
2258
+ throw new Error ( 'Not implemented' ) ;
2259
+ } ,
2260
+ applyMigration ( ) {
2261
+ throw new Error ( 'Not implemented' ) ;
2262
+ } ,
2263
+ } ,
2264
+ } ;
2265
+
2266
+ const { client } = await setup ( { platform } ) ;
2267
+ const { tools } = await client . listTools ( ) ;
2268
+ const toolNames = tools . map ( ( tool ) => tool . name ) ;
2269
+
2270
+ expect ( toolNames ) . toEqual ( [
2271
+ 'search_docs' ,
2272
+ 'list_tables' ,
2273
+ 'list_extensions' ,
2274
+ 'list_migrations' ,
2275
+ 'apply_migration' ,
2276
+ 'execute_sql' ,
2277
+ ] ) ;
2278
+ } ) ;
2246
2279
} ) ;
2247
2280
2248
2281
describe ( 'project scoped tools' , ( ) => {
0 commit comments