-
Notifications
You must be signed in to change notification settings - Fork 8
feat(mcp-optimizer): enable host networking when native containers are used #1147
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
base: main
Are you sure you want to change the base?
Conversation
Re-enable the auto-update logic in fetch-thv.ts that was temporarily disabled during host networking testing. Also update to thv v0.4.2 which includes the host networking support needed for mcp-optimizer. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
|
@claude please do a deep review of this pr |
|
Claude finished @kantord's task —— View job Deep PR ReviewTodo List
Review SummaryThis PR introduces host networking support for the MCP optimizer on Linux platforms to work around port management issues. The implementation is generally well-structured with comprehensive test coverage, but there are several areas that need attention. Critical Issues1. Platform Detection Inconsistency 🔴Location: The same function
Problem: These could theoretically return different values if the Electron API isn't properly set up or if there's a mismatch. Recommendation:
2. Hard-coded Port Number 🟡Location: The port Problems:
Recommendations:
3. Error Detection Anti-Pattern 🟡Location: const isNotFoundError =
typeof error === 'string' && error.includes('Workload not found')Problems:
Recommendation: const isNotFoundError =
(error as any)?.status === 404 ||
(typeof error === 'string' && error.includes('Workload not found'))Code Quality Issues4. Image Override Without Comment 🟡Location: The code fetches server info from the registry but then always overrides the image to Questions:
Recommendation:
5. Silent Failures 🟡Location: Multiple places in Many functions return
Recommendation:
6. Inconsistent Error Handling 🟡Location: The try-catch for try {
const response = await queryClient.fetchQuery(...)
server = response.server
} catch {
log.info('...falling back to meta-mcp')
// No error details logged
}Recommendation: } catch (error) {
log.info(
'[createMetaOptimizerWorkload] mcp-optimizer not found in registry, falling back to meta-mcp',
error
)
}Testing Issues7. Missing Test Cases 🟡Location: Good test coverage overall, but missing some edge cases:
Recommendations:
8. Test Mock Inconsistency 🟡Location: isLinux: true, // Tests run on Linux by default (for host networking tests)All tests run with Documentation Issues9. Missing PR Description 🟡The PR has no description, making it hard to understand:
Recommendation: Add a comprehensive PR description covering:
10. Insufficient Inline Documentation 🟡While there are some good comments, some complex logic needs more explanation:
Security Considerations11. Host Networking Security 🟠Location: Using Questions:
Recommendation:
Minor Issues12. TypeScript Type Safety 🔵Location: error instanceof Error ? error.message : errorBetter to use proper type narrowing: error instanceof Error ? error.message : String(error)13. Naming Convention 🔵Location: Convention mix: Some constants use UPPER_SNAKE_CASE, the function uses camelCase. Consider if the function should also be a constant or be in a separate utilities file. Positive Aspects ✅
Recommendations SummaryMust Fix:
Should Fix: Nice to Have: |
No description provided.