Conversation
Code Review - PR #293: Add Virtual MCP server supportSummaryThis PR adds Virtual MCP (vMCP) support, enabling intelligent filtering that prioritizes virtual MCP servers when present in a group. The implementation includes database schema changes, K8s client enhancements, and comprehensive documentation. Issues Found1. Performance: Inefficient double query in _get_group_server_filter() (base_tool_ops.py:751-827) The method executes a query to identify groups with virtual MCPs, then builds filter logic. This is called every time find_similar_tools() or get_all_tools() is invoked, adding significant overhead. Recommendation: Cache the group→virtual_mcp mapping or use a single query with conditional logic (e.g., using CASE statements). 2. Missing Tests No tests verify the new virtual MCP filtering logic. The existing test_group_filtering.py doesn't cover:
Recommendation: Add tests to test_group_filtering.py covering these scenarios. 3. Migration doesn't handle existing data (migrations/versions/...py:71) The migration adds virtual_mcp INTEGER NOT NULL DEFAULT 0 but doesn't verify existing rows handle the default correctly. Recommendation: Consider using ALTER TABLE ... ADD COLUMN virtual_mcp INTEGER DEFAULT 0 NOT NULL explicitly or verify the migration works on existing databases. 4. Type inconsistency in virtual_mcp field
SQLite stores as 0/1, Python uses True/False. This works but could be clearer. Recommendation: Add comment explaining the INTEGER→bool mapping, or use consistent integer types. 5. Verbose logging could impact performance (base_tool_ops.py:793-797) Debug logging serializes sets to lists on every call, even when debug logging is disabled. Recommendation: Use lazy evaluation or check log level first. Positive Aspects✓ Comprehensive documentation with working examples Minor Suggestions
VerdictStrong feature implementation with good documentation. Primary concern is the performance issue with repeated queries. Consider addressing before merge or in immediate follow-up. Estimated reading time: 1.5 minutes |
therealnb
left a comment
There was a problem hiding this comment.
I think the code is ok.
What is the use case for this? It looks redundant to me, if we have optimizer included in vmcp. Is it a temporary thing?
959ee03 to
e344495
Compare
- Added virtual_mcp field to workload server model and database schema - Implemented intelligent group filtering: prioritizes virtual MCP servers when present in a group, falls back to all servers when absent - Updated tool discovery, search, and token counting to respect virtual MCP hierarchy - Enhanced k8s client to detect VirtualMCPServer resources and configure transport/URLs correctly - Added RBAC permissions for reading virtualmcpservers and mcpgroups CRDs - Created vmcp-github-fetch.yaml example with complete MCPGroup, backend servers, and VirtualMCPServer configuration - Created mcpserver_mcp-optimizer-vmcp.yaml for deploying MCP Optimizer with vMCP support - Updated documentation with vMCP setup instructions and usage examples 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
e344495 to
033e428
Compare
🤖 Generated with Claude Code