Skip to content
Skip to content
PGB Learn

Connect AI coding tools with the MCP server

Let tools such as Claude Code, Cursor and Windsurf inspect your schema and run your actions through the PGB MCP server.

Updated Nov 12, 2026

The Model Context Protocol (MCP) is a standard way for AI coding tools to use outside services. PGB's MCP server connects tools such as Claude Code, Cursor, Windsurf and Antigravity to your project's database, so an agent can read your schema and run your actions instead of guessing.

Get your configuration

  1. Open your project in the Console.
  2. In the sidebar, under Platform Services, choose Agent MCP.
  3. Choose Copy Config. The page shows a ready-made block for your project.

Save it where your tool reads MCP servers, for example .cursor/mcp.json in your project, your Claude Desktop configuration, or Antigravity settings. It looks like this:

{
  "mcpServers": {
    "pgbhub-myapp": {
      "command": "npx",
      "args": ["-y", "@pgbhub/mcp", "--db", "myapp", "--url", "<your connection URL>"]
    }
  }
}

You can also use environment variables (PGBHUB_ENDPOINT, PGBHUB_API_KEY, PGBHUB_DATABASE) instead of the --url argument. The connection URL contains a database password, so treat the file like a secret and keep it out of version control.

What the agent can do

Tool Purpose
pgbhub_inspect Reads your schema: tables, columns, keys and actions
pgbhub_list_actions Lists your actions with their parameters and sample payloads
pgbhub_action Runs an action, or previews it with dry_run
pgbhub_query_crud Safe parameterised find, insert, update, delete and count
pgbhub_create_table Creates a table with typed columns and primary keys
pgbhub_provision Provisions a new database sandbox
pgbhub_upload_asset, pgbhub_signed_url, pgbhub_set_bucket_visibility Storage helpers for buckets and signed links

A guardrail blocks destructive table-wide drops such as DROP TABLE at the protocol level.

Try a prompt

The Agent MCP page suggests prompts to try:

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

Keep it safe

  • Use actions for anything that changes several tables. They run as one transaction, and an agent can preview them with dry_run first.
  • Storage tools need the project's secret key. Making a bucket public needs an explicit confirmation, and agents should ask you first.
  • Give an agent a database you can afford to experiment on, or review its changes before running them in production.
  • For other products, the same server also offers tools for PGB Business apps using a separate mailbox key. Those are described in PGB Business help.

Good to know

  • The View /schema.json link on the page shows the schema document an agent reads.
  • Actions you define in the Console are immediately visible to agents. See Actions.

More guides in Console: APIs, SDKs & tools