Skip to content

[subtask] [Subtask 3/4] Add OCI authentication to MCP load-component tool #563

@github-actions

Description

@github-actions

Parent Issue: #559

Objective

Add OCI authentication support to the MCP load-component tool, enabling AI agents to load private components with authentication.

Context

Subtasks 1 and 2 implemented OCI authentication for the CLI, but the MCP built-in tool load-component (used by AI agents) doesn't yet support authentication parameters. This subtask extends the MCP tool to accept and use credentials when loading components from private registries.

Implementation Details

Files to Modify

  1. MCP Tool Schema (in crates/mcp-server/src/components.rs):

    • Update the load-component tool schema to include optional authentication parameters:
      {
        "name": "load-component",
        "description": "Load a WebAssembly component from a file path or OCI registry",
        "inputSchema": {
          "type": "object",
          "properties": {
            "path": {
              "type": "string",
              "description": "Path to component ((redacted) or (redacted))"
            },
            "registry_user": {
              "type": "string",
              "description": "Registry username for OCI authentication (optional)"
            },
            "registry_password": {
              "type": "string",
              "description": "Registry password for OCI authentication (optional)"
            }
          },
          "required": ["path"]
        }
      }
  2. crates/mcp-server/src/components.rs (line 44-86):

    • Update handle_load_component() to extract optional registry_user and registry_password from args
    • Pass credentials to lifecycle_manager.load_component()
    • Ensure sensitive data (passwords) are not logged
  3. Documentation:

    • Update built-in tools documentation to mention authentication support
    • Add examples of using authentication with AI agents

Key Implementation Notes

  • Extract credentials from MCP tool arguments safely
  • Security: Never log passwords or include them in error messages visible to clients
  • Fallback: If no credentials provided, use Docker config (Subtask 1) or Anonymous
  • Consider using Wassette's existing secrets management for storing registry credentials per-component
  • The MCP client (AI agent) will prompt users for credentials when needed

Security Considerations

  • Passwords in MCP tool calls are transmitted over the MCP transport (typically local stdio/SSE)
  • Consider logging a warning when credentials are provided via MCP vs Docker config
  • Ensure error messages don't leak credential information
  • Add documentation about preferred authentication methods (Docker config > explicit credentials)

Acceptance Criteria

  • MCP load-component tool accepts optional registry_user and registry_password parameters
  • Credentials are passed correctly to the loading pipeline
  • Loading private components via MCP works with explicit credentials
  • Docker config fallback still works when credentials not provided
  • Passwords are never logged or exposed in error messages
  • Tool schema validation works correctly
  • Tests added for MCP tool with authentication
  • Documentation updated with examples

Testing Strategy

  1. Unit tests:

    • Test argument extraction from MCP tool call request
    • Test credential passing to lifecycle manager
    • Verify password sanitization in logs
  2. Integration tests:

    • Test MCP tool call with valid credentials (may need test registry)
    • Test MCP tool call without credentials (Docker config fallback)
    • Test error handling with invalid credentials
  3. Manual testing with MCP inspector:

    # Start Wassette MCP server
    just run
    
    # Use MCP inspector to test load-component with auth
    npx `@modelcontextprotocol/inspector` --cli (redacted) \
      --method tools/call \
      --tool-name load-component \
      --tool-arg path=(redacted) \
      --tool-arg registry_user=myuser \
      --tool-arg registry_password=mypass

Dependencies

Depends on Subtasks 1 and 2 being completed (authentication infrastructure and CLI support).

Example AI Agent Interaction

User: Load the private component from (redacted)

AI Agent: To load this private component, I need credentials. What is your registry username?

User: myusername

AI Agent: What is the registry password?

User: [provides password]

AI Agent: [calls load-component tool with credentials]
         Component loaded successfully!

Related to #559

AI generated by Plan for #559

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestrustPull requests that update rust code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions