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.
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
- Open your project in the Console.
- In the sidebar, under Platform Services, choose Agent MCP.
- 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_runfirst. - 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
The REST API: query your data over HTTPS
Read and write rows, run SQL and call actions with plain HTTP requests to your project address.
Use the TypeScript SDK
Install @pgb/sdk, create a client, run a first query, and find the calls for each service.
Use the Python SDK
Install pgbhub, create a sync or async client, run a first query, and use auth, mail, storage and actions.
Use the Go and Rust SDKs
Install the Go and Rust clients and run a first call with each, then find auth, mail, storage and actions.
Webhooks: receiving and sending
Receive webhooks in a function, send them from event rules, cron jobs, jobs and actions, and verify signatures.
API keys
Publishable and secret project keys, account-level keys, how to create, scope, rotate and revoke them.