# Culpr.dev Complete Technical Reference > Culpr.dev is an agent-first, Sentry-compatible error tracking platform for TypeScript applications (`@sentry/nextjs` and `@sentry/node`), running on Cloudflare Workers, Cloudflare Queues, D1, R2, KV, and SQLite Durable Objects. ## 1. Product Summary & Architecture Culpr.dev replaces heavy observability UIs with clean Markdown dossiers ("BugPacks") designed specifically for coding agents like Cursor and Claude Code. ### Data Flow 1. **Edge Ingestion (`POST /api/:projectId/envelope/`)**: A Hono Worker receives standard gzipped or raw Sentry SDK envelopes, extracts the DSN key from `X-Sentry-Auth` or `?sentry_key=`, validates it against edge KV (`DSN_CACHE`) backed by Cloudflare D1 (`culpr-meta`), and checks per-project rate limits and monthly quotas in `ProjectDO`. 2. **Cloudflare Queue (`culpr-ingest-queue` + `culpr-ingest-dlq`)**: Accepted events are enqueued asynchronously (with R2 spill support when serialized payloads exceed inline queue bounds) so SDK ingestion stays fast. Failed deliveries retry with exponential backoff up to 5 attempts before entering the dead-letter queue. 3. **Processor Consumer**: Recursively scrubs sensitive headers, cookies, JWTs, bearer tokens, emails, phone numbers, IP addresses, and sensitive query parameters. Loads `.map` files from R2 (guarding against source maps over 25 MB), resolves minified frames to original TypeScript source with +/- 5 context lines via `@jridgewell/trace-mapping`, computes deterministic fingerprints ignoring framework frames, builds runnable `curl` or Vitest reproductions, stores the scrubbed `StoredEventPayload` in R2 with plan-tiered expiration, and upserts the issue into `ProjectDO`. 4. **Per-Project SQLite Durable Object (`ProjectDO`)**: Each project gets an isolated SQLite database storing `issues`, `events`, `rate_limits`, `issue_hourly_counts`, `monthly_usage`, and `processed_events` (idempotency deduplication), plus an alarm handler pruning expired payloads. 5. **Control Plane & Remote MCP (`https://api.culpr.dev`)**: Serves multi-tenant auth (`culpr_ses_*` sessions with PBKDF2-SHA256 password hashing), organizations, projects, RBAC (`owner`, `admin`, `member`), org invites (`culpr_inv_*`), project REST APIs, and the stateless Streamable HTTP MCP server at `https://api.culpr.dev/mcp`. --- ## 2. Three-Step Migration from Sentry ### Step 1: Swap Sentry DSN Keep `@sentry/nextjs` or `@sentry/node` installed and change only `dsn`: ```ts import * as Sentry from "@sentry/nextjs"; Sentry.init({ dsn: "https://@api.culpr.dev/", release: process.env.GIT_SHA, environment: process.env.NODE_ENV, }); ``` ### Step 2: Upload Source Maps in CI ```bash npx @culpr/cli sourcemaps upload \ --project \ --release "$GIT_SHA" \ --token "$CULPR_CLI_TOKEN" \ --api-url https://api.culpr.dev \ ./.next ``` Or print project snippets directly via `npx @culpr/cli init --project `. ### Step 3: Connect Cursor or Claude Code via Remote MCP `.cursor/mcp.json`: ```json { "mcpServers": { "culpr": { "url": "https://api.culpr.dev/mcp", "headers": { "Authorization": "Bearer " } } } } ``` Claude Code CLI: ```bash claude mcp add --transport http culpr https://api.culpr.dev/mcp \ --header "Authorization: Bearer $CULPR_MCP_TOKEN" ``` --- ## 3. Remote MCP Server Reference - **Endpoint**: `https://api.culpr.dev/mcp` (Streamable HTTP, JSON responses) - **Auth**: `Authorization: Bearer ` (also accepts project `culpr_adm_*` tokens) - **CORS Headers Allowed**: `Content-Type`, `Authorization`, `Accept`, `Mcp-Session-Id`, `Mcp-Protocol-Version`, `X-Culpr-Project-Id` ### Tool: `get_project_summary` Returns live project counters and monthly quota consumption. - Input schema: `{}` - Returns JSON: `{ project_id, open_issues, resolved_issues, ignored_issues, total_events, environments, monthly_events_used, usage_month }` ### Tool: `list_active_bugs` Lists issues filtered by status, environment, search query, or release. - Input schema: - `status` (`"open" | "resolved" | "ignored" | "all"`, optional, default `"open"`) - `env` (`string`, optional) - `q` (`string`, optional; matches title, culprit, or issue ID) - `release` (`string`, optional) - `sort` (`"last_seen" | "event_count"`, optional, default `"last_seen"`) - `limit` (`integer` 1..50, optional, default `10`) - Returns JSON array of `{ issue_id, status, title, culprit, environment, release_sha, count, last_seen }` ### Tool: `get_bug_pack` Fetches the full token-optimized Markdown BugPack for an issue. - Input schema: - `issue_id` (`string`, required) - `include_framework_frames` (`boolean`, optional, default `false`) - Returns Markdown containing issue metadata, in-app resolved stack frames with `>= 5` context lines around crash line, scrubbed JSON request payload, and a runnable `curl` command or Vitest skeleton. ### Tool: `mark_bug_resolved` Updates an issue's status after applying and verifying a patch. - Input schema: - `issue_id` (`string`, required) - `status` (`"resolved" | "ignored" | "open"`, optional, default `"resolved"`) - `commit_sha` (`string`, optional) - `note` (`string`, optional) - Returns JSON: `{ issue_id, status, resolved_commit_sha, resolved_note }` --- ## 4. Security, Guardrails & Multi-Tenant Model - **Scoped Tokens**: - `culpr_dsn_*`: Public client/server ingest key (`POST /api/:projectId/envelope/`) - `culpr_cli_*`: Upload/delete source maps in CI (`PUT /api/v1/sourcemaps/...`, `DELETE /api/v1/sourcemaps/:releaseSha`) - `culpr_mcp_*`: Read project/issues and update issue status (`/mcp` and read/patch issue endpoints) - `culpr_adm_*`: Full single-project administrative access (API key rotation, issue delete, billing checkout/portal, DSN rotation) - `culpr_ses_*`: User session bearer token across authorized organizations (`owner`, `admin`, `member` RBAC) with `X-Culpr-Project-Id` switching - **Auth Brute-Force Protection**: IP-windowed rate limits enforced on `/api/v1/auth/login` (25 req/min) and `/api/v1/auth/register` (15 req/min). - **Spike & Loop Sampling**: First 10 identical events per issue per hour store full payloads; subsequent events sample 1-in-20 to prevent quota exhaustion. - **Tiered R2 Lifecycle + Durable Object Alarm Pruning**: Payloads expire after 14 days (Free), 30 days (Pro), or 90 days (Scale); source map artifacts expire after 90 days. --- ## 5. Plans & Limits - **Free ($0/month)**: 10,000 events/month, 500 events/min rate limit, 14-day R2 payload retention, full Remote MCP access, unlimited organizations, projects, and seats. - **Pro ($29/month)**: 250,000 events/month, 2,000 events/min rate limit, 30-day R2 payload retention, 90-day source map storage, unlimited seats, Stripe Checkout and Customer Portal. - **Scale ($99/month)**: 1,000,000 events/month, 5,000 events/min rate limit, 90-day R2 payload retention, 90-day source map storage, unlimited seats, Stripe Checkout and Customer Portal. Web Dashboard: https://app.culpr.dev Landing Page: https://culpr.dev/ API Health: https://api.culpr.dev/health