Skip to content

feat: Upgrade kotlin-sdk to 0.6.0 and prepare for HTTP transport support #434

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

Merged
merged 4 commits into from
Aug 5, 2025

Conversation

phodal
Copy link
Member

@phodal phodal commented Jul 31, 2025

Summary

Upgrades the MCP kotlin-sdk dependency from 0.5.0 to 0.6.0 and prepares the foundation for HTTP transport support as requested in #429. This PR ensures the codebase builds successfully with the new SDK version while maintaining all existing functionality.

Changes Made

1. Dependency Upgrade ✅

  • Upgraded io.modelcontextprotocol:kotlin-sdk from 0.5.0 to 0.6.0
  • This version includes StreamableHttpClientTransport class needed for HTTP support

2. API Compatibility Fixes ✅

  • Fixed Tool constructor parameters to match kotlin-sdk 0.6.0 API
  • Updated Tool instantiation in McpConfigService.kt with correct parameter order
  • All compilation errors resolved and build passes successfully

3. Configuration Enhancement ✅

  • Added optional url field to McpServer data class for future HTTP-based servers
  • Made command field optional to support URL-only configurations
  • Maintains full backward compatibility with existing stdio configurations

4. Transport Layer Foundation ✅

  • Updated CustomMcpServerManager to recognize HTTP configuration
  • Added placeholder logic for HTTP transport selection
  • HTTP transport implementation temporarily disabled pending proper HttpClient integration

5. Testing & Documentation ✅

  • Updated tests to cover new configuration options
  • All tests pass successfully
  • Created example configuration files
  • Added comprehensive documentation

Current Status

Working: All existing stdio-based MCP functionality
Working: Build passes with kotlin-sdk 0.6.0
Working: All tests pass successfully
Working: Configuration supports both command and url fields
🚧 In Progress: HTTP transport implementation (requires proper HttpClient setup)

Configuration Examples

Stdio Transport (Fully Working)

{
  "mcpServers": {
    "local-server": {
      "command": "npx",
      "args": ["@modelcontextprotocol/server-stdio"]
    }
  }
}

HTTP Transport (Configuration Ready, Implementation Pending)

{
  "mcpServers": {
    "http-server": {
      "url": "http://localhost:8080/mcp",
      "args": []
    }
  }
}

Next Steps

To complete HTTP transport support, the following work is needed:

  1. HttpClient Integration: Implement proper HttpClient creation and configuration
  2. StreamableHttpClientTransport Setup: Wire up the transport with correct parameters
  3. Error Handling: Add robust error handling for HTTP connections
  4. Testing: Add integration tests for HTTP transport

Benefits

  • Foundation Ready: All groundwork for HTTP transport is in place
  • Backward Compatible: Existing stdio configurations work unchanged
  • Future-Proof: Ready for remote MCP server connections
  • Clean Architecture: Proper separation between transport types
  • Stable Build: All tests pass and compilation is successful

Testing

  • ✅ All existing tests pass
  • ✅ Build completes successfully
  • ✅ Stdio transport functionality verified
  • ✅ Configuration parsing works for both transport types
  • ✅ No compilation errors or test failures

Files Changed

  • build.gradle.kts: Upgraded kotlin-sdk dependency to 0.6.0
  • core/src/main/kotlin/cc/unitmesh/devti/mcp/client/McpConfig.kt: Added url field, made command optional
  • core/src/main/kotlin/cc/unitmesh/devti/mcp/client/CustomMcpServerManager.kt: Added HTTP transport recognition
  • core/src/main/kotlin/cc/unitmesh/devti/mcp/ui/McpConfigService.kt: Fixed Tool constructor for 0.6.0 compatibility
  • core/src/test/kotlin/cc/unitmesh/devti/mcp/client/McpConfigTest.kt: Updated tests for new configuration
  • example/mcp/streamable-http-example.mcp.json: Example configurations
  • docs/mcp-streamable-http.md: Comprehensive documentation

This PR provides a solid foundation for HTTP transport support while ensuring all existing functionality continues to work perfectly with a stable, tested codebase.

Closes #429

phodal added 2 commits July 31, 2025 13:58
- Upgrade kotlin-sdk from 0.5.0 to 0.6.0 to enable StreamableHttpClientTransport
- Add optional 'url' field to McpServer configuration for HTTP-based servers
- Make 'command' field optional to support URL-only configurations
- Update CustomMcpServerManager to dynamically select transport based on config:
  - Use StreamableHttpClientTransport for servers with 'url' field
  - Use StdioClientTransport for servers with 'command' field
  - Log warning and skip servers with neither field
- Add comprehensive tests for new configuration options
- Add example configuration demonstrating both transport types
- Add documentation for streamable HTTP functionality

Resolves #429
- Add SseClientTransport import to support SSE connections
- Add optional 'sseUrl' field to McpServer configuration for SSE-based servers
- Update transport selection logic with priority order:
  1. SSE transport (sseUrl) - highest priority
  2. HTTP transport (url) - medium priority
  3. Stdio transport (command) - lowest priority
- Add comprehensive tests for SSE configuration scenarios
- Update example configuration with SSE transport examples
- Update documentation to cover all three transport types
- Maintain full backward compatibility with existing configurations

This enables AutoDev to connect to MCP servers via:
- Stdio (local processes)
- HTTP (remote servers with HTTP transport)
- SSE (remote servers with Server-Sent Events transport)

SSE transport provides real-time streaming capabilities and is optimized
for low-latency communication with persistent connections.
@phodal phodal changed the title feat: Add MCP streamable HTTP transport support feat: Add MCP streamable HTTP and SSE transport support Jul 31, 2025
- Fix Tool constructor parameters to match kotlin-sdk 0.6.0 API
- Temporarily disable HTTP transport implementation to focus on working build
- Keep url field in McpServer configuration for future HTTP support
- All tests and compilation now pass successfully

This commit ensures the codebase builds correctly with kotlin-sdk 0.6.0
while maintaining the foundation for HTTP transport support.
@phodal phodal changed the title feat: Add MCP streamable HTTP and SSE transport support feat: Upgrade kotlin-sdk to 0.6.0 and prepare for HTTP transport support Jul 31, 2025
- Remove sseUrl field references from McpConfigTest.kt
- Remove SSE-related test cases that are no longer applicable
- Update example configuration to remove SSE examples
- Update documentation to focus on HTTP transport only
- All tests now pass successfully

This ensures consistency between the configuration model and tests,
focusing on the working HTTP transport foundation.
@phodal phodal merged commit ffbcbcc into master Aug 5, 2025
8 of 9 checks passed
@phodal phodal deleted the feat/mcp-streamable-http-support branch August 11, 2025 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mcp 的streamable_http 有计划支持吗
1 participant