rankcontrol 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Infowick
3
+ Copyright (c) 2026 RankControl, LLC
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -9,15 +9,15 @@ Every command calls the same authed, rate-limited, org-scoped API the RankContro
9
9
 
10
10
  ## Auth
11
11
 
12
- The easy way approve in your browser (you must be logged in to RankControl):
12
+ The easy way (browser approval; you must be logged in to RankControl):
13
13
 
14
14
  ```bash
15
15
  npx rankcontrol login
16
16
  ```
17
17
 
18
- That opens your dashboard, you check the confirmation code matches, pick the permissions to grant, and the CLI stores a scoped key in `~/.rankcontrol/config.json`. `npx rankcontrol logout` removes it (revoke the key itself in Settings → API).
18
+ That opens your dashboard, you check the confirmation code matches and approve. The CLI stores a key in `~/.rankcontrol/config.json`. `npx rankcontrol logout` removes it (revoke the key itself in Settings → API).
19
19
 
20
- The headless way (CI, servers, MCP `env` blocks) create a key in **RankControl → Settings → API**, then:
20
+ The headless way (CI, servers, MCP `env` blocks): create a key in **RankControl → Settings → API**, then:
21
21
 
22
22
  ```bash
23
23
  export RANKCONTROL_API_KEY=rctrl_pk_...
@@ -28,40 +28,102 @@ The env var wins over the stored config when both exist. Scopes are set per key;
28
28
  ## CLI
29
29
 
30
30
  ```bash
31
+ # Visibility and citations
31
32
  npx rankcontrol funnel # AI crawls / AI visits / AI leads (30d)
32
33
  npx rankcontrol score # composite visibility score + subscores (AI/Google/Bing)
33
- npx rankcontrol leads --limit 100 # captured leads with AI source attribution
34
- npx rankcontrol traffic --days 30 # page views, visitors, bounce rate, time on page
35
34
  npx rankcontrol visibility --days 60 # daily AI visibility score trend
36
35
  npx rankcontrol sov --days 30 # share of voice vs competitors
37
36
  npx rankcontrol sources --days 30 # cited domains typed brand/competitive/ugc/editorial
38
37
  npx rankcontrol sentiment --days 30 # how AI answers frame your brand
39
- npx rankcontrol optimizer --limit 25 # pages ranked by citability, worst first
40
38
  npx rankcontrol citations --model chatgpt
39
+ npx rankcontrol crawler-access # can AI crawlers reach your site (daily probe)
41
40
  npx rankcontrol queries # tracked queries checked weekly across AI engines
41
+ npx rankcontrol query-add "best crm for agencies"
42
+ npx rankcontrol query-edit <queryId> "new text"
43
+ npx rankcontrol query-track <queryId> off # pause weekly checks (frees a slot)
44
+ npx rankcontrol query-remove <queryId>
45
+ npx rankcontrol competitors
46
+ npx rankcontrol competitor-add "Acme" https://acme.com
47
+ npx rankcontrol competitor-remove <competitorId>
48
+
49
+ # Content pipeline
42
50
  npx rankcontrol capacity # remaining content-plan slots
51
+ npx rankcontrol content # pages with status
43
52
  npx rankcontrol plan-content --topics "bus travel" --max-difficulty 40
44
53
  npx rankcontrol commit-titles --file titles.json
45
- npx rankcontrol publish <contentId> # dry run
46
- npx rankcontrol publish <contentId> --confirm # actually publish
47
- npx rankcontrol generate <contentId> # dry run
48
- npx rankcontrol generate <contentId> --confirm # write a planned article now (slot unchanged)
54
+ npx rankcontrol ideas # scored content-idea backlog
55
+ npx rankcontrol plan-idea "query text" # put an idea on the calendar
56
+ npx rankcontrol delete-planned <contentId> # title returns to the idea pool
57
+ npx rankcontrol generate <contentId> --confirm # write a planned article now
58
+ npx rankcontrol publish <contentId> --confirm # dry run without --confirm
59
+ npx rankcontrol archive <contentId>
60
+ npx rankcontrol reschedule <contentId> 2026-08-04
49
61
  npx rankcontrol settings # article policy (auto-write, auto-publish, images, ...)
50
62
  npx rankcontrol settings-set --auto-generate off --auto-publish off
51
- npx rankcontrol reschedule <contentId> 2026-08-04
63
+ npx rankcontrol topics # pillar list (topic clusters)
64
+ npx rankcontrol topics-set "Topic A" "Topic B" # replaces the FULL list
52
65
  npx rankcontrol internal-links <contentId> # who links here / links out
53
66
  npx rankcontrol site-pages # pages used for internal links
54
67
  npx rankcontrol detect-links https://example.com/sitemap.xml
55
68
  npx rankcontrol add-pages https://example.com/pricing
56
- npx rankcontrol repurpose # published articles + social draft chips
57
- npx rankcontrol repurpose <contentId> # full drafts for one article
69
+
70
+ # Leads and analytics
71
+ npx rankcontrol leads --limit 100 # captured leads with AI source attribution
72
+ npx rankcontrol traffic --days 30 # page views, visitors, bounce rate, time on page
73
+ npx rankcontrol engagement # per-page views, citations, sparkline
74
+ npx rankcontrol analytics-sources # which source writes traffic/crawler data
75
+ npx rankcontrol analytics-set-source <dataType> <source>
76
+ npx rankcontrol analytics-activate <screen>
77
+
78
+ # Reports
79
+ npx rankcontrol report # exec summary: last 30 days vs the 30 before
80
+ npx rankcontrol wins # biggest wins of the last 30 days
81
+ npx rankcontrol agent-activity # recent runs per agent lane
82
+ npx rankcontrol jobs # async job status
83
+
84
+ # Backlinks and outreach
85
+ npx rankcontrol backlinks --status live
86
+ npx rankcontrol backlink-stats
87
+ npx rankcontrol outreach-prospects
88
+ npx rankcontrol outreach-find-contact <backlinkId>
89
+ npx rankcontrol outreach-draft-reply <backlinkId>
90
+ npx rankcontrol outreach-queue <backlinkId> --confirm # sends from YOUR mailbox
91
+ npx rankcontrol outreach-status <backlinkId> <status>
92
+ npx rankcontrol network # Link Network credits + placements
93
+ npx rankcontrol network-opt-in on --confirm
94
+ npx rankcontrol network-remove-placement <placementId> --confirm
95
+
96
+ # Social and repurposing
97
+ npx rankcontrol repurpose [contentId] # published articles + social drafts (8 platforms)
58
98
  npx rankcontrol repurpose-generate <contentId> --platforms twitter --confirm
59
99
  npx rankcontrol repurpose-edit <draftId> --title "New hook"
60
- npx rankcontrol repurpose-channels # Postiz channel ids (for repurpose-push)
61
- npx rankcontrol repurpose-push <draftId> --channels <id> # dry run
100
+ npx rankcontrol repurpose-channels # Postiz channel ids
62
101
  npx rankcontrol repurpose-push <draftId> --channels <id> --confirm
63
- npx rankcontrol repurpose-mark-posted <draftId> # posted it yourself
64
- npx rankcontrol jobs # async job status (agent runs)
102
+ npx rankcontrol repurpose-mark-posted <draftId>
103
+ npx rankcontrol social # Reddit/X threads where your articles fit
104
+ npx rankcontrol social-stats
105
+ npx rankcontrol social-status <threadId> <status>
106
+ npx rankcontrol social-draft-reply <threadId>
107
+
108
+ # Brand, team, workspace
109
+ npx rankcontrol brand # brand profile, products, ICPs in one read
110
+ npx rankcontrol brand-set --industry "SaaS" # name, industry, description, authors, style refs
111
+ npx rankcontrol brand-profile-set --json '{"tone":"confident"}'
112
+ npx rankcontrol brand-product --json @product.json
113
+ npx rankcontrol brand-icp --json @icp.json
114
+ npx rankcontrol team
115
+ npx rankcontrol team-invite user@company.com --perms content=write,analytics=read --confirm
116
+ npx rankcontrol team-revoke <invitationId>
117
+ npx rankcontrol team-remove <memberId> --confirm
118
+ npx rankcontrol support "Subject" --message "..."
119
+
120
+ # Integration helpers
121
+ npx rankcontrol shopify-install-url <shop>
122
+ npx rankcontrol cloudflare-connect # OAuth URL for read-only crawler analytics
123
+ npx rankcontrol cloudflare-zones
124
+ npx rankcontrol cloudflare-zone <zoneId> <zoneName>
125
+ npx rankcontrol framer-install-embed --confirm
126
+ npx rankcontrol webflow-custom-code --confirm
65
127
  ```
66
128
 
67
129
  ## MCP
@@ -86,39 +148,104 @@ Or in `.mcp.json` / Cursor `mcp.json`:
86
148
  }
87
149
  ```
88
150
 
89
- ### Tools
151
+ ### Tools (83)
152
+
153
+ **Visibility and citations**
90
154
 
91
155
  | Tool | What it does |
92
156
  |---|---|
93
157
  | `get_overview_funnel` | AI crawls / AI visits / AI leads, last 30 days |
94
- | `list_leads` | Captured leads with AI model / query / page attribution |
95
- | `get_traffic_overview` | Page views, visitors, sessions, bounce rate, time on page |
96
- | `get_visibility_trend` | Daily visibility score from stored weekly citation checks |
97
- | `list_citations` | Recent citation checks per AI model |
98
- | `list_tracked_queries` | The queries checked weekly across the AI engines |
99
158
  | `get_visibility_score` | Composite score (50% AI + 30% Google + 20% Bing) with subscores |
159
+ | `get_visibility_trend` | Daily visibility score from stored weekly citation checks |
100
160
  | `get_share_of_voice` | Your citation rate vs competitor mention rates + your share |
101
161
  | `get_citation_sources` | Cited domains typed brand / competitive / UGC / editorial |
102
162
  | `get_citation_sentiment` | Positive / neutral / negative framing with recent receipts |
103
163
  | `get_citability_report` | Published pages by citability score, worst first, with fixes |
164
+ | `list_citations` | Recent citation checks per AI model |
165
+ | `get_crawler_access` | Daily AI-crawler reachability probe (edge blocks, robots.txt) |
166
+ | `list_tracked_queries` | The queries checked weekly across the AI engines |
167
+ | `add_tracked_query` / `update_tracked_query` / `set_query_tracking` / `remove_tracked_query` | Manage the query pool and its plan slots |
168
+ | `get_competitors` / `add_competitor` / `remove_competitor` | Manage share-of-voice competitors (max 10) |
169
+
170
+ **Content pipeline**
171
+
172
+ | Tool | What it does |
173
+ |---|---|
104
174
  | `get_planning_capacity` | Remaining calendar slots (check before planning) |
105
175
  | `plan_content` | Generate candidate titles (capacity-gated, nothing scheduled) |
106
176
  | `commit_planned_titles` | Approve reviewed titles onto the calendar |
107
- | `publish_content` | Dry run by default; `confirm: true` publishes |
108
- | `generate_article` | Write a planned article's body now, slot unchanged; dry run by default |
109
- | `get_article_settings` / `update_article_settings` | Read / merge-patch the article policy (auto-write, auto-publish, images, links, ...) |
177
+ | `get_content_ideas` / `plan_content_idea` | Scored idea backlog; put an idea on the calendar |
178
+ | `delete_planned_title` | Remove a planned title (returns to the idea pool) |
179
+ | `generate_article` | Write a planned article's body now; dry run by default |
180
+ | `publish_content` | Dry run by default; `confirm: true` publishes to the CMS |
181
+ | `archive_content` | Archive an article (reversible in the dashboard) |
110
182
  | `reschedule_article` | Move a planned article to another day (flexible schedule) |
183
+ | `get_article_settings` / `update_article_settings` | Read / merge-patch the article policy |
184
+ | `get_topics` / `set_topics` | Read / replace the pillar list (full-list replace) |
111
185
  | `get_internal_links` | Who links to this article internally, and its outbound count |
112
- | `list_site_pages` / `add_site_pages` | Pages used for in-article internal links |
113
- | `detect_site_links` | Scan a sitemap or blog root for site pages |
114
- | `list_repurpose_queue` | Published articles + social draft chips per platform |
115
- | `get_repurpose_drafts` | Full social drafts for one article (8 platforms) |
116
- | `generate_repurpose_drafts` | Draft social posts for an article; dry run by default |
117
- | `update_repurpose_draft` | Edit a draft's body/title before pushing |
118
- | `mark_repurpose_posted` | Record a draft as posted manually |
119
- | `list_postiz_channels` | Connected Postiz channels (ids for pushing) |
120
- | `push_repurpose_draft` | Send a draft to Postiz; dry run by default |
186
+ | `list_site_pages` / `add_site_pages` / `detect_site_links` | Pages used for in-article internal links |
121
187
  | `list_content` | Content pages with status |
188
+
189
+ **Leads and analytics**
190
+
191
+ | Tool | What it does |
192
+ |---|---|
193
+ | `list_leads` | Captured leads with AI model / query / page attribution |
194
+ | `get_traffic_overview` | Page views, visitors, sessions, bounce rate, time on page |
195
+ | `get_page_engagement` | Per-page views, citations, and a view sparkline |
196
+ | `get_analytics_sources` / `set_analytics_source` | Which source writes traffic and crawler data |
197
+ | `activate_analytics_screen` | One-time activation of the Analytics or Reports screen |
198
+
199
+ **Reports**
200
+
201
+ | Tool | What it does |
202
+ |---|---|
203
+ | `get_exec_summary` | Last 30 days vs the 30 before: cite rate, views, crawls, leads |
204
+ | `get_top_wins` | Most-cited page, best cite-rate jump, biggest ranking climb |
205
+ | `get_agent_activity` | Recent pipeline runs per agent lane |
122
206
  | `list_jobs` | Async job status (agent runs) |
123
207
 
124
- The plan→commit split is intentional: `plan_content` proposes, a human (or a supervising agent) reviews, `commit_planned_titles` approves. `publish_content` and `generate_article` are dry-run-first for the same reason.
208
+ **Backlinks and outreach**
209
+
210
+ | Tool | What it does |
211
+ |---|---|
212
+ | `list_backlinks` / `get_backlink_stats` | Backlink table and totals |
213
+ | `list_outreach_prospects` | Outreach pipeline per published article |
214
+ | `find_outreach_contact` | Scrape a prospect site for an outreach email |
215
+ | `draft_outreach_reply` | AI-draft the next reply in a live conversation |
216
+ | `queue_outreach_email` | Queue an email from the workspace's own mailbox |
217
+ | `update_outreach_status` | Move a prospect through the pipeline |
218
+ | `get_link_network` | Credit balance, membership, placements |
219
+ | `set_link_network_opt_in` / `remove_network_placement` | Join/leave, retire placements; dry run by default |
220
+
221
+ **Social and repurposing**
222
+
223
+ | Tool | What it does |
224
+ |---|---|
225
+ | `list_repurpose_queue` / `get_repurpose_drafts` | Published articles + social drafts (8 platforms) |
226
+ | `generate_repurpose_drafts` / `update_repurpose_draft` | Draft and edit platform-native posts |
227
+ | `list_postiz_channels` / `push_repurpose_draft` | Push to Postiz; dry run by default |
228
+ | `mark_repurpose_posted` | Record a draft as posted manually |
229
+ | `list_social_threads` / `get_social_stats` | Reddit/X threads where your articles fit |
230
+ | `update_social_thread_status` / `draft_social_reply` | Work a thread; drafts never auto-post |
231
+
232
+ **Brand, team, workspace**
233
+
234
+ | Tool | What it does |
235
+ |---|---|
236
+ | `get_brand` | Brand profile, links/CTAs, products, and ICPs in one read |
237
+ | `update_brand_identity` | Name, industry, description, authors (EEAT bylines), style refs |
238
+ | `update_brand_profile` | Voice, colors, meta fields, locale |
239
+ | `write_brand_product` / `write_brand_icp` | Create/update/delete products and buyer profiles |
240
+ | `get_team` / `invite_team_member` / `revoke_team_invite` / `remove_team_member` | Seats, invites, per-screen permissions |
241
+ | `contact_support` | Message the RankControl team with the workspace identified |
242
+
243
+ **Integration helpers**
244
+
245
+ | Tool | What it does |
246
+ |---|---|
247
+ | `shopify_install_url` | Mint an install link for the Shopify app |
248
+ | `get_cloudflare_connect_url` / `list_cloudflare_zones` / `select_cloudflare_zone` | Connect read-only Cloudflare crawler analytics |
249
+ | `install_framer_embed` / `install_webflow_custom_code` | Install visit tracking; dry run by default |
250
+
251
+ The plan→commit split is intentional: `plan_content` proposes, a human (or a supervising agent) reviews, `commit_planned_titles` approves. `publish_content`, `generate_article`, and everything with a public side effect are dry-run-first for the same reason.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rankcontrol",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "RankControl CLI + MCP server: drive your SEO/AI-visibility workspace from the terminal or any AI agent",
5
5
  "license": "MIT",
6
6
  "homepage": "https://rctrl.com",
package/src/cli.mjs CHANGED
@@ -33,11 +33,10 @@ export function runCli(argv) {
33
33
 
34
34
  program
35
35
  .command("login")
36
- .description("Authenticate via your browser (approves a scoped API key into ~/.rankcontrol)")
37
- .option("--scopes <a,b,c>", "Scopes to request (default: reads + write:content + write:publish)")
38
- .action(async (opts) => {
36
+ .description("Authenticate via your browser (full workspace access; billing stays in the dashboard)")
37
+ .action(async () => {
39
38
  const { login } = await import("./login.mjs");
40
- await login({ scopes: opts.scopes ? list(opts.scopes) : undefined }).catch(fail);
39
+ await login().catch(fail);
41
40
  });
42
41
 
43
42
  program
@@ -119,15 +118,154 @@ export function runCli(argv) {
119
118
 
120
119
  program
121
120
  .command("crawler-access")
122
- .description("Daily AI-crawler reachability probe: is the site's edge or robots.txt blocking GPTBot/ClaudeBot")
121
+ .description("Daily AI-crawler reachability probe (a diagnostic, not a metric): is the site's edge or robots.txt blocking GPTBot/ClaudeBot")
123
122
  .action(() => api.crawlerAccess().then(out).catch(fail));
124
123
 
124
+ program
125
+ .command("analytics-sources")
126
+ .description("Per-org analytics sources: selections, qualified options, Cloudflare/plugin/embed install state")
127
+ .action(() => api.analyticsSources().then(out).catch(fail));
128
+
129
+ program
130
+ .command("analytics-set-source")
131
+ .description("Select the writer for a data type (validated against what the setup supports)")
132
+ .argument("<dataType>", "humanTraffic or aiCrawlers")
133
+ .argument("<source>", "embed, wordpress_plugin, cloudflare or none")
134
+ .action((dataType, source) =>
135
+ api.setAnalyticsSource(dataType, source).then(out).catch(fail)
136
+ );
137
+
138
+ program
139
+ .command("analytics-activate")
140
+ .description("Turn on the Analytics or Reports screen for this workspace")
141
+ .argument("<screen>", "analytics or reports")
142
+ .action((screen) => api.activateScreen(screen).then(out).catch(fail));
143
+
144
+ program
145
+ .command("cloudflare-connect")
146
+ .description("Print the Cloudflare OAuth URL to connect read-only crawler analytics")
147
+ .action(() =>
148
+ api
149
+ .cloudflareConnectUrl()
150
+ .then((d) => out(d?.url ?? d))
151
+ .catch(fail)
152
+ );
153
+
154
+ program
155
+ .command("cloudflare-zones")
156
+ .description("List Cloudflare zones visible to the connected grant")
157
+ .action(() => api.cloudflareZones().then(out).catch(fail));
158
+
159
+ program
160
+ .command("cloudflare-zone")
161
+ .description("Pick the polled zone (also selects Cloudflare as the AI-crawler source and starts the first sync)")
162
+ .argument("<zoneId>", "Zone id from cloudflare-zones")
163
+ .argument("<zoneName>", "Zone name, e.g. example.com")
164
+ .action((zoneId, zoneName) =>
165
+ api.cloudflareSelectZone(zoneId, zoneName).then(out).catch(fail)
166
+ );
167
+
168
+ program
169
+ .command("framer-install-embed")
170
+ .description("Install site-wide tracking on the Framer project (dry run without --confirm; installing also publishes the Framer site)")
171
+ .option("--integration <id>", "Integration id (defaults to the org's Framer integration)")
172
+ .option("--confirm", "Actually install", false)
173
+ .action((opts) =>
174
+ api
175
+ .framerInstallEmbed({
176
+ ...(opts.integration ? { integrationId: opts.integration } : {}),
177
+ confirm: Boolean(opts.confirm),
178
+ })
179
+ .then(out)
180
+ .catch(fail)
181
+ );
182
+
183
+ program
184
+ .command("webflow-custom-code")
185
+ .description("Install the tracking loader via Webflow's Custom Code API (dry run without --confirm; live on the customer's next site publish)")
186
+ .option("--integration <id>", "Integration id (defaults to the org's Webflow integration)")
187
+ .option("--token <token>", "New site token with CMS + Custom code scopes (replaces the stored one)")
188
+ .option("--confirm", "Actually install", false)
189
+ .action((opts) =>
190
+ api
191
+ .webflowInstallCustomCode({
192
+ ...(opts.integration ? { integrationId: opts.integration } : {}),
193
+ ...(opts.token ? { apiToken: opts.token } : {}),
194
+ confirm: Boolean(opts.confirm),
195
+ })
196
+ .then(out)
197
+ .catch(fail)
198
+ );
199
+
125
200
  program
126
201
  .command("query-add")
127
202
  .description("Add a query to the tracking pool (tracks immediately when a plan slot is free)")
128
203
  .argument("<queryText>", "The search/AI query to track")
129
204
  .action((queryText) => api.addQuery(queryText).then(out).catch(fail));
130
205
 
206
+ program
207
+ .command("query-remove")
208
+ .description("Delete a query from the tracking pool")
209
+ .argument("<queryId>", "Query id (from the queries command)")
210
+ .action((queryId) => api.removeQuery(queryId).then(out).catch(fail));
211
+
212
+ program
213
+ .command("query-track")
214
+ .description("Pause or resume weekly checks on a query. Tracking uses a plan slot; pausing frees it")
215
+ .argument("<queryId>", "Query id (from the queries command)")
216
+ .argument("<state>", "on | off")
217
+ .action((queryId, state) =>
218
+ api.setQueryTracking(queryId, state === "on").then(out).catch(fail)
219
+ );
220
+
221
+ program
222
+ .command("query-edit")
223
+ .description("Rewrite a tracked query's text")
224
+ .argument("<queryId>", "Query id (from the queries command)")
225
+ .argument("<queryText>", "New query text")
226
+ .action((queryId, queryText) =>
227
+ api.updateQuery(queryId, queryText).then(out).catch(fail)
228
+ );
229
+
230
+ program
231
+ .command("competitors")
232
+ .description("Tracked competitors used in share-of-voice and visibility comparisons")
233
+ .action(() => api.competitors().then(out).catch(fail));
234
+
235
+ program
236
+ .command("competitor-add")
237
+ .description("Track a competitor (max 10)")
238
+ .argument("<name>", "Competitor name")
239
+ .argument("<websiteUrl>", "Competitor website URL")
240
+ .action((name, websiteUrl) =>
241
+ api.addCompetitor(name, websiteUrl).then(out).catch(fail)
242
+ );
243
+
244
+ program
245
+ .command("competitor-remove")
246
+ .description("Stop tracking a competitor")
247
+ .argument("<competitorId>", "Competitor id (from the competitors command)")
248
+ .action((competitorId) =>
249
+ api.removeCompetitor(competitorId).then(out).catch(fail)
250
+ );
251
+
252
+ program
253
+ .command("topics")
254
+ .description("The pillar list (topic clusters): queries, ideas and planned articles group under these")
255
+ .action(() => api.topics().then(out).catch(fail));
256
+
257
+ program
258
+ .command("topics-set")
259
+ .description("Replace the full pillar list (create/dedupe/safe-delete reconcile)")
260
+ .argument("<topics...>", "Topic names, space-separated (quote multi-word topics)")
261
+ .action((topics) => api.setTopics(topics).then(out).catch(fail));
262
+
263
+ program
264
+ .command("delete-planned")
265
+ .description("Remove a planned title from the calendar; the title returns to Content Ideas")
266
+ .argument("<contentId>", "Planned contentPage id")
267
+ .action((contentId) => api.deletePlanned(contentId).then(out).catch(fail));
268
+
131
269
  program
132
270
  .command("capacity")
133
271
  .description("Remaining plan slots on the content calendar")
@@ -287,6 +425,11 @@ export function runCli(argv) {
287
425
  api.generateContent(contentId, !!opts.confirm).then(out).catch(fail)
288
426
  );
289
427
 
428
+ program
429
+ .command("shopify-install-url <shop>")
430
+ .description("Mint a Shopify app install link for your store (open it in a browser; the destination is added to the workspace automatically)")
431
+ .action((shop) => api.shopifyInstallUrl(shop).then(out).catch(fail));
432
+
290
433
  program
291
434
  .command("settings")
292
435
  .description("Show the article policy: per-article defaults + flexible scheduling")
@@ -592,6 +735,21 @@ export function runCli(argv) {
592
735
  .description("Brand profile, products, and buyer profiles (ICPs) in one read")
593
736
  .action(() => api.brand().then(out).catch(fail));
594
737
 
738
+ program
739
+ .command("brand-set")
740
+ .description("Update brand identity: name, industry, product description, authors, style reference URLs")
741
+ .option("--name <name>", "Company/brand name")
742
+ .option("--industry <industry>", "Industry label")
743
+ .option("--description <text>", "Product description")
744
+ .option("--json <json>", "Full patch as JSON (or @file.json): {name?, industry?, productDescription?, authors?, styleReferenceUrls?}; authors/styleReferenceUrls replace the stored list")
745
+ .action((opts) => {
746
+ const patch = opts.json ? parseJson(opts.json, "brand-set") : {};
747
+ if (opts.name) patch.name = opts.name;
748
+ if (opts.industry) patch.industry = opts.industry;
749
+ if (opts.description) patch.productDescription = opts.description;
750
+ api.brandIdentitySet(patch).then(out).catch(fail);
751
+ });
752
+
595
753
  program
596
754
  .command("brand-profile-set")
597
755
  .description("Patch brand voice/style fields. --json '{\"tone\":\"...\"}' or --json @file.json")
package/src/client.mjs CHANGED
@@ -113,6 +113,8 @@ export const api = {
113
113
  request("POST", "/api/v1/content/publish", { contentId, confirm }),
114
114
  generateContent: (contentId, confirm = false) =>
115
115
  request("POST", "/api/v1/content/generate", { contentId, confirm }),
116
+ shopifyInstallUrl: (shop) =>
117
+ request("POST", "/api/v1/integrations/shopify/install-url", { shop }),
116
118
  internalLinks: (contentId) =>
117
119
  request(
118
120
  "GET",
@@ -143,9 +145,39 @@ export const api = {
143
145
  repurposePush: (opts) => request("POST", "/api/v1/repurpose/push", opts),
144
146
  trackedQueries: () => request("GET", "/api/v1/queries"),
145
147
  addQuery: (queryText) => request("POST", "/api/v1/queries", { queryText }),
148
+ removeQuery: (queryId) =>
149
+ request("POST", "/api/v1/queries/remove", { queryId }),
150
+ setQueryTracking: (queryId, tracked) =>
151
+ request("POST", "/api/v1/queries/set-tracking", { queryId, tracked }),
152
+ updateQuery: (queryId, queryText) =>
153
+ request("POST", "/api/v1/queries/update", { queryId, queryText }),
154
+ competitors: () => request("GET", "/api/v1/competitors"),
155
+ addCompetitor: (name, websiteUrl) =>
156
+ request("POST", "/api/v1/competitors", { name, websiteUrl }),
157
+ removeCompetitor: (competitorId) =>
158
+ request("POST", "/api/v1/competitors/remove", { competitorId }),
159
+ topics: () => request("GET", "/api/v1/topics"),
160
+ setTopics: (topics) => request("POST", "/api/v1/topics", { topics }),
161
+ deletePlanned: (contentId) =>
162
+ request("POST", "/api/v1/content/delete-planned", { contentId }),
146
163
  crawlerAccess: () => request("GET", "/api/v1/crawler-access"),
147
164
  trafficOverview: (days = 30) =>
148
165
  request("GET", `/api/v1/analytics/traffic?days=${days}`),
166
+ analyticsSources: () => request("GET", "/api/v1/analytics/sources"),
167
+ setAnalyticsSource: (dataType, source) =>
168
+ request("POST", "/api/v1/analytics/sources", { dataType, source }),
169
+ activateScreen: (screen) =>
170
+ request("POST", "/api/v1/analytics/activate", { screen }),
171
+ cloudflareConnectUrl: () =>
172
+ request("POST", "/api/v1/integrations/cloudflare/connect-url"),
173
+ cloudflareZones: () =>
174
+ request("GET", "/api/v1/integrations/cloudflare/zones"),
175
+ cloudflareSelectZone: (zoneId, zoneName) =>
176
+ request("POST", "/api/v1/integrations/cloudflare/zone", { zoneId, zoneName }),
177
+ framerInstallEmbed: (opts = {}) =>
178
+ request("POST", "/api/v1/integrations/framer/install-embed", opts),
179
+ webflowInstallCustomCode: (opts = {}) =>
180
+ request("POST", "/api/v1/integrations/webflow/custom-code", opts),
149
181
  team: () => request("GET", "/api/v1/team"),
150
182
  teamInvite: (opts) => request("POST", "/api/v1/team/invite", opts),
151
183
  teamRevoke: (invitationId) =>
@@ -202,6 +234,7 @@ export const api = {
202
234
  request("POST", "/api/v1/social/draft-reply", { threadId, mentionMode }),
203
235
  support: (opts) => request("POST", "/api/v1/support", opts),
204
236
  brand: () => request("GET", "/api/v1/brand"),
237
+ brandIdentitySet: (opts) => request("POST", "/api/v1/brand", opts),
205
238
  brandProfileSet: (opts) => request("POST", "/api/v1/brand/profile", opts),
206
239
  brandProductWrite: (opts) => request("POST", "/api/v1/brand/product", opts),
207
240
  brandIcpWrite: (opts) => request("POST", "/api/v1/brand/icp", opts),
package/src/login.mjs CHANGED
@@ -6,13 +6,22 @@ import {
6
6
  deleteStoredConfig,
7
7
  } from "./client.mjs";
8
8
 
9
+ // Owner self-connection gets every grantable scope (server grants the full
10
+ // set on approval regardless; "admin" keys are minted in Settings only).
9
11
  const DEFAULT_SCOPES = [
10
12
  "read:citations",
11
13
  "read:content",
12
14
  "read:leads",
13
15
  "read:analytics",
14
16
  "write:content",
17
+ "write:queries",
18
+ "write:leads",
19
+ "write:backlinks",
20
+ "write:social",
15
21
  "write:publish",
22
+ "manage:integrations",
23
+ "manage:org",
24
+ "trigger:agents",
16
25
  ];
17
26
 
18
27
  function openBrowser(url) {
@@ -31,9 +40,9 @@ function openBrowser(url) {
31
40
  }
32
41
  }
33
42
 
34
- export async function login({ scopes } = {}) {
43
+ export async function login() {
35
44
  const { baseUrl, appUrl } = getBaseUrls();
36
- const requested = scopes?.length ? scopes : DEFAULT_SCOPES;
45
+ const requested = DEFAULT_SCOPES;
37
46
 
38
47
  const startRes = await fetch(`${baseUrl}/api/v1/auth/device/start`, {
39
48
  method: "POST",
package/src/mcp.mjs CHANGED
@@ -106,11 +106,93 @@ export async function startMcpServer() {
106
106
 
107
107
  server.tool(
108
108
  "get_crawler_access",
109
- "Daily AI-crawler reachability probe result: whether the site's edge (e.g. Cloudflare Bot Fight Mode) or robots.txt blocks GPTBot/ClaudeBot a blocked site cannot be read or cited by AI engines.",
109
+ "Daily AI-crawler reachability probe result — a DIAGNOSTIC, not a traffic metric: whether the site's edge (e.g. Cloudflare Bot Fight Mode) or robots.txt blocks GPTBot/ClaudeBot. 'shielded' means browsers and bots are both challenged (site-wide shield, ambiguous for real, signed crawlers).",
110
110
  {},
111
111
  run(() => api.crawlerAccess())
112
112
  );
113
113
 
114
+ server.tool(
115
+ "get_analytics_sources",
116
+ "Per-workspace analytics source setup: the selected writer for human traffic and AI-crawler data, which sources the setup qualifies for, and install state (Cloudflare zone/sync, WordPress plugin version, embed liveness). Both Analytics and Reports screens ship disabled until activated.",
117
+ {},
118
+ run(() => api.analyticsSources())
119
+ );
120
+
121
+ server.tool(
122
+ "set_analytics_source",
123
+ "Select the active writer for a data type. Validated server-side against what the customer's setup supports. Switching aiCrawlers to cloudflare starts a backfill sync.",
124
+ {
125
+ dataType: z.enum(["humanTraffic", "aiCrawlers"]),
126
+ source: z
127
+ .string()
128
+ .describe("embed, wordpress_plugin, cloudflare or none"),
129
+ },
130
+ run(({ dataType, source }) => api.setAnalyticsSource(dataType, source))
131
+ );
132
+
133
+ server.tool(
134
+ "activate_analytics_screen",
135
+ "Turn on the Analytics or Reports screen for this workspace (they ship disabled; activation is one-time per screen).",
136
+ { screen: z.enum(["analytics", "reports"]) },
137
+ run(({ screen }) => api.activateScreen(screen))
138
+ );
139
+
140
+ server.tool(
141
+ "get_cloudflare_connect_url",
142
+ "OAuth URL to connect read-only Cloudflare analytics (AI-crawler data source). Open it in a browser; the grant is scoped to Analytics:Read.",
143
+ {},
144
+ run(() => api.cloudflareConnectUrl())
145
+ );
146
+
147
+ server.tool(
148
+ "list_cloudflare_zones",
149
+ "Cloudflare zones visible to the connected grant, for picking which zone to poll.",
150
+ {},
151
+ run(() => api.cloudflareZones())
152
+ );
153
+
154
+ server.tool(
155
+ "select_cloudflare_zone",
156
+ "Pick the Cloudflare zone to poll. Also selects Cloudflare as the AI-crawler source and starts the first sync (backfills up to 7 days).",
157
+ {
158
+ zoneId: z.string(),
159
+ zoneName: z.string().describe("Zone name, e.g. example.com"),
160
+ },
161
+ run(({ zoneId, zoneName }) => api.cloudflareSelectZone(zoneId, zoneName))
162
+ );
163
+
164
+ server.tool(
165
+ "install_framer_embed",
166
+ "Install site-wide visit tracking on the connected Framer project via its custom-code API. Dry run unless confirm is true. Confirming ALSO PUBLISHES the customer's Framer site.",
167
+ {
168
+ integrationId: z.string().optional(),
169
+ confirm: z.boolean().optional().describe("Actually install (default: dry run)"),
170
+ },
171
+ run(({ integrationId, confirm }) =>
172
+ api.framerInstallEmbed({
173
+ ...(integrationId ? { integrationId } : {}),
174
+ confirm: confirm === true,
175
+ })
176
+ )
177
+ );
178
+
179
+ server.tool(
180
+ "install_webflow_custom_code",
181
+ "Register and apply the tracking loader via Webflow's Custom Code API. Dry run unless confirm is true. Needs a site token with CMS + Custom code scopes (pass apiToken to upgrade the stored one). Goes live on the customer's next Webflow site publish.",
182
+ {
183
+ integrationId: z.string().optional(),
184
+ apiToken: z.string().optional().describe("New site token with CMS + Custom code scopes"),
185
+ confirm: z.boolean().optional().describe("Actually install (default: dry run)"),
186
+ },
187
+ run(({ integrationId, apiToken, confirm }) =>
188
+ api.webflowInstallCustomCode({
189
+ ...(integrationId ? { integrationId } : {}),
190
+ ...(apiToken ? { apiToken } : {}),
191
+ confirm: confirm === true,
192
+ })
193
+ )
194
+ );
195
+
114
196
  server.tool(
115
197
  "add_tracked_query",
116
198
  "Add a query to the tracking pool. It starts weekly AI citation checks immediately when a plan slot is free; otherwise it joins the pool untracked.",
@@ -118,6 +200,80 @@ export async function startMcpServer() {
118
200
  run(({ queryText }) => api.addQuery(queryText))
119
201
  );
120
202
 
203
+ server.tool(
204
+ "remove_tracked_query",
205
+ "Delete a query from the tracking pool. Frees its plan slot if it was tracking.",
206
+ { queryId: z.string().describe("Query id from get_tracked_queries") },
207
+ run(({ queryId }) => api.removeQuery(queryId))
208
+ );
209
+
210
+ server.tool(
211
+ "set_query_tracking",
212
+ "Pause or resume weekly AI citation checks on a pooled query. Tracking consumes one plan slot; pausing frees it. The query stays in the pool either way.",
213
+ {
214
+ queryId: z.string().describe("Query id from get_tracked_queries"),
215
+ tracked: z.boolean().describe("true to track weekly, false to pause"),
216
+ },
217
+ run(({ queryId, tracked }) => api.setQueryTracking(queryId, tracked))
218
+ );
219
+
220
+ server.tool(
221
+ "update_tracked_query",
222
+ "Rewrite a tracked query's text. Future weekly checks use the new text.",
223
+ {
224
+ queryId: z.string().describe("Query id from get_tracked_queries"),
225
+ queryText: z.string().describe("New query text (min 5 characters)"),
226
+ },
227
+ run(({ queryId, queryText }) => api.updateQuery(queryId, queryText))
228
+ );
229
+
230
+ server.tool(
231
+ "get_competitors",
232
+ "Tracked competitors used in share-of-voice and visibility comparisons.",
233
+ {},
234
+ run(() => api.competitors())
235
+ );
236
+
237
+ server.tool(
238
+ "add_competitor",
239
+ "Track a competitor (max 10). They enter weekly share-of-voice comparisons against the org's own citation rate.",
240
+ {
241
+ name: z.string().describe("Competitor name"),
242
+ websiteUrl: z.string().describe("Competitor website URL"),
243
+ },
244
+ run(({ name, websiteUrl }) => api.addCompetitor(name, websiteUrl))
245
+ );
246
+
247
+ server.tool(
248
+ "remove_competitor",
249
+ "Stop tracking a competitor.",
250
+ { competitorId: z.string().describe("Competitor id from get_competitors") },
251
+ run(({ competitorId }) => api.removeCompetitor(competitorId))
252
+ );
253
+
254
+ server.tool(
255
+ "get_topics",
256
+ "The org's pillar list (topic clusters). Tracked queries, content ideas and planned articles all group under these.",
257
+ {},
258
+ run(() => api.topics())
259
+ );
260
+
261
+ server.tool(
262
+ "set_topics",
263
+ "Replace the FULL pillar list. Send every topic that should exist; missing ones are safe-deleted, new ones created, duplicates merged. Read get_topics first and modify that list.",
264
+ {
265
+ topics: z.array(z.string()).describe("The complete list of topic names"),
266
+ },
267
+ run(({ topics }) => api.setTopics(topics))
268
+ );
269
+
270
+ server.tool(
271
+ "delete_planned_title",
272
+ "Remove a planned title from the content calendar. The title returns to Content Ideas as a pool query (deduped), so the topic is not lost. Only planned rows qualify; use archive for generated articles.",
273
+ { contentId: z.string().describe("Planned contentPage id") },
274
+ run(({ contentId }) => api.deletePlanned(contentId))
275
+ );
276
+
121
277
  server.tool(
122
278
  "get_traffic_overview",
123
279
  "Traffic overview from RankControl's own page analytics: total page views, unique visitors, sessions, bounce rate, and average time on page.",
@@ -272,6 +428,15 @@ export async function startMcpServer() {
272
428
  run(({ contentId, confirm }) => api.generateContent(contentId, confirm === true))
273
429
  );
274
430
 
431
+ server.tool(
432
+ "shopify_install_url",
433
+ "Mint an install link for the RankControl Shopify app. A human opens it in a browser and approves the install in Shopify; the Shopify destination is then added to the workspace automatically. The link expires in 10 minutes and minting it has no side effect on its own.",
434
+ {
435
+ shop: z.string().describe("The store's .myshopify.com domain"),
436
+ },
437
+ run(({ shop }) => api.shopifyInstallUrl(shop))
438
+ );
439
+
275
440
  server.tool(
276
441
  "get_article_settings",
277
442
  "The workspace article policy: per-article defaults (auto-write, auto-publish, images, title-in-hero, section infographics, Related Reading, YouTube, emojis, link counts, global instructions) plus the flexible-scheduling flag.",
@@ -620,6 +785,30 @@ export async function startMcpServer() {
620
785
  run((args) => api.brandProfileSet(args))
621
786
  );
622
787
 
788
+ server.tool(
789
+ "update_brand_identity",
790
+ "Update workspace identity: name, industry, productDescription, authors (EEAT bylines used in article JSON-LD), styleReferenceUrls (articles whose writing style the writer imitates). authors and styleReferenceUrls REPLACE the stored list — call get_brand first and send the full updated list. websiteUrl is immutable and cannot be changed.",
791
+ {
792
+ name: z.string().optional(),
793
+ industry: z.string().optional(),
794
+ productDescription: z.string().optional(),
795
+ authors: z
796
+ .array(
797
+ z.object({
798
+ name: z.string(),
799
+ bio: z.string().optional(),
800
+ linkedinUrl: z
801
+ .string()
802
+ .optional()
803
+ .describe("Person sameAs URL for article JSON-LD"),
804
+ })
805
+ )
806
+ .optional(),
807
+ styleReferenceUrls: z.array(z.string()).optional(),
808
+ },
809
+ run((args) => api.brandIdentitySet(args))
810
+ );
811
+
623
812
  server.tool(
624
813
  "write_brand_product",
625
814
  "Create, update, or delete a product in brand memory (feeds article context + entity triples). Create: name+description+category. Update: productId + changed fields. Delete: productId + del=true.",