---
title: "Set up OpenCrawl agents in Replicas"
description: "Install the OpenCrawl CLI, skills, MCP, and proactive search hooks for Claude Code and Codex in a Replicas environment."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.getopencrawl.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Set up OpenCrawl agents in Replicas

![A prompt and its reply in a shared Replicas session.](https://docs.getopencrawl.com/images/docs/pixel/headers/replicas-agents.png)

## Copy the agent setup prompt

In OpenCrawl **Integrations**, choose **Connect** on the Replicas card. If Replicas is already connected, choose **Set up agents**. Copy the snippet and paste it into a chat in the intended Replicas organization and team environment. It includes your OpenCrawl server and a one-time admin approval code, valid for 30 minutes.

Agent setup gives workspaces in the approved Replicas organization access to team tools using their signed workspace identities.

## Enroll the organization

Inside Replicas, confirm the organization, environment and destination OpenCrawl server with the admin’s prompt. Use the exact server origin from the prompt for the identity token audience and the enrollment request. If the code has expired, copy a fresh snippet from Integrations.

Run the following once in a private shell in the intended workspace. Substitute the server origin and one-time code from the prompt. Keep the credentials out of logs, files and persistent environment settings.

```sh
set -eu
set +x
api='OPENCRAWL_SERVER_FROM_PROMPT'
code='ONE_TIME_CODE_FROM_PROMPT'
token=$(replicas identity token --audience "$api")
printf '%s\n' "header = \"Authorization: Bearer $token\"" "data = \"{\\\"code\\\":\\\"$code\\\"}\"" |
  curl --config - --fail --silent --show-error \
    --header 'Content-Type: application/json' "$api/api/replicas/connect"
unset token code
```

Continue after the server confirms enrollment in the intended OpenCrawl workspace. Stop on a conflict or an unexpected destination. Future workspaces in the same Replicas organization use their own identities.

## Configure the Replicas environment

Use the built-in Replicas controls in the chat where the admin pasted the prompt. Target the environment that workspace uses. Propose each missing change and have the environment owner approve it above the chat. Replicas applies approved settings to future workspaces in the environment. [Environment access](https://docs.replicas.dev/features/environments#environment-access)

1. Set the environment variables `OPENCRAWL_API_URL` to the approved OpenCrawl origin and `OPENCRAWL_AUTH` to `replicas-workspace`. The official CLI command is `replicas env vars set <environment> <key> <value>`.
2. Add one HTTP MCP server named `opencrawl` at the approved origin plus `/mcp`. Set `config.auth` to `{"type":"workspace_identity","audience":"OPENCRAWL_SERVER_FROM_PROMPT"}`, replacing the placeholder with the exact origin. Leave headers empty. Use the Replicas environment MCP create or update operation if available in the chat. Reuse an existing matching server. If the chat only has the Replicas CLI, use the command below after the image is ready. [Environment MCP API](https://docs.replicas.dev/api-reference/environment-mcps/create-environment-mcp)
3. Download the [OpenCrawl warm hook](https://docs.getopencrawl.com/replicas-agent-tools-warm.sh) to a temporary file. Inspect the selected environment’s own warm hook with `replicas env warm-hooks get <environment>` and its inherited setup. Add the downloaded block once, after the shell shebang and before any early exit, preserving existing commands. Submit the combined script with `replicas env warm-hooks save-test <environment> --file <combined-script>`. Report a conflict for review if an existing installation already manages OpenCrawl hooks or the environment disables them.
4. Wait for the environment build to show **Ready**. If it shows **Needs attention**, inspect its build output and retry the failed step. The warm hook installs the CLI, skills, and released `SessionStart`, `UserPromptSubmit`, and `PreToolUse` handlers. The Codex handlers live in the administrator-managed image policy. Each workspace obtains its own short-lived identity at runtime. [Environment builds](https://docs.replicas.dev/features/environments)

### Add MCP from a CLI-only chat

The Replicas CLI can register OpenCrawl’s native stdio client as an environment MCP. The client forwards the same tools to the approved server and obtains a fresh workspace identity for authentication. Run this once if the environment still needs an MCP. Substitute the selected environment and the exact server origin from the prompt. Approve the change above the chat.

```sh
replicas env mcps add 'REPLICAS_ENVIRONMENT' opencrawl --command opencrawl \
  --arg mcp --arg=--api --arg 'OPENCRAWL_SERVER_FROM_PROMPT' \
  --env OPENCRAWL_AUTH=replicas-workspace --env 'OPENCRAWL_API_URL=OPENCRAWL_SERVER_FROM_PROMPT'
```

## Verify in new chats

Start a **new workspace** from the ready image. Run `opencrawl whoami --json` and check the OpenCrawl workspace. Open a fresh Claude Code chat and a fresh Codex chat. For each one:

1. Confirm the OpenCrawl skill is available. Call the OpenCrawl MCP tools `test_connection` and `opencrawl_search_v1` for a known earlier team discussion. Check the returned source.
2. Send an ordinary question about that earlier discussion. A successful proactive check supplies relevant prior context on prompt submission, before the agent calls search. Look for the native hook output or a suggestion task for **this chat** with `status: "delivered"` and a `checkId` under the workspace user’s `~/.config/opencrawl/plugin-state/*/suggestions/tasks/`. A prompt with no relevant history can legitimately yield no suggestion. Retry with a known relevant question.
3. Report CLI identity, MCP search, skill availability, and proactive delivery separately for each harness. If an approval, image build, or fresh-chat check is outstanding, say which one.

Source: https://docs.getopencrawl.com/agents/replicas/index.mdx
