Toolkit contains the Sentry CLI, the Sentry MCP server, and shared code. Product-specific instructions live in their packages; start with the shared documentation index.
- Type Safety: Prefer strict types over
any- they catch bugs and improve tooling. Useunknownfor truly unknown types. - Security: Never log secrets. Validate external input. See docs/operations/security.md.
- Simplicity: Follow existing patterns. Check neighboring files before inventing new approaches, then search the whole package for an existing helper before writing one (see Reuse Existing Helpers for the CLI). Neighbors can mislead: code ported from another repo, such as the wizards, often carries its own copy of a helper the package already has.
- MCP tool count:
EXPOSE_ALL_TOOLSlists every tool and relies on harness tool search. The gateway surface it falls back to (TOP_LEVEL_TOOL_NAMES) targets ≤20, hard limit 25. - Quality gate:
pnpm run typecheck && pnpm run lint && pnpm run testmust pass before committing. - Dependency direction:
sentry(cli) →@sentry/mcp-core→@sentry/toolkit-core, and@sentry/mcp-cloudflare→@sentry/mcp-core; never the reverse. mcp-core and toolkit-core never import the CLI. Inject CLI-only capabilities (SQLite cache, local-file DSN detection, file uploads) through interfaces defined in mcp-core or toolkit-core.pnpm run lintenforces this; see docs/architecture/overview.md#package-dependency-direction. - Lint rules: Write new lint rules for Oxlint: a built-in rule in
.oxlintrc.json, or a custom rule inpackages/cli/lint-rules/cli-oxlint-plugin.js. Do not add ast-grep rules. See docs/contributing/coding-guidelines.md#formatting-and-linting. - Package CI: Put checks for one workspace package in its
package.jsonscripts andsentryCi, whichtest.ymlruns per project. Do not add a workflow for them. See docs/operations/github-actions.md#package-ci-checks.
| Rule | Enforced by |
|---|---|
Move Cloudflare traffic only with deployVersions(), never wrangler versions deploy; Cloudflare 404s (100146) on a fresh version for seconds |
scripts/deploy-workflow.test.mjs (pnpm run test:ci-projects) |
toolkit/
├── apps/
│ ├── cli-docs/ # CLI documentation site and generated command pages
│ ├── docs-mcp/ # Private Docs MCP Worker
│ ├── games-api/ # Public Worker for the sentry games leaderboard
│ └── local/ # Sentry Local browser viewer
├── packages/
│ ├── cli/ # Sentry CLI (see packages/cli/AGENTS.md)
│ ├── codemod-cli3to4/ # @getsentry/cli3to4 codemod: CLI v3 → v4 (Codemod Registry)
│ ├── http/ # HTTP response cache, body codec, and retries (@sentry/http on npm)
│ ├── logger/ # Structured logger (@sentry/logger on npm)
│ ├── toolkit-core/ # Shared CLI/MCP primitives
│ ├── mcp-core/ # Core MCP implementation (private)
│ ├── mcp-server/ # stdio transport (@sentry/mcp-server on npm)
│ ├── mcp-cloudflare/ # Web app + OAuth
│ ├── mcp-server-evals/ # AI evaluation tests
│ ├── mcp-server-mocks/ # MSW mocks
│ ├── mcp-test-client/ # CLI test client
│ ├── spotlight/ # Deprecated @spotlightjs/spotlight, forwards to `sentry local`
│ └── wizard/ # Deprecated @sentry/wizard, forwards to `sentry wizard`
└── docs/ # Toolkit contributor docs for CLI and MCP
- design/README.md — Design docs: each system's goals and rules. Read the owning file before changing a system.
- docs/README.md — Toolkit documentation index
- docs/cli/README.md — CLI guides and the published CLI site
- docs/mcp/README.md — MCP guides across its packages
- docs/mcp/harnesses.md — First-class agent harnesses and native tool search support
- packages/cli/AGENTS.md — CLI-specific rules
Read before MCP tool changes:
- docs/contributing/adding-tools.md — Tool implementation guide
- docs/contributing/tool-responses.md — Conventions every tool result follows (goals and rules: design/mcp-tool-responses.md)
- docs/testing/overview.md — Testing requirements and snapshot policy
- docs/contributing/common-patterns.md — Error handling, Zod schemas, shared formatting patterns
- docs/contributing/error-handling.md — Error types and propagation
Shared contributing:
- docs/contributing/coding-guidelines.md — TypeScript and code style guidance
- docs/contributing/documentation-style-guide.md — Documentation style guide
- docs/contributing/pr-management.md — Commit and PR guidelines
- docs/contributing/quality-checks.md — Pre-commit checklist
MCP contributing:
- docs/contributing/api-patterns.md — Sentry API client usage
- docs/contributing/search-events-api-patterns.md — Search Events API patterns
MCP testing:
- docs/testing/overview.md — Unit, snapshot, eval, and agent CLI testing
- docs/testing/stdio.md — Stdio transport testing
- docs/testing/remote.md — Remote server and OAuth testing
MCP architecture and operations:
- docs/architecture/overview.md — MCP system design
- docs/operations/security.md — Authentication and security patterns
- docs/operations/stdio-auth.md — stdio auth: shared CLI login and static tokens
- docs/operations/oauth-signout-playbook.md — Remote OAuth diagnostic runbook
- docs/operations/embedded-agents.md — LLM provider configuration for AI-powered tools
- docs/operations/github-actions.md — CI matrix,
package.json#sentryCi, and MCP deployment workflows - docs/operations/logging.md — Logging guidance
- docs/operations/monitoring.md — Monitoring guidance
- docs/operations/token-cost-tracking.md — Tool definition token cost tracking
MCP Cloudflare:
- docs/cloudflare/overview.md — Cloudflare package overview
- docs/cloudflare/architecture.md — Cloudflare architecture
- docs/cloudflare/oauth-architecture.md — Cloudflare OAuth architecture
MCP integrations:
- docs/integrations/claude-code-plugin.md — Plugin structure and agent prompts
- docs/integrations/ide-instructions-refactor.md — IDE instruction refactor notes
MCP releases:
- docs/releases/stdio.md —
@sentry/mcp-serverrelease and the MCP registry - docs/releases/cloudflare.md — Cloudflare deployment
# Development
pnpm run dev # Start MCP dev server
pnpm run build # Build non-CLI workspace packages
pnpm --filter sentry run cli help # Run CLI help from repository root
# MCP testing
pnpm -w run cli --transport stdio "q" # Test MCP tools
pnpm -w run cli --transport stdio --access-token=TOKEN "q"
# Quality (run before committing)
pnpm run typecheck && pnpm run lint && pnpm run test
# Token overhead
pnpm run measure-tokens # Check tool definition size
# Definitions (run after changing tools, skills, or agent prompts)
pnpm run --filter @sentry/mcp-core generate-definitionsFor MCP tool QA, use the mcp-qa skill at .agents/skills/mcp-qa/SKILL.md:
stdio-first local CLI and real agent clients; Cloudflare HTTP or /mcp only
for transport, OAuth, routing, or hosted-server compatibility. To prove MCP or
CLI behavior offline, with no Sentry account, use the verify-toolkit skill at
.agents/skills/verify-toolkit/SKILL.md and its claim map.
Use /dex skill to coordinate complex work. Create tasks with full context, break down into subtasks, complete with detailed results.
- Check neighboring files for existing patterns before writing new code.
- When adding or modifying Sentry API endpoint usage, ALWAYS validate the endpoint behavior against the getsentry/sentry source instead of assuming docs or client parameters are authoritative.
- Update relevant docs when changing functionality.
- Follow docs/contributing/error-handling.md for MCP error types and packages/cli/src/lib/errors.ts for CLI error classes.
- Follow docs/contributing/pr-management.md for commits and PRs.
AI commits MUST include:
Co-Authored-By: (the agent model's name and attribution byline)