How to Integrate with Claude Code

This guide walks through everything a developer needs to go from zero to running ChainAware agents in Claude Code — interactively, in automated pipelines, and as subagents inside larger AI workflows.


Prerequisites

  • Claude Code installed — npm install -g @anthropic-ai/claude-code
  • A ChainAware API key — get one at chainaware.ai/pricing
  • Git — to clone the agent repository

Step 1 — Register the MCP Server

The agents call ChainAware's Prediction MCP tools. Register the server globally so it's available in every Claude Code session:

claude mcp add --transport sse chainaware-behavioral-prediction \
  https://prediction.mcp.chainaware.ai/sse \
  --header "X-API-Key: YOUR_API_KEY"

Verify the server is registered:

claude mcp list
# chainaware-behavioral-prediction  sse  https://prediction.mcp.chainaware.ai/sse

Store your key as an environment variable rather than hardcoding it:

# Add to ~/.bashrc or ~/.zshrc
export CHAINAWARE_API_KEY="your-api-key-here"

Then register with the variable:

claude mcp add --transport sse chainaware-behavioral-prediction \
  https://prediction.mcp.chainaware.ai/sse \
  --header "X-API-Key: $CHAINAWARE_API_KEY"

Step 2 — Install the Agents

Clone the repository and copy the agent files into your project:

# Clone the repository
git clone https://github.com/ChainAware/behavioral-prediction-mcp.git

# Copy all 31 agents into your project
cp -r behavioral-prediction-mcp/.claude/agents/ .claude/agents/

Your project structure should now look like this:

your-project/
├── .claude/
│   └── agents/
│       ├── chainaware-fraud-detector.md
│       ├── chainaware-wallet-auditor.md
│       ├── chainaware-rug-pull-detector.md
│       ├── chainaware-wallet-marketer.md
│       └── ... (31 agents total)
├── src/
└── package.json

To install only specific agents instead of all 31:

# Install just the ones you need
cp behavioral-prediction-mcp/.claude/agents/chainaware-fraud-detector.md .claude/agents/
cp behavioral-prediction-mcp/.claude/agents/chainaware-wallet-marketer.md .claude/agents/

Step 3 — Verify the Setup

Run a quick test inside a Claude Code session in your project directory:

claude

Then prompt:

Fraud check on 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 on Ethereum

You should see chainaware-fraud-detector activate and return a fraud score. If the agent doesn't activate, check that .claude/agents/ exists in your project root and the MCP server is registered.


Step 4 — Interactive Use

Once installed, agents activate automatically when you describe a task that matches their purpose. You don't call them by name — Claude Code selects the right agent based on your prompt.

Examples by use case

Fraud & safety checks:

Is this wallet safe to interact with? 0xAbcD1234... on Ethereum
Screen all wallets in this list before we approve payouts: [list]
Check the deployer of this contract before we list it: 0x9f8F72... on BNB

Onboarding & personalisation:

What onboarding flow should we show this wallet? 0x1a2b3c... just connected to our DEX on Ethereum
Write a welcome message for this user connecting to our lending platform: 0xUser...
What DeFi products would suit this wallet? 0xVeteran... on Base

Marketing & growth:

Write a personalised marketing message for this wallet: 0xTarget... on Ethereum
Score these 50 wallets as sales leads for our yield product: [list]
Segment our community into behavioural cohorts and give us a campaign plan: [200 addresses]

Compliance:

AML score for this wallet before onboarding: 0xNew... on Ethereum
Full compliance report on this address — MiCA-aligned: 0xBusiness...

Token & airdrop:

Rank these tokens by holder community quality: [list of contracts]
Filter our airdrop list — remove bots and sybil clusters: [500 addresses]

Step 5 — Use Agents in Automated Pipelines

For non-interactive use — CI scripts, scheduled jobs, or backend processes — use the --print flag to get a single response and exit:

# Single wallet fraud check, output to terminal
claude --print "Fraud check on 0xAbcD1234... on Ethereum"
# Capture the result in a variable
RESULT=$(claude --print "AML score for 0xUser... on Ethereum")
echo "$RESULT"
# Write the result to a file
claude --print "Full wallet audit: 0xAddress... on BNB Chain" > audit-report.txt

Processing a list of wallets in a script

#!/bin/bash
WALLETS=("0xWallet1..." "0xWallet2..." "0xWallet3...")

for wallet in "${WALLETS[@]}"; do
  echo "Checking $wallet..."
  claude --print "Quick fraud check on $wallet on Ethereum" >> fraud-results.txt
done

Step 6 — Use Agents as Subagents in an Orchestrator

The most powerful pattern: a parent Claude Code session spins up ChainAware agents as subagents using the Agent tool. This lets you build multi-step workflows where ChainAware intelligence is one step in a larger pipeline.

Example: Automated onboarding pipeline

Create an orchestrator prompt in your project:

# onboarding-orchestrator.md

You are an onboarding orchestrator for our DeFi lending protocol.

When a new wallet connects:
1. Use the Agent tool to invoke chainaware-fraud-detector on the wallet
2. If fraud score > 0.6 → reject and log
3. If fraud score ≤ 0.6 → use Agent tool to invoke chainaware-onboarding-router
4. Based on the routing result → trigger the appropriate onboarding flow
5. Use Agent tool to invoke chainaware-wallet-marketer to generate the welcome message
6. Return: { decision, onboardingFlow, welcomeMessage }

Then invoke the orchestrator:

claude --print "New wallet connected: 0xNewUser... on Ethereum. Run onboarding pipeline."

Example: Airdrop screening pipeline

claude --print "
Screen this airdrop list for our token launch.
Step 1: Remove fraud wallets (score > 0.5)
Step 2: Remove sybil clusters
Step 3: Segment remaining into tiers by experience
Step 4: Return allocation recommendations per tier

Wallet list: [0xAddr1, 0xAddr2, ... 0xAddr500]
Network: Ethereum
"

Step 7 — Trigger Agents from CLAUDE.md

Add instructions to your project's CLAUDE.md file to automatically apply ChainAware checks in specific contexts — so any developer working in the project gets consistent behaviour:

# CLAUDE.md

## Security Policy

Before approving any wallet payout or grant over $1,000:
- Always run chainaware-wallet-auditor on the recipient wallet
- If fraud probability > 0.3, flag for manual review
- Log the audit result to /audit-logs/

## New User Onboarding

When a new wallet connects and needs routing:
- Use chainaware-onboarding-router to determine the flow
- Use chainaware-whale-detector to check for VIP treatment
- Never skip these checks for wallets with < 30 days on-chain history

Step 8 — Customise an Agent

Each agent is a plain markdown file in .claude/agents/. Open any agent to read and modify its prompt:

cat .claude/agents/chainaware-fraud-detector.md

Common customisations:

Change the risk threshold:

# In your local copy of chainaware-fraud-detector.md
# Find the decision logic section and change:
If probabilityFraud > 0.5 → flag as high risk

# To your own threshold:
If probabilityFraud > 0.3 → flag as high risk (stricter for our compliance needs)

Add platform-specific context:

# Add at the top of chainaware-platform-greeter.md
Platform context: We are a DeFi lending protocol on Ethereum.
Our key products are: undercollateralised loans, yield vaults, and credit lines.
Always reference one of these products in the welcome message.

Combine two agents into one:

# Create a custom composite agent
cat > .claude/agents/my-onboarding-screener.md << 'EOF'
---
description: Run fraud check and generate personalised welcome message in one step
tools: mcp__chainaware-behavioral-prediction__predictive_fraud, mcp__chainaware-behavioral-prediction__predictive_behaviour
---

You are an onboarding screener. For any wallet address given:
1. Check fraud probability with predictive_fraud
2. If fraud > 0.5, return REJECTED with reason
3. If fraud ≤ 0.5, call predictive_behaviour to get their profile
4. Generate a personalised ≤20-word welcome message based on their segment
5. Return: { status, fraudScore, segment, welcomeMessage }
EOF

Troubleshooting

Issue Likely Cause Fix
Agent doesn't activate .claude/agents/ not in project root Check directory exists at your-project/.claude/agents/
403 Unauthorized from MCP API key not set or expired Re-run claude mcp add with a valid key
400 Bad Request Wrong network identifier Use ETH, BNB, POLYGON, TON, BASE, TRON, HAQQ — not full names
Agent activates but no MCP call MCP server not registered Run claude mcp list to verify registration
Slow responses Using Sonnet-based agents on large batches Use Haiku-based agents (chainaware-fraud-detector, chainaware-lead-scorer) for bulk operations


See also: For AI Agents | GitHub Repository