Human-in-the-Loop Agent Task Management for Claude Code
Docs / Connect Claude Code
Setup Guide

Connect Claude Code

Full setup guide for wiring AgentRQ into Claude Code — from .mcp.json configuration to CLAUDE.md instructions and permission handling.

Prerequisites
  • Claude Code installed (npm install -g @anthropic-ai/claude-code)
  • AgentRQ account at app.agentrq.com
  • A workspace created with an MCP token generated

1 Configure .mcp.json

Create or update .mcp.json in your project root. Claude Code auto-loads this file when you start a session.

.mcp.json
project root
{
  "mcpServers": {
    "agentrq": {
      "type": "http",
      "url": "https://WORKSPACE_ID.mcp.agentrq.com/mcp?token=MCP_TOKEN"
    }
  }
}
WORKSPACE_ID
Found in your workspace URL or workspace settings page. Looks like: 0ZPO4WBMZIP
MCP_TOKEN
Generated in workspace settings → MCP Tokens. 30-day expiry. Rotate anytime.
Security: Add .mcp.json to your .gitignore if your token is embedded. Alternatively, use environment variable substitution in .mcp.json.

2 Global vs Project Config

You can add AgentRQ at the project level (per project root) or globally (all Claude Code sessions).

Project-Level
Recommended

Place .mcp.json in your project root. Only active when you cd into that project and run claude.

./my-project/.mcp.json
Global

Place in ~/.claude/mcp.json. AgentRQ tools available in every Claude Code session, every project.

~/.claude/mcp.json

3 Add CLAUDE.md Instructions

Tell Claude when and how to use AgentRQ tools by adding instructions to your CLAUDE.md. This is the most important step — it shapes Claude's behavior throughout your session.

CLAUDE.md (example)
## Human-in-the-Loop (AgentRQ)

# At the start of every session:
Call `getWorkspace` to load context about this workspace.

# When you need human input, approval, or a decision:
Use `createTask` to create a task for the human. Include:
- A clear title
- Full context in the body (what you've done, what you need)
- Any relevant file snippets as attachments

Then wait for the human's response via the notification channel.
Do NOT proceed past a blocking decision without human approval.

# When you receive a reply:
Read the reply, update the task status to `completed`, then continue.

# When asked to make irreversible changes (DB, deploys, deletes):
Always ask via `createTask` before executing.

Adapt this template to your workflow. The key is being explicit about when Claude should pause and ask vs. when it can proceed autonomously.

4 The Notification Channel

When you reply to a task in the AgentRQ dashboard, your response is delivered to Claude Code as a notification channel message — Claude's native push mechanism. The message looks like this in Claude's context:

Claude Code context — incoming message
<channel source="agentrq" chat_id="0ZRgCquBZ7R"
         ts="2026-03-24T14:30:00Z" user="human">
[Response to task 0ZRgCquBZ7R]

Approved — but use a UUID primary key instead of auto-increment.
Please add an index on expires_at too.
</channel>

Claude reads this channel message, processes your reply, and continues — all within the same session. No interruption, no re-prompting.

Permission Requests

Claude Code can also send permission requests for sensitive operations. These show up as special task types in your dashboard with Allow / Deny / Allow All buttons.

Example permission request
Claude is requesting permission to run: rm -rf dist/

5 Verify the Connection

Start Claude Code and run this quick test:

Test prompt
> Call getWorkspace and tell me what workspace you're connected to.
  Then create a test task called "Connection test" with body "Hello from Claude".

Claude: I called getWorkspace — connected to workspace "my-api-project"
(ID: 0ZPO4WBMZIP). Creating test task now...
Task created ✓ (ID: 0ZRgXXXXXXX). You should see it in your dashboard.

Check your AgentRQ dashboard — the task should appear instantly. Reply to it, and Claude will receive your message via the notification channel.

Troubleshooting

AgentRQ tools not appearing
Verify .mcp.json is valid JSON (no trailing commas). Restart Claude Code. Check the URL contains both WORKSPACE_ID and token query param.
401 / Unauthorized error
Your MCP token may have expired (30-day TTL) or been revoked. Generate a new token in workspace settings.
Notifications not arriving in Claude
Claude Code must be actively running (not paused at input). The SSE connection drops when Claude is waiting for user input. Resume Claude to receive pending messages.
Tasks created but dashboard empty
Check you're viewing the correct workspace in the dashboard. The WORKSPACE_ID in .mcp.json must match the workspace you're viewing.
Connection working?
Learn the full task lifecycle next.