feat: implement MCP tool grouping and search functionality#43
Merged
Conversation
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add grouped MCP tool selection in the chat composer and make the per-message MCP tool selection limit configurable from the admin console.
This keeps the existing backend contract based on
selectedToolIDs, while improving the frontend selection flow by grouping tools by MCP server, supporting service-level select/clear, search, expand/collapse animation, and clear limit feedback. The backend now exposes and enforces the configured MCP selection policy consistently.Change type
Affected areas
Verification
cd backend && go test ./...cd frontend && pnpm lint features/chat/hooks/use-chat-model-options.ts features/chat/components/app-chat-area.tsx features/chat/components/sections/chat-input.tsx features/chat/components/sections/chat-mcp.tsx features/admin/model/tool-settings.tscd frontend && pnpm buildmake swaggergit diff --checkScreenshots, API examples, or logs
Not included.
Configuration, migration, and compatibility notes
Adds a dynamic MCP setting:
mcp.mcp_max_selected_tools_per_message321-128No database migration is required. Existing MCP tools and message sending continue to use
selectedToolIDs. The frontend reads the runtime MCP policy from/api/v1/settings/mcp-policy, and the backend enforces the same limit during message send.Documentation
Swagger was regenerated for the new MCP policy endpoint.
Security and privacy
The selected MCP tool limit is enforced on the backend and capped at a safe maximum to avoid exposing an excessive number of tool schemas in a single model request.
Checklist
.pycfiles,.envfiles, and local storage data are not committed.