Skip to main content
Glama

register

Register a Claude instance with the IPC system by providing a unique ID, enabling inter-process communication for collaborative AI operations.

Instructions

Register this Claude instance with the IPC system

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
instance_idYesUnique identifier for this instance (e.g., 'wsl1', 'wsl2')

Implementation Reference

  • Input schema for the 'register' MCP tool, requiring an 'instance_id' parameter.
    Tool( name="register", description="Register this Claude instance with the IPC system", inputSchema={ "type": "object", "properties": { "instance_id": { "type": "string", "description": "Unique identifier for this instance (e.g., 'wsl1', 'wsl2')" } }, "required": ["instance_id"] } ),
  • MCP tool handler for 'register' that sends the registration request to the internal message broker and stores the session token.
    if name == "register": # Calculate auth token instance_id = arguments["instance_id"] shared_secret = os.environ.get("IPC_SHARED_SECRET", "") auth_token = "" if shared_secret: import hashlib auth_token = hashlib.sha256(f"{instance_id}:{shared_secret}".encode()).hexdigest() response = BrokerClient.send_request({ "action": "register", "instance_id": instance_id, "auth_token": auth_token }) # Store session token for this MCP instance if response.get("status") == "ok" and response.get("session_token"): # Store in a global variable for this MCP session global current_session_token, current_instance_id current_session_token = response["session_token"] current_instance_id = instance_id return [TextContent(type="text", text=json.dumps(response, indent=2))]
  • Core registration logic in the MessageBroker's _process_request method, which handles the 'register' action: validates ID and auth, generates session token, persists instance and session to DB.
    if action == "register": instance_id = request["instance_id"] # Validate instance ID format if not self._validate_instance_id(instance_id): return {"status": "error", "message": "Invalid instance ID format. Use 1-32 alphanumeric characters, hyphens, or underscores."} # Rate limit registration attempts (use IP or a special key) if not self.rate_limiter.is_allowed(f"register_{instance_id}"): return {"status": "error", "message": "Too many registration attempts. Please wait."} # Validate auth token (shared secret) auth_token = request.get("auth_token") shared_secret = os.environ.get("IPC_SHARED_SECRET", "") if shared_secret: import hashlib expected_token = hashlib.sha256(f"{instance_id}:{shared_secret}".encode()).hexdigest() if auth_token != expected_token: return {"status": "error", "message": "Invalid auth token"} # Generate session token session_token = secrets.token_urlsafe(32) # Register instance self.instances[instance_id] = datetime.now() # Save to database self._save_instance_to_db(instance_id) self._save_session_to_db(session_token, instance_id) # Preserve existing queue or create new one if instance_id not in self.queues: self.queues[instance_id] = [] queued_count = 0 else: queued_count = len(self.queues[instance_id]) response = { "status": "ok", "session_token": session_token, "message": f"Registered {instance_id}" } if queued_count > 0: response["message"] = f"Registered {instance_id} with {queued_count} queued messages" return response

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jdez427/claude-ipc-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server