Skip to content

feat: add virtual_key_id and user_id multi-select filters to MCP sessions - #5921

Merged
Pratham-Mishra04 merged 1 commit into
devfrom
08-06-feat_add_virtual_key_and_users_filters_to_mcp_auth_sessions_sidebar
Aug 8, 2026
Merged

Pratham-Mishra04 merged 1 commit into
devfrom
08-06-feat_add_virtual_key_and_users_filters_to_mcp_auth_sessions_sidebar

Conversation

@Pratham-Mishra04

Copy link
Copy Markdown
Collaborator

Summary

Adds virtual_key_id and user_id as multi-select filter facets on the MCP Sessions list, allowing operators to narrow sessions down to specific virtual keys or users. The Users filter is enterprise-only (renders nothing in OSS builds where no user directory is available).

Changes

  • Added VirtualKeyIDs and UserIDs fields to MCPSessionsFilterParams in the configstore, with corresponding WHERE ... IN ? clauses applied in applyMCPSessionFilters.
  • Exposed virtual_key_id and user_id as query parameters in the HTTP handler (parseMCPSessionsListQuery).
  • Extended MCPSessionsQueryParams (TypeScript types), buildMCPSessionsListParams (API layer), and the MCP Sessions page URL state to carry and serialize the new filter values.
  • Added VirtualKeyFilterSection to the filter sidebar: a lazy-loaded, searchable checkbox list backed by the existing useGetVirtualKeysQuery hook, fetching one page at a time to handle large VK counts.
  • Added UsersFilterSection to the filter sidebar: mirrors VirtualKeyFilterSection but uses a registry-injected search hook (getUserSearchQuery) so OSS builds render nothing while enterprise builds plug in their user directory.
  • Registered registerUserSearchQuery / getUserSearchQuery in ui/lib/registries/userPicker.tsx alongside the existing single-select picker registry, following the same load-once contract.
  • Added sidebar visibility logic: when the auth_mode facet is pinned to a single mode, the irrelevant picker (VK for user-mode, user for vk-mode, both for session-mode) is hidden and its stale selection is cleared automatically.
  • Removed an unnecessary wrapping <div className="rounded-md border p-4"> around the headers FormField in mcpClientSheet.tsx, and corrected indentation throughout that file.

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. Open the MCP Sessions page.
  2. Expand the filter sidebar. Confirm Virtual Key and Users sections appear (Users only in enterprise builds).
  3. Select one or more virtual keys — confirm the session list narrows to rows with matching virtual_key_id.
  4. Select one or more users (enterprise) — confirm the session list narrows to rows with matching user_id.
  5. Pin the Auth Mode filter to "User" — confirm the Virtual Key section disappears and any prior VK selection is cleared. Pin to "VK" — confirm the Users section disappears.
  6. Confirm URL state reflects virtual_key_id and user_id arrays and survives a page reload.
go test ./framework/configstore/...
go test ./transports/bifrost-http/...

cd ui
pnpm i
pnpm build

Breaking changes

  • Yes
  • No

Related issues

Security considerations

virtual_key_id and user_id filter values are passed as parameterized IN ? clauses via GORM — no raw string interpolation. The Users filter section is gated behind an enterprise-only registry hook, so no user directory data is exposed in OSS builds.

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

This was referenced Aug 6, 2026
@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.

Pratham-Mishra04 commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added MCP session filters for virtual key IDs and user IDs.
    • Added searchable, paginated selection lists for virtual keys and users.
    • Filter selections are reflected in the URL and session results, with active-filter counts and reset support.
    • Filters automatically adjust when the selected identity mode changes.
  • Style

    • Simplified and reformatted MCP client connection settings for a cleaner presentation.

Walkthrough

The PR adds virtual key and user ID filters across MCP session contracts, queries, HTTP parsing, API requests, URL state, and filter controls. It also adds optional user search registration and reformats MCP client form markup.

Changes

MCP session identity filters

Layer / File(s) Summary
Filter contracts and query handling
framework/configstore/store.go, framework/configstore/rdb.go, transports/bifrost-http/handlers/mcpsessions.go, ui/lib/types/mcpSessions.ts, ui/lib/store/apis/mcpSessionsApi.ts
MCP session filters accept virtual key IDs and user IDs. The API and HTTP handler encode and parse comma-separated values. The RDB query applies exact-match predicates.
Filter sidebar and URL state
ui/app/workspace/mcp-sessions/...
The session page persists the filters in URL state and API requests. The sidebar adds searchable checkbox sections, identity-mode visibility, pagination, reset handling, and active-filter counts.
Optional enterprise user search
ui/lib/registries/userPicker.tsx
The registry defines user search result contracts and optional hook registration and retrieval functions.

MCP client form markup cleanup

Layer / File(s) Summary
MCP client form markup and formatting
ui/app/workspace/mcp-registry/views/mcpClientSheet.tsx
Form expressions and parsing blocks are reformatted. The outer headers wrapper is removed while editable headers and validation remain in place.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant MCPSessionsFilterSidebar
  participant MCPSessionsPage
  participant mcpSessionsApi
  participant MCPHTTPHandler
  participant ConfigstoreRDB
  MCPSessionsFilterSidebar->>MCPSessionsPage: update virtual key and user selections
  MCPSessionsPage->>mcpSessionsApi: request sessions with selected filters
  mcpSessionsApi->>MCPHTTPHandler: send comma-separated query parameters
  MCPHTTPHandler->>ConfigstoreRDB: apply VirtualKeyIDs and UserIDs
  ConfigstoreRDB-->>MCPSessionsPage: return filtered MCP sessions
Loading

Possibly related PRs

  • maximhq/bifrost#5916: Extends the MCP sessions filter state and sidebar used by this change.
  • maximhq/bifrost#5918: Modifies shared MCP session filter state, URL synchronization, active counts, and reset behavior.
  • maximhq/bifrost#5913: Modifies overlapping formatting and layout in mcpClientSheet.tsx.

Suggested reviewers: akshaydeo, danpiths, impoiler

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.
Title check ✅ Passed The title clearly and concisely describes the main feature: multi-select virtual key and user filters for MCP sessions.
Description check ✅ Passed The description covers the purpose, changes, affected areas, testing steps, breaking changes, and security considerations; optional sections remain empty.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 08-06-feat_add_virtual_key_and_users_filters_to_mcp_auth_sessions_sidebar

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

@coderabbitai
coderabbitai Bot requested a review from impoiler August 6, 2026 17:04

@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: 1

🤖 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/views/mcpSessionsFilterSidebar.tsx`:
- Around line 483-506: Pass the Virtual Key query error state from
useGetVirtualKeysQuery into SearchableCheckboxList at
ui/app/workspace/mcp-sessions/views/mcpSessionsFilterSidebar.tsx:483-506 and
render the list’s distinct error state. Do the same for the Users query at
ui/app/workspace/mcp-sessions/views/mcpSessionsFilterSidebar.tsx:530-555. Extend
UserSearchQueryResult in ui/lib/registries/userPicker.tsx:56-65 with the
error-state field so registered and fallback user-search hooks share the same
contract.
🪄 Autofix

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: 860433e8-5173-451f-b78c-696da5559fea

📥 Commits

Reviewing files that changed from the base of the PR and between 569aa6e and a2fd13b.

📒 Files selected for processing (9)
  • framework/configstore/rdb.go
  • framework/configstore/store.go
  • transports/bifrost-http/handlers/mcpsessions.go
  • ui/app/workspace/mcp-registry/views/mcpClientSheet.tsx
  • ui/app/workspace/mcp-sessions/page.tsx
  • ui/app/workspace/mcp-sessions/views/mcpSessionsFilterSidebar.tsx
  • ui/lib/registries/userPicker.tsx
  • ui/lib/store/apis/mcpSessionsApi.ts
  • ui/lib/types/mcpSessions.ts

Comment thread ui/app/workspace/mcp-sessions/views/mcpSessionsFilterSidebar.tsx
@Pratham-Mishra04
Pratham-Mishra04 force-pushed the 08-06-feat_add_mcp_client_state-change_callback_hook branch from 569aa6e to c80bf09 Compare August 6, 2026 21:53
@Pratham-Mishra04
Pratham-Mishra04 force-pushed the 08-06-feat_add_virtual_key_and_users_filters_to_mcp_auth_sessions_sidebar branch from a2fd13b to 6dab3c7 Compare August 6, 2026 21:53
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 6, 2026
@Pratham-Mishra04
Pratham-Mishra04 force-pushed the 08-06-feat_add_mcp_client_state-change_callback_hook branch from c80bf09 to a096a8a Compare August 8, 2026 10:29
@Pratham-Mishra04
Pratham-Mishra04 force-pushed the 08-06-feat_add_virtual_key_and_users_filters_to_mcp_auth_sessions_sidebar branch from 6dab3c7 to 06551aa Compare August 8, 2026 10:29

Pratham-Mishra04 commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator Author

Merge activity

  • Aug 8, 10:33 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Aug 8, 11:31 AM UTC: Graphite rebased this pull request as part of a merge.
  • Aug 8, 11:32 AM UTC: @Pratham-Mishra04 merged this pull request with Graphite.

@Pratham-Mishra04
Pratham-Mishra04 changed the base branch from 08-06-feat_add_mcp_client_state-change_callback_hook to graphite-base/5921 August 8, 2026 11:27
@Pratham-Mishra04
Pratham-Mishra04 changed the base branch from graphite-base/5921 to dev August 8, 2026 11:30
@Pratham-Mishra04
Pratham-Mishra04 dismissed coderabbitai[bot]’s stale review August 8, 2026 11:30

The base branch was changed.

@Pratham-Mishra04
Pratham-Mishra04 requested a review from a team as a code owner August 8, 2026 11:30
@Pratham-Mishra04
Pratham-Mishra04 force-pushed the 08-06-feat_add_virtual_key_and_users_filters_to_mcp_auth_sessions_sidebar branch from 06551aa to 11ca207 Compare August 8, 2026 11:30
@Pratham-Mishra04
Pratham-Mishra04 merged commit 53addcf into dev Aug 8, 2026
14 of 15 checks passed
@Pratham-Mishra04
Pratham-Mishra04 deleted the 08-06-feat_add_virtual_key_and_users_filters_to_mcp_auth_sessions_sidebar branch August 8, 2026 11:32
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