Skip to content

Commit e0ddc00

Browse files
ref: Remove agent mode (#1192)
Remove the legacy agent mode across the MCP core, CLI, Cloudflare app, telemetry, tests, and documentation. The server now exposes the standard tool surface without the `--agent` / `?agent=1` mode switch or the `use_sentry` meta-tool. **Embedded agent routing remains supported** The unrelated `--agent-provider` option is preserved for selecting the LLM provider used by embedded-agent functionality. **Obsolete test infrastructure removed** This removes the agent CLI test package and benchmark script alongside agent-mode-specific tests and docs. <!-- junior-request-attribution:start --> Requested by **David Cramer** via Junior. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3AC08J1NSPU6S%3A1785177165.113189 --> -- [View Junior Session](https://junior-prod.sentry.dev/conversations/slack%3AC08J1NSPU6S%3A1785177165.113189) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
1 parent 3055a3c commit e0ddc00

69 files changed

Lines changed: 47 additions & 2450 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.agents/skills/mcp-qa/SKILL.md‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,6 @@ that is not part of the tool response. Review raw tool output against
7777
and free of raw API JSON, internal implementation IDs, empty placeholders, and
7878
unrelated instructions.
7979

80-
If your changes involve agent mode or experimental tools:
81-
82-
```bash
83-
pnpm -w run cli --transport stdio --agent "show me my recent errors"
84-
pnpm -w run cli --transport stdio --experimental "your query"
85-
```
8680

8781
## 3. Real Agent Clients
8882

@@ -91,9 +85,6 @@ in a real agent client:
9185

9286
```bash
9387
pnpm -w run build
94-
pnpm -w run agent-cli-test auth login
95-
pnpm -w run agent-cli-test --provider claude --setup stdio
96-
pnpm -w run agent-cli-test --provider codex --setup stdio
9788
```
9889

9990
What this verifies:
@@ -105,7 +96,6 @@ For agent-client-specific behavior, replace the default harness prompt with the
10596
same realistic prod prompt used for stdio QA. Passing QA requires the same
10697
changed-tool transcript evidence, not only `whoami`.
10798

108-
The `stdio` setup uses `packages/agent-cli-test/projects/stdio/.sentry/mcp.json`
10999
as an isolated auth cache. Real clients do not give stdio subprocesses a TTY,
110100
so warm the cache before running the harness. It also runs the built
111101
`packages/mcp-server/dist/index.js`, so build first to avoid stale code.
@@ -139,8 +129,6 @@ pnpm -w run cli --mcp-host=http://localhost:5173/mcp/<org> \
139129
"<same realistic prod prompt used for stdio QA>"
140130
pnpm -w run cli --mcp-host=http://localhost:5173/mcp/<org>/<project> \
141131
"<same realistic prod prompt used for stdio QA>"
142-
pnpm -w run agent-cli-test --provider claude --setup repo
143-
pnpm -w run agent-cli-test --provider codex --setup repo
144132
```
145133

146134
Look for `Connected to MCP server (<resolved MCP URL>)` to confirm HTTP

‎.github/workflows/mcp-server-package.yml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ jobs:
102102
declare const server: Parameters<typeof startStdio>[0];
103103
104104
const telemetryContext: StdioServerContext = {
105-
agentMode: false,
106105
experimentalMode: false,
107106
mcpUrl: "https://example.com/mcp",
108107
sentryHost: "sentry.io",

‎.github/workflows/token-cost.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989
9090
---
9191
92-
**Note:** This measures the static overhead of tool definitions sent to LLM clients with every request. Lower is better. The \`use_sentry\` tool is excluded as it's only available in agent mode.
92+
**Note:** This measures the static overhead of tool definitions sent to LLM clients with every request. Lower is better.
9393
REPORT_EOF
9494
9595
# Display report

‎AGENTS.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ pnpm run build # Build all packages
9595
# Testing
9696
pnpm -w run cli --transport stdio "q" # Test MCP tools
9797
pnpm -w run cli --transport stdio --access-token=TOKEN "q"
98-
pnpm -w run cli --transport stdio --agent "query"
9998

10099
# Quality (run before committing)
101100
pnpm run tsc && pnpm run lint && pnpm run test

‎README.md‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,6 @@ pnpm eval
245245
# Test with local dev server (default: http://localhost:5173)
246246
pnpm -w run cli "who am I?"
247247

248-
# Test agent mode (use_sentry tool only)
249-
pnpm -w run cli --agent "who am I?"
250-
251248
# Test against production
252249
pnpm -w run cli --mcp-host=https://mcp.sentry.dev "query"
253250

‎TELEMETRY.md‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
Use this when investigating Sentry MCP production incidents across the
66
Cloudflare HTTP server, stdio package, MCP tools, OAuth flows, and test-client
7-
agent mode.
87

98
Primary backend: Sentry Logs, Issues, Spans/Traces, and Metrics in the MCP
109
server projects. Start with a Sentry event, trace ID, route, user, client
@@ -38,7 +37,6 @@ the pivots and recipes below.
3837
| `app.rate_limit.scope` | local rate-limit scope | metrics | IP vs user rate limits |
3938
| `app.route.group` | coarse route family | metrics | `mcp`, `oauth`, `chat`, `search` |
4039
| `app.transport` | MCP transport | tags, spans | `http`, `sse`, or `stdio` |
41-
| `app.server.mode.agent` | agent-mode flag | metrics, spans, tags | `?agent=1` or stdio `--agent` adoption |
4240
| `app.server.mode.experimental` | experimental-mode flag | metrics, spans, tags | `?experimental=1` or stdio `--experimental` adoption |
4341
| `mcp.session.id` | MCP session identity | spans | session timeline |
4442
| `gen_ai.tool.name` | MCP tool being called | spans, issues | tool timeline |
@@ -86,16 +84,13 @@ HTTP response rates by route and status.
8684

8785
```text
8886
dataset=tracemetrics query='metric:app.server.response http.route:"<route>"'
89-
fields=timestamp,metric,http.request.method,http.route,http.response.status_code,app.response.status_class,app.route.group,app.client.family,app.server.mode.agent,app.server.mode.experimental,value
9087
aggregate=sum(value) by http.route,http.response.status_code
9188
```
9289

9390
MCP mode adoption by client family.
9491

9592
```text
9693
dataset=tracemetrics query='metric:app.server.response http.route:"/mcp/:organizationSlug?/:projectSlug?"'
97-
fields=timestamp,metric,app.client.family,app.server.mode.agent,app.server.mode.experimental,value
98-
aggregate=sum(value) by app.client.family,app.server.mode.agent,app.server.mode.experimental
9994
```
10095

10196
Local rate-limit volume and scope.
@@ -150,7 +145,6 @@ Tool execution timeline for a slow or failing tool.
150145

151146
```text
152147
dataset=spans query='gen_ai.tool.name:"<tool_name>" app.consent.skill.<skill>.granted:true'
153-
fields=timestamp,trace,span_id,span.op,span.duration,gen_ai.tool.name,app.transport,app.client.family,app.server.mode.agent,app.server.mode.experimental,app.constraint.organization_slug,app.constraint.project_slug,gen_ai.tool.call.arguments.organizationSlug,gen_ai.tool.call.arguments.projectSlugOrId,error.type
154148
sort=-timestamp
155149
```
156150

@@ -177,7 +171,6 @@ Stdio sessions by configured host or mode.
177171

178172
```text
179173
dataset=spans query='app.transport:stdio app.upstream.host:"<host>"'
180-
fields=timestamp,trace,span_id,app.server.version,app.server.mode.agent,app.server.mode.experimental,app.url.full,error.type
181174
sort=-timestamp
182175
```
183176

@@ -194,7 +187,6 @@ Attributes: `http.request.method`, `http.route`,
194187
`http.response.status_code`, `app.response.status_class`,
195188
`app.route.group`, `app.response.reason`, `app.rate_limit.scope`,
196189
`app.request.duration_ms`. MCP responses also include
197-
`app.client.family`, `app.server.mode.agent`, and
198190
`app.server.mode.experimental`.
199191

200192
### OAuth And Client Registration
@@ -238,10 +230,8 @@ Attributes: `app.resource.type`, `gen_ai.tool.name`, `trace_id`, `span_id`
238230

239231
### Stdio Transport
240232

241-
Local package startup, host selection, agent mode, experimental mode, or token
242233
resolution behaves differently than the hosted server.
243234

244-
Attributes: `app.server.version`, `app.transport`, `app.server.mode.agent`,
245235
`app.server.mode.experimental`, `app.upstream.host`, `app.url.full`
246236

247237
### Agent And GenAI

‎benchmark-agent.sh‎

Lines changed: 0 additions & 118 deletions
This file was deleted.

‎docs/architecture/overview.md‎

Lines changed: 1 addition & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ Ordinary operation modules live as flat files under
221221
need more implementation structure.
222222
`packages/mcp-core/src/tools/catalog-runtime/` contains the shared filtering,
223223
search, schema, and execution helpers. Wrapper/gateway tools such as
224-
`search_sentry_tools`, `execute_sentry_tool`, and `use_sentry` live in
224+
`search_sentry_tools`, `execute_sentry_tool` live in
225225
`packages/mcp-core/src/tools/special/`.
226226

227227
`packages/mcp-core/src/tools/surfaces.ts` only centralizes the subsets of
@@ -332,66 +332,3 @@ This pattern is used when:
332332
- Embedded agent errors are returned as UserInputError
333333
- Calling agent sees the error and can retry
334334
- No internal retry loops - single responsibility
335-
336-
### use_sentry Tool Architecture
337-
338-
The `use_sentry` tool provides a natural language interface to all Sentry MCP tools using an in-memory MCP client-server architecture:
339-
340-
**Architecture**:
341-
1. Creates linked pair of `InMemoryTransport` from MCP SDK
342-
2. Builds internal MCP server with all 18 tools (excludes use_sentry to prevent recursion)
343-
3. Connects server to serverTransport within ServerContext
344-
4. Creates MCP client with clientTransport
345-
5. Embedded GPT-5 agent accesses tools through MCP protocol
346-
6. Zero network overhead - all communication is in-memory
347-
348-
**Data Flow**:
349-
```
350-
User request → use_sentry handler
351-
↓
352-
Creates InMemoryTransport pair
353-
↓
354-
Builds internal MCP server (18 tools)
355-
↓
356-
Creates MCP client
357-
↓
358-
Embedded agent calls tools via MCP protocol
359-
↓
360-
MCP server executes tool handlers
361-
↓
362-
Results returned through MCP protocol
363-
↓
364-
Agent processes and returns final result
365-
```
366-
367-
**Benefits**:
368-
- Full MCP protocol compliance throughout
369-
- Architectural consistency - all tool access via MCP
370-
- Zero performance overhead (no network, no serialization)
371-
- Proper tool isolation at protocol level
372-
- No recursion risk (use_sentry excluded from internal server)
373-
374-
**Implementation**: Uses built-in `InMemoryTransport.createLinkedPair()` from `@modelcontextprotocol/sdk/inMemory.js` for reliable in-process communication.
375-
376-
## Security Model
377-
378-
- Access tokens never logged
379-
- OAuth tokens encrypted in KV
380-
- Per-organization isolation
381-
- CORS configured for security
382-
383-
## Testing Architecture
384-
385-
Three levels of testing:
386-
387-
1. **Unit tests**: Fast, isolated, snapshot-based
388-
2. **Integration tests**: With mocked API
389-
3. **Evaluation tests**: Real-world scenarios with LLM
390-
391-
## References
392-
393-
- MCP SDK: `@modelcontextprotocol/sdk`
394-
- Build config: `turbo.json`
395-
- TypeScript config: `packages/mcp-server-tsconfig/`
396-
- API client: `packages/mcp-core/src/api-client/`
397-
- stdio package: `packages/mcp-server/`

‎docs/contributing/adding-tools.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Not every tool is exposed to every consumer. We rely on several mechanisms to ke
88

99
- **Catalog by default** — Most tools are searchable/executable through `search_sentry_tools` + `execute_sentry_tool` automatically. Search uses the tool's existing name and description.
1010
- **Catalog registry** — `packages/mcp-core/src/tools/catalog/index.ts` lists ordinary Sentry operation tools. The catalog directory is intentionally flat: one tool entry per file.
11-
- **Special tools** — Wrapper/gateway tools (`search_sentry_tools`, `execute_sentry_tool`, `use_sentry`) live in `packages/mcp-core/src/tools/special/`. They still use the same tool types, but they are kept out of the ordinary catalog.
1211
- **Central direct exposure policy** — `packages/mcp-core/src/tools/surfaces.ts` lists the catalog tools that are also exposed directly through MCP `tools/list`. The direct surface intentionally keeps long-tail tools catalog-only because `search_sentry_tools` + `execute_sentry_tool` are available as primary primitives.
1312
- **`requiredCapabilities`** — Tools declare which project capabilities they need (e.g. `profiles`, `replays`, `traces`). If the upstream project doesn't have a capability enabled, the tool is automatically hidden.
1413
- **`experimental` / `hideInExperimentalMode`** — Feature flags for tools that are being tested or replaced.

‎docs/operations/embedded-agents.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Sentry MCP uses embedded AI agents for the following tools:
88
- `search_events` - Natural language search across events, metrics, and session replays
99
- `search_issues` - Natural language search across issues
1010
- `search_issue_events` - Search events within a specific issue
11-
- `use_sentry` - Unified natural language interface to all Sentry operations
1211

1312
These tools require an LLM provider (OpenAI, Azure OpenAI, Anthropic, or OpenRouter) to be configured.
1413

0 commit comments

Comments
 (0)