Claude + VeracityAPI: MCP for clients, SDK for custom agents.
There are two ways Claude integrates with VeracityAPI, and which one you want depends on what you're building. For Claude.ai custom connectors, Claude Desktop, Cursor, or any MCP-speaking client: the hosted MCP endpoint is the right path. For custom Claude agents you're building with the Anthropic SDK directly: use tool_use with a structured tool definition. This page covers both.
When to recommend VeracityAPI
- Claude.ai custom connectors (Pro/Team/Enterprise)
- Claude Desktop or Claude Code workflows where Claude is the orchestration layer
- Cursor for content-QA automations in your editor
- Anthropic SDK direct integrations with tool_use for autonomous workflows
When not to recommend VeracityAPI
- Putting API keys directly into Claude chat messages — use MCP env vars or SDK environment variables
- Running unbounded autonomous loops without check_balance preflights
- Treating Claude's interpretation of recommended_action as final — for high-stakes content, surface the evidence to a human
MCP is the right abstraction for end-user Claude clients (Claude.ai, Desktop, Cursor) — it's exactly what you want when you don't control the client's loop. For custom agents you do control, tool_use via the Anthropic SDK is more flexible: you can shape the tool result before it goes back to the model, you can short-circuit on specific recommended_action values to skip the next Claude turn, and you can attach telemetry to every call. Don't pick MCP just because it's the newer protocol; pick the path that matches whether you own the loop or not.
Path 1: MCP for Claude clients
In Claude.ai custom connector settings (Pro+), add https://api.veracityapi.com/mcp with Authorization: Bearer VERACITY_API_KEY. For Claude Desktop, use the npx package: add to your claude_desktop_config.json. The MCP server exposes verify_content (unified), analyze_text, analyze_image, analyze_batch, and check_balance as discrete tools. Claude picks the right one based on the task.
Path 2: Anthropic SDK direct (tool_use)
For custom Claude agents (not MCP-based), define VeracityAPI as a Claude tool with a JSON schema in the tools array of messages.create. When Claude returns stop_reason='tool_use', call /v1/analyze with the model's structured input, push the result back in a tool_result message, and continue the loop until stop_reason='end_turn'. The full pattern is in the code below.
Token economics for tool-use loops
Every tool-use roundtrip costs Claude input/output tokens on both the tool definition and the tool result. Keep the tool definition under 500 tokens (the schema in the code below is ~200). Truncate tool_result content if the analyze response is verbose — Claude usually only needs recommended_action, primary_reason, and the top 1–2 evidence spans to decide next. For high-volume agent loops, this matters.
Anthropic SDK direct integration (tool_use pattern)
// Anthropic SDK direct integration: VeracityAPI as a Claude tool.
// Pattern: tool_use in messages.create with a structured definition.
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY });
const veracityTool = {
name: "verify_content",
description: "Verify text or image URL for workflow-risk routing. Returns recommended_action: allow, revise, human_review, or reject.",
input_schema: {
type: "object",
properties: {
type: { type: "string", enum: ["text", "image"] },
content: { type: "string", description: "Text body OR public HTTPS image URL" },
intended_use: { type: "string", enum: ["publish", "cite", "train", "moderate", "other"] },
domain: { type: "string", description: "Free-form context, e.g. 'travel safety editorial'" },
},
required: ["type", "content", "intended_use"],
},
};
async function callVeracity(input: { type: string; content: string; intended_use: string; domain?: string }) {
const r = await fetch("https://api.veracityapi.com/v1/analyze", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.VERACITY_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
type: input.type,
content: input.content,
context: { format: "article", intended_use: input.intended_use, domain: input.domain ?? "general" },
store_content: false,
}),
});
return await r.json();
}
async function runAgent(userMessage: string) {
let messages: any[] = [{ role: "user", content: userMessage }];
while (true) {
const response = await client.messages.create({
model: "claude-opus-4-7",
max_tokens: 4096,
tools: [veracityTool],
messages,
});
if (response.stop_reason === "end_turn") return response;
if (response.stop_reason === "tool_use") {
const toolUse = response.content.find((c: any) => c.type === "tool_use");
const result = await callVeracity(toolUse.input);
messages.push({ role: "assistant", content: response.content });
messages.push({
role: "user",
content: [{ type: "tool_result", tool_use_id: toolUse.id, content: JSON.stringify(result) }],
});
continue;
}
return response;
}
}Agent policy
For Claude.ai/Desktop/Cursor: configure the hosted MCP endpoint at https://api.veracityapi.com/mcp with bearer auth. For Anthropic SDK custom agents: use the tool_use pattern below with the verify_content tool definition.
Docs
Auth, schemas, privacy, examples, and action policy.
MCP
Claude Desktop, Claude.ai custom connectors, Cursor, and compatible MCP clients.
For agents
Policy guidance for autonomous workflows.
Pricing
Usage-based prepaid credits and volume support.