• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase-community / supabase-mcp / 16727694595

04 Aug 2025 03:41PM UTC coverage: 96.357% (+0.03%) from 96.328%
16727694595

push

github

web-flow
Merge pull request #119 from supabase-community/charis/user-agent

fix: add user-agent string to content api requests

225 of 244 branches covered (92.21%)

Branch coverage included in aggregate %.

17 of 17 new or added lines in 3 files covered. (100.0%)

2076 of 2144 relevant lines covered (96.83%)

34.02 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.18
/packages/mcp-server-supabase/src/pg-meta/index.ts
1
import { stripIndent } from 'common-tags';
2✔
2
import columnsSql from './columns.sql';
3
import extensionsSql from './extensions.sql';
4
import tablesSql from './tables.sql';
5

6
export const SYSTEM_SCHEMAS = [
2✔
7
  'information_schema',
2✔
8
  'pg_catalog',
2✔
9
  'pg_toast',
2✔
10
  '_timescaledb_internal',
2✔
11
];
2✔
12

13
/**
14
 * Generates the SQL query to list tables in the database.
15
 */
16
export function listTablesSql(schemas: string[] = []) {
2✔
17
  let sql = stripIndent`
12✔
18
    with
19
      tables as (${tablesSql}),
12✔
20
      columns as (${columnsSql})
12✔
21
    select
22
      *,
23
      ${coalesceRowsToArray('columns', 'columns.table_id = tables.id')}
12✔
24
    from tables
25
  `;
26

27
  sql += '\n';
12✔
28

29
  if (schemas.length > 0) {
12✔
30
    sql += `where schema in (${schemas.map((s) => `'${s}'`).join(',')})`;
12✔
31
  } else {
12!
32
    sql += `where schema not in (${SYSTEM_SCHEMAS.map((s) => `'${s}'`).join(',')})`;
×
33
  }
×
34

35
  return sql;
12✔
36
}
12✔
37

38
/**
39
 * Generates the SQL query to list all extensions in the database.
40
 */
41
export function listExtensionsSql() {
2✔
42
  return extensionsSql;
1✔
43
}
1✔
44

45
/**
46
 * Generates a SQL segment that coalesces rows into an array of JSON objects.
47
 */
48
export const coalesceRowsToArray = (source: string, filter: string) => {
2✔
49
  return stripIndent`
12✔
50
    COALESCE(
51
      (
52
        SELECT
53
          array_agg(row_to_json(${source})) FILTER (WHERE ${filter})
12✔
54
        FROM
55
          ${source}
12✔
56
      ),
57
      '{}'
58
    ) AS ${source}
12✔
59
  `;
60
};
12✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc