Conversation
|
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughSummary by CodeRabbit
WalkthroughDiscovered tools are now attached to MCP client configs before the initial DB persistence. The ConfigStore interface adds Changes
Sequence Diagram(s)sequenceDiagram
participant Handler as HTTP Handler
participant ConfigStore as Config Store
participant MCPMgr as MCP Manager
rect rgba(100, 150, 255, 0.5)
Note over Handler,ConfigStore: Old Flow: create then update tools
Handler->>ConfigStore: CreateMCPClientConfig(configWithoutTools)
ConfigStore->>ConfigStore: Persist config row
Handler->>ConfigStore: UpdateMCPClientDiscoveredTools(id, tools)
ConfigStore->>ConfigStore: Persist discovered tools fields
Handler->>MCPMgr: SetClientTools(id, tools)
end
rect rgba(100, 255, 150, 0.5)
Note over Handler,ConfigStore: New Flow: include tools on create
Handler->>Handler: Attach DiscoveredTools to config
Handler->>ConfigStore: CreateMCPClientConfig(configWithTools)
ConfigStore->>ConfigStore: Persist config including tools
Handler->>MCPMgr: SetClientTools(id, tools)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.11.4)level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies" Comment |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Confidence Score: 5/5Safe to merge; all findings are minor style issues that do not affect correctness. The core fix (carrying json:"-" fields around the deep-copy and consolidating into one DB write) is correct. No data-integrity, security, or reliability concerns were found. Remaining comments are P2: redundant nil guards and an unused interface method. No files require special attention. Important Files Changed
Reviews (2): Last reviewed commit: "fix: mcp per oauth clients gossip fixes" | Re-trigger Greptile |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
framework/configstore/rdb.go (1)
1261-1285: Consider extracting a sharedTableMCPClient→schemas.MCPClientConfigmapper.This field list is now duplicated in
GetMCPConfigand here, so future MCP fields can drift between code paths again.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@framework/configstore/rdb.go` around lines 1261 - 1285, The mapping from the DB client type to schemas.MCPClientConfig is duplicated between GetMCPClientConfigByID and GetMCPConfig; extract a single helper like mapTableMCPClientToMCPClientConfig(dbClient *TableMCPClient) *schemas.MCPClientConfig (or similar) that constructs and returns the MCPClientConfig (mapping fields such as ClientID→ID, Name, IsCodeModeClient, ConnectionType, ConnectionString, StdioConfig, AuthType, OauthConfigID, ToolsToExecute, ToolsToAutoExecute, Headers, AllowedExtraHeaders, IsPingAvailable, ToolSyncInterval, AllowOnAllVirtualKeys, ToolPricing, DiscoveredTools, DiscoveredToolNameMapping) and replace the in-place construction in GetMCPClientConfigByID and GetMCPConfig with a call to that helper to avoid duplication and drift.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@framework/configstore/rdb.go`:
- Around line 1261-1285: The mapping from the DB client type to
schemas.MCPClientConfig is duplicated between GetMCPClientConfigByID and
GetMCPConfig; extract a single helper like
mapTableMCPClientToMCPClientConfig(dbClient *TableMCPClient)
*schemas.MCPClientConfig (or similar) that constructs and returns the
MCPClientConfig (mapping fields such as ClientID→ID, Name, IsCodeModeClient,
ConnectionType, ConnectionString, StdioConfig, AuthType, OauthConfigID,
ToolsToExecute, ToolsToAutoExecute, Headers, AllowedExtraHeaders,
IsPingAvailable, ToolSyncInterval, AllowOnAllVirtualKeys, ToolPricing,
DiscoveredTools, DiscoveredToolNameMapping) and replace the in-place
construction in GetMCPClientConfigByID and GetMCPConfig with a call to that
helper to avoid duplication and drift.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d954b580-f68a-4823-8288-5a37cc8406d8
📒 Files selected for processing (5)
core/schemas/mcp.goframework/configstore/rdb.goframework/configstore/store.gotransports/bifrost-http/handlers/mcp.gotransports/bifrost-http/lib/config_test.go
fe043ae to
d8bfb06
Compare
273d4d1 to
98f47a8
Compare
The base branch was changed.
98f47a8 to
2d64473
Compare
2d64473 to
3c87ff9
Compare
Merge activity
|
## Summary Consolidates the persistence of discovered MCP tools into the initial `CreateMCPClientConfig` call during the OAuth completion flow, eliminating the separate `UpdateMCPClientDiscoveredTools` method and its redundant second database write. ## Changes - Removed `UpdateMCPClientDiscoveredTools` from the `ConfigStore` interface and its `RDBConfigStore` implementation. - Added `GetMCPClientConfigByID` to the `ConfigStore` interface and implemented it in `RDBConfigStore`, returning a fully populated `schemas.MCPClientConfig` including `DiscoveredTools` and `DiscoveredToolNameMapping`. - In `completeMCPClientOAuth`, discovered tools are now attached to `mcpClientConfig` before calling `CreateMCPClientConfig`, so the DB row is written with tools in a single operation rather than two sequential writes. - `CreateMCPClientConfig` now explicitly carries `DiscoveredTools` and `DiscoveredToolNameMapping` from the original (pre-deep-copy) config to avoid losing those fields, which are tagged `json:"-"` and therefore dropped during deep copy. - Updated `MockConfigStore` in tests to reflect the interface changes. ## Type of change - [ ] Bug fix - [x] Refactor - [ ] Feature - [ ] Documentation - [ ] Chore/CI ## Affected areas - [x] Core (Go) - [x] Transports (HTTP) - [ ] Providers/Integrations - [ ] Plugins - [ ] UI (React) - [ ] Docs ## How to test Complete a per-user OAuth flow for an MCP client and verify: 1. The MCP client row in the database contains the correct `discovered_tools_json` and `tool_name_mapping_json` immediately after creation. 2. Restarting the service still loads the discovered tools correctly from the persisted row. 3. No second DB update for discovered tools is issued after client creation. ```sh go test ./... ``` ## Breaking changes - [x] Yes - [ ] No `UpdateMCPClientDiscoveredTools` has been removed from the `ConfigStore` interface. Any custom implementations of `ConfigStore` must remove this method and add `GetMCPClientConfigByID`. ## Related issues ## Security considerations No new auth, secrets, or PII handling introduced. The change reduces the window where a restart between the two previous DB writes could leave a client row without its discovered tools. ## Checklist - [ ] I read `docs/contributing/README.md` and followed the guidelines - [x] I added/updated tests where appropriate - [ ] I updated documentation where needed - [x] I verified builds succeed (Go and UI) - [ ] I verified the CI pipeline passes locally if applicable

Summary
Consolidates the persistence of discovered MCP tools into the initial
CreateMCPClientConfigcall during the OAuth completion flow, eliminating the separateUpdateMCPClientDiscoveredToolsmethod and its redundant second database write.Changes
UpdateMCPClientDiscoveredToolsfrom theConfigStoreinterface and itsRDBConfigStoreimplementation.GetMCPClientConfigByIDto theConfigStoreinterface and implemented it inRDBConfigStore, returning a fully populatedschemas.MCPClientConfigincludingDiscoveredToolsandDiscoveredToolNameMapping.completeMCPClientOAuth, discovered tools are now attached tomcpClientConfigbefore callingCreateMCPClientConfig, so the DB row is written with tools in a single operation rather than two sequential writes.CreateMCPClientConfignow explicitly carriesDiscoveredToolsandDiscoveredToolNameMappingfrom the original (pre-deep-copy) config to avoid losing those fields, which are taggedjson:"-"and therefore dropped during deep copy.MockConfigStorein tests to reflect the interface changes.Type of change
Affected areas
How to test
Complete a per-user OAuth flow for an MCP client and verify:
discovered_tools_jsonandtool_name_mapping_jsonimmediately after creation.go test ./...Breaking changes
UpdateMCPClientDiscoveredToolshas been removed from theConfigStoreinterface. Any custom implementations ofConfigStoremust remove this method and addGetMCPClientConfigByID.Related issues
Security considerations
No new auth, secrets, or PII handling introduced. The change reduces the window where a restart between the two previous DB writes could leave a client row without its discovered tools.
Checklist
docs/contributing/README.mdand followed the guidelines