Skip to content
Skip to content
PGB Learn

Connect AI coding tools with MCP

What MCP gives your tools

The Model Context Protocol is a standard way for AI coding tools to use outside services. PGB's MCP server lets tools such as Claude Code, Cursor, Windsurf and Antigravity read your schema and run your actions, so they work from facts instead of guesses.

Install it

  1. In the Console, open your project and choose Agent MCP under Platform Services.
  2. Choose Copy Config.
  3. Paste it into your tool's MCP settings, for example .cursor/mcp.json.
{
  "mcpServers": {
    "pgbhub-myapp": {
      "command": "npx",
      "args": ["-y", "@pgbhub/mcp", "--db", "myapp", "--url", "<your connection URL>"]
    }
  }
}

The connection URL includes a password. Keep the file out of version control. You can use PGBHUB_ENDPOINT, PGBHUB_API_KEY and PGBHUB_DATABASE environment variables instead.

The tools

Tool What it does
pgbhub_inspect Reads tables, columns, keys and actions
pgbhub_list_actions Lists actions and their parameters
pgbhub_action Runs an action or previews it with dry_run
pgbhub_query_crud Parameterised find, insert, update, delete and count
pgbhub_create_table Creates a table
pgbhub_provision Provisions a database sandbox
pgbhub_upload_asset, pgbhub_signed_url, pgbhub_set_bucket_visibility Storage helpers

Destructive drops such as DROP TABLE are blocked at the protocol level.

Work with an agent safely

  1. Ask the agent to inspect the schema first, then describe your goal.
  2. Prefer actions. They are named, atomic and previewable.
  3. Ask for a dry run before a real run: "Execute action saveUser with this email using dry_run."
  4. Making a bucket public needs an explicit confirmation and an agent should ask you first.
  5. Work on a development project, or review each change before applying to production.

Example prompts from the Console page:

  • "Execute PGB action 'saveuser' on database 'myapp' with email '[email protected]'."
  • "Create a 'customers' table with an id UUID primary key, name text and a unique email."
  • "Insert a user with email '[email protected]' and tier 'pro', then query all pro customers."

Try it

  1. Copy the config and connect one tool.
  2. Ask it to describe your database. It should use pgbhub_inspect.
  3. Ask it to list your actions, then run one with a dry run.

Recap

  • Agent MCP gives you a ready-made configuration.
  • Tools cover schema, actions, CRUD, tables and storage.
  • Dry runs and actions are the safest way to let an agent change data.

Open Access Course

Free

forever
  • 7 structured lessons across 4 modules
  • Interactive knowledge checks with instant feedback
  • Verifiable completion certificate & PDF