Skip to content
Open
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
26 changes: 12 additions & 14 deletions .agents/skills/mcp-qa/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,27 @@ Fix any failures before proceeding.
This is the primary QA path for tool behavior. Stdio runs the local MCP server
against prod Sentry without depending on the Cloudflare worker, local `/mcp`
route, or Cloudflare OAuth configuration.
When validating code or tool changes, build first because the test client
launches `packages/mcp-server/dist/index.js`:
The test client launches `sentry mcp` from CLI source
(`pnpm --dir packages/cli run cli mcp`), which reads mcp-core's build output, so
build first when validating code or tool changes:

```bash
pnpm -w run build
```

Check auth first:
Check auth first. `sentry mcp` uses the CLI's credentials:

```bash
pnpm --filter @sentry/mcp-server start auth status
pnpm --filter sentry run cli auth status
```

If no cache exists, warm the device-code cache:
If you are not logged in, log in once (or pass `--access-token` to the test
client):

```bash
pnpm --filter @sentry/mcp-server start auth login
pnpm --filter sentry run cli auth login
```

Device-code auth uses the bundled stdio public client ID, requires no client
secret, is separate from the Cloudflare OAuth app, and caches the token in
`~/.sentry/mcp.json`.

First prove startup and auth:

```bash
Expand Down Expand Up @@ -96,9 +94,9 @@ For agent-client-specific behavior, replace the default harness prompt with the
same realistic prod prompt used for stdio QA. Passing QA requires the same
changed-tool transcript evidence, not only `whoami`.

as an isolated auth cache. Real clients do not give stdio subprocesses a TTY,
so warm the cache before running the harness. It also runs the built
`packages/mcp-server/dist/index.js`, so build first to avoid stale code.
Real clients do not give stdio subprocesses a TTY, so log in with
`sentry auth login` before running the harness. Build first to avoid stale
mcp-core code.

## 4. Cloudflare HTTP Only When Relevant

Expand Down Expand Up @@ -144,7 +142,7 @@ dev-time source execution:

```bash
pnpm -w run build
pnpm --filter @sentry/mcp-server start auth status
pnpm --filter sentry run cli auth status
pnpm -w run cli --transport stdio "who am I?"
```

Expand Down
115 changes: 0 additions & 115 deletions .github/workflows/mcp-server-package.yml

This file was deleted.

11 changes: 10 additions & 1 deletion .github/workflows/merge-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,23 @@ jobs:
run: pnpm install

- name: Build
run: pnpm --filter '@sentry/mcp-server...' --if-present run build
run: pnpm --filter '@sentry/mcp-core...' --if-present run build

- name: Run linter
run: pnpm lint

- name: Run tests
run: pnpm test:ci

# @sentry/mcp-server bundles the CLI's `sentry mcp` server into one file.
- name: Bundle mcp-server
env:
SENTRY_CLIENT_ID: ${{ vars.SENTRY_CLIENT_ID }}
run: pnpm --filter @sentry/mcp-server run bundle

- name: Test mcp-server bundle
run: pnpm --filter @sentry/mcp-server run test:bundle

- name: Package mcp-server
working-directory: packages/mcp-server
run: pnpm pack --pack-destination dist
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ coverage
.env.sentry-build-plugin

# Generated files
packages/mcp-server/src/toolDefinitions.json
packages/mcp-server/src/skillDefinitions.json
packages/mcp-server-evals/eval-results.json
apps/cli-docs/.astro
apps/cli-docs/src/content/docs/commands/
Expand Down
30 changes: 30 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,28 @@
"jsx-a11y/no-static-element-interactions": "off"
}
},
{
"files": ["packages/mcp-core/**/*.{ts,tsx,js,mjs,cjs}"],
"rules": {
"no-restricted-imports": [
"error",
{
"paths": [
{
"name": "sentry",
"message": "mcp-core and toolkit-core must not import the Sentry CLI. Inject CLI-only capabilities through interfaces defined in mcp-core or toolkit-core (see docs/architecture/overview.md#package-dependency-direction)."
}
],
"patterns": [
{
"group": ["sentry/**", "**/cli/src/**", "**/packages/cli/**"],
"message": "mcp-core and toolkit-core must not import the Sentry CLI. Inject CLI-only capabilities through interfaces defined in mcp-core or toolkit-core (see docs/architecture/overview.md#package-dependency-direction)."
}
]
}
]
}
},
{
"files": [
"packages/cli/src/**/*.{ts,tsx}",
Comment thread
sentry-junior[bot] marked this conversation as resolved.
Expand Down Expand Up @@ -153,6 +175,10 @@
"error",
{
"paths": [
{
"name": "sentry",
"message": "mcp-core and toolkit-core must not import the Sentry CLI. Inject CLI-only capabilities through interfaces defined in mcp-core or toolkit-core (see docs/architecture/overview.md#package-dependency-direction)."
},
{
"name": "assert",
"message": "Shared toolkit-core modules move into @sentry/api and must run in browsers. Use web-standard APIs, or inject the host-specific piece."
Expand Down Expand Up @@ -267,6 +293,10 @@
}
],
"patterns": [
{
"group": ["sentry/**", "**/cli/src/**", "**/packages/cli/**"],
"message": "mcp-core and toolkit-core must not import the Sentry CLI. Inject CLI-only capabilities through interfaces defined in mcp-core or toolkit-core (see docs/architecture/overview.md#package-dependency-direction)."
},
{
"group": ["node:*"],
"message": "Shared toolkit-core modules move into @sentry/api and must run in browsers. Use web-standard APIs, or inject the host-specific piece."
Expand Down
5 changes: 3 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Toolkit contains the Sentry CLI, the Sentry MCP server, and shared code. Product

- **MCP tool count**: Target ≤20, hard limit 25 (AI agents have limited tool slots).
- **Quality gate**: `pnpm run tsc && pnpm run lint && pnpm run test` must 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 lint` enforces this; see docs/architecture/overview.md#package-dependency-direction.

## Repository Structure

Expand Down Expand Up @@ -69,7 +70,7 @@ toolkit/

- docs/architecture/overview.md — MCP system design
- docs/operations/security.md — Authentication and security patterns
- docs/operations/stdio-auth.md — Device code flow, token caching, client ID architecture
- 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 — MCP deployment workflows
Expand Down Expand Up @@ -97,7 +98,7 @@ toolkit/

**MCP releases:**

- docs/releases/stdio.md — npm package release
- docs/releases/stdio.md — `@sentry/mcp-server` release and the MCP registry
- docs/releases/cloudflare.md — Cloudflare deployment

## Commands
Expand Down
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ While this repository is focused on acting as an MCP service, we also support a

**Note:** The AI-powered search tools (`search_errors`, `search_traces`, `search_logs`, `search_issues`, etc.) require an LLM provider (OpenAI, Azure OpenAI, Anthropic, or OpenRouter). These tools use natural language processing to translate queries into Sentry's query syntax. Without a configured provider, these specific tools will be unavailable, but all other tools will function normally.

To utilize the `stdio` transport, you'll need to create an User Auth Token in Sentry with the necessary scopes. As of writing this is:
The `stdio` transport ships as [`@sentry/mcp-server`](https://www.npmjs.com/package/@sentry/mcp-server). Sign in once with `npx @sentry/mcp-server@latest auth login`, or pass a static token with `--access-token` / `SENTRY_ACCESS_TOKEN`. The login is shared with the [`sentry` CLI](https://cli.sentry.dev), so an existing `sentry auth login` works too.

To use a static token, create a User Auth Token in Sentry with the necessary scopes. As of writing this is:

```
org:read
Expand All @@ -59,6 +61,8 @@ event:write
Launch the transport:

```shell
npx @sentry/mcp-server@latest auth login # once, to sign in
npx @sentry/mcp-server@latest # uses that login
npx @sentry/mcp-server@latest --access-token=sentry-user-token
```

Expand Down Expand Up @@ -118,7 +122,7 @@ tools with `?skills=inspect,triage` or `?disable-skills=seer`.
#### Environment Variables

```shell
SENTRY_ACCESS_TOKEN= # Required: Your Sentry auth token
SENTRY_ACCESS_TOKEN= # Optional after `auth login`: static Sentry auth token

# LLM Provider Configuration (required for AI-powered search tools)
EMBEDDED_AGENT_PROVIDER= # Required when multiple provider keys are set: 'openai', 'azure-openai', 'anthropic', or 'openrouter'
Expand All @@ -143,7 +147,7 @@ MCP_DISABLE_SKILLS= # Disable specific skills (comma-separated, e.g. 'p
"mcpServers": {
"sentry": {
"command": "npx",
"args": ["@sentry/mcp-server"],
"args": ["@sentry/mcp-server@latest"],
"env": {
"SENTRY_ACCESS_TOKEN": "your-token",
"EMBEDDED_AGENT_PROVIDER": "openai",
Expand All @@ -166,7 +170,7 @@ self-hosted deployment that does run Seer, opt in with `MCP_SKILLS`:
"mcpServers": {
"sentry": {
"command": "npx",
"args": ["@sentry/mcp-server"],
"args": ["@sentry/mcp-server@latest"],
"env": {
"SENTRY_ACCESS_TOKEN": "your-token",
"SENTRY_HOST": "sentry.example.com",
Expand Down
3 changes: 1 addition & 2 deletions ast-grep-rules/no-stdio-stdout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ rule:
- pattern: console.debug($$$ARGS)
files:
- packages/mcp-core/src/**/*.ts
- packages/mcp-server/src/**/*.ts
- packages/cli/src/lib/mcp/**/*.ts
ignores:
- packages/mcp-server/src/cli/**
- "**/*.test.ts"
- "**/*.d.ts"
Loading
Loading