Connect PlanetScale to Claude Code

Browse PlanetScale databases and branches, read schemas and query insights, and open, deploy or cancel deploy requests. Add Toolspoke to Claude Code once and it can use 18 PlanetScale actions. Your PlanetScale credential stays in Toolspoke, and you choose which actions Claude Code may call.

Set it up in Claude Code

Three steps, the first one once for every toolkit you will ever add.

  1. Add Toolspoke to Claude Code

    Run it in your project, then /mcp to sign in

    claude mcp add --transport http toolspoke https://toolspoke.com/mcp

    The sign-in opens in your browser, and Toolspoke asks you to approve it.

  2. Install PlanetScale and connect it

    Add PlanetScale to a project in your Toolspoke workspace.

    Service token. You provide it once, when you install the connector. Toolspoke encrypts it at rest and decrypts it only for the length of a single call, and the gateway attaches it to the outbound request itself, so it is never part of the arguments an agent sends.

    Service token ID and token
    PlanetScale → your organization → Settings → Service tokens → New service token. Paste the token ID and the token joined by a colon, ID first. Then open the token and grant it access: read_databases under Organization access, then under Database access pick each database and tick read_branch, create_branch and the deploy request permissions it should have. A token sees nothing it was not granted.
  3. Choose what Claude Code may do

    All 18 actions start on. Switch off any of the 6 actions that change something in PlanetScale, and Claude Code gets a refusal if it tries.

What you can ask Claude Code for

A few of the PlanetScale actions that only read, so they are safe to try first.

  • List the organizations this service token can reach
  • Read one database's settings, engine, region, default branch and whether safe migrations are required
  • List a database's branches, with which are production branches and which have safe migrations on
  • Read one branch, including its parent, its state and whether it is a production branch

What Claude Code can do in PlanetScale

12 actions read, 3 write and 3 delete or permanently change something.

Reads

  • List organizations

    List the organizations this service token can reach. A service token belongs to one organization, so this usually returns one row; its name is the `organization` every other action takes.

  • List databases

    List the databases in an organization, with their engine (mysql or postgresql), region, state and default branch.

  • Get database

    Read one database's settings, engine, region, default branch and whether safe migrations are required.

  • List branches

    List a database's branches, with which are production branches and which have safe migrations on.

  • Get branch

    Read one branch, including its parent, its state and whether it is a production branch.

  • Get branch schema

    Return the CREATE statement of every table on a branch. Use it before writing a query or a migration against an unfamiliar database.

  • Lint branch schema

    List the schema lint errors on a branch, the problems that would block a deploy request from it.

  • List query insights

    List the queries a branch has run, grouped by pattern, with counts, rows read and latency. Use it to find what is slow or expensive. The statements are normalized patterns, not the literal values sent.

  • List query errors

    List the errors a branch's queries have raised, grouped by error, with counts and when each last happened.

  • List schema recommendations

    List PlanetScale's index and schema recommendations for a database, each with the DDL that would apply it.

  • List deploy requests

    List a database's deploy requests, the schema changes proposed from one branch into another, with their state and deployment status.

  • Get deploy request

    Read one deploy request by its number, including whether it can be deployed and the state of its deployment.

Writes

  • Create branch

    Create a development branch from an existing branch. It copies the parent's schema, not its data, unless a backup is named.

  • Create deploy request

    Open a deploy request proposing a branch's schema changes into another branch. Nothing is deployed until deploy_deploy_request is called.

  • Close deploy request

    Close an open deploy request without deploying it. The branch and its changes are left as they are.

Deletes or permanently changes

  • Deploy deploy request

    Queue a deploy request, which applies its schema changes to the target branch, usually production. Destructive because it changes a live schema: a dropped column's data goes with it, and a revert is only possible within the revert window, if at all.

  • Cancel deploy request

    Cancel a deploy request that is queued or in progress. Destructive because it stops a running schema change partway, and the request has to be opened again to retry.

  • Delete branch

    Delete a branch and all the data on it. There is no undo. PlanetScale refuses to delete a production branch or one with deletion protection on.

PlanetScale in Claude Code: questions

Does Claude Code see my PlanetScale credential?

No. The credential is stored encrypted in Toolspoke, and the gateway adds it to each call. Claude Code only ever talks to Toolspoke, and the dashboard shows the last four characters of the credential and nothing more.

Can I stop Claude Code from changing things in PlanetScale?

Yes. Each of the 18 actions can be switched off for a project. Turn off the 6 that change something and Claude Code can only read.

Will 18 actions crowd Claude Code's context?

No. Toolspoke shows Claude Code five bridge tools, plus a guide where a toolkit has one, and Claude Code searches for the PlanetScale action it needs when it needs it. Adding more toolkits does not add more tools to its list.

Can I add it once for every project?

Yes. Add --scope user to the command and Claude Code keeps Toolspoke in every project on this machine. Without it, the server is added to the project you ran the command in.

What does it cost?

Tool calls are free on every plan, and a PlanetScale call does not run in a sandbox, so it bills nothing.

Try PlanetScale in Claude Code

Free to start, and tool calls cost nothing on any plan.