Skip to content

feat: Add OpenClaw MCP Integration for ROCK Environment Management#491

Open
psx20000101-star wants to merge 1 commit intoalibaba:masterfrom
psx20000101-star:feature/openclaw-mcp-support
Open

feat: Add OpenClaw MCP Integration for ROCK Environment Management#491
psx20000101-star wants to merge 1 commit intoalibaba:masterfrom
psx20000101-star:feature/openclaw-mcp-support

Conversation

@psx20000101-star
Copy link

🎯 Overview

This PR adds Model Context Protocol (MCP) integration to ROCK, enabling OpenClaw agents to create, manage, and clone ROCK environments for self-replication and scalable deployment.

📦 What's Added

New Directory: mcp/

  • rock_mcp_server.py - Main MCP server implementation with full ROCK environment management
  • rock_client.py - ROCK client wrapper for OpenClaw agents
  • requirements.txt - Python dependencies (mcp, asyncio, httpx, pydantic, etc.)
  • start.sh - Startup script for MCP server
  • README.md - Complete documentation

🚀 Features

Agent Management Tools

  • rock_create_agent - Create new agent instances in ROCK environments
  • rock_clone_agent - Clone existing agents with optional memory/context transfer
  • rock_list_agents - List all running agents
  • rock_get_status - Get system or individual agent status
  • rock_stop_agent - Stop running agents
  • rock_cleanup_agent - Cleanup agent resources

Environment Management

  • Create ROCK sandbox environments dynamically
  • Support for custom images, memory, CPU allocation
  • Environment isolation options (container, gem, bash)
  • Agent session management

Self-Replication

  • Agents can clone themselves to new ROCK environments
  • Optional memory and context transfer
  • Configurable agent capabilities

📖 Usage

# Start MCP server
cd mcp
python3 rock_mcp_server.py

# Or use start script
./start.sh

Example: Agent Self-Replication

from rock_client import rock_clone_agent

# Clone current agent to new environment
result = await rock_clone_agent(
    source_agent_id="agent-123",
    clone_name="agent-123-replica",
    transfer_memory=True,
    transfer_context=True
)

🔧 Configuration

Environment variables:

  • ROCK_ADMIN_URL - ROCK Admin server URL (default: http://127.0.0.1:8080)
  • ROCK_WORKER_ENV_TYPE - Worker environment type (default: uv)

🧪 Testing

cd mcp
python3 rock_client.py  # Runs test suite

📝 Technical Details

  • Built with Python 3.11+ asyncio
  • Uses MCP (Model Context Protocol) for agent communication
  • Integrates with ROCK CLI and SDK
  • Supports Docker-based container isolation
  • Type-hinted with pydantic dataclasses

✅ Checklist

  • MCP server implementation
  • ROCK client wrapper
  • Complete documentation
  • Test examples
  • Startup script
  • Dependencies specified

🎉 Impact

This integration enables:

  1. Scalable Agent Deployment - Agents can spawn new instances on demand
  2. Self-Replication - Agents can clone themselves for parallel processing
  3. Resource Management - Leverage ROCK's environment isolation and resource allocation
  4. OpenClaw Integration - Seamlessly works with OpenClaw agent framework

This PR enables ROCK to serve as the environment management backend for OpenClaw agents, opening up new possibilities for multi-agent systems and distributed AI architectures.

- Add MCP server implementation for ROCK environment management
- Add ROCK client wrapper for OpenClaw agents
- Enable agents to create, manage, and clone ROCK environments
- Support self-replication capabilities via ROCK
- Include startup script and dependencies

This enables OpenClaw agents to leverage ROCK's environment
management for scalable agent deployment and self-replication.
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


OpenClaw ROCK Integration seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

2 participants