Skip to content

chore(mcp): update rmcp crate#2106

Merged
jonaro00 merged 5 commits intomainfrom
cursor/update-rmcp-crate-and-run-clippy-7b32
Sep 9, 2025
Merged

chore(mcp): update rmcp crate#2106
jonaro00 merged 5 commits intomainfrom
cursor/update-rmcp-crate-and-run-clippy-7b32

Conversation

@jonaro00
Copy link
Member

@jonaro00 jonaro00 commented Sep 4, 2025

Updated rmcp to 0.6

@cursor
Copy link

cursor bot commented Sep 4, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@jonaro00 jonaro00 changed the title Update rmcp crate and run clippy chore(mcp): update rmcp crate Sep 8, 2025
@jonaro00 jonaro00 marked this pull request as ready for review September 9, 2025 16:41
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. Constructor Pattern: The ShuttleMcpServer now requires explicit initialization via ShuttleMcpServer::new() instead of direct struct instantiation, following standard Rust patterns.

  2. Unified Parameter Handling: All MCP tools now use structured parameter objects (DeployArgs, ProjectStatusArgs, LogsArgs) instead of mixed parameter patterns. This consolidates the cwd (current working directory) parameter into each struct rather than passing it separately.

  3. 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.

  4. JSON Schema Integration: All parameter structs now derive schemars::JsonSchema and include descriptive annotations, enabling automatic schema generation for better API documentation and validation.

  5. ToolRouter Pattern: The server implementation now uses a centralized ToolRouter for 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"
Loading

7 files reviewed, no comments

Edit Code Review Bot Settings | Greptile

@jonaro00 jonaro00 merged commit a810c37 into main Sep 9, 2025
25 checks passed
@jonaro00 jonaro00 deleted the cursor/update-rmcp-crate-and-run-clippy-7b32 branch September 9, 2025 20:40
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.

3 participants