-
Notifications
You must be signed in to change notification settings - Fork 171
Merge jerm/2026-01-13-optimizer-in-vmcp into main #3373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
22e020c to
3f3a011
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Large PR Detected
This PR exceeds 1000 lines of changes and requires justification before it can be reviewed.
How to unblock this PR:
Add a section to your PR description with the following format:
## Large PR Justification
[Explain why this PR must be large, such as:]
- Generated code that cannot be split
- Large refactoring that must be atomic
- Multiple related changes that would break if separated
- Migration or data transformationAlternative:
Consider splitting this PR into smaller, focused changes (< 1000 lines each) for easier review and reduced risk.
See our Contributing Guidelines for more details.
This review will be automatically dismissed once you add the justification section.
|
Here's the demo scripts I mentioned #3375 |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3373 +/- ##
==========================================
- Coverage 64.83% 63.19% -1.65%
==========================================
Files 382 398 +16
Lines 37219 39033 +1814
==========================================
+ Hits 24132 24668 +536
- Misses 11200 12449 +1249
- Partials 1887 1916 +29 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Large PR justification has been provided. Thank you!
|
✅ Large PR justification has been provided. The size review has been dismissed and this PR can now proceed with normal review. |
#3253) * feat: Add optimizer package with semantic tool discovery and ingestion This PR introduces the optimizer package, a Go port of the mcp-optimizer Python service that provides semantic tool discovery and ingestion for MCP servers. - **Semantic tool search** using vector embeddings (384-dim) - **Token counting** for LLM cost estimation - **Full-text search** via SQLite FTS5 - **Multiple embedding backends**: Ollama, vLLM, or placeholder (testing) - **Production-ready database** with sqlite-vec for vector similarity search
* feat: Add optimizer integration endpoints and tool discovery - Add find_tool and call_tool endpoints to vmcp optimizer - Add semantic search and string matching for tool discovery - Update optimizer integration documentation - Add test scripts for optimizer functionality
* feat: Add token metrics and observability to optimizer integration
…failures The checkPodsReady function was checking all pods with matching labels, including old pods that had completed (Phase: Succeeded) from previous deployments. This caused the auth discovery e2e test to fail when old pods were still present during deployment updates. Fix: Skip pods that are not in Running phase and ensure at least one running pod exists after filtering.
The test was failing with 'connection reset by peer' errors when trying to connect to the health endpoint. This can happen if pods crash or restart between the BeforeAll setup and the actual test execution. Fix: Add explicit pod readiness verification right before the health check and also check pod readiness inside the Eventually loop to catch pods that crash during health check retries. This makes the test more robust by ensuring pods are stable before attempting HTTP connections.
d7c874e to
0aa6751
Compare
- Revert server.go to cleaner version with minimal optimizer-specific code - Create OptimizerIntegration interface that encapsulates all optimizer logic - Add Initialize() method to handle global tool registration and backend ingestion - Move optimizer initialization logic behind the interface - Add per-backend ingestion spans for better observability - Create helper function for config conversion to maintain backward compatibility This refactoring makes the optimizer integration fully self-contained and modular, with server.go acting as a thin orchestration layer.
The OnRegisterSession method was removed during refactoring but is still used by tests. Added it back as a legacy method that does nothing since ingestion is now handled by Initialize(). This maintains backward compatibility with existing tests while the new HandleSessionRegistration method is used in production code.
Run gofmt and goimports to fix formatting issues.
- Move OptimizerIntegration interface from server.go to optimizer package - Rename interface to Integration for clarity within optimizer package - Update server.go to import and use optimizer.Integration - Fix unused parameter lint error (rename ctx to _) - Add compile-time interface implementation check
The OptimizerIntegration interface was moved to the optimizer package, so mockgen no longer generates it in server.go mocks.
… package - Remove duplicate OptimizerConfig type from server.go - Create ConfigFromVMCPConfig helper in optimizer package for conversion - Update CLI to use optimizer.Config directly via conversion helper - Remove createOptimizerIntegrationFromConfig helper function - Remove unused embeddings import from server.go This eliminates unnecessary duplication and improves separation of concerns. The optimizer package now owns the conversion logic from config types.
…Reporter - Move optimizer initialization from New() to Start() to match main branch structure - Restore StatusReporter functionality (was removed to match main, but needed for operator) - Fix optimizer_test.go to use optimizer.Config instead of removed server.OptimizerConfig - Update test configs to use EmbeddingConfig structure This makes server.go structure closer to main while maintaining both optimizer and StatusReporter functionality.
Merge jerm/2026-01-13-optimizer-in-vmcp into main
This PR merges 17 commits that integrate the MCP optimizer into vMCP, adding semantic tool discovery, observability, Kubernetes support, and various bug fixes and improvements.
Core Optimizer Integration
Add Optimizer Package (#3253)
Add Optimizer Integration Endpoints (#3318)
find_toolandcall_toolendpoints to vMCP optimizerResolve Tool Names in optim.find_tool (#3337)
Observability & Metrics
Add Token Metrics and Observability (#3347)
Add OpenTelemetry Tracing to Capability Aggregation
AggregateCapabilities(parent span)QueryAllCapabilities(parallel backend queries)QueryCapabilities(per-backend queries)ResolveConflicts(conflict resolution)MergeCapabilities(final merge)Kubernetes Integration
Add Dynamic/Static Mode Support (#3235)
Add DeepCopy and Kubernetes Service Resolution
DeepCopy()for automatic passthrough of config fields (Optimizer, Metadata, etc.)resolveEmbeddingService()to resolve Kubernetes Service names to URLsKubernetes Optimizer Integration Fixes (#3359)
WithContinuousListening()to use timeout-based approachTesting & Reliability Improvements
Run API E2E Test Server as Standalone Process (#3356)
Fix Flaky E2E Tests
checkPodsReadyto prevent flaky test failuresFix Unrecognized Dotty Names
Infrastructure
Bump Operator CRDs Chart Version
Documentation Updates
Summary
This PR consolidates the complete integration of the MCP optimizer into vMCP, enabling semantic tool discovery, reducing token usage, and providing comprehensive observability. The integration includes full Kubernetes support, robust error handling, and improved test reliability.
Related PRs
Large PR Justification