Features How it works Integrations Pricing FAQ Sign in Get Started

Recipes

Copy-paste flows that use the REST API + MCP together. Everything below is real, runnable code.

Recipe 1 — Daily SEO monitor in n8n

Poll your top 10 published articles weekly, run audit_seo on each, post a Slack diff if any score dropped.

  1. Cron trigger — every Monday 9am.
  2. HTTP node — GET https://app.ranki.io/api/v1/projects with X-API-Key.
  3. For each project: GET /projects/{id}/articles?status=published&per_page=10.
  4. For each article: POST https://mcp.ranki.io/ calling audit_seo.
  5. Compare score with last week (stored in n8n's static data).
  6. If delta < -5: post to Slack with the failing checks.
// n8n Function node
const projects = await this.helpers.httpRequest({
  url: 'https://app.ranki.io/api/v1/projects',
  headers: { 'X-API-Key': $env.RANKI_API_KEY },
});

const drops = [];
for (const p of projects.data) {
  const arts = await this.helpers.httpRequest({
    url: `https://app.ranki.io/api/v1/projects/${p.id}/articles?status=published&per_page=10`,
    headers: { 'X-API-Key': $env.RANKI_API_KEY },
  });
  for (const a of arts.data) {
    const r = await this.helpers.httpRequest({
      method: 'POST',
      url: 'https://mcp.ranki.io/',
      body: { jsonrpc: '2.0', id: 1, method: 'tools/call', params: { name: 'audit_seo', arguments: { url: `https://${p.url}/${a.slug}` } } },
      json: true,
    });
    // parse "Score: NN/100" out of r.result.content[0].text
    const m = r.result.content[0].text.match(/Score: (\d+)/);
    if (m) drops.push({ title: a.title, score: +m[1] });
  }
}
return drops;

Recipe 2 — Cursor "fix my SEO" workflow

In Cursor, with the Ranki MCP and Skill installed, type a prompt and let it self-orchestrate.

You: audit this page for AEO and fix it: https://mysite.com/blog/intro

Cursor:
  → Calling ranki.audit_aeo(url=https://mysite.com/blog/intro)
  ← Score: 50/100. Failing: Article schema, author byline, answer-style headings.
  → Reading blog/intro.md from current repo…
  → Editing blog/intro.md to add FAQPage JSON-LD and rephrase 2 H2s as questions.
  → Editing layouts/post.tsx to inject Article JSON-LD with author from frontmatter.
  → Calling ranki.audit_aeo again to verify…
  ← Score: 88/100. ✅

Recipe 3 — Generate llms.txt for any framework

Pull your site's key pages, hand them to generate_llms_txt, save the output.

// pages/api/build-llms-txt.ts
import fs from 'fs';
import { getAllPages } from '@/lib/pages';

export default async function handler(req, res) {
  const pages = await getAllPages();
  const r = await fetch('https://mcp.ranki.io/', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      jsonrpc: '2.0', id: 1, method: 'tools/call',
      params: {
        name: 'generate_llms_txt',
        arguments: {
          site_name: 'My Site',
          summary: 'Independent media for X audience',
          key_pages: pages.slice(0, 20).map(p => ({ url: p.canonical, title: p.title })),
        },
      },
    }),
  });
  const data = await r.json();
  const llmsTxt = data.result.content[0].text.replace(/^.*?```markdown\n/, '').replace(/```$/, '');
  fs.writeFileSync('public/llms.txt', llmsTxt);
  res.json({ ok: true });
}
// scripts/build-llms-txt.ts (Astro)
import { getCollection } from 'astro:content';
import { writeFile } from 'fs/promises';

const posts = await getCollection('blog');
const r = await fetch('https://mcp.ranki.io/', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    jsonrpc: '2.0', id: 1, method: 'tools/call',
    params: { name: 'generate_llms_txt', arguments: {
      site_name: 'My Astro Site',
      summary: 'Posts about X',
      key_pages: posts.map(p => ({ url: `https://site.com/${p.slug}`, title: p.data.title })),
    } },
  }),
}).then(r => r.json());

await writeFile('public/llms.txt', r.result.content[0].text);
// app/Console/Commands/BuildLlmsTxt.php
$pages = Page::published()->limit(20)->get();
$resp = Http::post('https://mcp.ranki.io/', [
    'jsonrpc' => '2.0', 'id' => 1, 'method' => 'tools/call',
    'params' => ['name' => 'generate_llms_txt', 'arguments' => [
        'site_name' => config('app.name'),
        'summary' => 'X',
        'key_pages' => $pages->map(fn ($p) => ['url' => $p->canonical, 'title' => $p->title])->all(),
    ]],
])->json();
file_put_contents(public_path('llms.txt'), $resp['result']['content'][0]['text']);

Recipe 4 — Daily Markdown export

Dump every published article to a Markdown file so you can syndicate to Medium / dev.to / Substack manually.

#!/usr/bin/env python3
import os, requests
from pathlib import Path

KEY = os.environ['RANKI_API_KEY']
HDR = {'X-API-Key': KEY}
OUT = Path('export'); OUT.mkdir(exist_ok=True)

projects = requests.get('https://app.ranki.io/api/v1/projects', headers=HDR).json()
for p in projects['data']:
    arts = requests.get(
        f"https://app.ranki.io/api/v1/projects/{p['id']}/articles?status=published&per_page=50",
        headers=HDR,
    ).json()
    for a in arts['data']:
        detail = requests.get(f"https://app.ranki.io/api/v1/articles/{a['id']}", headers=HDR).json()
        d = detail['data']
        md = f"# {d['title']}\n\n> Keywords: {', '.join(d['focus_keyword'])}\n\n{d['content_html']}"
        (OUT / f"{p['name']}__{d['slug'] or d['id']}.md").write_text(md)
        print('wrote', d['title'])