Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions packages/mcp-server-supabase/src/platform/api-platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {
type GetLogsOptions,
type QueryLogsOptions,
type ResetBranchOptions,
type SecretOperations,
type StorageConfig,
type StorageOperations,
type SupabasePlatform,
Expand Down Expand Up @@ -815,6 +816,30 @@ export function createSupabaseApiPlatform(
},
};

const secrets: SecretOperations = {
async getUpdatedAt(projectId: string, name: string) {
const response = await managementApiClient.GET(
'/v1/projects/{ref}/secrets',
{
params: {
path: {
ref: projectId,
},
},
}
);

assertSuccess(response, 'Failed to fetch secrets');

const secret = response.data.find((s) => s.name === name);
if (!secret || !secret.updated_at) {
return undefined;
}

return new Date(secret.updated_at);
},
};

const platform: SupabasePlatform = {
async init(info: InitData) {
const { clientInfo } = info;
Expand All @@ -838,6 +863,7 @@ export function createSupabaseApiPlatform(
functions,
branching,
storage,
secrets,
};

return platform;
Expand Down
9 changes: 9 additions & 0 deletions packages/mcp-server-supabase/src/platform/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,14 @@ export type BranchingOperations = {
rebaseBranch(branchId: string): Promise<void>;
};

/**
* Returns only the `updated_at` timestamp of the named secret, never its
* value or digest.
*/
export type SecretOperations = {
getUpdatedAt(projectId: string, name: string): Promise<Date | undefined>;
};

export type SupabasePlatform = {
init?(info: InitData): Promise<void>;
account?: AccountOperations;
Expand All @@ -284,4 +292,5 @@ export type SupabasePlatform = {
development?: DevelopmentOperations;
storage?: StorageOperations;
branching?: BranchingOperations;
secrets?: SecretOperations;
};
Loading
Loading