Skip to content

ui: add OAuth Grants page and identity exact-match filter for MCP sessions - #4511

Merged
Pratham-Mishra04 merged 1 commit into
devfrom
06-18-feat_adds_mcp_oauth_grants_ui
Jun 30, 2026
Merged

Pratham-Mishra04 merged 1 commit into
devfrom
06-18-feat_adds_mcp_oauth_grants_ui

Conversation

@Pratham-Mishra04

Copy link
Copy Markdown
Collaborator

Summary

Adds an OAuth Grants management page to the UI and introduces an identity exact-match filter for MCP sessions. Together these allow operators to view all active downstream OAuth grants issued to MCP clients and drill through from a grant directly to the auth sessions belonging to that specific identity.

Changes

  • Added Identity field to MCPSessionsFilterParams in the config store, which exact-matches against user_id, virtual_key_id, or session_id columns (ANDed with any other active filters).
  • Exposed the identity query parameter in the HTTP handler so callers can pass it via the API.
  • Added identity to the MCP sessions URL state and query params in the UI, included it in the "has active filters" check, and wired it into handleClearFilters.
  • Created oauth2SessionsApi.ts with getOAuth2Grants and revokeOAuth2Grant endpoints, registered the OAuth2Grants cache tag in baseApi, and exported the new API from the store index.
  • Built the OAuthGrantsPage component with client-side search and mode filtering, a paginated table showing client name, bound identity (user/virtual key/anonymous session), access token expiry, created time, and last used time, and per-row actions to revoke a grant or navigate to MCP sessions pre-filtered to that identity via auth_mode + identity query params.
  • Added the OAuth Grants route and sidebar entry under the MCP Gateway section.

The identity filter is intentionally an exact match (not a substring) so that linking from a grant to its sessions produces a precise, unambiguous result rather than a fuzzy hit list.

Type of change

  • Bug fix
  • Feature
  • Refactor
  • Documentation
  • Chore/CI

Affected areas

  • Core (Go)
  • Transports (HTTP)
  • Providers/Integrations
  • Plugins
  • UI (React)
  • Docs

How to test

  1. Start the gateway with at least one MCP client connected via the OAuth consent flow.
  2. Navigate to OAuth Grants in the sidebar — the table should list active grants with client name, bound identity, expiry, and timestamps.
  3. Use the search box and identity-mode filter to narrow results; verify the Clear filters button resets both.
  4. Open the row actions menu on a user or virtual-key grant and click View auth sessions — confirm the MCP Sessions page opens filtered to that exact identity and auth mode.
  5. Click Revoke on a grant, confirm the dialog, and verify the grant disappears from the list and a success toast appears.
  6. On the MCP Sessions page, manually append &identity=<some-id> to the URL and confirm only sessions matching that exact identity are returned.
go test ./framework/configstore/...

cd ui
pnpm i
pnpm build

Screenshots/Recordings

Add before/after screenshots of the OAuth Grants page and the MCP Sessions identity filter.

Breaking changes

  • Yes
  • No

Related issues

Link related issues here.

Security considerations

Revocation stops refresh token rotation immediately; the current short-lived JWT access token (≤10 min TTL) remains valid until it expires naturally. This is documented in the revocation confirmation dialog so operators understand the brief window before full cutoff.

Checklist

  • I read docs/contributing/README.md and followed the guidelines
  • I added/updated tests where appropriate
  • I updated documentation where needed
  • I verified builds succeed (Go and UI)
  • I verified the CI pipeline passes locally if applicable

Pratham-Mishra04 commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator Author

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 30 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: dd62e041-2a13-407e-a961-b20fb2b44bfd

📥 Commits

Reviewing files that changed from the base of the PR and between 1736ff8 and c5fd042.

📒 Files selected for processing (16)
  • framework/configstore/rdb.go
  • framework/configstore/store.go
  • transports/bifrost-http/handlers/mcpsessions.go
  • ui/app/workspace/mcp-sessions/page.tsx
  • ui/app/workspace/oauth-grants/layout.tsx
  • ui/app/workspace/oauth-grants/page.tsx
  • ui/app/workspace/oauth-grants/views/grantActions.tsx
  • ui/app/workspace/oauth-grants/views/grantsFilterBar.tsx
  • ui/app/workspace/oauth-grants/views/grantsTable.tsx
  • ui/app/workspace/oauth-grants/views/revokeGrantDialog.tsx
  • ui/components/sidebar.tsx
  • ui/lib/store/apis/baseApi.ts
  • ui/lib/store/apis/index.ts
  • ui/lib/store/apis/mcpSessionsApi.ts
  • ui/lib/store/apis/oauth2SessionsApi.ts
  • ui/lib/types/mcpSessions.ts
📝 Walkthrough

Walkthrough

Adds exact-match identity filtering to MCP sessions end-to-end. Also adds OAuth grants querying and revocation, the grants page UI, and navigation into the new page.

Changes

MCP Sessions identity filter

Layer / File(s) Summary
Backend identity filter contract and SQL
framework/configstore/store.go, transports/bifrost-http/handlers/mcpsessions.go, framework/configstore/rdb.go
Adds Identity to MCP session filters, parses the identity request query, and applies an exact-match OR predicate across user_id, virtual_key_id, and session_id.
Frontend identity filter wiring
ui/lib/types/mcpSessions.ts, ui/lib/store/apis/mcpSessionsApi.ts, ui/app/workspace/mcp-sessions/page.tsx
Adds identity to the MCP sessions query params, passes it from the page when non-empty, and updates active-filter and clear-filter handling.

OAuth Grants management

Layer / File(s) Summary
OAuth grants API slice
ui/lib/store/apis/oauth2SessionsApi.ts, ui/lib/store/apis/baseApi.ts, ui/lib/store/apis/index.ts
Defines OAuth grant row/list types, injects the grants query and revoke mutation, registers the RTK Query tag, and re-exports the API slice.
OAuth grants UI components
ui/app/workspace/oauth-grants/views/grantsFilterBar.tsx, ui/app/workspace/oauth-grants/views/grantActions.tsx, ui/app/workspace/oauth-grants/views/grantsTable.tsx, ui/app/workspace/oauth-grants/views/revokeGrantDialog.tsx
Adds the filter bar, row actions menu, table view, and revoke confirmation dialog used by the OAuth grants page.
OAuth grants page logic
ui/app/workspace/oauth-grants/page.tsx
Implements the OAuth grants page state, filtering, pagination, revoke flow, and conditional loading, error, and table rendering.
OAuth grants route and sidebar
ui/app/workspace/oauth-grants/layout.tsx, ui/components/sidebar.tsx
Registers the /workspace/oauth-grants route and adds the matching sidebar entry under MCP Gateway.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • maximhq/bifrost#3295: Changes sidebar entry derivation and gating logic in ui/components/sidebar.tsx, which is directly related to the new OAuth Grants navigation entry.

Suggested reviewers

  • akshaydeo
  • danpiths
  • roroghost17

Poem

🐇 I hop through sessions, exact and neat,
Grants now twirl in a table seat.
One click, one revoke, one filter tune,
Moonlit sidebars sing by afternoon.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main UI feature and identity filter change.
Description check ✅ Passed The description follows the template and covers summary, changes, testing, impact, security, and checklist items, with only minor placeholders left.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 06-18-feat_adds_mcp_oauth_grants_ui

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (1)
ui/lib/store/apis/oauth2SessionsApi.ts (1)

25-28: ⚡ Quick win

Prefer deterministic cache patch for revoke to avoid stale grants rows.

For this delete-by-id mutation, patching getOAuth2Grants in onQueryStarted is safer than full invalidation in this codebase’s clustered setup.

♻️ Suggested change
 		revokeOAuth2Grant: builder.mutation<void, string>({
 			query: (id) => ({ url: `/oauth2/sessions/${id}`, method: "DELETE" }),
-			invalidatesTags: ["OAuth2Grants"],
+			async onQueryStarted(id, { dispatch, queryFulfilled }) {
+				const patch = dispatch(
+					oauth2SessionsApi.util.updateQueryData("getOAuth2Grants", undefined, (draft) => {
+						draft.sessions = draft.sessions.filter((s) => s.id !== id);
+					}),
+				);
+				try {
+					await queryFulfilled;
+				} catch {
+					patch.undo();
+				}
+			},
 		}),

Based on learnings: “In ui/lib/store/apis/, optimistically patch the cache with onQueryStarted + updateQueryData for deterministic mutations like deleting a known row.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ui/lib/store/apis/oauth2SessionsApi.ts` around lines 25 - 28, The
revokeOAuth2Grant mutation currently uses invalidatesTags to fully invalidate
the OAuth2Grants cache, which can cause stale rows in a clustered setup. Replace
the invalidatesTags approach with an onQueryStarted handler that uses
updateQueryData to patch the getOAuth2Grants query cache. The handler should
optimistically remove the revoked grant with the matching ID from the cached
grants list, ensuring only the specific deleted grant is removed rather than
invalidating the entire cache, making the mutation deterministic and cache-safe.

Source: Learnings

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ui/app/workspace/mcp-sessions/page.tsx`:
- Line 35: Normalize the identity value before using it in the query and
active-filter checks to handle whitespace-only values consistently with the
backend. At line 35 where identity is assigned from urlState.identity and at
line 69 where it's used in the active-filter check, apply trimming to the
identity string and convert empty or whitespace-only values to undefined. This
ensures that values like identity=%20 don't create inconsistent UI state and
unnecessary cache fragmentation between the UI and backend behavior.

In `@ui/app/workspace/oauth-grants/page.tsx`:
- Around line 108-126: The AlertDialog component in the revoke confirmation
dialog is missing data-testid attributes on its interactive controls for E2E
testing. Add data-testid attributes to the AlertDialogCancel (Cancel button) and
AlertDialogAction (Revoke button) elements within the AlertDialogFooter to
ensure they are properly selectable in E2E tests, following the repository's
testing convention.
- Around line 305-317: The AccessTokenExpiry function does not validate that the
timestamp from row.created_at is valid before using it in calculations. When new
Date(row.created_at).getTime() receives an invalid date string, it returns NaN
instead of throwing an error, which causes the function to render "in NaN min".
Add a Number.isFinite() guard check immediately after calculating createdMs to
validate it is a valid number, and return a fallback span with an appropriate
message (such as "Unknown expiry") if the timestamp is invalid. This same
validation pattern should also be applied to other similar timestamp
calculations referenced in the "Also applies to" comment at lines 401-414.
- Around line 60-276: The OAuthGrantsPage component contains excessive UI logic
and rendering that should be extracted into view components according to project
conventions. Move the filter bar section (search input, ComboboxSelect, clear
filters button) into a separate view component, extract the table rendering
logic with its header and body rows into another view component, and separate
the AlertDialog confirmation logic into its own component. Keep the
OAuthGrantsPage function focused on state management and composition, delegating
rendering to these view components. Create these new components in a views/
subdirectory alongside page.tsx.

---

Nitpick comments:
In `@ui/lib/store/apis/oauth2SessionsApi.ts`:
- Around line 25-28: The revokeOAuth2Grant mutation currently uses
invalidatesTags to fully invalidate the OAuth2Grants cache, which can cause
stale rows in a clustered setup. Replace the invalidatesTags approach with an
onQueryStarted handler that uses updateQueryData to patch the getOAuth2Grants
query cache. The handler should optimistically remove the revoked grant with the
matching ID from the cached grants list, ensuring only the specific deleted
grant is removed rather than invalidating the entire cache, making the mutation
deterministic and cache-safe.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 41aea2ef-4014-4abc-bd40-7165db2edfda

📥 Commits

Reviewing files that changed from the base of the PR and between 3d76e6a and ffd24d4.

📒 Files selected for processing (12)
  • framework/configstore/rdb.go
  • framework/configstore/store.go
  • transports/bifrost-http/handlers/mcp_sessions.go
  • ui/app/workspace/mcp-sessions/page.tsx
  • ui/app/workspace/oauth-grants/layout.tsx
  • ui/app/workspace/oauth-grants/page.tsx
  • ui/components/sidebar.tsx
  • ui/lib/store/apis/baseApi.ts
  • ui/lib/store/apis/index.ts
  • ui/lib/store/apis/mcpSessionsApi.ts
  • ui/lib/store/apis/oauth2SessionsApi.ts
  • ui/lib/types/mcpSessions.ts

Comment thread ui/app/workspace/mcp-sessions/page.tsx Outdated
Comment thread ui/app/workspace/oauth-grants/page.tsx
Comment thread ui/app/workspace/oauth-grants/page.tsx Outdated
Comment thread ui/app/workspace/oauth-grants/page.tsx Outdated
@greptile-apps

greptile-apps Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

Safe to merge — the SQL parenthesization fix is correct, the offset snap-back logic handles all edge cases, and the new UI components follow existing patterns with full data-testid coverage.

The Go backend changes are narrow and correct: the identity filter uses explicit parentheses in the raw SQL string, the parameterized bindings prevent injection, and the change is additive with no regressions to existing filters. The React page correctly handles loading, error, empty, and paginated states; the offset useEffect snaps the page back when totalCount shrinks after a revoke; the revoke flow closes the dialog immediately and surfaces errors as toasts. No browser crypto APIs, no data-testid removals, and no auth/authz regressions were found.

No files require special attention. The two comments are minor style nits (unused import, redundant type guard) with no behavioral impact.

Important Files Changed

Filename Overview
framework/configstore/rdb.go Adds Identity exact-match filter with explicit SQL parentheses so the OR group is correctly ANDed — correctly addresses the previously flagged parenthesization bug.
framework/configstore/store.go Adds Identity string field to MCPSessionsFilterParams with clear documentation on its exact-match semantics and how it differs from Search.
transports/bifrost-http/handlers/mcpsessions.go Exposes the identity query parameter verbatim (no trim) from the request; documented rationale, and the UI-side trim covers the practical whitespace concern.
ui/app/workspace/oauth-grants/page.tsx OAuthGrantsPage correctly handles loading/error/empty states, uses a useEffect to snap the offset into range when totalCount shrinks after a revoke, and closes the dialog immediately before the async revoke resolves.
ui/app/workspace/oauth-grants/views/grantsTable.tsx Table with pagination, correct empty-state branching, AccessTokenExpiry approximated from last_used_at ?? created_at; ShieldCheck is imported but not used anywhere in this file.
ui/app/workspace/oauth-grants/views/grantActions.tsx Per-row actions dropdown; identity link correctly encodes bf_sub; mode condition guard is always true given the current bf_mode union type.
ui/lib/store/apis/oauth2SessionsApi.ts New RTK Query API with getOAuth2Grants and revokeOAuth2Grant, correctly tagged with OAuth2Grants cache tag; no server-side pagination or filtering (all handled client-side).
ui/app/workspace/mcp-sessions/page.tsx Adds identity URL state with trim normalization, includes it in the active-filters check, and clears it from handleClearFilters.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[User navigates to OAuth Grants page] --> B[useGetOAuth2GrantsQuery\nGET /oauth2/sessions — all grants]
    B --> C{Response}
    C -->|isLoading| D[Spinner]
    C -->|isError| E[Error message]
    C -->|data| F[Client-side filter\nsearch + bf_mode]
    F --> G[Client-side pagination\nPAGE_SIZE = 50]
    G --> H[GrantsTable renders current page slice]
    H --> I{Row action}
    I -->|View auth sessions| J[Navigate to MCP Sessions\n?auth_mode=bf_mode&identity=bf_sub]
    J --> K[GET /mcp/sessions\nwith identity exact-match filter\nAND auth_mode filter]
    I -->|Revoke| L[RevokeGrantDialog\nconfirmation]
    L -->|Confirm| M[DELETE /oauth2/sessions/:id\nrevokeOAuth2Grant mutation]
    M -->|success| N[Invalidate OAuth2Grants tag\nRe-fetch grants list]
    M -->|error| O[Toast error]
    N --> F
    P[useEffect: offset snap] -->|totalCount shrinks| G
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[User navigates to OAuth Grants page] --> B[useGetOAuth2GrantsQuery\nGET /oauth2/sessions — all grants]
    B --> C{Response}
    C -->|isLoading| D[Spinner]
    C -->|isError| E[Error message]
    C -->|data| F[Client-side filter\nsearch + bf_mode]
    F --> G[Client-side pagination\nPAGE_SIZE = 50]
    G --> H[GrantsTable renders current page slice]
    H --> I{Row action}
    I -->|View auth sessions| J[Navigate to MCP Sessions\n?auth_mode=bf_mode&identity=bf_sub]
    J --> K[GET /mcp/sessions\nwith identity exact-match filter\nAND auth_mode filter]
    I -->|Revoke| L[RevokeGrantDialog\nconfirmation]
    L -->|Confirm| M[DELETE /oauth2/sessions/:id\nrevokeOAuth2Grant mutation]
    M -->|success| N[Invalidate OAuth2Grants tag\nRe-fetch grants list]
    M -->|error| O[Toast error]
    N --> F
    P[useEffect: offset snap] -->|totalCount shrinks| G
Loading

Reviews (25): Last reviewed commit: "feat: adds mcp oauth grants ui" | Re-trigger Greptile

Comment thread framework/configstore/rdb.go
Comment thread ui/app/workspace/oauth-grants/page.tsx Outdated
@Pratham-Mishra04 Pratham-Mishra04 changed the title feat: add OAuth Grants page and identity exact-match filter for MCP sessions ui: add OAuth Grants page and identity exact-match filter for MCP sessions Jun 17, 2026
@Pratham-Mishra04
Pratham-Mishra04 force-pushed the 06-18-feat_adds_mcp_oauth_grants_ui branch from ffd24d4 to 9424fab Compare June 18, 2026 07:34
@Pratham-Mishra04
Pratham-Mishra04 force-pushed the 06-18-feat_adds_ui_for_mcp_oauth_consent_screen branch 2 times, most recently from e5a9a8f to 47cce08 Compare June 18, 2026 07:37
@Pratham-Mishra04
Pratham-Mishra04 force-pushed the 06-18-feat_adds_mcp_oauth_grants_ui branch from 9424fab to 41e5b36 Compare June 18, 2026 07:37

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ui/app/workspace/oauth-grants/page.tsx`:
- Around line 33-35: The pagination offset can become invalid when the filtered
results shrink after actions like revoking items. On line 34 where
filtered.slice is called with offset, the offset variable needs to be clamped to
ensure it doesn't exceed the bounds of the new filtered array. Before calling
slice with offset and offset + PAGE_SIZE, calculate the maximum valid offset
using Math.max(0, Math.floor((totalCount - 1) / PAGE_SIZE)) or similar logic,
then use the smaller of the current offset and this maximum value to ensure
pagination stays within valid bounds when the filtered count decreases.

In `@ui/app/workspace/oauth-grants/views/grantActions.tsx`:
- Around line 40-47: The conditional check on the DropdownMenuItem gating the
View auth sessions link currently only includes user and vk modes, excluding
session-based grants. Extend the bf_mode condition to also include the "session"
mode so that session-bound grants can navigate to auth sessions, aligning with
the identity filter contract that supports exact matching on session_id just as
it does for user_id and virtual_key_id.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 92a7db2e-849e-43c1-8365-68106e57eb5f

📥 Commits

Reviewing files that changed from the base of the PR and between ffd24d4 and 9424fab.

📒 Files selected for processing (16)
  • framework/configstore/rdb.go
  • framework/configstore/store.go
  • transports/bifrost-http/handlers/mcp_sessions.go
  • ui/app/workspace/mcp-sessions/page.tsx
  • ui/app/workspace/oauth-grants/layout.tsx
  • ui/app/workspace/oauth-grants/page.tsx
  • ui/app/workspace/oauth-grants/views/grantActions.tsx
  • ui/app/workspace/oauth-grants/views/grantsFilterBar.tsx
  • ui/app/workspace/oauth-grants/views/grantsTable.tsx
  • ui/app/workspace/oauth-grants/views/revokeGrantDialog.tsx
  • ui/components/sidebar.tsx
  • ui/lib/store/apis/baseApi.ts
  • ui/lib/store/apis/index.ts
  • ui/lib/store/apis/mcpSessionsApi.ts
  • ui/lib/store/apis/oauth2SessionsApi.ts
  • ui/lib/types/mcpSessions.ts
✅ Files skipped from review due to trivial changes (3)
  • ui/app/workspace/oauth-grants/layout.tsx
  • ui/lib/store/apis/index.ts
  • ui/lib/store/apis/baseApi.ts
🚧 Files skipped from review as they are similar to previous changes (6)
  • ui/components/sidebar.tsx
  • ui/lib/store/apis/mcpSessionsApi.ts
  • framework/configstore/rdb.go
  • transports/bifrost-http/handlers/mcp_sessions.go
  • ui/lib/store/apis/oauth2SessionsApi.ts
  • ui/app/workspace/mcp-sessions/page.tsx

Comment thread ui/app/workspace/oauth-grants/page.tsx
Comment thread ui/app/workspace/oauth-grants/views/grantActions.tsx Outdated
Comment thread ui/app/workspace/oauth-grants/page.tsx
@Pratham-Mishra04
Pratham-Mishra04 force-pushed the 06-18-feat_adds_mcp_oauth_grants_ui branch from 41e5b36 to d30ef75 Compare June 18, 2026 08:17
@Pratham-Mishra04
Pratham-Mishra04 force-pushed the 06-18-feat_adds_ui_for_mcp_oauth_consent_screen branch from 47cce08 to 577e9c3 Compare June 18, 2026 08:17
@Pratham-Mishra04
Pratham-Mishra04 force-pushed the 06-18-feat_adds_ui_for_mcp_oauth_consent_screen branch from da29389 to bcdf0a4 Compare June 29, 2026 10:59
@Pratham-Mishra04
Pratham-Mishra04 force-pushed the 06-18-feat_adds_mcp_oauth_grants_ui branch from a4a55d2 to e143956 Compare June 29, 2026 10:59
@Pratham-Mishra04
Pratham-Mishra04 force-pushed the 06-18-feat_adds_ui_for_mcp_oauth_consent_screen branch from bcdf0a4 to 91ef58c Compare June 29, 2026 18:18
@Pratham-Mishra04
Pratham-Mishra04 force-pushed the 06-18-feat_adds_mcp_oauth_grants_ui branch from e143956 to 8a77f80 Compare June 29, 2026 18:18
@Pratham-Mishra04
Pratham-Mishra04 force-pushed the 06-18-feat_adds_ui_for_mcp_oauth_consent_screen branch from 91ef58c to 90b5a4b Compare June 30, 2026 07:53
@Pratham-Mishra04
Pratham-Mishra04 force-pushed the 06-18-feat_adds_mcp_oauth_grants_ui branch from 8a77f80 to 110d3b7 Compare June 30, 2026 07:53
@Pratham-Mishra04
Pratham-Mishra04 force-pushed the 06-18-feat_adds_ui_for_mcp_oauth_consent_screen branch from 90b5a4b to ce55915 Compare June 30, 2026 11:43
@Pratham-Mishra04
Pratham-Mishra04 force-pushed the 06-18-feat_adds_mcp_oauth_grants_ui branch from 110d3b7 to 110c0aa Compare June 30, 2026 11:43
@coderabbitai
coderabbitai Bot requested a review from roroghost17 June 30, 2026 11:44
@Pratham-Mishra04
Pratham-Mishra04 force-pushed the 06-18-feat_adds_ui_for_mcp_oauth_consent_screen branch from ce55915 to 520b193 Compare June 30, 2026 13:44
@Pratham-Mishra04
Pratham-Mishra04 force-pushed the 06-18-feat_adds_mcp_oauth_grants_ui branch from 110c0aa to 1736ff8 Compare June 30, 2026 13:44

Pratham-Mishra04 commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator Author

Merge activity

  • Jun 30, 1:53 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jun 30, 2:14 PM UTC: Graphite rebased this pull request as part of a merge.
  • Jun 30, 2:15 PM UTC: @Pratham-Mishra04 merged this pull request with Graphite.

@Pratham-Mishra04
Pratham-Mishra04 changed the base branch from 06-18-feat_adds_ui_for_mcp_oauth_consent_screen to graphite-base/4511 June 30, 2026 14:10
@Pratham-Mishra04
Pratham-Mishra04 changed the base branch from graphite-base/4511 to dev June 30, 2026 14:13
@Pratham-Mishra04
Pratham-Mishra04 dismissed coderabbitai[bot]’s stale review June 30, 2026 14:13

The base branch was changed.

@Pratham-Mishra04
Pratham-Mishra04 force-pushed the 06-18-feat_adds_mcp_oauth_grants_ui branch from 1736ff8 to c5fd042 Compare June 30, 2026 14:13
@Pratham-Mishra04
Pratham-Mishra04 merged commit 7632eb6 into dev Jun 30, 2026
14 of 16 checks passed
@Pratham-Mishra04
Pratham-Mishra04 deleted the 06-18-feat_adds_mcp_oauth_grants_ui branch June 30, 2026 14:15
akshaydeo pushed a commit that referenced this pull request Jul 1, 2026
…essions (#4511)

## Summary

Adds an **OAuth Grants** management page to the UI and introduces an `identity` exact-match filter for MCP sessions. Together these allow operators to view all active downstream OAuth grants issued to MCP clients and drill through from a grant directly to the auth sessions belonging to that specific identity.

## Changes

- Added `Identity` field to `MCPSessionsFilterParams` in the config store, which exact-matches against `user_id`, `virtual_key_id`, or `session_id` columns (ANDed with any other active filters).
- Exposed the `identity` query parameter in the HTTP handler so callers can pass it via the API.
- Added `identity` to the MCP sessions URL state and query params in the UI, included it in the "has active filters" check, and wired it into `handleClearFilters`.
- Created `oauth2SessionsApi.ts` with `getOAuth2Grants` and `revokeOAuth2Grant` endpoints, registered the `OAuth2Grants` cache tag in `baseApi`, and exported the new API from the store index.
- Built the `OAuthGrantsPage` component with client-side search and mode filtering, a paginated table showing client name, bound identity (user/virtual key/anonymous session), access token expiry, created time, and last used time, and per-row actions to revoke a grant or navigate to MCP sessions pre-filtered to that identity via `auth_mode` + `identity` query params.
- Added the OAuth Grants route and sidebar entry under the MCP Gateway section.

The `identity` filter is intentionally an exact match (not a substring) so that linking from a grant to its sessions produces a precise, unambiguous result rather than a fuzzy hit list.

## Type of change

- [ ] Bug fix
- [x] Feature
- [ ] Refactor
- [ ] Documentation
- [ ] Chore/CI

## Affected areas

- [x] Core (Go)
- [x] Transports (HTTP)
- [ ] Providers/Integrations
- [ ] Plugins
- [x] UI (React)
- [ ] Docs

## How to test

1. Start the gateway with at least one MCP client connected via the OAuth consent flow.
2. Navigate to **OAuth Grants** in the sidebar — the table should list active grants with client name, bound identity, expiry, and timestamps.
3. Use the search box and identity-mode filter to narrow results; verify the Clear filters button resets both.
4. Open the row actions menu on a user or virtual-key grant and click **View auth sessions** — confirm the MCP Sessions page opens filtered to that exact identity and auth mode.
5. Click **Revoke** on a grant, confirm the dialog, and verify the grant disappears from the list and a success toast appears.
6. On the MCP Sessions page, manually append `&identity=<some-id>` to the URL and confirm only sessions matching that exact identity are returned.

```sh
go test ./framework/configstore/...

cd ui
pnpm i
pnpm build
```

## Screenshots/Recordings

_Add before/after screenshots of the OAuth Grants page and the MCP Sessions identity filter._

## Breaking changes

- [ ] Yes
- [x] No

## Related issues

_Link related issues here._

## Security considerations

Revocation stops refresh token rotation immediately; the current short-lived JWT access token (≤10 min TTL) remains valid until it expires naturally. This is documented in the revocation confirmation dialog so operators understand the brief window before full cutoff.

## Checklist

- [ ] I read `docs/contributing/README.md` and followed the guidelines
- [ ] I added/updated tests where appropriate
- [ ] I updated documentation where needed
- [ ] I verified builds succeed (Go and UI)
- [ ] I verified the CI pipeline passes locally if applicable
akhsaul pushed a commit to akhsaul/bifrost that referenced this pull request Aug 27, 2026
…essions (maximhq#4511)

## Summary

Adds an **OAuth Grants** management page to the UI and introduces an `identity` exact-match filter for MCP sessions. Together these allow operators to view all active downstream OAuth grants issued to MCP clients and drill through from a grant directly to the auth sessions belonging to that specific identity.

## Changes

- Added `Identity` field to `MCPSessionsFilterParams` in the config store, which exact-matches against `user_id`, `virtual_key_id`, or `session_id` columns (ANDed with any other active filters).
- Exposed the `identity` query parameter in the HTTP handler so callers can pass it via the API.
- Added `identity` to the MCP sessions URL state and query params in the UI, included it in the "has active filters" check, and wired it into `handleClearFilters`.
- Created `oauth2SessionsApi.ts` with `getOAuth2Grants` and `revokeOAuth2Grant` endpoints, registered the `OAuth2Grants` cache tag in `baseApi`, and exported the new API from the store index.
- Built the `OAuthGrantsPage` component with client-side search and mode filtering, a paginated table showing client name, bound identity (user/virtual key/anonymous session), access token expiry, created time, and last used time, and per-row actions to revoke a grant or navigate to MCP sessions pre-filtered to that identity via `auth_mode` + `identity` query params.
- Added the OAuth Grants route and sidebar entry under the MCP Gateway section.

The `identity` filter is intentionally an exact match (not a substring) so that linking from a grant to its sessions produces a precise, unambiguous result rather than a fuzzy hit list.

## Type of change

- [ ] Bug fix
- [x] Feature
- [ ] Refactor
- [ ] Documentation
- [ ] Chore/CI

## Affected areas

- [x] Core (Go)
- [x] Transports (HTTP)
- [ ] Providers/Integrations
- [ ] Plugins
- [x] UI (React)
- [ ] Docs

## How to test

1. Start the gateway with at least one MCP client connected via the OAuth consent flow.
2. Navigate to **OAuth Grants** in the sidebar — the table should list active grants with client name, bound identity, expiry, and timestamps.
3. Use the search box and identity-mode filter to narrow results; verify the Clear filters button resets both.
4. Open the row actions menu on a user or virtual-key grant and click **View auth sessions** — confirm the MCP Sessions page opens filtered to that exact identity and auth mode.
5. Click **Revoke** on a grant, confirm the dialog, and verify the grant disappears from the list and a success toast appears.
6. On the MCP Sessions page, manually append `&identity=<some-id>` to the URL and confirm only sessions matching that exact identity are returned.

```sh
go test ./framework/configstore/...

cd ui
pnpm i
pnpm build
```

## Screenshots/Recordings

_Add before/after screenshots of the OAuth Grants page and the MCP Sessions identity filter._

## Breaking changes

- [ ] Yes
- [x] No

## Related issues

_Link related issues here._

## Security considerations

Revocation stops refresh token rotation immediately; the current short-lived JWT access token (≤10 min TTL) remains valid until it expires naturally. This is documented in the revocation confirmation dialog so operators understand the brief window before full cutoff.

## Checklist

- [ ] I read `docs/contributing/README.md` and followed the guidelines
- [ ] I added/updated tests where appropriate
- [ ] I updated documentation where needed
- [ ] I verified builds succeed (Go and UI)
- [ ] I verified the CI pipeline passes locally if applicable
occcat pushed a commit to occcat/bifrost that referenced this pull request Sep 2, 2026
…essions (maximhq#4511)

## Summary

Adds an **OAuth Grants** management page to the UI and introduces an `identity` exact-match filter for MCP sessions. Together these allow operators to view all active downstream OAuth grants issued to MCP clients and drill through from a grant directly to the auth sessions belonging to that specific identity.

## Changes

- Added `Identity` field to `MCPSessionsFilterParams` in the config store, which exact-matches against `user_id`, `virtual_key_id`, or `session_id` columns (ANDed with any other active filters).
- Exposed the `identity` query parameter in the HTTP handler so callers can pass it via the API.
- Added `identity` to the MCP sessions URL state and query params in the UI, included it in the "has active filters" check, and wired it into `handleClearFilters`.
- Created `oauth2SessionsApi.ts` with `getOAuth2Grants` and `revokeOAuth2Grant` endpoints, registered the `OAuth2Grants` cache tag in `baseApi`, and exported the new API from the store index.
- Built the `OAuthGrantsPage` component with client-side search and mode filtering, a paginated table showing client name, bound identity (user/virtual key/anonymous session), access token expiry, created time, and last used time, and per-row actions to revoke a grant or navigate to MCP sessions pre-filtered to that identity via `auth_mode` + `identity` query params.
- Added the OAuth Grants route and sidebar entry under the MCP Gateway section.

The `identity` filter is intentionally an exact match (not a substring) so that linking from a grant to its sessions produces a precise, unambiguous result rather than a fuzzy hit list.

## Type of change

- [ ] Bug fix
- [x] Feature
- [ ] Refactor
- [ ] Documentation
- [ ] Chore/CI

## Affected areas

- [x] Core (Go)
- [x] Transports (HTTP)
- [ ] Providers/Integrations
- [ ] Plugins
- [x] UI (React)
- [ ] Docs

## How to test

1. Start the gateway with at least one MCP client connected via the OAuth consent flow.
2. Navigate to **OAuth Grants** in the sidebar — the table should list active grants with client name, bound identity, expiry, and timestamps.
3. Use the search box and identity-mode filter to narrow results; verify the Clear filters button resets both.
4. Open the row actions menu on a user or virtual-key grant and click **View auth sessions** — confirm the MCP Sessions page opens filtered to that exact identity and auth mode.
5. Click **Revoke** on a grant, confirm the dialog, and verify the grant disappears from the list and a success toast appears.
6. On the MCP Sessions page, manually append `&identity=<some-id>` to the URL and confirm only sessions matching that exact identity are returned.

```sh
go test ./framework/configstore/...

cd ui
pnpm i
pnpm build
```

## Screenshots/Recordings

_Add before/after screenshots of the OAuth Grants page and the MCP Sessions identity filter._

## Breaking changes

- [ ] Yes
- [x] No

## Related issues

_Link related issues here._

## Security considerations

Revocation stops refresh token rotation immediately; the current short-lived JWT access token (≤10 min TTL) remains valid until it expires naturally. This is documented in the revocation confirmation dialog so operators understand the brief window before full cutoff.

## Checklist

- [ ] I read `docs/contributing/README.md` and followed the guidelines
- [ ] I added/updated tests where appropriate
- [ ] I updated documentation where needed
- [ ] I verified builds succeed (Go and UI)
- [ ] I verified the CI pipeline passes locally if applicable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants