Conversation
Co-authored-by: johan <[email protected]>
|
Cursor Agent can help with this pull request. Just |
Co-authored-by: johan <[email protected]>
There was a problem hiding this comment.
Greptile Summary
This PR updates the rmcp (Rust Model Context Protocol) crate from version 0.1.5 to 0.6, which represents a major version upgrade with significant API changes. The MCP (Model Context Protocol) is used by Shuttle to provide AI assistants and other tools with structured access to deployment, project management, and logging operations.
The update introduces several key architectural improvements:
-
Constructor Pattern: The
ShuttleMcpServernow requires explicit initialization viaShuttleMcpServer::new()instead of direct struct instantiation, following standard Rust patterns. -
Unified Parameter Handling: All MCP tools now use structured parameter objects (
DeployArgs,ProjectStatusArgs,LogsArgs) instead of mixed parameter patterns. This consolidates thecwd(current working directory) parameter into each struct rather than passing it separately. -
Enhanced Macro System: The update leverages new procedural macros (
#[tool_router],#[tool_handler],#[tool]) that reduce boilerplate and provide a more declarative API for defining MCP tools. -
JSON Schema Integration: All parameter structs now derive
schemars::JsonSchemaand include descriptive annotations, enabling automatic schema generation for better API documentation and validation. -
ToolRouter Pattern: The server implementation now uses a centralized
ToolRouterfor managing tool registration and handling, replacing the previous#[tool(tool_box)]pattern.
The changes maintain all existing functionality while modernizing the codebase to align with rmcp 0.6's improved type safety, reduced boilerplate, and enhanced tooling support. This upgrade positions Shuttle's MCP integration to take advantage of the latest features in the Model Context Protocol ecosystem.
Important Files Changed
Changed Files
| Filename | Score | Overview |
|---|---|---|
| mcp/src/lib.rs | 5/5 | Updates server initialization to use constructor pattern required by rmcp 0.6 |
| mcp/Cargo.toml | 4/5 | Upgrades rmcp to 0.6 and adds macros feature plus schemars dependency |
| mcp/src/tools/deployment.rs | 5/5 | Refactors parameter structures to use unified Args structs with JSON schema support |
| mcp/src/mcp.rs | 4/5 | Modernizes tool handler implementation using new ToolRouter pattern and macros |
| mcp/src/tools/project.rs | 5/5 | Standardizes parameter handling with proper Args structs and schema annotations |
| Cargo.toml | 4/5 | Updates workspace-level rmcp dependency to 0.6 with macros feature |
| mcp/src/tools/logs.rs | 5/5 | Unifies parameter handling pattern consistent with other tool modules |
Confidence score: 4/5
- This PR represents a well-structured dependency upgrade that maintains functionality while modernizing the API
- Score reflects the systematic nature of changes and consistent patterns across all affected files
- Pay close attention to the workspace Cargo.toml and mcp module integration to ensure no breaking changes in downstream usage
Sequence Diagram
sequenceDiagram
participant User
participant ShuttleMcpServer
participant ToolRouter
participant Utils
participant ShuttleCLI as "Shuttle CLI"
User->>ShuttleMcpServer: "MCP request (deploy/logs/project/docs)"
ShuttleMcpServer->>ToolRouter: "route_tool(request)"
ToolRouter->>ShuttleMcpServer: "call appropriate tool method"
alt Deploy Tool
ShuttleMcpServer->>Utils: "run_tool(deploy(args))"
Utils->>ShuttleCLI: "execute_command('shuttle', ['deploy', ...], cwd)"
else Deployment List/Status
ShuttleMcpServer->>Utils: "run_tool(deployment_list/status(args))"
Utils->>ShuttleCLI: "execute_command('shuttle', ['deployment', ...], cwd)"
else Logs Tool
ShuttleMcpServer->>Utils: "run_tool(logs(args))"
Utils->>ShuttleCLI: "execute_command('shuttle', ['logs', ...], cwd)"
else Project Status/List
ShuttleMcpServer->>Utils: "run_tool(project_status/list(args))"
Utils->>ShuttleCLI: "execute_command('shuttle', ['project', ...], cwd)"
else Search Docs
ShuttleMcpServer->>Utils: "run_tool(search_docs(query))"
Utils->>ShuttleCLI: "execute_command('shuttle', ['docs', 'search', query], cwd)"
end
ShuttleCLI-->>Utils: "command output"
Utils-->>ShuttleMcpServer: "Result<String, String>"
ShuttleMcpServer-->>ToolRouter: "tool result"
ToolRouter-->>ShuttleMcpServer: "response"
ShuttleMcpServer-->>User: "MCP response with CLI output"
7 files reviewed, no comments
Updated
rmcpto 0.6