PlanetScale MCP Server
Official hosted MCP server for PlanetScale databases: query execution with replica routing, schema inspection, Insights, and billing access via OAuth.
The PlanetScale MCP server is an officially hosted remote MCP server that gives MCP-compatible clients (Claude, Cursor, VS Code, Notion, OpenCode, Gemini CLI, and others) direct access to PlanetScale organizations, databases, branches, schemas, and Insights data. Authentication is handled via OAuth, with configurable scopes that let you grant read-only or full access at the organization, database, branch, or feature level. Queries are executed over HTTP using ephemeral credentials that are created on demand and destroyed immediately after execution.
The server exposes 16 tools covering discovery (list organizations, databases, branches, regions, cluster sizes), schema inspection, read and write query execution, query performance Insights, schema recommendations (including index suggestions and primary key exhaustion warnings), billing and invoice data, and documentation search. Read queries are automatically routed to replicas when available, and all queries are tagged with a source=planetscale-mcp comment so they can be tracked in Insights.
Built-in safeguards block UPDATE or DELETE statements without a WHERE clause, block TRUNCATE, and require the LLM to request human confirmation for schema-altering DDL. An Insights-only variant of the server is available at https://mcp.pscale.dev/mcp/planetscale-insights-only for teams who want analysis and recommendations without query execution. A partial source repository for the tool implementations is published at github.com/planetscale/mcp-server, while the full tool set is generated from the PlanetScale API OpenAPI spec on the hosted server.
Tools
| Tool | Description |
|---|---|
planetscale_list_organizations |
List all PlanetScale organizations accessible to the authenticated user |
planetscale_get_organization |
Get details about a specific organization |
planetscale_list_databases |
List all databases within an organization |
planetscale_get_database |
Get details about a specific database |
planetscale_list_branches |
List all branches within a database |
planetscale_get_branch |
Get details about a specific database branch |
planetscale_get_branch_schema |
Get the schema for a database branch |
planetscale_execute_read_query |
Execute a read-only SQL query, automatically routed to a replica when available; supports optional postgres_database_name for Postgres |
planetscale_execute_write_query |
Execute a write SQL query or DDL with destructive-query safeguards; supports optional postgres_database_name for Postgres |
planetscale_get_insights |
Get query performance insights for a database branch |
planetscale_list_schema_recommendations |
List schema recommendations including index suggestions and primary key exhaustion warnings |
planetscale_list_regions_for_organization |
List the regions available to an organization |
planetscale_list_cluster_size_skus |
List the available cluster size SKUs |
planetscale_list_invoices |
List all invoices for an organization |
planetscale_get_invoice_line_items |
Get line items for an invoice with prorated costs by branch |
planetscale_search_documentation |
Search the PlanetScale documentation |
The PlanetScale MCP server is hosted by PlanetScale. There is nothing to install: point your MCP client at the server URL and authenticate via OAuth.
Prerequisites
- A PlanetScale account with at least one organization and database
- An MCP-compatible client (Claude Desktop, Claude Code, Cursor, VS Code, Notion, OpenCode, Codex CLI, Amp CLI, or Gemini CLI)
Server URLs
- Full server:
https://mcp.pscale.dev/mcp/planetscale - Insights-only (no query execution):
https://mcp.pscale.dev/mcp/planetscale-insights-only
Config JSON (Cursor, Claude Code, VS Code, generic clients)
{
"mcpServers": {
"planetscale": {
"url": "https://mcp.pscale.dev/mcp/planetscale"
}
}
}
Cursor
- Open the command palette and run "Cursor Settings".
- Go to Tools & MCP and click "New MCP Server".
- Paste the JSON above and save.
- When prompted, authorize Cursor against your PlanetScale account.
Claude Desktop
- Open Settings, Connectors.
- Click Browse connectors, search for "PlanetScale", click the "+" button.
- Sign in to PlanetScale and approve the requested scopes.
Alternatively add it as a custom connector with URL https://mcp.pscale.dev/mcp/planetscale.
Scopes
During OAuth approval you choose which organizations, databases, and branches the server can access, and whether each is read-only or full access. You can re-authenticate later to change scopes.
- Ask an agent to inspect a branch schema and propose missing indexes using
planetscale_list_schema_recommendationsandplanetscale_get_branch_schema. - Run natural-language data analysis against a production replica via
planetscale_execute_read_query, with automatic replica routing keeping load off primaries. - Diagnose slow queries by pulling Insights data with
planetscale_get_insightsand correlating against the live schema. - Audit billing usage by listing invoices and pulling prorated line items per branch for cost attribution.
- Search PlanetScale docs in-line during agent workflows with
planetscale_search_documentationinstead of context-switching to a browser.
- "List my PlanetScale organizations, then show all databases in the
acmeorg." - "Get the schema for the
mainbranch ofacme-prodand suggest any missing indexes." - "Show me the top 10 slowest queries from Insights on the
mainbranch over the last 24 hours." - "Run a read query that counts orders per status from the
mainbranch." - "Pull the latest invoice for the
acmeorg and break it down by branch."
- Officially built and hosted by PlanetScale, no self-hosting or credential management required.
- Strong safety model: ephemeral per-query credentials, replica routing for reads, blocks on unfiltered
UPDATE/DELETEandTRUNCATE, and human-in-the-loop for DDL. - Broad surface area, 16 tools spanning data, schema, Insights, infrastructure, billing, and docs search.
- OAuth scopes allow fine-grained, per-branch read-only or full-access permissions.
- Giving an LLM write access to a production database is inherently risky; PlanetScale explicitly recommends caution even with the built-in safeguards.
- Requires a PlanetScale account and is tied exclusively to PlanetScale-hosted databases.
- Postgres users must pass the
postgres_database_nameparameter to target a non-default database, which can trip up agents that do not know to set it.
- Neon MCP server, an official hosted MCP server for Neon Postgres with similar branching and query capabilities.
- Supabase MCP server, official server for managing Supabase Postgres projects and running SQL.
- Generic MySQL or Postgres MCP servers (e.g.
@modelcontextprotocol/server-postgres) for self-hosted databases without PlanetScale-specific features.