Skip to content

Commit 80a6dcf

Browse files
committed
feat: test tool filtering by platform ops
1 parent 1977bb7 commit 80a6dcf

File tree

1 file changed

+37
-4
lines changed

1 file changed

+37
-4
lines changed

packages/mcp-server-supabase/src/server.test.ts

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import {
2525
import { createSupabaseApiPlatform } from './platform/api-platform.js';
2626
import { BRANCH_COST_HOURLY, PROJECT_COST_MONTHLY } from './pricing.js';
2727
import { createSupabaseMcpServer } from './server.js';
28+
import type { SupabasePlatform } from './platform/types.js';
2829

2930
beforeEach(async () => {
3031
mockOrgs.clear();
@@ -38,6 +39,7 @@ beforeEach(async () => {
3839
type SetupOptions = {
3940
accessToken?: string;
4041
projectId?: string;
42+
platform?: SupabasePlatform;
4143
readOnly?: boolean;
4244
features?: string[];
4345
};
@@ -63,10 +65,12 @@ async function setup(options: SetupOptions = {}) {
6365
}
6466
);
6567

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+
});
7074

7175
const server = createSupabaseMcpServer({
7276
platform,
@@ -2243,6 +2247,35 @@ describe('feature groups', () => {
22432247
'restore_project',
22442248
]);
22452249
});
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+
});
22462279
});
22472280

22482281
describe('project scoped tools', () => {

0 commit comments

Comments
 (0)