Skip to content

Commit 735c48c

Browse files
committed
feat: minifiy content api graphql schema
1 parent da79165 commit 735c48c

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

packages/mcp-server-supabase/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"@modelcontextprotocol/sdk": "^1.18.0",
5151
"@supabase/mcp-utils": "workspace:^",
5252
"common-tags": "^1.8.2",
53+
"gqlmin": "^0.3.1",
5354
"graphql": "^16.11.0",
5455
"openapi-fetch": "^0.13.5",
5556
"zod": "^3.24.1"

packages/mcp-server-supabase/src/content-api/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import gqlmin from 'gqlmin';
12
import { z } from 'zod';
23
import { GraphQLClient, type GraphQLRequest, type QueryFn } from './graphql.js';
34

@@ -25,7 +26,8 @@ export async function createContentApiClient(
2526
loadSchema: async () => {
2627
const response = await graphqlClient.query({ query: '{ schema }' });
2728
const { schema } = contentApiSchemaResponseSchema.parse(response);
28-
return schema;
29+
const minifiedSchema = gqlmin(schema);
30+
return minifiedSchema;
2931
},
3032
async query(request: GraphQLRequest) {
3133
return graphqlClient.query(request);

packages/mcp-server-supabase/src/tools/docs-tools.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ export function getDocsTools({ contentApiClient }: DocsToolsOptions) {
1616
return source`
1717
Search the Supabase documentation using GraphQL. Must be a valid GraphQL query.
1818
You should default to calling this even if you think you already know the answer, since the documentation is always being updated.
19-
Below is the GraphQL schema for the Supabase docs endpoint:
19+
20+
Below is the GraphQL schema for this tool:
21+
2022
${schema}
2123
`;
2224
},

pnpm-lock.yaml

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)