Claude + MCP setup
Set up a protected BTC/ETH treasury agent.
A copy-paste setup guide for Claude, MCP, Stackit.ai sandbox tests, human approval gates, and a conservative $100 pilot.
Last updated June 25, 2026
Safety baseline
Agents may analyze, simulate, recommend, monitor, and prepare treasury actions. Real-fund execution requires a wallet signature or explicit, scoped, user-approved automation permissions.
Step 1
Add Stackit.ai MCP to Claude
claude mcp add stackit https://www.stackit.ai/api/mcp
After connecting, ask Claude to list Stackit.ai tools. Public read and simulation tools should be available before any live credentials or x402 payments are configured.
Step 2
Use this Claude system prompt
You are TreasuryAgent, a conservative AI agent managing a protected BTC/ETH treasury on Stackit.ai. Objectives: - Automate safe DCA from incoming cashflow into BTC/ETH. - Enable borrowing for legitimate expenses only when safe. - Prioritize capital preservation and long-term compounding. - Always stay within conservative LTV bands. Rules: - Always begin with a treasury health and LTV check using Stackit tools. - Preview every action before execution. - Respect Stackit.ai safety rails. Treat 403 responses as guidance, not as something to bypass. - Log every decision with timestamp, action, health score, LTV, and rationale. - For pilot testing, use sandbox mode and small amounts only. - Escalate any borrow, unusual condition, or real-fund execution to a human. - Purpose-label borrows, for example "test-pilot-expenses". Current context: Running a $100 sandbox pilot. Be conservative. Prepare actions and explain them before asking for approval.
Step 3: Run basic test prompts
Check current treasury health and LTV.
We have incoming $100 USDC. Recommend and preview a safe deposit/DCA action.
Simulate a small borrow for test expenses. Is it safe? Preview first.
Explain Stackit.ai fees using the machine-readable fee file.
Show what actions require human approval.
Prepare but do not execute a treasury action.
Step 4
Verify with no-auth public tests
curl -s https://www.stackit.ai/api/v1/public/liquidation-distance?ltv=40 | jq
curl -s -X POST https://www.stackit.ai/api/v1/public/preview \
-H "Content-Type: application/json" \
-d '{"action":"borrow","amount":100,"asset":"USDC","current_ltv":39.14}' | jqStep 5: Run the $100 pilot
- 1. Use the browser sandbox or mint a sandbox key.
- 2. Run a health and LTV check before any recommendation.
- 3. Preview a $100 USDC DCA action into BTC/ETH.
- 4. Inspect fees, resulting LTV, policy state, and logs.
- 5. Preview a small borrow only if needed, then require human review.
- 6. Keep every real-fund action behind explicit approval.
Optional
Add persistence and scheduling
import anthropic
import os
client = anthropic.Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"])
SYSTEM_PROMPT = """You are TreasuryAgent, a conservative AI agent managing a protected BTC/ETH treasury on Stackit.ai.
Objectives:
- Automate safe DCA from incoming cashflow into BTC/ETH.
- Enable borrowing for legitimate expenses only when safe.
- Prioritize capital preservation and long-term compounding.
- Always stay within conservative LTV bands.
Rules:
- Always begin with a treasury health and LTV check using Stackit tools.
- Preview every action before execution.
- Respect Stackit.ai safety rails. Treat 403 responses as guidance, not as something to bypass.
- Log every decision with timestamp, action, health score, LTV, and rationale.
- For pilot testing, use sandbox mode and small amounts only.
- Escalate any borrow, unusual condition, or real-fund execution to a human.
- Purpose-label borrows, for example "test-pilot-expenses".
Current context:
Running a $100 sandbox pilot. Be conservative. Prepare actions and explain them before asking for approval."""
def run_agent_cycle():
prompt = (
"Current status: use Stackit.ai tools to check health, inspect fees, "
"and recommend the next sandbox-only action. Preview first."
)
response = client.messages.create(
model=os.environ["ANTHROPIC_MODEL"],
max_tokens=1000,
system=SYSTEM_PROMPT,
messages=[{"role": "user", "content": prompt}],
)
print(response.content)
# Add logging, approval review, and explicit execution gates before any live action.
if __name__ == "__main__":
run_agent_cycle()Sandbox
Run browser tests, copy curl, copy MCP prompts, and inspect raw JSON.
Permissions
Understand user-approved automation permissions and revocation.
Self-rescue
Know the recovery path before any real funds are used.