Skip to content

@sbtools/mcp-server

npm

A thin MCP (Model Context Protocol) server that exposes every @sbtools/plugin-migration-studio tool and resource to AI agents via stdio. No business logic lives here — it is a registration layer over the existing tool catalog.

Quick Start

bash
npx @sbtools/mcp-server --cwd /path/to/your/supabase-project

Or point directly at the built file if you are in the monorepo:

bash
node packages/mcp-server/dist/index.js --cwd /path/to/your/supabase-project

Claude Desktop Configuration

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or the equivalent path on your OS:

json
{
  "mcpServers": {
    "sbtools": {
      "command": "node",
      "args": ["/absolute/path/to/packages/mcp-server/dist/index.js"],
      "cwd": "/absolute/path/to/your/supabase-project"
    }
  }
}

With npx:

json
{
  "mcpServers": {
    "sbtools": {
      "command": "npx",
      "args": ["@sbtools/mcp-server"],
      "cwd": "/absolute/path/to/your/supabase-project"
    }
  }
}

--cwd Flag

The server walks up from its working directory looking for supabase-tools.config.json to locate the project root. If it is not found it falls back to cwd. Override explicitly:

bash
node dist/index.js --cwd /path/to/project

Tools (21)

All tools discovered from @sbtools/plugin-migration-studio's tool catalog are registered automatically. The MCP tool name matches the studio tool ID exactly (e.g. studio-introspect, studio-release-gate).

Understand Layer

Tool IDWhat it does
studio-introspectQuery live DB → studio.schema.snapshot artifact
studio-sql-parseParse migration files → studio.sql.ast artifact
studio-intent-syncConfidence-score DB entities vs SQL → studio.intent.sync-report
studio-intent-initBuild intent graph from sync report → studio.intent.graph

Generate Layer

Tool IDWhat it generates
studio-create-tableCREATE TABLE migration
studio-add-columnALTER TABLE … ADD COLUMN migration
studio-add-indexCREATE INDEX migration
studio-add-constraintALTER TABLE … ADD CONSTRAINT migration
studio-add-rls-policyCREATE POLICY migration
studio-add-functionCREATE OR REPLACE FUNCTION migration
studio-create-rpcRPC function (schema: public) migration
studio-create-viewCREATE OR REPLACE VIEW migration
studio-greenfield-initInitialize empty intent graph for a new project

Validate Layer

Tool IDWhat it validates
studio-rls-checkRLS coverage gaps per entity
studio-rpc-lintFunction security (DEFINER, search_path, exposure)
studio-migration-planOrdered SQL change plan vs intent graph
studio-lintMigration file risk flags and naming violations
studio-release-gateAggregated pass/fail gate with blocking reasons

Graph & Mapping

Tool IDDescription
studio-intent-patchMutate a single entity's managed-status
studio-endpoint-mapDerive PostgREST endpoints from intent graph entities/functions

Resources (3)

Resources are read-only and available in any MCP client that supports resource listing.

Resource URIContent
sbtools://studio/catalogFull tool + workflow catalog (filterable JSON)
sbtools://studio/intent-graphCurrent studio.intent.graph artifact data or null
sbtools://studio/llm-contextSingle-call orientation: intent graph summary, artifact freshness, gate status, catalog

Read sbtools://studio/llm-context first — it is the fastest way for an AI agent to understand the project state.

Typical Agent Workflow

1. Read sbtools://studio/llm-context      ← orient: what exists, what's stale
2. Call studio-introspect                 ← snapshot the live DB
3. Call studio-sql-parse                  ← parse migration history
4. Call studio-intent-sync                ← score confidence
5. Call studio-intent-init                ← build intent graph
6. Call studio-release-gate               ← validate before any apply

Monorepo Convenience

If the MCP server package is installed alongside plugin-migration-studio, you can start it via:

bash
sbt mcp
# or
sbt mcp --cwd /path/to/project

See Also