Skip to main content
The nanoclaw MCP server is automatically available to all agents running in NanoClaw. It provides tools for scheduling tasks, managing the task lifecycle, and sending messages to users.

Overview

The NanoClaw MCP server is implemented as a stdio-based MCP server that communicates with the host process via file-based IPC. Each agent gets a dynamically configured instance with context about its group, privileges, and target chat. Location: container/agent-runner/src/ipc-mcp-stdio.ts

Context Variables

The MCP server receives context from environment variables set by the agent runner:
VariableDescription
NANOCLAW_CHAT_JIDJID of the chat/group this agent is running for
NANOCLAW_GROUP_FOLDERFolder name of the group (e.g., whatsapp_main)
NANOCLAW_IS_MAIN"1" if this is the main control group, otherwise unset

Available Tools

The NanoClaw MCP server exposes the following tools to agents:

Task Management

  • schedule_task - Schedule a recurring or one-time task
  • list_tasks - List all scheduled tasks (filtered by group)
  • update_task - Modify an existing task’s prompt or schedule
  • pause_task - Pause a scheduled task
  • resume_task - Resume a paused task
  • cancel_task - Delete a scheduled task

Messaging

  • send_message - Send a message to the user immediately while the agent is running

Group Management (Main Only)

  • register_group - Register a new chat/group for the agent to respond to

IPC Communication

The MCP server communicates with the host process by writing JSON files to the IPC directory:
const IPC_DIR = '/workspace/ipc';
const MESSAGES_DIR = path.join(IPC_DIR, 'messages');
const TASKS_DIR = path.join(IPC_DIR, 'tasks');
Each operation writes a uniquely-named JSON file with atomic write semantics (write to temp file, then rename).

How Agents Access the Server

Agents running in containers automatically have access to the NanoClaw MCP server. The agent runner configures it dynamically based on the group context. Example usage from agent:
// The agent can call MCP tools directly
await mcp__nanoclaw__schedule_task({
  prompt: "Check for new emails and summarize them",
  schedule_type: "interval",
  schedule_value: "3600000" // 1 hour in milliseconds
});

Permissions Model

  • All groups can schedule tasks for themselves, list their own tasks, and send messages
  • Main group can schedule tasks for any group, list all tasks, and register new groups
  • Non-main groups can only target their own chat with schedule_task - the target_group_jid parameter is ignored

Build docs developers (and LLMs) love