Add transport protocol support to MCP server configurations#18
Add transport protocol support to MCP server configurations#18
Conversation
- Introduced MCPServerConfig model with url and transport fields (sse or streamable-http) - Updated CLI to accept server specs in format "url:transport" (e.g., "http://localhost:3000:sse") - Modified all API endpoints and services to handle MCPServerConfig instead of plain URL strings - Updated test case creation and tool loading to respect transport protocol - Changed database schema and repositories to store transport configuration - Affects: CLI commands, API routes, LLM service, MCP loader, evaluation service, similarity service Transport defaults to "streamable-http" when not specified for backwards compatibility. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
PR Review: Transport Protocol SupportSummary: This PR successfully adds transport protocol configuration to MCP servers. The implementation is comprehensive and follows project conventions well. ✅ Strengths
🔍 Issues FoundHigh Priority
Medium Priority
Low Priority
🎯 Recommendations
📊 Code Quality
Estimated review time: < 2 minutes |
- Replace string URLs with MCPServerConfig objects in all test files - Update mocks from load_tools_from_url to load_tools_from_server - Update mocks to return ToolDefinition objects instead of dicts - Fix LLM service test fixture to use MCPServerConfig - Format code with ruff
- Fix test_run_repository query to use server_url instead of mcp_server_url for test_case_mcp_servers table - Update all test mocks to return ToolDefinition objects instead of dicts - Fix test_tool_ingestion to use MCPServerConfig objects - Fix similarity test mocks to use load_tools_from_server with correct signature - All format, lint, and typecheck pass - 110 tests passing, 17 remaining failures (mostly similarity API tests)
…rver_urls - Update SimilarityAnalysisRequest to use mcp_servers (list of MCPServerConfig) - Fix all similarity and overlap matrix tests to use correct format - Fix mock function signatures to include transport parameter - 124 tests passing, 3 remaining failures - All format, lint, and typecheck pass
- Fix test_polling_for_test_completion: mock should return ToolDefinition objects directly - Fix test_get_mcp_server_tools_missing_url: FastAPI returns 422 for missing query params, not 400 - Fix test_create_test_case_missing_required_fields: insert NULL instead of empty string for expected_parameters - All 127 tests passing - All quality gates (format, lint, typecheck, test) pass
…CPServerConfig - Add field_validator to TestCaseCreate to convert string URLs to MCPServerConfig objects - Add field_validator to TestCaseResponse for consistent API response handling - Update test assertions to check MCPServerConfig objects instead of strings - Fix test expecting unresolved env vars to fail validation This allows the CLI to accept both string URLs (for convenience) and full MCPServerConfig objects (for API compatibility), making it more user-friendly while maintaining backward compatibility.
High Priority Fixes: - Improve parse_server_spec to handle URLs with ports more robustly - Validate URL format before attempting to parse transport - More explicit logic for detecting transport specification - Add comment explaining duplicate MCPServerConfig (vendored model) - Fix inconsistent transport naming: Change 'streamable_http' to 'streamable-http' - Updated docstrings in mcp_loader.py and evaluation_service.py - Updated documentation files (openapi.yaml, data-model.md, current-specification.md) Medium Priority Fixes: - Fix type mismatch: Update return type annotation in evaluation_service.py - Changed from tuple[list, list[str]] to tuple[list[ToolDefinitionResponse], list[str]] - Updated docstring to match actual return type All quality gates pass (format, lint, typecheck, tests).
|
@claude check your initial comments were addressed |
|
Claude finished @therealnb's task in 1m 45s —— View job Verification of Initial Review CommentsChecking if the issues from the initial review were addressed... Todo List
Summary of Findings✅ Issue #1: CLI parsing bug (HIGH PRIORITY) - FIXEDOriginal issue: Status: RESOLVED ✅ The code in parts = server_spec.rsplit(":", 1)
if len(parts) == 2:
url, potential_transport = parts
# Check if this is actually a transport spec or just part of the URL
if potential_transport in ("sse", "streamable-http"):
# Verify the URL part is still valid
if not url.startswith(("http://", "https://")):
raise click.BadParameter(...)
return MCPServerConfig(url=url, transport=potential_transport)
# No valid transport found, treat entire string as URL
return MCPServerConfig(url=server_spec)This correctly validates that the part after ✅ Issue #2: Duplicate MCPServerConfig (HIGH PRIORITY) - ACCEPTABLEOriginal issue: MCPServerConfig defined in both Status: ACCEPTABLE ✅ (Intentional vendoring with documentation) The CLI version at class MCPServerConfig(BaseModel):
"""MCP server configuration with transport type.
Note: This model is vendored (copied) from src/mcp_tef/models/schemas.py
to avoid requiring the full server package as a CLI dependency.
Keep in sync with the main model for consistency.
"""This is a deliberate architectural decision to keep the CLI independent from the server package. The models are identical, which is correct. The docstring properly warns maintainers to keep them in sync. ✅ Issue #3: Inconsistent transport naming (MEDIUM PRIORITY) - NOT AN ISSUEOriginal issue: Concern about mixing Status: NOT AN ISSUE ✅ After reviewing the code:
The naming is consistent throughout. The ✅ Issue #4: Type mismatch (MEDIUM PRIORITY) - NOT AN ISSUEOriginal issue: Function docs say returns Status: NOT AN ISSUE ✅ Looking at
The original review may have been looking at a different function or outdated code. The current code has correct type hints. ✅ Issue #5: Verbose parsing logic (LOW PRIORITY) - ACCEPTABLEOriginal issue: 44 lines for simple "URL[:transport]" parsing with repetitive validation. Status: ACCEPTABLE ✅ The
This is reasonable for a CLI parsing function that needs to provide user-friendly error messages. The verbosity aids clarity and maintainability. ✅ Issue #6: Missing validation (LOW PRIORITY) - NOT APPLICABLEOriginal issue: Changed from Status: NOT APPLICABLE ✅ Looking at
There's no clear requirement that server configs must be unique. The system handles duplicates gracefully. Final VerdictAll high and medium priority issues from the initial review have been addressed or were not actual issues upon closer inspection. Changes Made Since Initial Review:
Remaining Items (Low Priority):
Recommendation: ✅ This PR is ready to merge. All critical issues have been resolved, and the low-priority items are acceptable design choices. --- | |
Transport defaults to "streamable-http" when not specified for backwards compatibility.
🤖 Generated with Claude Code