Skip to main content
PowerSync DevTools exposes MCP (Model Context Protocol) tools that let a coding agent, such as Claude Code or Codex, query your app’s local database, read its sync status, and run sync actions.
These tools work with your running app. To let an agent search the PowerSync documentation, use the docs MCP server instead.

Endpoints

Nuxt DevTools 3 does not have an MCP endpoint. On the web, the tools get the database from an open app tab. Keep your app open in a browser that Vite DevTools trusts, or the tools return an error. For a Node.js app, set a fixed port in enablePowerSyncDiagnostics() so that the endpoint stays the same when your app restarts.

Connect a Coding Agent

The endpoint accepts only requests that have a loopback Origin header, such as http://localhost:5173. Some MCP clients do not send this header, so add it to the client configuration. For example, to add the Vite endpoint to Claude Code:
If your MCP client cannot send the header, set allowedOrigins: false. Read Origin and Authorization.
Coding agents such as Claude Code can add the server themselves. Start your dev server, open your app, and give the agent a prompt like this one:
Change the URL and the port to match your host. Some agents must restart before they can use a new MCP server.

Tools

The tools take positional arguments named arg0 and arg1. The last argument of most tools is the database ID. Pass null to use the first attached database, or call powersync_sources to list the IDs. For subscribeStream and unsubscribeStream, args is { name, params?, ttl?, priority? }.
powersync_query can change data. powersync_action with clearData deletes the local data, including the local changes in the upload queue, and downloads the data again. powersync_info returns the current JWT. Give these tools only to agents that you trust.

Origin and Authorization

To change how the endpoint checks requests, use the mcp setting: Set it in your host:

Test the Endpoint

Use curl to check that the endpoint works. This example counts the operations in the local oplog:
If the response is 403 Forbidden, the request has no loopback Origin header.