Serverpod Overview
Serverpod is an open-source backend framework for Flutter written in Dart. A Serverpod project consists of usually three packages:
- the server code.
- generated client code.
- a Flutter app (imports the client).
There can also be packages that share code, e.g.,
.
The server starts in
, which creates the generated
class from
src/generated/serverpod.dart
(pre-wired with the project's protocol and endpoints) with
final pod = Serverpod(args);
and then
.
The server exposes endpoint classes that the client calls via generated RPC client. Add methods to the endpoints, the code generation will recreate them on the client side. Models are defined in YAML and generate Dart classes for both server and client.
Serverpod projects use a PostgreSQL database for persistence (SQLite is also supported) and include an ORM, caching, real-time streaming (using Dart streams), file uploads, scheduling (called future calls), logging, and a built-in web server (Relic).
Each of these feature areas has its own
skill; use the one that matches the task. The Insights companion app is not covered by a skill and is documented at
https://docs.serverpod.dev.
Running the server
The user runs the server with
, which watches for file changes to run incremental code generation and hot reload the server (and the Flutter app, when the project has one).
Do not check whether the server is running before acting: make the changes and call the
MCP tools. When nothing is running, the MCP answers with an explicit "the server is not running" error. Only then, stop and ask the user to start it. NEVER start the server yourself.
ALWAYS use the MCP server instead of the command line. A running
exposes:
- and for the database (after you change data models).
- when the database has drifted out of sync with the migrations. It only writes the repair file; follow up with .
- to read logs from the server.
- to read raw stdout/stderr from a Flutter app.
- to reload the server and the Flutter app while keeping in-memory state. Only needed with , since reloads on file changes.
- to restart the server and the Flutter app, dropping in-memory state. ALWAYS call it after doing changes in the Flutter app that may not work with normal hot reload (which is automatically applied).
- to start a Flutter app declared under in the server .
- to get the Dart Tooling Daemon URI of a running Flutter app. Pass it to the MCP to drive the app.
Tools that target a Flutter app take an optional
, which is the map key under
. It is required only when the project declares more than one app.
Working on the project with no running instance
- NEVER use the CLI unless you have already attempted to use the MCP.
- ONLY if you cannot connect to the MCP server, the code can be generated by calling .
- NEVER edit the generated code, as it will be overwritten by the next generation. This does not cover the SQL of a created migration, which may be edited — see the Serverpod Migrations skill.
After generating the code, database migrations can be created by calling
serverpod create-migration
. Use ONLY if you cannot use the MCP.
bash
# Use `--force` to create migrations with destructive changes
# Use the `--tag` flag to name the migration
serverpod create-migration [--force] [--tag <tag>]
See the Serverpod Migrations skill for more details.
Checklist after doing changes:
- (CLI, or the MCP server)
- (CLI, or the MCP server)
- Do MCP if required (hot reload is done automatically). Will also hot restart Flutter app
- Check MCP (and for a Flutter app) for any issues