Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions codex-plugin/plugins/spacetimedb/skills/cli/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ spacetime logout
| `--yes` | `-y` | Non-interactive mode (skip confirmations) |
| `--anonymous` | | Use anonymous identity |
| `--module-path` | `-p` | Path to module project |
| `--no-config` | | Ignore `spacetime.json` project configuration |

## Troubleshooting

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ var conn = DbConnection.Builder()
.WithUri("http://localhost:3000")
.WithDatabaseName("my-database")
.WithToken(savedToken)
.WithCompression(Compression.Brotli) // optional; this is the default
.OnConnect((conn, identity, token) =>
{
Console.WriteLine($"Connected as: {identity}");
Expand All @@ -45,6 +46,8 @@ var conn = DbConnection.Builder()
.Build();
```

Compression options are `Compression.Brotli`, `Compression.Gzip`, and `Compression.None`. The SDK uses Brotli when `WithCompression` is omitted.

## Event Loop (Critical)

**`FrameTick()` must be called in your main loop.** The SDK queues all network messages and only processes them when you call `FrameTick()`. Without it, no callbacks fire.
Expand Down
8 changes: 6 additions & 2 deletions codex-plugin/plugins/spacetimedb/skills/mcp/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ database, so there is no `database` argument and no `list_databases`:
{ "name": "sql", "arguments": { "sql": "SELECT * FROM message" } }
```

When `spacetime mcp` runs inside a project with a `spacetime.json` that has a single unambiguous
`server`, it uses that server unless `--server` or `--no-config` is passed. It does not infer a
database from the config; omitting the database argument still means host-wide mode.

## Rules that do not change

The tools run with your identity, exactly as the HTTP API does. The model is the same as everywhere
Expand Down Expand Up @@ -108,7 +112,7 @@ Pass `"confirmed": true` to `sql` to wait for a durably confirmed read.
| `no such table: x` | The table is private, or you are querying the wrong database |
| No `spacetimedb` tools at all | No MCP server is connected. Use the CLI instead (`cli` skill) |

`spacetime mcp` is UNSTABLE and may not be in a released CLI yet, so a client that cannot start it
falls back to the CLI commands in the `cli` skill.
`spacetime mcp` is UNSTABLE and subject to breaking changes. If a client cannot start it, fall back
to the CLI commands in the `cli` skill.

Reference: https://spacetimedb.com/docs
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,8 @@ ctx.db[reminder].insert(Reminder{

For interval schedules, the current implementation calculates the next run from the previous intended run time. Missed interval ticks are skipped, so a delayed scheduled reducer or procedure resumes on the next future interval boundary.

When multiple schedule rows have already expired by the time SpacetimeDB observes them, their dispatch order is not guaranteed to match `scheduled_at` order. If application behavior depends on ordering, store an explicit sequence or timestamp in the scheduled row and handle ordering in your module logic.

### Row Lifecycle

SpacetimeDB passes the schedule row to the scheduled reducer or procedure as an argument. One-shot schedule rows are removed at different times depending on the kind of function being called:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ Construct a `DbConnection` by calling `DbConnection.Builder()`, chaining configu
| [WithUri method](#method-withuri) | Set the URI of the SpacetimeDB instance hosting the remote database. |
| [WithDatabaseName method](#method-withdatabasename) | Set the name or identity of the remote database. |
| [WithConfirmedReads method](#method-withconfirmedreads) | Enable or disable confirmed reads. |
| [WithCompression method](#method-withcompression) | Set the compression method for WebSocket messages. |
| [OnConnect callback](#callback-onconnect) | Register a callback to run when the connection is successfully established. |
| [OnConnectError callback](#callback-onconnecterror) | Register a callback to run if the connection is rejected or the host is unreachable. |
| [OnDisconnect callback](#callback-ondisconnect) | Register a callback to run when the connection ends. |
Expand Down Expand Up @@ -149,6 +150,19 @@ When enabled, the server will send query results only after they are confirmed t

If this method is not called, the server chooses the default.

#### Method `WithCompression`

```csharp
class DbConnectionBuilder
{
public DbConnectionBuilder<DbConnection> WithCompression(Compression compression);
}
```

Configure compression for WebSocket messages. Available options are `Compression.Brotli`, `Compression.Gzip`, and `Compression.None`.

If this method is not called, the SDK uses `Compression.Brotli`. Use `Compression.None` only when you need to debug raw message sizes or avoid compression overhead for very small local test payloads.

#### Callback `OnConnect`

```csharp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ slug: /cli-reference/spacetime-json

The `spacetime.json` file defines project-level configuration for the SpacetimeDB CLI. It eliminates repetitive CLI flags and enables multi-target workflows such as publishing multiple databases or generating bindings for multiple languages from a single project.

Commands that read `spacetime.json` include [`spacetime publish`](/cli-reference#spacetime-publish), [`spacetime generate`](/cli-reference#spacetime-generate), and [`spacetime dev`](/cli-reference#spacetime-dev).
Commands that read `spacetime.json` include [`spacetime publish`](/cli-reference#spacetime-publish), [`spacetime generate`](/cli-reference#spacetime-generate), and [`spacetime dev`](/cli-reference#spacetime-dev). Commands that operate on an already-published database, such as [`spacetime call`](/cli-reference#spacetime-call), [`spacetime sql`](/cli-reference#spacetime-sql), and [`spacetime logs`](/cli-reference#spacetime-logs), can resolve their database and server from matching config targets. Commands that operate on a server rather than a named config database, such as [`spacetime list`](/cli-reference#spacetime-list), [`spacetime rename`](/cli-reference#spacetime-rename), and [`spacetime mcp`](/cli-reference#spacetime-mcp), can also use the configured server when the config has a single unambiguous server.

## Config structure

Expand Down Expand Up @@ -236,7 +236,7 @@ These produce an error if the selected database has multiple generate entries:

## `--no-config`

The `--no-config` flag causes the CLI to ignore `spacetime.json` entirely, behaving as if no config file exists. This is useful for one-off operations or scripting.
The `--no-config` flag causes the CLI to ignore `spacetime.json` entirely, behaving as if no config file exists. This is useful for one-off operations, scripting, or commands such as `spacetime list` when you want the default server instead of the server configured for the current project.

```bash
spacetime publish my-db --module-path ./module --no-config
Expand Down
1 change: 1 addition & 0 deletions docs/docs/00300-resources/00200-reference/00150-mcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ spacetime mcp my-database --server local
When you omit the database argument, the MCP server is host-wide.
When you pass a database name or identity, the MCP server is scoped to that database.
The database argument can also come from the `SPACETIMEDB_DB_NAME` environment variable.
When you run `spacetime mcp` from a project with a `spacetime.json` that names a single unambiguous `server`, the command uses that server unless you pass `--server` or `--no-config`. It does not infer a database from the config; omitting the database argument still starts a host-wide MCP server.

The command uses your saved SpacetimeDB identity unless you pass `--anonymous`.

Expand Down
1 change: 1 addition & 0 deletions skills/cli/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ spacetime logout
| `--yes` | `-y` | Non-interactive mode (skip confirmations) |
| `--anonymous` | | Use anonymous identity |
| `--module-path` | `-p` | Path to module project |
| `--no-config` | | Ignore `spacetime.json` project configuration |

## Troubleshooting

Expand Down
3 changes: 3 additions & 0 deletions skills/csharp-client/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ var conn = DbConnection.Builder()
.WithUri("http://localhost:3000")
.WithDatabaseName("my-database")
.WithToken(savedToken)
.WithCompression(Compression.Brotli) // optional; this is the default
.OnConnect((conn, identity, token) =>
{
Console.WriteLine($"Connected as: {identity}");
Expand All @@ -45,6 +46,8 @@ var conn = DbConnection.Builder()
.Build();
```

Compression options are `Compression.Brotli`, `Compression.Gzip`, and `Compression.None`. The SDK uses Brotli when `WithCompression` is omitted.

## Event Loop (Critical)

**`FrameTick()` must be called in your main loop.** The SDK queues all network messages and only processes them when you call `FrameTick()`. Without it, no callbacks fire.
Expand Down
8 changes: 6 additions & 2 deletions skills/mcp/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ database, so there is no `database` argument and no `list_databases`:
{ "name": "sql", "arguments": { "sql": "SELECT * FROM message" } }
```

When `spacetime mcp` runs inside a project with a `spacetime.json` that has a single unambiguous
`server`, it uses that server unless `--server` or `--no-config` is passed. It does not infer a
database from the config; omitting the database argument still means host-wide mode.

## Rules that do not change

The tools run with your identity, exactly as the HTTP API does. The model is the same as everywhere
Expand Down Expand Up @@ -108,7 +112,7 @@ Pass `"confirmed": true` to `sql` to wait for a durably confirmed read.
| `no such table: x` | The table is private, or you are querying the wrong database |
| No `spacetimedb` tools at all | No MCP server is connected. Use the CLI instead (`cli` skill) |

`spacetime mcp` is UNSTABLE and may not be in a released CLI yet, so a client that cannot start it
falls back to the CLI commands in the `cli` skill.
`spacetime mcp` is UNSTABLE and subject to breaking changes. If a client cannot start it, fall back
to the CLI commands in the `cli` skill.

Reference: https://spacetimedb.com/docs
Loading