Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/web_intel_mcp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def _billing_note(receipt: dict, credits: int) -> dict[str, Any]:
return {"credits_charged": credits, "credits_remaining": receipt.get("remaining_balance")}


@mcp.tool(annotations=RO, meta=UI)
@mcp.tool(title="Read web page as text", annotations=RO, meta=UI)
async def read_url(url: str, ctx: Context, max_chars: int = 20000) -> dict[str, Any]:
"""Fetch a web page and return its main content as clean Markdown (nav, ads and cookie banners removed).

Expand All @@ -98,35 +98,35 @@ async def read_url(url: str, ctx: Context, max_chars: int = 20000) -> dict[str,
return {**out, "billing": _billing_note(receipt, PRICES["read_url"])}


@mcp.tool(annotations=RO, meta=UI)
@mcp.tool(title="Get page metadata", annotations=RO, meta=UI)
async def page_metadata(url: str, ctx: Context) -> dict[str, Any]:
"""Title, description, canonical, lang, robots, Open Graph, JSON-LD types, H1-H3 and image alt stats."""
out, receipt = await _paid(ctx, "page_metadata", url, analyze.metadata)
return {**out, "billing": _billing_note(receipt, PRICES["page_metadata"])}


@mcp.tool(annotations=RO, meta=UI)
@mcp.tool(title="Extract page links", annotations=RO, meta=UI)
async def extract_links(url: str, ctx: Context, limit: int = 200) -> dict[str, Any]:
"""Internal and external links on a page (deduplicated, absolute URLs, anchor text)."""
out, receipt = await _paid(ctx, "extract_links", url, analyze.links, max(1, min(int(limit), 1000)))
return {**out, "billing": _billing_note(receipt, PRICES["extract_links"])}


@mcp.tool(annotations=RO, meta=UI)
@mcp.tool(title="Detect website tech stack", annotations=RO, meta=UI)
async def tech_stack(url: str, ctx: Context) -> dict[str, Any]:
"""Detect frameworks, CMS, analytics, payments, CDN/hosting and security headers of a site."""
out, receipt = await _paid(ctx, "tech_stack", url, analyze.tech_stack)
return {**out, "billing": _billing_note(receipt, PRICES["tech_stack"])}


@mcp.tool(annotations=RO, meta=UI)
@mcp.tool(title="Audit page SEO", annotations=RO, meta=UI)
async def seo_audit(url: str, ctx: Context) -> dict[str, Any]:
"""Scored on-page SEO audit (0-100, A-F) with 16 weighted checks and the top fixes to apply first."""
out, receipt = await _paid(ctx, "seo_audit", url, analyze.seo_audit)
return {**out, "billing": _billing_note(receipt, PRICES["seo_audit"])}


@mcp.tool(annotations=RO, meta=UI)
@mcp.tool(title="Compare SEO of pages", annotations=RO, meta=UI)
async def compare_seo(urls: list[str], ctx: Context) -> dict[str, Any]:
"""Audit 2-5 pages (e.g. you vs competitors) and rank them. Costs seo_audit price x number of URLs.

Expand Down Expand Up @@ -156,15 +156,15 @@ async def compare_seo(urls: list[str], ctx: Context) -> dict[str, Any]:
return {"ranking": results, "failed": failed, "billing": _billing_note(receipt, unit * len(pages))}


@mcp.tool(annotations=ToolAnnotations(readOnlyHint=True, openWorldHint=False))
@mcp.tool(title="Show tool prices", annotations=ToolAnnotations(readOnlyHint=True, openWorldHint=False))
def pricing() -> dict[str, Any]:
"""Credit price of each tool and where to buy credits. Free."""
return {"credits_per_call": {**PRICES, "compare_seo": f"{PRICES['seo_audit']} x URLs"},
"refunds": "Failed fetches are refunded automatically.",
"buy_credits": billing.checkout_url or "Set KEYFLINT_CHECKOUT_URL"}


@mcp.tool(annotations=ToolAnnotations(readOnlyHint=True, openWorldHint=False), meta=UI)
@mcp.tool(title="Check credit balance", annotations=ToolAnnotations(readOnlyHint=True, openWorldHint=False), meta=UI)
async def credits_balance(ctx: Context) -> dict[str, Any]:
"""Remaining credits on your KeyFlint license. Free."""
return await billing.balance(_headers(ctx))
Expand Down
14 changes: 14 additions & 0 deletions tests/test_directory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""Claude Connectors Directory: every tool declares a title and readOnlyHint or destructiveHint (policy 5E)."""
from __future__ import annotations

from web_intel_mcp import server


async def test_every_tool_has_title_and_hint():
tools = await server.mcp.list_tools()
assert tools
for t in tools:
assert t.title and len(t.title) <= 60, t.name
assert t.annotations and (t.annotations.read_only_hint is not None
or t.annotations.destructive_hint is not None), t.name
assert len({t.title for t in tools}) == len(tools)
Loading