Klazify MCP: Categorize a URL From an Agent
You’re building or orchestrating an agent that needs to decide, in real time, whether to block a page, flag it for review, or enrich a lead with company data—without standing up your own REST wrapper. By the end of this article, you’ll connect an agent directly to Klazify MCP, call klazify.categorize for any URL, interpret the response, and ship it safely into your pipeline with caching, backoff, and category mapping in place.
Why use Klazify MCP from an agent
Klazify provides domain intelligence: categorization (including IAB taxonomy categories), company data, logos, social links and related signals. Klazify MCP runs this from an agent via JSON-RPC, so you don’t have to implement REST calls inside tool calling logic. The live MCP host is https://mcp.klazify.com with the path /mcp, and it exposes the tools you’ll actually use in an agent:
- klazify.categorize — classify a URL or domain and return categories (including IAB), plus related signals useful for policy or enrichment.
- klazify.domain_company — retrieve company-related data for a domain.
- klazify.domain_logo — fetch the logo associated with a domain.
Authentication is simple: pass your API key as a query string to the MCP URL (?api_key=). MCP only accepts POST JSON-RPC requests; a GET returns 405.
If you prefer REST later, the MCP categorize tool maps to POST /api/categorize. There’s also a “fresh recrawl” REST endpoint—POST /api/real_time_categorization—when you need a no-cache pass, but this is not an MCP tool in the public catalog.
Starter pricing is $39.99/mo for 500 successful calls with a 7-day trial, and failed/unreachable REST calls are not billed. You can review the Documentation for full details, but this post shows a working path you can copy into your agent runner.
Set up and call klazify.categorize
Go live in four steps
- Register for a 7-day trial.
- Copy your API key from the dashboard.
- Point your MCP client to https://mcp.klazify.com/mcp.
- Call the klazify.categorize tool with the URL you want to evaluate.
If you’re integrating from an agent framework, configure the MCP server using the URL above with ?api_key=YOUR_API_KEY and allow the agent to invoke klazify.categorize when it needs categorization or enrichment.
Reference page: MCP
Official quick-start request and response
Here’s the official call-and-response you can paste into your environment. The sample illustrates the structure used by the MCP categorize tool (and its REST equivalent). If the example uses a different site than the one you plan to classify, just replace the URL in the payload when you make your own call.
curl "https://www.klazify.com/api/categorize" -X POST \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
--data "url=https://www.cbsnews.com"
{
"domain": {
"categories": [
{"confidence": 0.95, "name": "/News"}
],
"domain_url": "https://cbsnews.com"
},
"success": true
}
How to read the response in practice:
- Use the category fields (including the IAB taxonomy shown in the sample) to enforce allow/deny or safety rules. If you only need a single decision, treat the first or most confident category object in the response as the primary label.
- If company or domain metadata is included in the sample, it’s suitable for lead enrichment (e.g., storing alongside a signup record) or analytics segmentation.
- If a logo URL or social links appear, you can render them in-product or store for CRM/BI. Always check for missing values before writing to your datastore.
- When the response indicates an error or no category, fallback to a neutral policy (e.g., review queue) and log the raw payload for inspection.
Python example: call the MCP tool directly
This example shows how to call klazify.categorize via JSON-RPC POST to the MCP endpoint. It sends the same type of request as the official snippet and prints the fields you’ll typically need to wire policies and enrichment.
import json
import uuid
import requests
API_KEY = "YOUR_API_KEY"
MCP_URL = f"https://mcp.klazify.com/mcp?api_key={API_KEY}"
def categorize_url(url):
payload = {
"jsonrpc": "2.0",
"id": str(uuid.uuid4()),
"method": "klazify.categorize",
"params": {
"url": url
}
}
r = requests.post(MCP_URL, json=payload, timeout=20)
r.raise_for_status()
data = r.json()
return data
if __name__ == "__main__":
target = "https://www.cbsnews.com/"
result = categorize_url(target)
# Basic checks and extraction
if "error" in result:
print("MCP error:", result["error"])
else:
# JSON-RPC result
out = result.get("result", {})
# Print the entire response so you can map fields in your pipeline
print(json.dumps(out, indent=2))
# Example usage patterns, aligned with the official sample:
# - Read categories (including IAB taxonomy labels) to decide policy.
# - Persist company/domain/brand data when present for enrichment.
# - Capture a logo URL or social link if included by your plan.
#
# In production, always:
# - Null-check each field before using it.
# - Default to a safe/neutral policy if the category array is empty.
# - Cache per domain to avoid redundant calls.
Operational guidance: accuracy in practice, caching, and freshness
Use MCP for in-band classification and enrichment when your agent needs a decision during a single turn or task. For workloads that repeatedly see the same domains (signups, telemetry, ad rendering), you should cache the response by domain or eTLD+1 to save time and quota.
- Caching keys: use normalized hostnames (lowercase, strip scheme and trailing slash). For pages under the same site that should share policy, cache by the registrable domain.
- Time-to-live: choose a TTL that matches your risk tolerance and content update cycle. Editorial news changes rapidly; static corporate sites don’t.
- Fresh recrawl: when you must bypass cache and re-check live content, call the REST endpoint POST /api/real_time_categorization. This is not exposed as a public MCP tool name, so run it from your server and pass the result to your agent.
- Unknowns: when a category is absent or the tool returns an error, default to a safe policy (block or review) and log for audit.
Throughput, batching, and resilience
Agents often classify URLs in bursts. Structure your client with a small async worker pool and backoff for transient failures. Because MCP is JSON-RPC over HTTP POST:
- Send independent calls for independent URLs. If you coalesce requests in your app layer, chunk them by domain family to maximize cache hits.
- Respect server responses and implement retry with jitter on network timeouts. Avoid retrying on validation errors.
- Monitor success rates. Only successful calls count toward plan usage; failed or unreachable REST calls are not billed.
If you expect spikes, pre-warm your cache with common domains and stagger agent tasks. When in doubt about concurrency and quotas, consult the Documentation for current guidelines.
Map returned categories to your policies
Your product likely maintains an internal taxonomy and policy matrix (e.g., “Allow Ads,” “Block,” “Require Review”). Klazify returns categories including IAB taxonomy labels so you can map to these policies. A pragmatic pattern:
- Choose a single “primary category” from the response for fast decisions.
- Keep the full set of categories for analytics, explainability, or overrides.
- Persist the raw response for auditing and future remapping as your policies evolve.
Example policy wiring patterns developers use:
- Ad tech and brand safety: deny-list or restrict inventory when the primary category matches your blocked sets; allow news but exclude specific sensitive subcategories as needed.
- Content filtering: build tiered filters keyed by category depth (IAB level) and apply them per user role or geography.
- CRM and lead enrichment: store the category path alongside company metadata for routing, scoring, and sales territory assignment.
What each MCP tool is for
| Tool | Best for | Key return values (see sample) | Notes |
|---|---|---|---|
| klazify.categorize | Real-time allow/deny, brand safety, content filter decisions | Categories including IAB taxonomy; domain signals usable for policy | Use this as the default classification call from your agent |
| klazify.domain_company | Lead and account enrichment, routing, analytics | Company-related fields for the domain (see sample output for naming) | Call after categorize if your flow needs firmographic context |
| klazify.domain_logo | UI rendering, CRM avatars, reporting dashboards | Logo URL or asset reference tied to the domain | Cache the resulting URL; null-check before rendering |
Pipeline integration patterns
1) Enrich a signup form
When a user signs up with a work email, derive the domain and call klazify.categorize. Use returned categories and company data (if present) to pre-fill CRM fields, assign sales routing, and prioritize outreach. Cache by domain so subsequent users from the same company incur no extra calls.
2) Real-time brand safety for ads
Before placing an ad, pass the landing page URL into klazify.categorize. If the returned categories match your restricted sets, skip or swap the placement. Store the raw JSON for reporting and to refine rules later.
3) Content filtering and parental controls
For DNS or proxy filtering, normalize each requested host and look up the cached category. On cache miss, call MCP and enforce the policy synchronized with your user’s ruleset. Consider a short TTL for dynamic sites and a long TTL for corporate domains.
4) Cybersecurity and telemetry
During URL inspection, call klazify.categorize and attach the category path to the event. Use the category to triage alerts, suppress noise from benign categories, and escalate when the category indicates risk in your model.
Error handling, unknowns, and data hygiene
- Validation errors: if the URL is malformed, MCP returns an error block. Surface a human-readable message and do not retry.
- Transport issues: retry with exponential backoff and jitter. Keep a short deadline inside agent actions to avoid stalling other tools.
- success=false or missing values: treat as unknown; route to a review queue or apply your safest default policy. Log the full response for later analysis.
- Time zones and timestamps: when you persist responses, store your receipt timestamp in UTC alongside the raw JSON so you can reason about cache freshness in your systems.
- Data selection: only extract the fields you need for decisions, but archive the raw payload. This allows you to remap to new policies without re-calling MCP.
Security and compliance considerations
- Do not forward end-user secrets. Send only the URL/domain to categorize.
- Normalize and hash user identifiers before logging, if you correlate results to users.
- Use HTTPS and keep your MCP API key in your agent runner’s secret store or environment.
End-to-end checklist
- Register and obtain your API key (7-day trial).
- Configure your agent to reach https://mcp.klazify.com/mcp?api_key=YOUR_API_KEY (POST only; GET returns 405).
- Call klazify.categorize with the target URL.
- Parse the categories (including IAB taxonomy) and make a decision.
- Cache by domain; on forced refresh needs, use the REST fresh recrawl endpoint from your server.
- Handle errors and unknowns with safe defaults and logs.
- Map results to your internal taxonomy and policy matrix.
FAQ
Can I call MCP without wrapping REST?
Yes. MCP is JSON-RPC over POST at https://mcp.klazify.com/mcp with ?api_key=; your agent can invoke klazify.categorize (and other tools) directly.
How do I bypass cache for a fresh read?
Use the REST endpoint POST /api/real_time_categorization from your server. This fresh recrawl is not exposed as a public MCP tool name.
What happens if a call fails?
Implement retries for transient errors. Per the service terms, failed or unreachable REST calls are not billed. Always choose a safe fallback policy when the response is missing categories or indicates an error.
How should I handle throughput spikes?
Queue and process URLs with a small worker pool, cache aggressively by domain, and apply backoff on errors. Pre-warm frequent domains before known bursts.
Where do I find field definitions?
Use the official request/response sample above as the canonical shape and refer to the Documentation for the latest schema notes.
Ready to try it? Create your key, point your agent at Klazify MCP, and ship your first categorization in minutes. Register for the 7‑day trial, explore the MCP reference, and visit klazify.com to see where domain intelligence fits in your stack.
Ready to use Klazify?
Start classifying websites, enriching company data, and exploring web intelligence.
Get Started Free