# Sentry

> Connect Sentry to FlyMyAI agents - issues, errors, releases, DSNs and Seer AI root-cause via OAuth.

Connects [Sentry](https://sentry.io) to FlyMyAI agents through Sentry's official
hosted MCP. Connect your Sentry organization once via OAuth and the agent can
triage issues and errors, inspect projects, events and releases, manage DSNs and
teams, run AI-powered search, and kick off Seer root-cause analysis - no token to paste.

## What it can do

- Find organizations, projects and teams; read project details
- List and search issues / errors, including natural-language `search_events` / `search_issues`
- Read event details, stack traces and releases
- Read and create client keys (DSNs)
- Create / update projects and teams (write)
- Resolve or update issues, and run **Seer** AI root-cause analysis + autofix

The exact verbs are discovered from Sentry's hosted MCP after you connect, so the
list tracks whatever Sentry currently exposes for your org and the scopes you grant.

> The agent is granted **read + write** scopes but is instructed to **confirm with
> you before any write** (creating or updating projects, teams or DSNs, resolving
> issues, or triggering Seer autofix) and before actions that may consume Sentry or
> Seer quota.

## How to get credentials

Sentry uses OAuth - there's no token to copy.

1. In FlyMyAI, open the Sentry MCP and start the setup flow.
2. A Sentry consent screen opens in a new tab. Sign in with the Sentry
   organization the agent should act as.
3. Review the requested scopes and approve.
4. You're redirected back to FlyMyAI; the tool flips to **Configured**.

Scopes requested: `org:read`, `project:read`, `project:write`, `team:read`,
`team:write`, `event:write`.

To revoke access later, open Sentry **Settings -> Account -> Authorized Applications**
(or your org's integration settings) and remove the FlyMyAI connection.

## Fields to fill in FlyMyAI

No fields - the OAuth flow stores the tokens automatically. To switch Sentry
organizations, remove the tool and connect again with the other org.

## Use it from code

Once Sentry is connected (above), call it directly from the SDK - no agent
required. The same connection also works when you attach the tool to an agent
(`tools=[sentry.id]`) and let it triage inside a run.

```python
from flymyai import AgentClient

client = AgentClient(api_key="fly-***")

# Find your connected Sentry tool (or client.tools.create(mcp_tool="sentry"))
sentry = next(t for t in client.tools.list() if t.mcp_tool == "sentry")

# Call any Sentry MCP action directly
issue = client.tools.call(
    sentry.id,
    action="get_issue_details",
    arguments={"organizationSlug": "my-org", "issueId": "PROJECT-123"},
)
print(issue)
```

Actions mirror Sentry's hosted MCP - for example `find_organizations`,
`find_projects`, `get_issue_details`, `get_event_details`, `search_issues`,
`search_events`, and the Seer fixes. The exact verbs are discovered from Sentry
after you connect, so they track whatever your org and scopes expose. See
[Tools & MCP](https://docs.flymy.ai/agents/concepts/tools.md) for the full `client.tools` API.

## Troubleshooting

- **OAuth denied / `403`** - your Sentry role lacks access to the org or project, or
  an admin restricts third-party apps. Connect with an account that has the needed access.
- **Connected, but some actions are missing** - the available actions are limited by
  the scopes granted at connect time and by your Sentry plan. Reconnect to refresh.
- **AI search / Seer unavailable** - `search_events`, `search_issues` and Seer need a
  Sentry plan that includes Seer; they may be absent on some orgs or self-hosted Sentry.
- **EU data residency** - handled by your own Sentry org / region; there is no separate
  EU MCP endpoint to configure on the FlyMyAI side.

## Links

- [Sentry](https://sentry.io)
- [Sentry MCP](https://mcp.sentry.dev)
- [Sentry MCP docs](https://docs.sentry.io/product/sentry-mcp/)
