How to Build an Agentic SEO Loop: Exact MCP Tool Calls
A six-station operating loop for measuring AI visibility, diagnosing citation gaps, briefing a fix, implementing it through controlled website access, and verifying the result on the next run.
Methodology
This implementation reference was reconstructed from Foglift's production hosted MCP route, its published integration contract, and the six-station workflow used in the companion explainer. Every Foglift tool name and argument below was checked against the hosted server schema on 2026-07-28. The workflow is vendor-portable: replace the worked-example calls with tools that cover the same measurement, diagnosis, briefing, editing, and verification jobs.
The useful definition of agentic SEO
Agentic SEO is a closed operating loop. The agent measures how a site and brand appear in AI answers, finds the strongest explanation for a weak result, prepares a bounded change, and checks the same evidence after release.
The six stations are scan, measure, diagnose, brief, implement, and verify. Each station exists because the one before it leaves a practical question unanswered.
Station 1
Scan
How does a machine read the target page?
Station 2
Measure
Which buyer questions produce a mention or citation?
Station 3
Diagnose
Which prompts, engines, and sources explain the gap?
Station 4
Brief
What exact page change should a human review?
Station 5
Implement
How does the proposed fix reach a draft or pull request?
Station 6
Verify
Did the readiness signal or answer-level result move?
Start with the manual check
Open an AI engine and ask one question a buyer would ask, such as “What is the best time tracking app for freelancers?” Read the answer and record the products and sources it names. This is a valid first measurement.
It is also a weak operating system. Personal history can shape the answer, repeated prompts can produce different results, and a person rarely repeats the same portfolio across five engines on a fixed schedule. Automation begins when the prompts, engines, cadence, and output fields become explicit.
Build the prompt portfolio before the automation
A prompt portfolio is a versioned set of buyer questions. Each prompt needs an intent label, a Foglift prompt category, and a target page so the agent knows what to diagnose and where a proposed fix belongs. Intent labels describe the buyer job inside your portfolio. Thecategory value is sent to Foglift and must be one ofbrand, product, comparison,industry, review, or local. Keep brand-included comparison prompts separate from unbranded category prompts.
Copyable template
Replace the example brand, domain, ID, and prompts.
{
"_refresh_contract": {
"artifact": "/research/agentic-seo-loop",
"purpose": "Canonical prompt portfolio template used by the implementation guide and companion video.",
"verified_against": "Hosted Foglift MCP tool schemas",
"verified_at": "2026-07-28"
},
"brand": {
"name": "Acme Time",
"domain": "acmetime.example",
"brand_id": "YOUR_FOGLIFT_BRAND_ID"
},
"cadence": "daily",
"engines": [
"chatgpt",
"claude",
"perplexity",
"gemini",
"ai-overview"
],
"prompts": [
{
"text": "best time tracking app for freelancers",
"intent": "shortlist",
"category": "industry",
"target_page": "/freelancers"
},
{
"text": "time tracking software with an API",
"intent": "capability",
"category": "product",
"target_page": "/developers"
},
{
"text": "Acme Time alternatives",
"intent": "comparison",
"category": "comparison",
"target_page": "/compare"
},
{
"text": "how to track billable hours for client work",
"intent": "problem",
"category": "industry",
"target_page": "/guides/billable-hours"
}
],
"guardrails": {
"human_approval_required": true,
"dry_run_days": 7,
"max_pull_requests_per_day": 2,
"max_visibility_runs_per_day": 1
}
}Load the portfolio into Foglift with one add_prompt call per prompt. Copy each prompt's text intoprompt and pass its separate category value. The first call looks like this:
add_prompt{
"brand_id": "YOUR_FOGLIFT_BRAND_ID",
"prompt": "best time tracking app for freelancers",
"category": "industry"
}Repeat the call for each prompt. Portfolio intent labels such as shortlist stay in your planning file; the MCP call accepts only the six Foglift prompt categories. Call get_prompts afterward and compare the saved list with the versioned template.
Schedule the same measurement
Read the current account settings before changing them. Engine access and cadence depend on the connected plan, so the agent should inspect the contract first.
get_models{}set_models{
"enabled_models": {
"chatgpt": true,
"claude": true,
"perplexity": true,
"gemini": true,
"ai-overview": true
},
"monitoring_frequency": "daily"
}This example uses the five-engine paid configuration. A Free workspace uses active-use weekly Perplexity monitoring.
The scheduled result should retain at least four fields for each prompt-engine pair: brand mentioned, cited URLs or domains, answer position, and run time. Trends become useful after the portfolio and engine set remain stable across repeated runs.
Give the agent one measurement connection
The hosted Foglift MCP endpoint is https://mcp.foglift.io/api/mcp. Add it as a remote MCP server in a client that supports OAuth, complete the authorization flow, then call whoami to confirm the account and default brand.
whoami{}MCP uses a client-server architecture. Servers expose typed tools, clients discover those tools with tools/list, and tool execution uses tools/call. The protocol defines the connection and tool exchange. Your agent still decides when a tool is appropriate and how to use its result.
The full six-station loop
1. Scan the target page
Start with the page mapped to the prompt. Save the scan ID, scores, and issue list as the technical baseline.
scan_website{
"url": "https://acmetime.example/freelancers"
}2. Measure the answer portfolio
Estimate the run before spending quota. Then execute the same saved prompts against the enabled engines.
estimate_cost{
"brand_id": "YOUR_FOGLIFT_BRAND_ID",
"use_saved_prompts": true,
"models": [
"chatgpt",
"claude",
"perplexity",
"gemini",
"ai-overview"
]
}Proceed only when the response says the balance is sufficient and the estimated run fits the daily budget.
run_ai_visibility{
"domain": "acmetime.example",
"brand_id": "YOUR_FOGLIFT_BRAND_ID",
"use_saved_prompts": true,
"models": [
"chatgpt",
"claude",
"perplexity",
"gemini",
"ai-overview"
]
}3. Diagnose the weak result
Pull the exact prompt history, then ask the Actions Engine for weak engines, prompt gaps, citation patterns, stored recommendations, and the reasoning recipe.
get_ai_results{
"brand_id": "YOUR_FOGLIFT_BRAND_ID",
"days": 30,
"prompt": "best time tracking app for freelancers",
"limit": 50
}get_recommendations{
"brand_id": "YOUR_FOGLIFT_BRAND_ID"
}Choose one recommendation with a named prompt and target page. Keep internal loss telemetry inside the work order rather than publishing it on a conversion page.
4. Turn the diagnosis into a work order
A useful brief names the target page, buyer question, missing evidence, required sections, source requirements, structured-data changes, and the verification query.
generate_content_brief{
"brand_id": "YOUR_FOGLIFT_BRAND_ID",
"url": "https://acmetime.example/freelancers",
"recTitle": "Answer the freelancer time-tracking shortlist query"
}If you want the action to remain visible in Foglift, store the agent’s work order with submit_recommendation. Useapply_recommendation on a stored recommendation to prepare its supported next action or precise change set.
5. Implement through controlled website access
Foglift supplies the evidence and work order. The editing tool belongs to the website system. For a repository, instruct the coding agent to create a focused branch and pull request. For a CMS, grant draft-only permissions and require a preview link.
Implementation instruction
Implement the approved brief on the mapped target page. Preserve factual product boundaries and cite primary sources. Open a pull request with the baseline scan ID, affected prompt, changed files, tests, and preview URL. Stop before merge and request human approval.
6. Verify after the release
Verification has two clocks. The Technical Audit can run immediately on a preview or released URL. Answer-level movement needs repeated runs because a single generated answer is noisy.
scan_website{
"url": "https://acmetime.example/freelancers"
}Compare the issue list and category scores with the saved baseline scan.
run_ai_visibility{
"domain": "acmetime.example",
"brand_id": "YOUR_FOGLIFT_BRAND_ID",
"prompts": [
"best time tracking app for freelancers"
],
"models": [
"chatgpt",
"claude",
"perplexity",
"gemini",
"ai-overview"
]
}Call estimate_cost first. Repeat on the normal schedule, then use get_ai_results with the same prompt to compare mention rate, position, and cited domains.
Guardrails that make the loop usable
The first version should propose changes and stop before publication. That keeps editorial judgment, legal claims, pricing, and security decisions with a person while the repeatable evidence collection runs on schedule.
- Human approval: every website change reaches a pull request or CMS draft.
- Dry mode: log proposed actions for seven days before enabling write access.
- Spend gate: call
estimate_costbefore every unscheduled visibility run. - Change limit: cap proposed pull requests or drafts per day.
- Audit trail: store tool arguments, result IDs, brief, diff, reviewer, and verification result together.
- One-variable releases: keep each change focused enough to connect the result with a plausible cause.
NIST’s Generative AI Profile recommends documenting system limits, data origin, content lineage, and test-and-evaluation practices. Pull request review supplies a practical approval record for repository changes, and branch rules can require an approval before merge.
A compact runbook for the scheduler
| When | Calls | Stop condition |
|---|---|---|
| Daily | estimate_cost, run_ai_visibility | Insufficient balance, provider failure, or the daily run already completed |
| After each run | get_ai_results, get_recommendations | No recommendation has a prompt, target page, and supportable rationale |
| For one approved action | generate_content_brief, then repository or CMS tools | Missing primary evidence, failed tests, or no human approval |
| After release | scan_website, then the scheduled measurement calls | Regression in the audit, unexpected page output, or inconclusive answer sample |
Sources and further reading
- Foglift hosted MCP integration and current tool inventory. First-party product contract, verified July 28, 2026.
- Model Context Protocol, Architecture overview. Official client-server, transport, primitive, and tool-discovery reference.
- Model Context Protocol specification, Tools. Official
tools/listandtools/callcontract. - NIST AI 600-1, Generative Artificial Intelligence Profile. July 2024, updated April 2026.
- GitHub Docs, Pull request reviews. Official review and required-approval reference.
Frequently Asked Questions
What is agentic SEO?
Agentic SEO is a measured operating loop in which an agent scans a site, monitors buyer questions across AI engines, diagnoses weak answers, prepares a specific change, routes that change through review, and verifies the result after release. The loop matters because each change returns to a measured baseline.
Do I need an MCP server to build the loop?
No. A script can call the same APIs directly. MCP gives an agent typed tool discovery and execution through one standard connection, which reduces custom integration work. The required capability is a stable toolbox that covers measurement, diagnosis, and handoff.
Which prompts belong in an AI visibility portfolio?
Use real buyer questions across four intents: category shortlists, capability checks, comparisons, and problem-solving questions. Give each prompt a target page and keep branded navigational prompts separate from unbranded discovery prompts so their mention rates do not distort each other.
Should the agent publish website changes automatically?
Start with proposals. Route repository changes through pull requests or CMS drafts, require a human approval, and run new automations in dry mode for at least one week. Add daily limits for visibility runs, spend, and proposed changes.
How do I know whether an agentic SEO fix worked?
Save the baseline result, release one focused change, run the Technical Audit again, and repeat the same prompt across the same engines. Compare mention rate, cited domains, position, and the targeted readiness issue over multiple runs. One answer is too noisy to establish movement.
Free tool
Run a Technical Audit on your own site
Check technical SEO, performance, security, accessibility, and structural AI Readiness. No signup required.
Run Free Technical Audit