Skip to content

Expose DSN key rate limits and audit logs in MCP #1740

Open

Description

@sentry-junior

Add MCP support for:

  • Reading rate limits configured on a project's DSN keys.
  • Accessing Sentry audit-log entries.

This would let MCP clients inspect project key limits and audit activity directly.

via Ido Shemesh.

--

View Junior Session [Sentry]

Activity

  1. linear-code commented on Oct 29, 2026

    @linear-code
  2. sentry-junior commented on Nov 9, 2026

    @sentry-junior
    ContributorAuthor

    Current state of the two parts of this issue:

    DSN rate limits. update_dsn can set a key's rate limit, but find_dsns drops it from its output even though the project keys API returns it. #2102 is one possible fix: it adds isActive and rateLimit ({ count, windowSeconds }, the same shape as update_dsn) to find_dsns. It's a proposal, not the required approach.

    Audit logs. No MCP tool reads audit-log entries yet. Sentry exposes GET /api/0/organizations/{org}/audit-logs/, but OrganizationAuditPermission requires org:write for GET, not org:read. So any tool here would only work for connections that already have that scope. #2102 doesn't touch this part.

  3. sentry-junior commented on Nov 18, 2026

    @sentry-junior
    ContributorAuthor

    New MCP feedback report for the audit-log half of this issue (Sentry User Feedback MCP-SERVER-GRM, 2026-11-18, kind=missing, impact=blocked, server 0.42.0, hosted HTTP transport).

    Task: find which user created a given project.

    What the agent did: it called find_projects (succeeded) and then search_issues. The embedded search agent turned "creator" into a user.id filter on issues, which can't answer the question. The agent then reported that "available tools do not list projects or project creator metadata". That's only half right: find_projects does list projects, but it returns slugs only (packages/mcp-core/src/tools/catalog/find-projects.ts:18-26, :70).

    Why no MCP tool can answer it today:

    • Sentry stores no creator on a project. Project has date_added but no creator or owner-user field (src/sentry/models/project.py:256-278 in getsentry/sentry).
    • The only record of who created a project is the audit-log event project.create (PROJECT_ADD, src/sentry/audit_log/register.py:66-70).
    • GET /api/0/organizations/{org}/audit-logs/?event=project.create can filter for it, but the endpoint is EXPERIMENTAL, owned by ApiOwner.FOUNDATIONS (src/sentry/core/endpoints/organization_auditlogs.py:38-43), and OrganizationAuditPermission needs org:write for GET (src/sentry/api/bases/organization.py:192-193).

    Use case to add here: "who created project X" / "which projects did user Y create". A read-only audit-log tool filtered by event (and optionally by actor) would cover it, for connections that have org:write.

    Side note, maybe separate: search_issues mapping "creator" to issue user.id is a wrong translation. It would be better if the tool said that project metadata is out of scope.

    I didn't check: the session's exact search_issues query string or its response (the feedback trace was not sampled), or whether the client's OAuth grant includes org:write.

    Report count for the project-creator / audit-log pattern: 1 MCP feedback report (on top of the original request that opened this issue).

  4. sentry-junior commented on Nov 18, 2026

    @sentry-junior
    ContributorAuthor

    Second MCP feedback report for the audit-log half of this issue (Sentry User Feedback MCP-SERVER-GRN, 2026-11-18 08:53 UTC, kind=missing, impact=blocked, server 0.42.0, hosted HTTP transport). Pattern "project creator / audit-log activity not readable": 2 reports (GRM, GRN).

    Task: find the project created by a specified user.

    Reported: "No available tool lists projects or project creator metadata. search_issues confirmed issue search cannot filter by the user who created a project."

    Same cause as the GRM report above: Sentry keeps no creator on Project, and the only record is the project.create audit-log event, which no MCP tool reads (and whose endpoint needs org:write). As with GRM, the "no tool lists projects" part is inaccurate, since find_projects exists but returns slugs only.

    Note: this report came from the same OAuth client as GRM, about 15 minutes later, so it is likely the same agent retrying the same task rather than an independent user. The trace for this event wasn't checked for tool-call details.

  5. sentry-junior commented on Nov 18, 2026

    @sentry-junior
    ContributorAuthor

    Third MCP feedback report for the audit-log half of this issue (Sentry User Feedback MCP-SERVER-GRP, 2026-11-18 08:59 UTC, kind=missing, impact=blocked, server 0.42.0, hosted HTTP transport, java-http-client). Pattern "project creator / audit-log activity not readable": 3 reports (GRM, GRN, GRP), all from the same MCP client within ~23 minutes, so most likely one agent retrying the same task.

    Task: find the project created by a specified user ID.

    Reported: "Available Sentry tools do not include project listing, organization discovery, or audit-log lookup to identify a project created by a specified user ID."

    Same cause as GRM and GRN above: Project stores no creator, and the only record is the project.create audit-log event, which no MCP tool reads (its endpoint needs org:write). The "no project listing / organization discovery" part is inaccurate: find_projects and find_organizations exist, though they don't carry creator data.

    Not checked: the trace for this event wasn't sampled and there's no mcp.session.id, so the exact tool calls aren't visible.

  6. sentry-junior commented on Nov 18, 2026

    @sentry-junior
    ContributorAuthor

    Fourth MCP feedback report for the audit-log half of this issue (Sentry User Feedback MCP-SERVER-GRT, 2026-11-18 09:11 UTC, kind=missing, impact=blocked, feedback.tool=find_dropped_events, server 0.42.0, hosted HTTP transport, java-http-client). Pattern "project creator / audit-log activity not readable": 4 reports (GRM, GRN, GRP, GRT), all from the same MCP client (client.id matches) within ~35 minutes, so most likely one agent retrying the same task.

    Task: find the Sentry project created by a specified user ID.

    Reported: no tool lists or searches projects by creator. The agent then called find_dropped_events with the user ID as the organization slug (404), and also tried a non-Sentry search tool.

    Same cause as above: Project stores no creator, and the only record is the project.create audit-log event, which no MCP tool reads (endpoint needs org:write). The find_dropped_events 404 is agent misuse (a user ID isn't an org slug), not a tool bug.

    Spans for this client.id over the previous 3h show only find_organizations, search_issues, get_alert_rule and two submit_feedback_to_sentry_team calls, all ok. The find_dropped_events call doesn't appear (likely unsampled), so I couldn't verify its request or response.

    Separate observation, not counted here: MCP-SERVER-GRQ from the same client was triaged as agent error (never called find_projects).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions