Anthropic via MCP
Call Krawl's MCP server from a Claude agent loop — drop Krawl into Anthropic's Messages API as a remote MCP server and Claude gains research, quick_search, and ask_krawl tools.
Anthropic's Messages API speaks MCP (mcp-client-2025-04-04 beta). Add
Krawl as a remote server and any Claude conversation gains research-grade
tools that return cited reports.
Working file: docs/cookbook/anthropic-via-mcp.py.
Install
pip install anthropic
export ANTHROPIC_API_KEY=sk-ant-...
export KRAWL_API_KEY=krawl_demo_xxx # optional — lets Claude bypass 402curl
You don't normally talk to MCP with curl, but you can hit the Krawl MCP endpoint to confirm it's alive:
curl -X POST https://api.krawl.sh/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'The reply lists every tool with its declared price (USDC, atomic units)
and JSON Schema input.
Python
import os, sys
import anthropic
client = anthropic.Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"])
response = client.beta.messages.create(
model="claude-opus-4-7",
max_tokens=2048,
system="You are a research analyst. Use krawl.research for deep questions.",
messages=[{"role": "user", "content": " ".join(sys.argv[1:])}],
mcp_servers=[
{
"type": "url",
"url": "https://api.krawl.sh/mcp",
"name": "krawl",
"tool_configuration": {
"enabled": True,
"allowed_tools": ["research", "quick_search", "ask_krawl"],
},
"authorization_token": os.environ.get("KRAWL_API_KEY"),
}
],
betas=["mcp-client-2025-04-04"],
)
for block in response.content:
if hasattr(block, "text"):
print(block.text)Run:
python cookbook/anthropic-via-mcp.py "Compare EigenLayer and Symbiotic"Node
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY! });
const res = await client.beta.messages.create({
model: "claude-opus-4-7",
max_tokens: 2048,
system: "Use krawl.research for deep questions. Cite every claim.",
messages: [{ role: "user", content: "Compare EigenLayer and Symbiotic" }],
mcp_servers: [
{
type: "url",
url: "https://api.krawl.sh/mcp",
name: "krawl",
tool_configuration: {
enabled: true,
allowed_tools: ["research", "quick_search", "ask_krawl"],
},
authorization_token: process.env.KRAWL_API_KEY,
},
],
betas: ["mcp-client-2025-04-04"],
});
for (const block of res.content) {
if ("text" in block) process.stdout.write(block.text);
}Notes
- The MCP server exposes
research,quick_search, andask_krawltoday. The full v1 surface addslist_lookouts,get_lookout,run_lookout,export_result,get_usage,get_memory, andcompare_results— see Agents & MCP. - Skip
authorization_tokenand Claude will pay per call via x402 — Krawl returns a 402 challenge inline. See Payments & x402. - For Claude Code (the CLI), install the skill directly:
npx skills@1.7.4 add ravidsrk/krawl --skill krawl --agent claude-code(requires repository read access while private).
OpenAI Agents SDK
Run an o3-deep-research-shaped OpenAI Agents SDK agent with Krawl as the model — point the OpenAI client at /v1 and the response is a cited research report.
Vercel AI SDK — streamText
Stream a Krawl deep-research report through Vercel AI SDK 6 streamText — wire Krawl in via the OpenAI-compatible provider and pipe the cited markdown into a server component or CLI.