Skip to content
Merged
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
1 change: 1 addition & 0 deletions packages/mcp-server-supabase/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@modelcontextprotocol/sdk": "^1.18.0",
"@supabase/mcp-utils": "workspace:^",
"common-tags": "^1.8.2",
"gqlmin": "^0.3.1",
"graphql": "^16.11.0",
"openapi-fetch": "^0.13.5",
"zod": "^3.24.1"
Expand Down
4 changes: 3 additions & 1 deletion packages/mcp-server-supabase/src/content-api/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import gqlmin from 'gqlmin';
import { z } from 'zod';
import { GraphQLClient, type GraphQLRequest, type QueryFn } from './graphql.js';

Expand Down Expand Up @@ -25,7 +26,8 @@ export async function createContentApiClient(
loadSchema: async () => {
const response = await graphqlClient.query({ query: '{ schema }' });
const { schema } = contentApiSchemaResponseSchema.parse(response);
return schema;
const minifiedSchema = gqlmin(schema);
return minifiedSchema;
},
async query(request: GraphQLRequest) {
return graphqlClient.query(request);
Expand Down
4 changes: 3 additions & 1 deletion packages/mcp-server-supabase/src/server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
} from '@modelcontextprotocol/sdk/types.js';
import { StreamTransport } from '@supabase/mcp-utils';
import { codeBlock, stripIndent } from 'common-tags';
import gqlmin from 'gqlmin';
import { setupServer } from 'msw/node';
import { beforeEach, describe, expect, test } from 'vitest';
import {
Expand Down Expand Up @@ -2962,7 +2963,8 @@ describe('docs tools', () => {
throw new Error('tool description not found');
}

expect(tool.description.includes(contentApiMockSchema)).toBe(true);
const minifiedSchema = gqlmin(contentApiMockSchema);
expect(tool.description.includes(minifiedSchema)).toBe(true);
});

test('schema is only loaded when listing tools', async () => {
Expand Down
4 changes: 3 additions & 1 deletion packages/mcp-server-supabase/src/tools/docs-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ export function getDocsTools({ contentApiClient }: DocsToolsOptions) {
return source`
Search the Supabase documentation using GraphQL. Must be a valid GraphQL query.
You should default to calling this even if you think you already know the answer, since the documentation is always being updated.
Below is the GraphQL schema for the Supabase docs endpoint:

Below is the GraphQL schema for this tool:

${schema}
`;
},
Expand Down
22 changes: 22 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.