What is the PlanetScale MCP server?
- A hosted MCP server that exposes your PlanetScale organizations, databases, branches, schema, and Insights data to MCP-compatible tools.
- Authenticated via OAuth for configurable access to permissions and scopes.
- Accessible from any MCP client that supports HTTP-hosted servers.
Quick start
Cursor
One-click install
VS Code
One-click install
Claude Code
See instructions
OpenCode
See instructions
Codex
See instructions
Other clients
See all options
Authentication
The hosted MCP server uses OAuth so you can authorize access to PlanetScale organizations, databases, branches, and Insights data directly in your client via the MCP server.- Each client (for example, Claude Code, Cursor, or other MCP-compatible tools) registers as an OAuth application with PlanetScale.
- When you connect the MCP server from your client, you’re redirected to PlanetScale to sign in and grant access.
Security and credentials
- Each query uses short-lived, ephemeral credentials that are created on demand and deleted immediately after execution.
Scopes and permissions
Permissions are controlled through OAuth scopes:- Scopes define which organizations, databases, branches, or features the MCP server can see.
- You choose whether the MCP server has no access, read-only access, or full access to databases at the organization or per-database level.
Installation instructions
Cursor
Cursor
Click to install the MCP server configuration for Cursor.
- Open the command palette and type “Cursor Settings”
- Under “Tools & MCP” click “New MCP Server”
- Paste the following JSON into the configuration file that opens
.cursor/mcp.json
- Once this configuration is saved, Cursor will attempt to authenticate and show a login prompt. Select this prompt to grant Cursor access to your PlanetScale account.
- You may need to restart Cursor to load the new configuration.
VS Code
VS Code
Click to install the MCP server configuration for VS Code.
- Open the Command Palette (
Ctrl+Shift+Pon Windows/Linux orCmd+Shift+Pon macOS) - Type “MCP: Add Server”
- Choose “HTTP”
- Enter the following details:
- URL: https://mcp.pscale.dev/mcp/planetscale
- Name: “PlanetScale”
- Click “Add”
- Open the Command Palette (
Ctrl+Shift+Pon Windows/Linux orCmd+Shift+Pon macOS) - Type “MCP: List Servers”
- Select “PlanetScale”
- Click “Start Server”
- When the dialog appears saying “The MCP Server Definition ‘PlanetScale’ wants to authenticate to PlanetScale MCP,” click “Allow”
- A popup will ask “Do you want Code to open the external website?” — click “Cancel”
- You’ll see a message: “Having trouble authenticating to ‘PlanetScale MCP’? Would you like to try a different way? (URL Handler)”
- Click “Yes”
- Click “Open” and complete the PlanetScale sign-in flow to connect to PlanetScale MCP
OpenCode
OpenCode supports automatic authentication for OAuth-based remote MCP servers.- Ensure OpenCode is installed and available in your terminal
- Add the PlanetScale MCP server to your OpenCode configuration file.
~/.config/opencode/opencode.json
- Enter the following to authenticate with the PlanetScale MCP server
- Enter OpenCode
- List the available MCP servers with the
/mcpslash command.
Claude.ai and Claude for desktop
Custom connectors using remote MCP are not available on all plans. See the Claude Support page for more information.
- Navigate to Settings > Connectors
- Click Add custom connector at the bottom of the section
- Enter the PlanetScale MCP server URL:
https://mcp.pscale.dev/mcp/planetscale - Click Add to save the connector
- Follow the prompts to authenticate with your PlanetScale account
- Click the + button in the lower left of your chat interface
- Select Connectors
- Toggle the PlanetScale connector on for that conversation
Claude Code
- Ensure Claude Code is available in your terminal
- Run the following command to add the PlanetScale MCP server to your Claude Code
- Enter Claude Code
- List the available MCP servers with the
/mcpslash command.
Gemini CLI
- Ensure Gemini CLI is available in your terminal
- Run the following command to add the PlanetScale MCP server to your Gemini CLI
- Enter Gemini CLI
- List the available MCP servers with the
/mcpslash command and select “List”
Codex CLI
- Ensure Codex CLI is available in your terminal
- Run the following command to add the PlanetScale MCP server to your Codex CLI
- Enter Codex CLI
- List the available MCP servers with the
/mcpslash command
Amp CLI
- Ensure Amp CLI is available in your terminal
- Run the following command to add the PlanetScale MCP server to your Amp CLI
- Enter Amp CLI
- You should be immediately prompted to authenticate. Follow the instructions in the browser.
-
List the available MCP servers with the
/mcp list toolscommand.
Query handling
All queries execute over HTTP via the hosted MCP server. This makes the MCP server useful in environments that normally cannot run database queries directly, such as browser-based tools or sandboxed AI agents. The PlanetScale MCP server includes several built-in behaviors to help ensure safe, observable, and performant query execution.Read queries
- Read queries automatically use a replica when your database has replicas configured, reducing load on the primary.
- All queries include a
source=planetscale-mcpcomment, making them easy to identify and track in Insights.
Write query safeguards
To help prevent accidental data loss, the MCP server blocks certain operations:UPDATEorDELETEstatements without aWHEREclause are blocked.TRUNCATEstatements are blocked.- DDL statements (
CREATE,DROP,ALTER, etc.) prompt the LLM to request human confirmation before proceeding.
Example workflows
Once installed, you can ask your MCP-enabled editor or agent to:- “Show me all databases in my PlanetScale organization and highlight anything running on PlanetScale Metal.”
- “List the branches for my production database and summarize their differences.”
- “Look at my slowest queries over the last day and suggest index or query changes.”
- “Check whether the CPU and memory profile for my database is appropriate for the current workload.”
- “Explain what changed between yesterday’s and today’s query patterns in Insights.”
Available tools
The hosted PlanetScale MCP server exposes a curated set of tools designed for day-to-day database exploration, debugging, and insights. The available tools are:planetscale_list_organizations- List all PlanetScale organizations you have access to.planetscale_list_databases- List all databases within an organization.planetscale_list_branches- List all branches within a database.planetscale_get_organization- Get details about a specific organization.planetscale_get_database- Get details about a specific database.planetscale_get_branch- Get details about a database branch.planetscale_get_branch_schema- Get the schema for a database branch.planetscale_execute_read_query- Execute a read-only SQL query (SELECT, SHOW, DESCRIBE, EXPLAIN) against a PlanetScale database.planetscale_execute_write_query- Execute a write SQL query (INSERT, UPDATE, DELETE, or DDL) against a PlanetScale database.planetscale_get_insights- Get query performance insights for a PlanetScale database branch.planetscale_list_regions_for_organization- List all available regions for an organization.planetscale_list_cluster_size_skus- List all available cluster size SKUs.planetscale_list_invoices- List all invoices for an organization.planetscale_get_invoice_line_items- Get all line items for an invoice, with prorated costs broken down by database branch.planetscale_search_documentation- Search the PlanetScale documentation.
Troubleshooting
If your MCP client cannot connect or tools fail to run:- Restart your client or CLI tool After installation, you may need to restart your client or CLI tool to load the new MCP configuration.
-
Check the server URL
Make sure the MCP server URL is set to the hosted endpoint (for example,
https://mcp.pscale.dev/mcp/planetscale). - Re-authorize the MCP server If scopes or tokens have changed, reauthorize the PlanetScale MCP server in your client so it can request fresh tokens.
- Verify organization and database access Confirm that your PlanetScale user account has access to the orgs and databases you expect to see.

