These tools work with your running app. To let an agent search the PowerSync documentation, use the docs MCP server instead.
Connect a Coding Agent
Tools
These tools are available on the MCP endpoint and in React Native. The MCP endpoint and the Rozenite agent CLI pass the inputs in different ways.
For
subscribeStream and unsubscribeStream, args is { name, params?, ttl?, priority? }.
MCP Endpoint
Vite, Nuxt DevTools 4, Capacitor, and Node.js serve the tools as MCP (Model Context Protocol) tools.
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 Capacitor app, keep the app running with live reload on a trusted simulator or emulator.
For a Node.js app, set a fixed
port in enablePowerSyncDiagnostics() so that the endpoint stays the same when your app restarts.
Add the Endpoint to Your Agent
The endpoint accepts only requests that have a loopbackOrigin 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:
allowedOrigins: false. Read Origin and Authorization.
Pass Tool Arguments
On the MCP endpoint, each tool name has thepowersync_ prefix, such as powersync_query. The endpoint also has a powersync_sources tool, which returns the attached databases with their ID and SDK.
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.
Origin and Authorization
To change how the endpoint checks requests, use themcp setting:
Set it in your host:
- devtools option (Vite 8.3+)
- DevTools() plugin (Vite 7+)
- Nuxt DevTools 4
- Node.js
Test the Endpoint
Usecurl to check that the endpoint works. This example counts the operations in the local oplog:
403 Forbidden, the request has no loopback Origin header.
React Native
In React Native apps, theusePowerSyncDevTools() hook registers the tools for the Rozenite agent CLI. The tools are in the powersync/diagnostics domain, for example npx rozenite agent powersync/diagnostics status.
To use the tools, set up PowerSync DevTools for React Native, and keep the app running with Metro started with WITH_ROZENITE=true. The agent runs the commands from your app’s folder.
The CLI passes the inputs as named flags, such as --sql. The tools have no database ID and there is no sources tool, because the tools use the database that you pass to the hook.