MODEL CONTEXT PROTOCOL

MCP Server & AI Agent Integration

Owlly ships with a built-in Model Context Protocol (MCP) server so AI coding and writing agents—Claude Code, Cursor, Antigravity, and Claude Desktop—can query live AI visibility metrics, inspect citations and brand facts, diagnose pages, and save drafts directly back to Owlly.

Supported Transports

Owlly implements MCP protocol versions 2025-06-18, 2025-03-26, and 2024-11-05 over two transports:

  • Streamable HTTP (POST https://app.getowlly.jp/api/mcp) — Recommended for Claude Code, Cursor, and Antigravity. Authenticates using workspace-scoped Authorization: Bearer owlly_sk_... headers.
  • Local Stdio Bridge (owlly mcp --url https://app.getowlly.jp) — For stdio-only clients such as Claude Desktop. Reads newline-delimited JSON-RPC from stdin, forwards requests to POST /api/mcp using OWLLY_API_KEY, and writes diagnostics exclusively to stderr.

Creating & Managing Workspace Tokens

While browser and REST endpoints use owlly_session cookies, POST /api/mcp uses workspace-scoped Bearer tokens managed by workspace owners and admins.

  1. Open API & MCP Settings — Navigate to https://app.getowlly.jp/app#mcp (or Settings → API & MCP).
  2. Choose Scopes & Expiration — Every token requires read; optionally grant write or opt-in collect, and set expiration from 0 (never) to 365 days.
  3. Configure Project Access Scope — Restrict the token to specific selected projects or allow access across all projects in the workspace.
  4. Copy Secret Once — Tokens follow the format owlly_sk_ plus 48 hex characters. Owlly stores only the 15-character display prefix and SHA-256 hash; the full secret is returned only at creation.
  5. Pause, Resume, Revoke & Audit — Pause/resume tokens (PATCH /api/workspace/tokens/{id}), revoke compromised tokens immediately (DELETE), and inspect MCP Access Logs (MCPアクセス履歴 / GET /api/workspace/mcp-logs).

Client Configuration Snippets

Replace <OWLLY_TOKEN> with your owlly_sk_... workspace token.

Streamable HTTP (Claude Code, Cursor, Antigravity) · json
{
  "mcpServers": {
    "owlly": {
      "type": "http",
      "url": "https://app.getowlly.jp/api/mcp",
      "headers": {
        "Authorization": "Bearer <OWLLY_TOKEN>"
      }
    }
  }
}
Claude Code CLI One-Liner · sh
claude mcp add --transport http owlly "https://app.getowlly.jp/api/mcp" \
  --header "Authorization: Bearer <OWLLY_TOKEN>"
Local Stdio Bridge (Claude Desktop) · json
{
  "mcpServers": {
    "owlly": {
      "command": "owlly",
      "args": ["mcp", "--url", "https://app.getowlly.jp"],
      "env": {
        "OWLLY_API_KEY": "<OWLLY_TOKEN>"
      }
    }
  }
}

Plan Entitlements, Dynamic Clamping & Safety Guardrails

Every request to POST /api/mcp re-evaluates the token against current database subscription state and creator membership role.

  • Plan Clamping (plan_clamped) — Downgrading to Starter or expiring a trial automatically clamps existing token write and collect scopes down to read.
  • Role Clamping (role_clamped) — Demoting the token creator to viewer clamps effective scopes to read. Revoked/expired tokens or removed/unverified creators fail with 401 unauthorized.
  • Human-in-the-Loop Safety — owlly_save_page_draft always saves with status="draft" and reviewed=false; marking content ready or publishing remains a human review step. Prompts added via owlly_manage_prompts_and_facts always start paused (enabled=false) to prevent unreviewed scheduled spend.
  • SSRF & Auditability — owlly_diagnose_html restricts public fetches to standard ports, rejects private/reserved IPs at dial time and on redirects, and caps HTML at 2 MiB. All write and collect calls log audit events as <creator_email> (mcp:<token_prefix>) with action mcp.<tool_name>.
ScopeTrial & StarterGrowth & AgencySelf-hosted
read (metrics, gaps, runs, facts)IncludedIncludedIncluded
write (diagnose, drafts, tasks, prompts)BlockedIncludedIncluded
collect (trigger live prompt sampling)BlockedIncluded (opt-in)Included (opt-in)

Complete MCP Tools Reference (12 Tools)

Owlly exposes 7 read tools, 4 write tools, and 1 collect tool.

read Scope Tools (7)

Tool NameParametersBehavior
owlly_workspace_overviewnone ({})Returns authenticated workspace (id, name, plan, status), effective_scopes, plan_clamped/role_clamped flags, collection_enabled, quota usage, and accessible projects.
owlly_get_visibility_reportproject_id*, from, to, provider, tag, country, language, source, prompt_idComputes coverage, share of voice, citation coverage, 6-quadrant citation categories, top domains/sources, daily trends, provider metrics, and recommendations.
owlly_find_competitive_gapsproject_id*, gaps_only, status, q, category, from, to, provider, language, limitFinds prompt cohorts where competitors appear without the primary brand, including recommended_track (onsite_content / offsite_authority), co-occurring citations, and gap_run_ids.
owlly_inspect_runsproject_id*, run_ids, prompt_id, provider, status, limitInspects full AI response text, citations, and brand mentions for specific run IDs (max 20) or filtered runs.
owlly_get_brand_factsproject_id*Retrieves approved brand truth cards, active hallucination alerts across up to 200 recent succeeded runs (last 30 days), and prompt stability metrics.
owlly_list_promptsproject_id*Lists all monitored prompts configured in a project.
owlly_get_optimization_statusproject_id*, task_id, page_idInspects optimization tasks (7-day baseline vs follow-up effect and reminder state) and content page revisions/assessments.

write Scope Tools (4)

Tool NameParametersBehavior & Guardrails
owlly_diagnose_htmlproject_id*, url*, question*, html, locale, opportunity_id, save_pageDiagnoses supplied or publicly fetched page HTML for AEO readiness and optionally saves a draft ContentPage (local demo requires explicit html).
owlly_save_page_draftproject_id*, page_id*, title, description, heading, bodyUpdates draft fields on an existing ContentPage. Always forces status="draft" and reviewed=false.
owlly_create_optimization_taskproject_id*, opportunity_id*, action_code*, title*, description, target_url, due_dateCreates an optimization task (answer_page, comparison, or evidence) linked to an opportunity and freezes its 7-day baseline.
owlly_manage_prompts_and_factsproject_id*, operation*, prompts | brand_factRuns add_prompts (1–25 items, always created paused with enabled=false) or add_brand_fact.

collect Scope Tool (1)

Tool NameParametersBehavior & Guardrails
owlly_run_prompt_samplingproject_id*, prompt_id*Queues immediate sampling when OWLLY_COLLECTION_ENABLED=true. Reserves observation quota atomically in PostgreSQL and refuses duplicates or exhausted quota.

MCP Resources (2) & Workflow Prompts (2)

Alongside tools, Owlly exposes two URI resource templates and two guided workflow prompts.

KindURI / NameArguments / MIME TypePurpose
Resourceowlly://projects/{project_id}/brand-factsapplication/jsonApproved brand truth cards and 30-day hallucination alerts for the project.
Resourceowlly://projects/{project_id}/optimization-reporttext/markdownLocalized Markdown optimization outcome report for the project.
Prompt/weekly-aeo-briefproject_id*, localeGathers live visibility, competitive gaps, brand fact alerts, and task statuses into an executive brief without inventing numbers.
Prompt/rewrite-for-citation-gapproject_id*, opportunity_id*, target_urlGuides the agent to check brand facts first, inspect gap runs, diagnose the page, and save a human-reviewable draft.