/local
`sentry local` runs a local development server that captures Sentry SDK envelopes from your dev stack and surfaces errors, traces, and logs in real time — right in your terminal. No authentication required.
> /plugin marketplace add getsentry/toolkit > /plugin install sentry-mcp@sentry-mcp
How it fires
How this command gets triggered: by you, by Claude, or both.
- Fires itselfClaude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/local
Context preview
What this command does when you run it.
`sentry local` runs a local development server that captures Sentry SDK envelopes from your dev stack and surfaces errors, traces, and logs in real time — right in your terminal. No authentication required.
Command definition
local.md`sentry local` runs a local development server that captures Sentry SDK envelopes from your dev stack and surfaces errors, traces, and logs in real time — right in your terminal. No authentication required.
No DSN is required either. If your app has no DSN configured, events flow **only** to the local server — nothing reaches your Sentry organization and no production quota is used. If a DSN *is* set, the SDK sends to both Sentry and the local server.
If a server is already running on the port, the command attaches as an SSE consumer instead of starting a duplicate.
Examples
# Start the server and tail events (default)
sentry local
# Run your app with the local server auto-enabled
sentry local run -- npm run dev
sentry local run -- python manage.py runserver
# Use a custom port
sentry local --port 9000
# Only show errors and logs (filter out transactions)
sentry local -f error -f log
# Run quietly (suppress per-envelope tail output)
sentry local --quiet
`sentry local run`
Runs a command with `SENTRY_SPOTLIGHT` injected into the environment. The Sentry SDK automatically detects this variable and sends envelopes to the local server. No code changes needed.
If nothing is listening on the port, a server is started in the background and shut down when your command exits. If something already is — the Spotlight desktop app's own sidecar, or a `sentry local serve` in another terminal — the command attaches to it as an SSE consumer, so events still tail to your terminal either way.
Env vars injected into the child process:
| Variable | Value | |----------|-------| | `SENTRY_SPOTLIGHT` | `http://localhost:<port>/stream` | | `<PREFIX>SENTRY_SPOTLIGHT` | `http://localhost:<port>/stream` | | `SENTRY_TRACES_SAMPLE_RATE` | `1` (unless already set) | | `SENTRY_RELEASE` | `sentry-cli-local` (unless already set) |
The `<PREFIX>` variants cover every common framework client prefix so the spotlight URL is inlined into your browser bundle no matter which bundler you use: `PUBLIC_` (SvelteKit, Astro, Qwik), `NEXT_PUBLIC_` (Next.js), `VITE_` (Vite), `NUXT_PUBLIC_` (Nuxt), `REACT_APP_` (Create React App), `VUE_APP_` (Vue CLI), and `GATSBY_` (Gatsby).
**Server vs. client.** Server-side SDKs (`@sentry/node`, Python, and friends) read `SENTRY_SPOTLIGHT` automatically — no code changes needed.
**Cloudflare Workers.** Wrangler does not expose inherited process environment variables to Worker code. When `local run` detects `wrangler dev` together with a `wrangler.json`, `wrangler.jsonc`, or `wrangler.toml`, it automatically adds `--var SENTRY_SPOTLIGHT:http://localhost:<port>/stream`.
This creates an ephemeral Worker binding that `@sentry/cloudflare` reads from its `env` object, so you do not need `spotlight: true` in `withSentry()` and no project file is modified. An explicit `--var SENTRY_SPOTLIGHT:...` is preserved.
For browser/client events, the CLI exposes the spotlight URL under every framework client prefix above. Once the [browser SDK reads these variables automatically](https://github.com/getsentry/sentry-javascript/pull/18198), client-side capture will be zero-config too. **Until then**, reference the variable matching your framework in your client config:
// Next.js example — other frameworks use their own env access pattern
// (e.g. import.meta.env.VITE_SENTRY_SPOTLIGHT for Vite-based frameworks).
Sentry.init({ spotlight: process.env.NEXT_PUBLIC_SENTRY_SPOTLIGHT ?? false });Browser UI
Use `--open` to launch the Sentry Local UI ([local.sentry.dev](https://local.sentry.dev)) in your browser. The UI connects to the local receiver via the loopback stream endpoint and provides a visual workspace for browsing errors, traces, logs, and AI spans captured during the session.
# Start the server and open the UI
sentry local --open
# Run your app with the UI
sentry local run --open -- npm run dev
The `--open` flag requires a loopback `--host` (localhost, 127.0.0.1, or ::1). The UI is read-only — it reads the SSE stream but cannot ingest or clear data. Session data stays in memory for the duration of the server; nothing is sent to sentry.io unless a DSN is configured.
Endpoints
| Method | Path | Description | |--------|---------------------------------|----------------------------------------------------| | `POST` | `/stream` | Envelope ingest | | `POST` | `/api/{projectId}/envelope/` | Sentry SDK ingest path | | `GET` | `/stream` | Server-Sent Events feed of incoming envelopes | | `GET` | `/health` | Liveness check (returns `OK`) |
Tail output
By default, incoming envelopes are pretty-printed to the terminal:
14:32:01 [ERROR] [SERVER] TypeError: x is not a function [app.ts:42:5] [handleRequest]
14:32:02 [TRACE] [BROWSER] [http.client] GET /api/users [245ms] [3 spans]
14:32:03 [INFO] [SERVER] User logged in [user_id=1234] [region=us]
Errors show the exception type, message, and top stack frame. Transactions show the operation, duration, and span count. Logs show the severity level, message, and custom attributes.
Use `--filter` / `-f` to narrow the output to specific event types (repeatable):
sentry local -f error -f log # only errors and logs
Use `--quiet` to suppress tail output entirely if you only need the SSE stream.
Agent tracing
`sentry local` shows rich output for AI agent spans when your SDK instruments with [OpenTelemetry semantic attributes](https://opentelemetry.io/docs/specs/semconv/gen-ai/):
14:32:01 [TRACE] [SERVER] [gen_ai] chat anthropic/claude-4-sonnet [1200ms] [5 spans]
14:32:02 [TRACE] [SERVER] [mcp] tools/call search_files [320ms]
14:32:03 [TRACE] [SERVER] [db] SELECT users [postgresql] [12ms]
14:32:04 [ERROR] [SERVER] RateLimitError: API
Read more
`sentry local` runs a local development server that captures Sentry SDK envelopes from your dev stack and surfaces errors, traces, and logs in real time — right in your terminal. No authentication required.
No DSN is required either. If your app has no DSN configured, events flow **only** to the local server — nothing reaches your Sentry organization and no production quota is used. If a DSN *is* set, the SDK sends to both Sentry and the local server.
If a server is already running on the port, the command attaches as an SSE consumer instead of starting a duplicate.
Examples
# Start the server and tail events (default) sentry local # Run your app with the local server auto-enabled sentry local run -- npm run dev sentry local run -- python manage.py runserver # Use a custom port sentry local --port 9000 # Only show errors and logs (filter out transactions) sentry local -f error -f log # Run quietly (suppress per-envelope tail output) sentry local --quiet
`sentry local run`
Runs a command with `SENTRY_SPOTLIGHT` injected into the environment. The Sentry SDK automatically detects this variable and sends envelopes to the local server. No code changes needed.
If nothing is listening on the port, a server is started in the background and shut down when your command exits. If something already is — the Spotlight desktop app's own sidecar, or a `sentry local serve` in another terminal — the command attaches to it as an SSE consumer, so events still tail to your terminal either way.
Env vars injected into the child process:
| Variable | Value | |----------|-------| | `SENTRY_SPOTLIGHT` | `http://localhost:<port>/stream` | | `<PREFIX>SENTRY_SPOTLIGHT` | `http://localhost:<port>/stream` | | `SENTRY_TRACES_SAMPLE_RATE` | `1` (unless already set) | | `SENTRY_RELEASE` | `sentry-cli-local` (unless already set) |
The `<PREFIX>` variants cover every common framework client prefix so the spotlight URL is inlined into your browser bundle no matter which bundler you use: `PUBLIC_` (SvelteKit, Astro, Qwik), `NEXT_PUBLIC_` (Next.js), `VITE_` (Vite), `NUXT_PUBLIC_` (Nuxt), `REACT_APP_` (Create React App), `VUE_APP_` (Vue CLI), and `GATSBY_` (Gatsby).
**Server vs. client.** Server-side SDKs (`@sentry/node`, Python, and friends) read `SENTRY_SPOTLIGHT` automatically — no code changes needed.
**Cloudflare Workers.** Wrangler does not expose inherited process environment variables to Worker code. When `local run` detects `wrangler dev` together with a `wrangler.json`, `wrangler.jsonc`, or `wrangler.toml`, it automatically adds `--var SENTRY_SPOTLIGHT:http://localhost:<port>/stream`.
This creates an ephemeral Worker binding that `@sentry/cloudflare` reads from its `env` object, so you do not need `spotlight: true` in `withSentry()` and no project file is modified. An explicit `--var SENTRY_SPOTLIGHT:...` is preserved.
For browser/client events, the CLI exposes the spotlight URL under every framework client prefix above. Once the [browser SDK reads these variables automatically](https://github.com/getsentry/sentry-javascript/pull/18198), client-side capture will be zero-config too. **Until then**, reference the variable matching your framework in your client config:
// Next.js example — other frameworks use their own env access pattern
// (e.g. import.meta.env.VITE_SENTRY_SPOTLIGHT for Vite-based frameworks).
Sentry.init({ spotlight: process.env.NEXT_PUBLIC_SENTRY_SPOTLIGHT ?? false });Browser UI
Use `--open` to launch the Sentry Local UI ([local.sentry.dev](https://local.sentry.dev)) in your browser. The UI connects to the local receiver via the loopback stream endpoint and provides a visual workspace for browsing errors, traces, logs, and AI spans captured during the session.
# Start the server and open the UI sentry local --open # Run your app with the UI sentry local run --open -- npm run dev
The `--open` flag requires a loopback `--host` (localhost, 127.0.0.1, or ::1). The UI is read-only — it reads the SSE stream but cannot ingest or clear data. Session data stays in memory for the duration of the server; nothing is sent to sentry.io unless a DSN is configured.
Endpoints
| Method | Path | Description | |--------|---------------------------------|----------------------------------------------------| | `POST` | `/stream` | Envelope ingest | | `POST` | `/api/{projectId}/envelope/` | Sentry SDK ingest path | | `GET` | `/stream` | Server-Sent Events feed of incoming envelopes | | `GET` | `/health` | Liveness check (returns `OK`) |
Tail output
By default, incoming envelopes are pretty-printed to the terminal:
14:32:01 [ERROR] [SERVER] TypeError: x is not a function [app.ts:42:5] [handleRequest] 14:32:02 [TRACE] [BROWSER] [http.client] GET /api/users [245ms] [3 spans] 14:32:03 [INFO] [SERVER] User logged in [user_id=1234] [region=us]
Errors show the exception type, message, and top stack frame. Transactions show the operation, duration, and span count. Logs show the severity level, message, and custom attributes.
Use `--filter` / `-f` to narrow the output to specific event types (repeatable):
sentry local -f error -f log # only errors and logs
Use `--quiet` to suppress tail output entirely if you only need the SSE stream.
Agent tracing
`sentry local` shows rich output for AI agent spans when your SDK instruments with [OpenTelemetry semantic attributes](https://opentelemetry.io/docs/specs/semconv/gen-ai/):
14:32:01 [TRACE] [SERVER] [gen_ai] chat anthropic/claude-4-sonnet [1200ms] [5 spans] 14:32:02 [TRACE] [SERVER] [mcp] tools/call search_files [320ms] 14:32:03 [TRACE] [SERVER] [db] SELECT users [postgresql] [12ms] 14:32:04 [ERROR] [SERVER] RateLimitError: API
Sentry's MCP service is primarily designed for human-in-the-loop coding agents. Our tool selection and priorities are focused on developer workflows and debugging use cases, rather than providing a general-purpose MCP server for all Sentry functionality.
Repo: getsentry/sentry-mcp
Other commands on toolkit.
explore
Enter explore mode - think through ideas, investigate problems, clarify requirements
propose
Propose a new change - create it and generate all artifacts in one step

