thorbit-content-mcp 0.1.2 → 0.1.4

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/dist/index.cjs CHANGED
@@ -84,6 +84,27 @@ var ThorbitContentExtractUrlInputSchema = {
84
84
  };
85
85
  var McpScraperProxyModeSchema = import_zod.z.enum(["location", "configured", "none"]);
86
86
  var McpScraperSerpDeviceSchema = import_zod.z.enum(["desktop", "mobile"]);
87
+ var PipelineModeSchema = import_zod.z.enum(["brief", "write", "optimize"]);
88
+ var ContentPipelineSourceKindSchema = import_zod.z.enum([
89
+ "search-console-query",
90
+ "topic-map-node",
91
+ "data-hub-roadmap",
92
+ "ranked-keyword",
93
+ "competitor-keyword",
94
+ "eics-entity",
95
+ "phrase-question",
96
+ "manual-keyword"
97
+ ]);
98
+ var ContentPipelineSourceRefSchema = import_zod.z.object({
99
+ sourceKind: ContentPipelineSourceKindSchema,
100
+ keyword: import_zod.z.string().min(1).max(200),
101
+ sourcePublicId: import_zod.z.string().min(1).max(128).optional(),
102
+ title: import_zod.z.string().min(1).max(300).optional(),
103
+ reason: import_zod.z.string().min(1).max(1e3).optional(),
104
+ sourceUrl: import_zod.z.string().url().optional(),
105
+ metrics: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional(),
106
+ selectedAt: import_zod.z.string().datetime().optional()
107
+ }).strict();
87
108
  var ThorbitContentHarvestSerpInputSchema = {
88
109
  query: import_zod.z.string().min(1).max(400).describe('Core search topic. Separate location when possible, e.g. query="best CRM" and location="Denver, CO".'),
89
110
  location: import_zod.z.string().min(1).max(160).optional().describe("Optional search location, such as Denver, CO. Required for precise residential proxy targeting."),
@@ -111,26 +132,114 @@ var ThorbitContentRedditResearchInputSchema = {
111
132
  readWithBrowserAgent: import_zod.z.boolean().default(true).describe("Keep true. Reads Reddit candidates through MCP Scraper browser-agent."),
112
133
  profile: import_zod.z.string().min(1).max(128).optional().describe("Optional MCP Scraper browser-agent saved profile name.")
113
134
  };
135
+ var ThorbitOnPageSourceSelectionSchema = import_zod.z.discriminatedUnion("mode", [
136
+ import_zod.z.object({ mode: import_zod.z.literal("keyword_only") }).strict(),
137
+ import_zod.z.object({
138
+ mode: import_zod.z.literal("inline_content"),
139
+ title: import_zod.z.string().min(1).max(255).optional(),
140
+ text: import_zod.z.string().min(20).max(5e5),
141
+ sourceUrl: import_zod.z.string().url().optional()
142
+ }).strict(),
143
+ import_zod.z.object({ mode: import_zod.z.literal("content_piece"), contentPiecePublicId: import_zod.z.string().min(1) }).strict(),
144
+ import_zod.z.object({
145
+ mode: import_zod.z.literal("wordpress_plugin_page"),
146
+ connectionPublicId: import_zod.z.string().min(1),
147
+ externalPostId: import_zod.z.number().int().positive()
148
+ }).strict(),
149
+ import_zod.z.object({
150
+ mode: import_zod.z.literal("wordpress_api_page"),
151
+ connectionPublicId: import_zod.z.string().min(1),
152
+ connectionPagePublicId: import_zod.z.string().min(1)
153
+ }).strict(),
154
+ import_zod.z.object({
155
+ mode: import_zod.z.literal("project_website_scrape"),
156
+ websitePagePublicId: import_zod.z.string().min(1)
157
+ }).strict()
158
+ ]);
159
+ var ThorbitContentOpportunitiesListInputSchema = {
160
+ projectPublicId: import_zod.z.string().min(1).describe("Thorbit project public ID."),
161
+ sourceKind: ContentPipelineSourceKindSchema.optional().describe("Optional content opportunity source kind filter."),
162
+ limit: import_zod.z.number().int().min(1).max(100).default(10).describe("Maximum opportunities per source.")
163
+ };
164
+ var ThorbitContentPipelineStartInputSchema = {
165
+ projectPublicId: import_zod.z.string().min(1).describe("Thorbit project public ID."),
166
+ keyword: import_zod.z.string().min(1).max(200).describe("Target keyword or query for the content pipeline."),
167
+ mode: PipelineModeSchema.describe("Content pipeline mode: brief, write, or optimize."),
168
+ reviewBrief: import_zod.z.boolean().default(false).describe("Pause after brief generation for review before writing."),
169
+ notes: import_zod.z.string().max(500).optional().describe("Optional writing or strategy instructions."),
170
+ existingContentPiecePublicId: import_zod.z.string().min(1).optional().describe("Required for optimize mode. Existing Thorbit content piece public ID."),
171
+ writingStyleId: import_zod.z.number().int().positive().optional().describe("Optional Thorbit writing style ID."),
172
+ maxIterations: import_zod.z.number().int().min(0).max(3).optional().describe("Optional verification/improvement iteration cap."),
173
+ analysisPublicId: import_zod.z.string().min(1).optional().describe("Optional related on-page analysis public ID."),
174
+ source: ContentPipelineSourceRefSchema.optional().describe("Optional persisted content opportunity source reference.")
175
+ };
176
+ var ThorbitContentPipelineGetInputSchema = {
177
+ jobPublicId: import_zod.z.string().min(1).describe("Content pipeline workflow job public ID."),
178
+ includePhaseData: import_zod.z.boolean().default(true).describe("Include raw workflow phaseData in addition to the normalized run view.")
179
+ };
180
+ var ThorbitContentPipelineResumeInputSchema = {
181
+ jobPublicId: import_zod.z.string().min(1).describe("Paused content pipeline workflow job public ID."),
182
+ userInstructions: import_zod.z.string().max(4e3).default("").describe("Optional instructions to append before resuming.")
183
+ };
184
+ var ThorbitContentPipelineStartFromBriefInputSchema = {
185
+ briefPublicId: import_zod.z.string().min(1).describe("Approved Thorbit brief public ID."),
186
+ analysisPublicId: import_zod.z.string().min(1).describe("On-page analysis public ID associated with the brief."),
187
+ writingStyleId: import_zod.z.number().int().positive().optional().describe("Optional Thorbit writing style ID.")
188
+ };
189
+ var ThorbitContentPipelineImproveInputSchema = {
190
+ jobOrPiecePublicId: import_zod.z.string().min(1).describe("Existing content pipeline job public ID or content piece public ID to improve.")
191
+ };
192
+ var ThorbitOnPageListSourcesInputSchema = {
193
+ projectPublicId: import_zod.z.string().min(1).describe("Thorbit project public ID."),
194
+ kind: import_zod.z.enum(["keyword", "wordpress_plugin", "wordpress_api", "project_website_scrape"]).optional().describe("Optional source kind filter."),
195
+ search: import_zod.z.string().max(200).optional().describe("Optional search string for page/title/url filtering."),
196
+ limit: import_zod.z.number().int().min(1).max(100).default(25).describe("Maximum source options to return."),
197
+ offset: import_zod.z.number().int().min(0).default(0).describe("Pagination offset."),
198
+ connectionPublicId: import_zod.z.string().min(1).optional().describe("Optional WordPress connection public ID filter.")
199
+ };
114
200
  var ThorbitOnPageStartAnalysisInputSchema = {
115
201
  projectPublicId: import_zod.z.string().min(1).describe("Thorbit project public ID."),
116
- keyword: import_zod.z.string().min(1).max(200).describe("Target keyword or query for on-page analysis."),
202
+ keyword: import_zod.z.string().min(1).max(200).optional().describe("Target keyword or query. Required for keyword-only and inline-content analysis; can be inferred for selected stored sources."),
117
203
  force: import_zod.z.boolean().default(false).describe("Force restart if an analysis is already running."),
118
- source: import_zod.z.discriminatedUnion("mode", [
119
- import_zod.z.object({ mode: import_zod.z.literal("keyword_only") }).strict(),
120
- import_zod.z.object({
121
- mode: import_zod.z.literal("inline_content"),
122
- title: import_zod.z.string().min(1).max(255).optional(),
123
- text: import_zod.z.string().min(20).max(5e5),
124
- sourceUrl: import_zod.z.string().url().optional()
125
- }).strict()
126
- ]).default({ mode: "keyword_only" }).describe("Use keyword_only for research-only analysis or inline_content to score provided content.")
204
+ source: ThorbitOnPageSourceSelectionSchema.default({ mode: "keyword_only" }).describe("Source to analyze: keyword_only, inline_content, content_piece, wordpress_plugin_page, wordpress_api_page, or project_website_scrape.")
127
205
  };
128
206
  var ThorbitOnPageGetAnalysisInputSchema = {
129
- analysisPublicId: import_zod.z.string().min(1).describe("On-page analysis public ID returned by thorbit_onpage_start_analysis.")
207
+ analysisPublicId: import_zod.z.string().min(1).describe("On-page analysis public ID returned by thorbit_onpage_start_analysis."),
208
+ detail: import_zod.z.enum(["summary", "standard", "full"]).default("standard").describe("Analysis detail level. Use full for SERP, competitors, clusters, entities, demand, brief, strategy, and raw analysis data."),
209
+ includeBrief: import_zod.z.boolean().default(true).describe("Include persisted brief content and structured brief data when available."),
210
+ includeStrategy: import_zod.z.boolean().default(true).describe("Include persisted strategy content when available."),
211
+ includeRawAnalysisData: import_zod.z.boolean().default(false).describe("Include raw analysisData JSON. Automatically included for detail=full.")
212
+ };
213
+ var ThorbitOnPageGetEditorContentInputSchema = {
214
+ analysisPublicId: import_zod.z.string().min(1).describe("On-page analysis public ID.")
215
+ };
216
+ var ThorbitOnPageRescoreAnalysisInputSchema = {
217
+ analysisPublicId: import_zod.z.string().min(1).describe("Completed on-page analysis public ID."),
218
+ editorContentPiecePublicId: import_zod.z.string().min(1).optional().describe("Editable content piece public ID returned by thorbit_onpage_get_editor_content."),
219
+ contentPiecePublicId: import_zod.z.string().min(1).optional().describe("Alternate content piece public ID to score.")
220
+ };
221
+ var ThorbitOnPageGenerateBriefInputSchema = {
222
+ analysisPublicId: import_zod.z.string().min(1).describe("Completed on-page analysis public ID. Returns an existing brief immediately, or queues generation and returns a job ID plus a thorbit_onpage_get_analysis poll target."),
223
+ regenerate: import_zod.z.boolean().default(false).describe("Regenerate an existing brief instead of returning it. Regeneration queues work and should be polled with thorbit_onpage_get_analysis.")
224
+ };
225
+ var ThorbitOnPageGenerateStrategyInputSchema = {
226
+ analysisPublicId: import_zod.z.string().min(1).describe("Completed on-page analysis public ID."),
227
+ articleContent: import_zod.z.string().min(20).max(5e5).optional().describe("Optional article content to include in strategy generation.")
228
+ };
229
+ var ThorbitOnPageProposeEditsInputSchema = {
230
+ analysisPublicId: import_zod.z.string().min(1).describe("Completed full-mode on-page analysis public ID.")
231
+ };
232
+ var ThorbitOnPageUpdateEditStatusInputSchema = {
233
+ analysisPublicId: import_zod.z.string().min(1).describe("On-page analysis public ID with a proposed edit session."),
234
+ editId: import_zod.z.string().min(1).describe("Edit ID from thorbit_onpage_propose_edits."),
235
+ status: import_zod.z.enum(["accepted", "rejected"]).describe("Accept or reject this proposed edit.")
236
+ };
237
+ var ThorbitOnPageApplyEditsInputSchema = {
238
+ analysisPublicId: import_zod.z.string().min(1).describe("On-page analysis public ID with accepted edits.")
130
239
  };
131
240
 
132
241
  // src/content-onpage-mcp-server.ts
133
- var VERSION = "0.1.2";
242
+ var VERSION = "0.1.3";
134
243
  function readOnlyAnnotations(title, openWorldHint = true) {
135
244
  return {
136
245
  title,
@@ -189,18 +298,102 @@ function buildThorbitContentOnPageMcpServer(client) {
189
298
  inputSchema: ThorbitContentRedditResearchInputSchema,
190
299
  annotations: readOnlyAnnotations("Research Reddit With Browser Agent")
191
300
  });
301
+ registerTool("thorbit_content_opportunities_list", {
302
+ title: "List Content Opportunities",
303
+ description: "List persisted Thorbit content opportunity candidates for a project. Use this before starting content pipeline work from GSC, topic-map, roadmap, ranked keyword, competitor, entity, or question sources.",
304
+ inputSchema: ThorbitContentOpportunitiesListInputSchema,
305
+ annotations: readOnlyAnnotations("List Content Opportunities", false)
306
+ });
307
+ registerTool("thorbit_content_pipeline_start", {
308
+ title: "Start Content Pipeline",
309
+ description: "Start the Thorbit content pipeline in brief, write, or optimize mode. Supports persisted opportunity sources, approved project context, writing style IDs, brief review pauses, existing content optimization, and metered durable workflow dispatch.",
310
+ inputSchema: ThorbitContentPipelineStartInputSchema,
311
+ annotations: writeAnnotations("Start Content Pipeline")
312
+ });
313
+ registerTool("thorbit_content_pipeline_get", {
314
+ title: "Read Content Pipeline",
315
+ description: "Read a Thorbit content pipeline workflow job and normalized content creation run view, including phase, next actions, brief/article markdown, writer sections, model call telemetry, publication summary, and optional raw phaseData.",
316
+ inputSchema: ThorbitContentPipelineGetInputSchema,
317
+ annotations: readOnlyAnnotations("Read Content Pipeline", false)
318
+ });
319
+ registerTool("thorbit_content_pipeline_resume", {
320
+ title: "Resume Content Pipeline",
321
+ description: "Resume a paused Thorbit content pipeline after strategy or brief review, optionally appending user instructions before the next phase dispatch.",
322
+ inputSchema: ThorbitContentPipelineResumeInputSchema,
323
+ annotations: writeAnnotations("Resume Content Pipeline")
324
+ });
325
+ registerTool("thorbit_content_pipeline_start_from_brief", {
326
+ title: "Start Writing From Brief",
327
+ description: "Start the Thorbit write pipeline directly from an approved brief and its on-page analysis. Use after thorbit_onpage_generate_brief or an existing approved Thorbit brief.",
328
+ inputSchema: ThorbitContentPipelineStartFromBriefInputSchema,
329
+ annotations: writeAnnotations("Start Writing From Brief")
330
+ });
331
+ registerTool("thorbit_content_pipeline_improve", {
332
+ title: "Improve Existing Content",
333
+ description: "Start a Thorbit improvement loop for an existing content pipeline job or content piece. Scores the article, identifies gaps, rewrites, and re-scores through the durable content pipeline.",
334
+ inputSchema: ThorbitContentPipelineImproveInputSchema,
335
+ annotations: writeAnnotations("Improve Existing Content")
336
+ });
337
+ registerTool("thorbit_onpage_list_sources", {
338
+ title: "List On-Page Source Options",
339
+ description: "List source options that can feed on-page analysis: keyword-only, WordPress Plugin pages, WordPress API synced pages, and project website scrape pages. Use before selecting a stored page source for analysis.",
340
+ inputSchema: ThorbitOnPageListSourcesInputSchema,
341
+ annotations: readOnlyAnnotations("List On-Page Source Options", false)
342
+ });
192
343
  registerTool("thorbit_onpage_start_analysis", {
193
344
  title: "Start Thorbit On-Page Analysis",
194
- description: "Start a Thorbit on-page analysis for a project keyword. Can run keyword-only analysis or score provided inline content. Hosted Thorbit dispatches the durable analysis workflow and meters usage against the MCP API key.",
345
+ description: "Start a Thorbit on-page analysis for a project. Supports keyword-only, inline content, existing Thorbit content pieces, WordPress Plugin pages, WordPress API synced pages, and project website scrape pages. Hosted Thorbit resolves source content, infers keywords when possible, dispatches the durable analysis workflow, and meters usage against the MCP API key.",
195
346
  inputSchema: ThorbitOnPageStartAnalysisInputSchema,
196
347
  annotations: writeAnnotations("Start Thorbit On-Page Analysis")
197
348
  });
198
349
  registerTool("thorbit_onpage_get_analysis", {
199
350
  title: "Read Thorbit On-Page Analysis",
200
- description: "Read persisted on-page analysis status, score, signal counts, and content report summary by analysis public ID. Use after thorbit_onpage_start_analysis to poll durable results.",
351
+ description: "Read persisted on-page analysis status, score, signal counts, brief, strategy, editor state, and optional full analysis surfaces: SERP, competitors, topic/demand clusters, Reddit/YouTube, entities, PMI, scoring, content reports, proposed edits, and raw analysisData.",
201
352
  inputSchema: ThorbitOnPageGetAnalysisInputSchema,
202
353
  annotations: readOnlyAnnotations("Read Thorbit On-Page Analysis", false)
203
354
  });
355
+ registerTool("thorbit_onpage_get_editor_content", {
356
+ title: "Read On-Page Editor Content",
357
+ description: "Read or materialize editable content for a completed on-page analysis. Creates an editable Thorbit draft from the selected stored source when needed, then returns content piece ID, text, word count, source URL, and stale-score state.",
358
+ inputSchema: ThorbitOnPageGetEditorContentInputSchema,
359
+ annotations: readOnlyAnnotations("Read On-Page Editor Content", false)
360
+ });
361
+ registerTool("thorbit_onpage_rescore_analysis", {
362
+ title: "Re-Score On-Page Content",
363
+ description: "Re-score a completed on-page analysis against the current editable content piece without re-running expensive SERP and competitor collection. Returns a page-analysis-rescore job ID for progress polling.",
364
+ inputSchema: ThorbitOnPageRescoreAnalysisInputSchema,
365
+ annotations: writeAnnotations("Re-Score On-Page Content")
366
+ });
367
+ registerTool("thorbit_onpage_generate_brief", {
368
+ title: "Generate On-Page Brief",
369
+ description: "Return an existing Thorbit final writer brief immediately, or queue brief generation for a completed on-page analysis and return a job ID plus a thorbit_onpage_get_analysis poll target. Persists brief content and structured brief data for later writing.",
370
+ inputSchema: ThorbitOnPageGenerateBriefInputSchema,
371
+ annotations: writeAnnotations("Generate On-Page Brief")
372
+ });
373
+ registerTool("thorbit_onpage_generate_strategy", {
374
+ title: "Generate On-Page Strategy",
375
+ description: "Generate and persist the Thorbit on-page strategy document for a completed analysis, optionally using article content as context.",
376
+ inputSchema: ThorbitOnPageGenerateStrategyInputSchema,
377
+ annotations: writeAnnotations("Generate On-Page Strategy")
378
+ });
379
+ registerTool("thorbit_onpage_propose_edits", {
380
+ title: "Propose On-Page Edits",
381
+ description: "Ask Thorbit to propose 3-8 targeted content edits from the completed analysis gaps and editable content. Persists an edit session with pending/invalid edits.",
382
+ inputSchema: ThorbitOnPageProposeEditsInputSchema,
383
+ annotations: writeAnnotations("Propose On-Page Edits")
384
+ });
385
+ registerTool("thorbit_onpage_update_edit_status", {
386
+ title: "Accept Or Reject On-Page Edit",
387
+ description: "Accept or reject one proposed edit in an on-page edit session before applying edits to the Thorbit content piece.",
388
+ inputSchema: ThorbitOnPageUpdateEditStatusInputSchema,
389
+ annotations: writeAnnotations("Accept Or Reject On-Page Edit")
390
+ });
391
+ registerTool("thorbit_onpage_apply_edits", {
392
+ title: "Apply On-Page Edits",
393
+ description: "Apply all accepted on-page edits to the editable Thorbit content piece and create before/after content version snapshots.",
394
+ inputSchema: ThorbitOnPageApplyEditsInputSchema,
395
+ annotations: writeAnnotations("Apply On-Page Edits")
396
+ });
204
397
  return server;
205
398
  }
206
399
 
@@ -237,8 +430,22 @@ var ThorbitContentOnPageMcpToolNames = [
237
430
  "thorbit_content_extract_url",
238
431
  "thorbit_content_harvest_serp",
239
432
  "thorbit_content_reddit_research",
433
+ "thorbit_content_opportunities_list",
434
+ "thorbit_content_pipeline_start",
435
+ "thorbit_content_pipeline_get",
436
+ "thorbit_content_pipeline_resume",
437
+ "thorbit_content_pipeline_start_from_brief",
438
+ "thorbit_content_pipeline_improve",
439
+ "thorbit_onpage_list_sources",
240
440
  "thorbit_onpage_start_analysis",
241
- "thorbit_onpage_get_analysis"
441
+ "thorbit_onpage_get_analysis",
442
+ "thorbit_onpage_get_editor_content",
443
+ "thorbit_onpage_rescore_analysis",
444
+ "thorbit_onpage_generate_brief",
445
+ "thorbit_onpage_generate_strategy",
446
+ "thorbit_onpage_propose_edits",
447
+ "thorbit_onpage_update_edit_status",
448
+ "thorbit_onpage_apply_edits"
242
449
  ];
243
450
  // Annotate the CommonJS export names for ESM import in node:
244
451
  0 && (module.exports = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/content-onpage-api-client.ts","../src/content-onpage-mcp-server.ts","../src/content-onpage-mcp-response-formatters.ts","../src/content-onpage-mcp-tool-schemas.ts","../src/content-onpage-mcp-env.ts","../src/content-onpage-mcp-tool-names.ts"],"sourcesContent":["export { ThorbitContentOnPageApiClient } from './content-onpage-api-client.js'\nexport { buildThorbitContentOnPageMcpServer } from './content-onpage-mcp-server.js'\nexport { resolveThorbitContentOnPageMcpEnv } from './content-onpage-mcp-env.js'\nexport { ThorbitContentOnPageMcpToolNames } from './content-onpage-mcp-tool-names.js'\n","import type { ThorbitContentOnPageMcpToolName } from './content-onpage-mcp-tool-names.js'\n\nexport type ThorbitContentOnPageMcpEnvelope =\n | {\n ok: true\n result: unknown\n warnings?: string[]\n requestId: string\n usage?: Record<string, unknown>\n }\n | {\n ok: false\n error: {\n code: string\n message: string\n details?: unknown\n }\n requestId: string\n }\n\nexport class ThorbitContentOnPageApiClient {\n private readonly baseUrl: string\n private readonly apiKey: string\n\n constructor(options: { baseUrl: string; apiKey: string }) {\n this.baseUrl = options.baseUrl.replace(/\\/$/, '')\n this.apiKey = options.apiKey\n }\n\n async callTool(toolName: ThorbitContentOnPageMcpToolName, input: unknown): Promise<ThorbitContentOnPageMcpEnvelope> {\n const response = await fetch(`${this.baseUrl}/api/v1/mcp/content-onpage/${toolName}`, {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${this.apiKey}`,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(input ?? {}),\n })\n\n const body = await response.json().catch(() => null) as ThorbitContentOnPageMcpEnvelope | null\n if (body && typeof body === 'object' && 'ok' in body) return body\n\n return {\n ok: false,\n requestId: 'unavailable',\n error: {\n code: response.ok ? 'invalid_response' : `http_${response.status}`,\n message: response.ok ? 'Thorbit returned an invalid MCP response' : `Thorbit API request failed with HTTP ${response.status}`,\n },\n }\n }\n}\n","import { McpServer, ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport type { ToolAnnotations } from '@modelcontextprotocol/sdk/types.js'\nimport type { ZodRawShape } from 'zod'\nimport type { ThorbitContentOnPageApiClient } from './content-onpage-api-client.js'\nimport { formatThorbitContentOnPageMcpToolResult } from './content-onpage-mcp-response-formatters.js'\nimport {\n ThorbitContentExtractUrlInputSchema,\n ThorbitContentHarvestSerpInputSchema,\n ThorbitContentRedditResearchInputSchema,\n ThorbitOnPageGetAnalysisInputSchema,\n ThorbitOnPageStartAnalysisInputSchema,\n} from './content-onpage-mcp-tool-schemas.js'\nimport type { ThorbitContentOnPageMcpToolName } from './content-onpage-mcp-tool-names.js'\n\nconst VERSION = '0.1.2'\n\ntype ThorbitContentOnPageToolConfig<InputArgs extends ZodRawShape> = {\n title: string\n description: string\n inputSchema: InputArgs\n annotations: ToolAnnotations\n}\n\nfunction readOnlyAnnotations(title: string, openWorldHint = true) {\n return {\n title,\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint,\n }\n}\n\nfunction writeAnnotations(title: string, openWorldHint = false) {\n return {\n title,\n readOnlyHint: false,\n destructiveHint: false,\n idempotentHint: false,\n openWorldHint,\n }\n}\n\nexport function buildThorbitContentOnPageMcpServer(client: ThorbitContentOnPageApiClient): McpServer {\n const server = new McpServer({ name: 'thorbit-content-mcp', version: VERSION })\n\n server.registerResource(\n 'analysis',\n new ResourceTemplate('thorbit-content://analyses/{analysisPublicId}', { list: undefined }),\n {\n title: 'Thorbit On-Page Analysis',\n description: 'Status, score, signal counts, and summary for one Thorbit on-page analysis.',\n mimeType: 'application/json',\n },\n async (uri, variables) => {\n const analysisPublicId = Array.isArray(variables.analysisPublicId)\n ? variables.analysisPublicId[0]\n : variables.analysisPublicId\n const envelope = await client.callTool('thorbit_onpage_get_analysis', { analysisPublicId: String(analysisPublicId) })\n return { contents: [{ uri: uri.href, mimeType: 'application/json', text: JSON.stringify(envelope, null, 2) }] }\n },\n )\n\n function registerTool<T extends ThorbitContentOnPageMcpToolName>(\n toolName: T,\n config: ThorbitContentOnPageToolConfig<ZodRawShape>,\n ): void {\n server.registerTool(toolName, config, async (input) => {\n const envelope = await client.callTool(toolName, input)\n return formatThorbitContentOnPageMcpToolResult(toolName, envelope)\n })\n }\n\n registerTool('thorbit_content_extract_url', {\n title: 'Extract URL For Content Analysis',\n description: 'Extract a public URL through MCP Scraper only. Use this before content audits, source ingestion, outline planning, or on-page comparisons. Browser fallback is enabled by default for JS-heavy pages.',\n inputSchema: ThorbitContentExtractUrlInputSchema,\n annotations: readOnlyAnnotations('Extract URL For Content Analysis'),\n })\n\n registerTool('thorbit_content_harvest_serp', {\n title: 'Harvest SERP And PAA Evidence',\n description: 'Harvest Google SERP/PAA evidence through MCP Scraper only. Returns the full evidence surface from MCP Scraper: PAA flat questions, PAA tree, organic SERP, local pack, videos/shorts, forums, whatPeopleSaying, AI Overview text/citations/sections, AI Mode, entity IDs, stats, diagnostics, and retry attempts. Split topic from location when possible. Keep proxyMode as location for US city/state SERPs so MCP Scraper rotates fresh residential proxy IDs and browser sessions across retryable CAPTCHA, proxy tunnel, proxy availability, and location-mismatch failures. Pass proxyZip for known city-center ZIP targeting and debug true when retry/proxy diagnostics are needed.',\n inputSchema: ThorbitContentHarvestSerpInputSchema,\n annotations: readOnlyAnnotations('Harvest SERP And PAA Evidence'),\n })\n\n registerTool('thorbit_content_reddit_research', {\n title: 'Research Reddit With MCP Scraper Browser Agent',\n description: 'Find Reddit candidates through MCP Scraper SERP harvest, then read selected posts through MCP Scraper browser-agent by default. Use for authentic audience language, objections, pain points, and questions. Keep proxyMode as location and pass location/proxyZip when the Reddit research has a local market. Do not use generic web scraping fallbacks for Reddit.',\n inputSchema: ThorbitContentRedditResearchInputSchema,\n annotations: readOnlyAnnotations('Research Reddit With Browser Agent'),\n })\n\n registerTool('thorbit_onpage_start_analysis', {\n title: 'Start Thorbit On-Page Analysis',\n description: 'Start a Thorbit on-page analysis for a project keyword. Can run keyword-only analysis or score provided inline content. Hosted Thorbit dispatches the durable analysis workflow and meters usage against the MCP API key.',\n inputSchema: ThorbitOnPageStartAnalysisInputSchema,\n annotations: writeAnnotations('Start Thorbit On-Page Analysis'),\n })\n\n registerTool('thorbit_onpage_get_analysis', {\n title: 'Read Thorbit On-Page Analysis',\n description: 'Read persisted on-page analysis status, score, signal counts, and content report summary by analysis public ID. Use after thorbit_onpage_start_analysis to poll durable results.',\n inputSchema: ThorbitOnPageGetAnalysisInputSchema,\n annotations: readOnlyAnnotations('Read Thorbit On-Page Analysis', false),\n })\n\n return server\n}\n","import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js'\nimport type { ThorbitContentOnPageMcpEnvelope } from './content-onpage-api-client.js'\nimport type { ThorbitContentOnPageMcpToolName } from './content-onpage-mcp-tool-names.js'\n\nexport function formatThorbitContentOnPageMcpToolResult(\n toolName: ThorbitContentOnPageMcpToolName,\n envelope: ThorbitContentOnPageMcpEnvelope,\n): CallToolResult {\n const text = JSON.stringify({\n toolName,\n ...envelope,\n }, null, 2)\n return {\n content: [{ type: 'text', text }],\n isError: !envelope.ok,\n }\n}\n","import { z } from 'zod'\n\nexport const ThorbitContentExtractUrlInputSchema = {\n url: z.string().url().describe('Public URL to extract through MCP Scraper.'),\n browserFallback: z.boolean().default(true).describe('Use MCP Scraper browser fallback for JS-heavy pages. Default true.'),\n extractBranding: z.boolean().default(false).describe('Ask MCP Scraper to extract brand colors, fonts, logo, and favicon when supported.'),\n downloadMedia: z.boolean().default(false).describe('Ask MCP Scraper to download page media when supported.'),\n maxCharacters: z.number().int().min(500).max(500000).default(80000).describe('Maximum extracted content characters returned to the MCP caller.'),\n}\n\nconst McpScraperProxyModeSchema = z.enum(['location', 'configured', 'none'])\nconst McpScraperSerpDeviceSchema = z.enum(['desktop', 'mobile'])\n\nexport const ThorbitContentHarvestSerpInputSchema = {\n query: z.string().min(1).max(400).describe('Core search topic. Separate location when possible, e.g. query=\"best CRM\" and location=\"Denver, CO\".'),\n location: z.string().min(1).max(160).optional().describe('Optional search location, such as Denver, CO. Required for precise residential proxy targeting.'),\n gl: z.string().length(2).optional().describe('Optional Google country code, such as us.'),\n hl: z.string().min(2).max(12).optional().describe('Optional Google interface language, such as en.'),\n device: McpScraperSerpDeviceSchema.default('desktop').describe('SERP device context. Use desktop by default; use mobile only when requested.'),\n maxQuestions: z.number().int().min(1).max(200).default(30).describe('Maximum PAA questions when serpOnly is false.'),\n includeSerp: z.boolean().default(true).describe('Include organic SERP results. Default true.'),\n serpOnly: z.boolean().default(false).describe('Use fast SERP-only mode when PAA expansion is not needed.'),\n proxyMode: McpScraperProxyModeSchema.default('location').describe('MCP Scraper proxy mode. Use location by default for US city/state SERPs so MCP Scraper rotates fresh residential proxy IDs and browser sessions across retryable CAPTCHA/proxy/location failures.'),\n proxyZip: z.string().regex(/^\\d{5}$/).optional().describe('Optional US ZIP override for residential location proxy targeting. Use when a specific ZIP or city-center ZIP is known.'),\n debug: z.boolean().default(false).describe('Include sanitized MCP Scraper browser/proxy/location diagnostics and attempt telemetry. Use true when debugging CAPTCHA, proxy selection, or localization.'),\n pages: z.number().int().min(1).max(2).default(1).describe('Number of Google result pages to fetch in SERP-only mode.'),\n}\n\nexport const ThorbitContentRedditResearchInputSchema = {\n query: z.string().min(1).max(400).describe('Topic, product, service, or pain point to research on Reddit.'),\n location: z.string().min(1).max(160).optional().describe('Optional location to bias MCP Scraper SERP discovery and residential proxy targeting.'),\n gl: z.string().length(2).optional().describe('Optional Google country code, such as us.'),\n hl: z.string().min(2).max(12).optional().describe('Optional Google interface language, such as en.'),\n device: McpScraperSerpDeviceSchema.default('desktop').describe('SERP device context for Reddit discovery.'),\n proxyMode: McpScraperProxyModeSchema.default('location').describe('MCP Scraper proxy mode for Reddit discovery. Use location by default so MCP Scraper owns CAPTCHA/proxy retries.'),\n proxyZip: z.string().regex(/^\\d{5}$/).optional().describe('Optional US ZIP override for residential location proxy targeting.'),\n debug: z.boolean().default(false).describe('Include sanitized MCP Scraper retry/proxy diagnostics for Reddit discovery.'),\n maxPosts: z.number().int().min(1).max(10).default(5).describe('Maximum Reddit posts to read with MCP Scraper browser-agent.'),\n readWithBrowserAgent: z.boolean().default(true).describe('Keep true. Reads Reddit candidates through MCP Scraper browser-agent.'),\n profile: z.string().min(1).max(128).optional().describe('Optional MCP Scraper browser-agent saved profile name.'),\n}\n\nexport const ThorbitOnPageStartAnalysisInputSchema = {\n projectPublicId: z.string().min(1).describe('Thorbit project public ID.'),\n keyword: z.string().min(1).max(200).describe('Target keyword or query for on-page analysis.'),\n force: z.boolean().default(false).describe('Force restart if an analysis is already running.'),\n source: z.discriminatedUnion('mode', [\n z.object({ mode: z.literal('keyword_only') }).strict(),\n z.object({\n mode: z.literal('inline_content'),\n title: z.string().min(1).max(255).optional(),\n text: z.string().min(20).max(500000),\n sourceUrl: z.string().url().optional(),\n }).strict(),\n ]).default({ mode: 'keyword_only' }).describe('Use keyword_only for research-only analysis or inline_content to score provided content.'),\n}\n\nexport const ThorbitOnPageGetAnalysisInputSchema = {\n analysisPublicId: z.string().min(1).describe('On-page analysis public ID returned by thorbit_onpage_start_analysis.'),\n}\n\nexport const ThorbitContentOnPageMcpToolInputSchemas = {\n thorbit_content_extract_url: ThorbitContentExtractUrlInputSchema,\n thorbit_content_harvest_serp: ThorbitContentHarvestSerpInputSchema,\n thorbit_content_reddit_research: ThorbitContentRedditResearchInputSchema,\n thorbit_onpage_start_analysis: ThorbitOnPageStartAnalysisInputSchema,\n thorbit_onpage_get_analysis: ThorbitOnPageGetAnalysisInputSchema,\n}\n","import { readFileSync } from 'node:fs'\nimport { homedir } from 'node:os'\nimport { join } from 'node:path'\n\nexport type ThorbitContentOnPageMcpEnv = {\n apiKey: string\n baseUrl: string\n}\n\nfunction readApiKeyFile(): string | undefined {\n const explicitPath = process.env.THORBIT_CONTENT_MCP_KEY_PATH?.trim()\n const paths = [explicitPath, join(homedir(), '.thorbit-content-mcp-key')].filter(Boolean) as string[]\n for (const path of paths) {\n try {\n const value = readFileSync(path, 'utf8').trim()\n if (value) return value\n } catch {\n continue\n }\n }\n return undefined\n}\n\nexport function resolveThorbitContentOnPageMcpEnv(): ThorbitContentOnPageMcpEnv {\n const apiKey = (\n process.env.THORBIT_API_KEY ||\n process.env.THORBIT_MCP_API_KEY ||\n process.env.THORBIT_CONTENT_MCP_API_KEY ||\n readApiKeyFile()\n )?.trim()\n\n if (!apiKey) {\n throw new Error('THORBIT_API_KEY, THORBIT_MCP_API_KEY, or ~/.thorbit-content-mcp-key is required')\n }\n\n return {\n apiKey,\n baseUrl: (process.env.THORBIT_BASE_URL || process.env.THORBIT_CONTENT_MCP_BASE_URL || 'https://thorbit.ai').trim(),\n }\n}\n","export const ThorbitContentOnPageMcpToolNames = [\n 'thorbit_content_extract_url',\n 'thorbit_content_harvest_serp',\n 'thorbit_content_reddit_research',\n 'thorbit_onpage_start_analysis',\n 'thorbit_onpage_get_analysis',\n] as const\n\nexport type ThorbitContentOnPageMcpToolName = typeof ThorbitContentOnPageMcpToolNames[number]\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACoBO,IAAM,gCAAN,MAAoC;AAAA,EACxB;AAAA,EACA;AAAA,EAEjB,YAAY,SAA8C;AACxD,SAAK,UAAU,QAAQ,QAAQ,QAAQ,OAAO,EAAE;AAChD,SAAK,SAAS,QAAQ;AAAA,EACxB;AAAA,EAEA,MAAM,SAAS,UAA2C,OAA0D;AAClH,UAAM,WAAW,MAAM,MAAM,GAAG,KAAK,OAAO,8BAA8B,QAAQ,IAAI;AAAA,MACpF,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,eAAe,UAAU,KAAK,MAAM;AAAA,QACpC,gBAAgB;AAAA,MAClB;AAAA,MACA,MAAM,KAAK,UAAU,SAAS,CAAC,CAAC;AAAA,IAClC,CAAC;AAED,UAAM,OAAO,MAAM,SAAS,KAAK,EAAE,MAAM,MAAM,IAAI;AACnD,QAAI,QAAQ,OAAO,SAAS,YAAY,QAAQ,KAAM,QAAO;AAE7D,WAAO;AAAA,MACL,IAAI;AAAA,MACJ,WAAW;AAAA,MACX,OAAO;AAAA,QACL,MAAM,SAAS,KAAK,qBAAqB,QAAQ,SAAS,MAAM;AAAA,QAChE,SAAS,SAAS,KAAK,6CAA6C,wCAAwC,SAAS,MAAM;AAAA,MAC7H;AAAA,IACF;AAAA,EACF;AACF;;;ACnDA,iBAA4C;;;ACIrC,SAAS,wCACd,UACA,UACgB;AAChB,QAAM,OAAO,KAAK,UAAU;AAAA,IAC1B;AAAA,IACA,GAAG;AAAA,EACL,GAAG,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AO;AAAA,IACP,aAAa;AAAA,IACb,aAAa;AAAA,IACb,aAAa,oBAAoB,oCAAoC;AAAA,EACvE,CAAC;AAED,eAAa,iCAAiC;AAAA,IAC5C,OAAO;AAAA,IACP,aAAa;AAAA,IACb,aAAa;AAAA,IACb,aAAa,iBAAiB,gCAAgC;AAAA,EAChE,CAAC;AAED,eAAa,+BAA+B;AAAA,IAC1C,OAAO;AAAA,IACP,aAAa;AAAA,IACb,aAAa;AAAA,IACb,aAAa,oBAAoB,iCAAiC,KAAK;AAAA,EACzE,CAAC;AAED,SAAO;AACT;;;AG7GA,qBAA6B;AAC7B,qBAAwB;AACxB,uBAAqB;AAOrB,SAAS,iBAAqC;AAC5C,QAAM,eAAe,QAAQ,IAAI,8BAA8B,KAAK;AACpE,QAAM,QAAQ,CAAC,kBAAc,2BAAK,wBAAQ,GAAG,0BAA0B,CAAC,EAAE,OAAO,OAAO;AACxF,aAAW,QAAQ,OAAO;AACxB,QAAI;AACF,YAAM,YAAQ,6BAAa,MAAM,MAAM,EAAE,KAAK;AAC9C,UAAI,MAAO,QAAO;AAAA,IACpB,QAAQ;AACN;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AAEO,SAAS,oCAAgE;AAC9E,QAAM,UACJ,QAAQ,IAAI,mBACZ,QAAQ,IAAI,uBACZ,QAAQ,IAAI,+BACZ,eAAe,IACd,KAAK;AAER,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI,MAAM,iFAAiF;AAAA,EACnG;AAEA,SAAO;AAAA,IACL;AAAA,IACA,UAAU,QAAQ,IAAI,oBAAoB,QAAQ,IAAI,gCAAgC,sBAAsB,KAAK;AAAA,EACnH;AACF;;;ACvCO,IAAM,mCAAmC;AAAA,EAC9C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/content-onpage-api-client.ts","../src/content-onpage-mcp-server.ts","../src/content-onpage-mcp-response-formatters.ts","../src/content-onpage-mcp-tool-schemas.ts","../src/content-onpage-mcp-env.ts","../src/content-onpage-mcp-tool-names.ts"],"sourcesContent":["export { ThorbitContentOnPageApiClient } from './content-onpage-api-client.js'\nexport { buildThorbitContentOnPageMcpServer } from './content-onpage-mcp-server.js'\nexport { resolveThorbitContentOnPageMcpEnv } from './content-onpage-mcp-env.js'\nexport { ThorbitContentOnPageMcpToolNames } from './content-onpage-mcp-tool-names.js'\n","import type { ThorbitContentOnPageMcpToolName } from './content-onpage-mcp-tool-names.js'\n\nexport type ThorbitContentOnPageMcpEnvelope =\n | {\n ok: true\n result: unknown\n warnings?: string[]\n requestId: string\n usage?: Record<string, unknown>\n }\n | {\n ok: false\n error: {\n code: string\n message: string\n details?: unknown\n }\n requestId: string\n }\n\nexport class ThorbitContentOnPageApiClient {\n private readonly baseUrl: string\n private readonly apiKey: string\n\n constructor(options: { baseUrl: string; apiKey: string }) {\n this.baseUrl = options.baseUrl.replace(/\\/$/, '')\n this.apiKey = options.apiKey\n }\n\n async callTool(toolName: ThorbitContentOnPageMcpToolName, input: unknown): Promise<ThorbitContentOnPageMcpEnvelope> {\n const response = await fetch(`${this.baseUrl}/api/v1/mcp/content-onpage/${toolName}`, {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${this.apiKey}`,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(input ?? {}),\n })\n\n const body = await response.json().catch(() => null) as ThorbitContentOnPageMcpEnvelope | null\n if (body && typeof body === 'object' && 'ok' in body) return body\n\n return {\n ok: false,\n requestId: 'unavailable',\n error: {\n code: response.ok ? 'invalid_response' : `http_${response.status}`,\n message: response.ok ? 'Thorbit returned an invalid MCP response' : `Thorbit API request failed with HTTP ${response.status}`,\n },\n }\n }\n}\n","import { McpServer, ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport type { ToolAnnotations } from '@modelcontextprotocol/sdk/types.js'\nimport type { ZodRawShape } from 'zod'\nimport type { ThorbitContentOnPageApiClient } from './content-onpage-api-client.js'\nimport { formatThorbitContentOnPageMcpToolResult } from './content-onpage-mcp-response-formatters.js'\nimport {\n ThorbitContentOpportunitiesListInputSchema,\n ThorbitContentExtractUrlInputSchema,\n ThorbitContentHarvestSerpInputSchema,\n ThorbitContentPipelineGetInputSchema,\n ThorbitContentPipelineImproveInputSchema,\n ThorbitContentPipelineResumeInputSchema,\n ThorbitContentPipelineStartFromBriefInputSchema,\n ThorbitContentPipelineStartInputSchema,\n ThorbitContentRedditResearchInputSchema,\n ThorbitOnPageApplyEditsInputSchema,\n ThorbitOnPageGenerateBriefInputSchema,\n ThorbitOnPageGenerateStrategyInputSchema,\n ThorbitOnPageGetEditorContentInputSchema,\n ThorbitOnPageGetAnalysisInputSchema,\n ThorbitOnPageListSourcesInputSchema,\n ThorbitOnPageProposeEditsInputSchema,\n ThorbitOnPageRescoreAnalysisInputSchema,\n ThorbitOnPageStartAnalysisInputSchema,\n ThorbitOnPageUpdateEditStatusInputSchema,\n} from './content-onpage-mcp-tool-schemas.js'\nimport type { ThorbitContentOnPageMcpToolName } from './content-onpage-mcp-tool-names.js'\n\nconst VERSION = '0.1.3'\n\ntype ThorbitContentOnPageToolConfig<InputArgs extends ZodRawShape> = {\n title: string\n description: string\n inputSchema: InputArgs\n annotations: ToolAnnotations\n}\n\nfunction readOnlyAnnotations(title: string, openWorldHint = true) {\n return {\n title,\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint,\n }\n}\n\nfunction writeAnnotations(title: string, openWorldHint = false) {\n return {\n title,\n readOnlyHint: false,\n destructiveHint: false,\n idempotentHint: false,\n openWorldHint,\n }\n}\n\nexport function buildThorbitContentOnPageMcpServer(client: ThorbitContentOnPageApiClient): McpServer {\n const server = new McpServer({ name: 'thorbit-content-mcp', version: VERSION })\n\n server.registerResource(\n 'analysis',\n new ResourceTemplate('thorbit-content://analyses/{analysisPublicId}', { list: undefined }),\n {\n title: 'Thorbit On-Page Analysis',\n description: 'Status, score, signal counts, and summary for one Thorbit on-page analysis.',\n mimeType: 'application/json',\n },\n async (uri, variables) => {\n const analysisPublicId = Array.isArray(variables.analysisPublicId)\n ? variables.analysisPublicId[0]\n : variables.analysisPublicId\n const envelope = await client.callTool('thorbit_onpage_get_analysis', { analysisPublicId: String(analysisPublicId) })\n return { contents: [{ uri: uri.href, mimeType: 'application/json', text: JSON.stringify(envelope, null, 2) }] }\n },\n )\n\n function registerTool<T extends ThorbitContentOnPageMcpToolName>(\n toolName: T,\n config: ThorbitContentOnPageToolConfig<ZodRawShape>,\n ): void {\n server.registerTool(toolName, config, async (input) => {\n const envelope = await client.callTool(toolName, input)\n return formatThorbitContentOnPageMcpToolResult(toolName, envelope)\n })\n }\n\n registerTool('thorbit_content_extract_url', {\n title: 'Extract URL For Content Analysis',\n description: 'Extract a public URL through MCP Scraper only. Use this before content audits, source ingestion, outline planning, or on-page comparisons. Browser fallback is enabled by default for JS-heavy pages.',\n inputSchema: ThorbitContentExtractUrlInputSchema,\n annotations: readOnlyAnnotations('Extract URL For Content Analysis'),\n })\n\n registerTool('thorbit_content_harvest_serp', {\n title: 'Harvest SERP And PAA Evidence',\n description: 'Harvest Google SERP/PAA evidence through MCP Scraper only. Returns the full evidence surface from MCP Scraper: PAA flat questions, PAA tree, organic SERP, local pack, videos/shorts, forums, whatPeopleSaying, AI Overview text/citations/sections, AI Mode, entity IDs, stats, diagnostics, and retry attempts. Split topic from location when possible. Keep proxyMode as location for US city/state SERPs so MCP Scraper rotates fresh residential proxy IDs and browser sessions across retryable CAPTCHA, proxy tunnel, proxy availability, and location-mismatch failures. Pass proxyZip for known city-center ZIP targeting and debug true when retry/proxy diagnostics are needed.',\n inputSchema: ThorbitContentHarvestSerpInputSchema,\n annotations: readOnlyAnnotations('Harvest SERP And PAA Evidence'),\n })\n\n registerTool('thorbit_content_reddit_research', {\n title: 'Research Reddit With MCP Scraper Browser Agent',\n description: 'Find Reddit candidates through MCP Scraper SERP harvest, then read selected posts through MCP Scraper browser-agent by default. Use for authentic audience language, objections, pain points, and questions. Keep proxyMode as location and pass location/proxyZip when the Reddit research has a local market. Do not use generic web scraping fallbacks for Reddit.',\n inputSchema: ThorbitContentRedditResearchInputSchema,\n annotations: readOnlyAnnotations('Research Reddit With Browser Agent'),\n })\n\n registerTool('thorbit_content_opportunities_list', {\n title: 'List Content Opportunities',\n description: 'List persisted Thorbit content opportunity candidates for a project. Use this before starting content pipeline work from GSC, topic-map, roadmap, ranked keyword, competitor, entity, or question sources.',\n inputSchema: ThorbitContentOpportunitiesListInputSchema,\n annotations: readOnlyAnnotations('List Content Opportunities', false),\n })\n\n registerTool('thorbit_content_pipeline_start', {\n title: 'Start Content Pipeline',\n description: 'Start the Thorbit content pipeline in brief, write, or optimize mode. Supports persisted opportunity sources, approved project context, writing style IDs, brief review pauses, existing content optimization, and metered durable workflow dispatch.',\n inputSchema: ThorbitContentPipelineStartInputSchema,\n annotations: writeAnnotations('Start Content Pipeline'),\n })\n\n registerTool('thorbit_content_pipeline_get', {\n title: 'Read Content Pipeline',\n description: 'Read a Thorbit content pipeline workflow job and normalized content creation run view, including phase, next actions, brief/article markdown, writer sections, model call telemetry, publication summary, and optional raw phaseData.',\n inputSchema: ThorbitContentPipelineGetInputSchema,\n annotations: readOnlyAnnotations('Read Content Pipeline', false),\n })\n\n registerTool('thorbit_content_pipeline_resume', {\n title: 'Resume Content Pipeline',\n description: 'Resume a paused Thorbit content pipeline after strategy or brief review, optionally appending user instructions before the next phase dispatch.',\n inputSchema: ThorbitContentPipelineResumeInputSchema,\n annotations: writeAnnotations('Resume Content Pipeline'),\n })\n\n registerTool('thorbit_content_pipeline_start_from_brief', {\n title: 'Start Writing From Brief',\n description: 'Start the Thorbit write pipeline directly from an approved brief and its on-page analysis. Use after thorbit_onpage_generate_brief or an existing approved Thorbit brief.',\n inputSchema: ThorbitContentPipelineStartFromBriefInputSchema,\n annotations: writeAnnotations('Start Writing From Brief'),\n })\n\n registerTool('thorbit_content_pipeline_improve', {\n title: 'Improve Existing Content',\n description: 'Start a Thorbit improvement loop for an existing content pipeline job or content piece. Scores the article, identifies gaps, rewrites, and re-scores through the durable content pipeline.',\n inputSchema: ThorbitContentPipelineImproveInputSchema,\n annotations: writeAnnotations('Improve Existing Content'),\n })\n\n registerTool('thorbit_onpage_list_sources', {\n title: 'List On-Page Source Options',\n description: 'List source options that can feed on-page analysis: keyword-only, WordPress Plugin pages, WordPress API synced pages, and project website scrape pages. Use before selecting a stored page source for analysis.',\n inputSchema: ThorbitOnPageListSourcesInputSchema,\n annotations: readOnlyAnnotations('List On-Page Source Options', false),\n })\n\n registerTool('thorbit_onpage_start_analysis', {\n title: 'Start Thorbit On-Page Analysis',\n description: 'Start a Thorbit on-page analysis for a project. Supports keyword-only, inline content, existing Thorbit content pieces, WordPress Plugin pages, WordPress API synced pages, and project website scrape pages. Hosted Thorbit resolves source content, infers keywords when possible, dispatches the durable analysis workflow, and meters usage against the MCP API key.',\n inputSchema: ThorbitOnPageStartAnalysisInputSchema,\n annotations: writeAnnotations('Start Thorbit On-Page Analysis'),\n })\n\n registerTool('thorbit_onpage_get_analysis', {\n title: 'Read Thorbit On-Page Analysis',\n description: 'Read persisted on-page analysis status, score, signal counts, brief, strategy, editor state, and optional full analysis surfaces: SERP, competitors, topic/demand clusters, Reddit/YouTube, entities, PMI, scoring, content reports, proposed edits, and raw analysisData.',\n inputSchema: ThorbitOnPageGetAnalysisInputSchema,\n annotations: readOnlyAnnotations('Read Thorbit On-Page Analysis', false),\n })\n\n registerTool('thorbit_onpage_get_editor_content', {\n title: 'Read On-Page Editor Content',\n description: 'Read or materialize editable content for a completed on-page analysis. Creates an editable Thorbit draft from the selected stored source when needed, then returns content piece ID, text, word count, source URL, and stale-score state.',\n inputSchema: ThorbitOnPageGetEditorContentInputSchema,\n annotations: readOnlyAnnotations('Read On-Page Editor Content', false),\n })\n\n registerTool('thorbit_onpage_rescore_analysis', {\n title: 'Re-Score On-Page Content',\n description: 'Re-score a completed on-page analysis against the current editable content piece without re-running expensive SERP and competitor collection. Returns a page-analysis-rescore job ID for progress polling.',\n inputSchema: ThorbitOnPageRescoreAnalysisInputSchema,\n annotations: writeAnnotations('Re-Score On-Page Content'),\n })\n\n registerTool('thorbit_onpage_generate_brief', {\n title: 'Generate On-Page Brief',\n description: 'Return an existing Thorbit final writer brief immediately, or queue brief generation for a completed on-page analysis and return a job ID plus a thorbit_onpage_get_analysis poll target. Persists brief content and structured brief data for later writing.',\n inputSchema: ThorbitOnPageGenerateBriefInputSchema,\n annotations: writeAnnotations('Generate On-Page Brief'),\n })\n\n registerTool('thorbit_onpage_generate_strategy', {\n title: 'Generate On-Page Strategy',\n description: 'Generate and persist the Thorbit on-page strategy document for a completed analysis, optionally using article content as context.',\n inputSchema: ThorbitOnPageGenerateStrategyInputSchema,\n annotations: writeAnnotations('Generate On-Page Strategy'),\n })\n\n registerTool('thorbit_onpage_propose_edits', {\n title: 'Propose On-Page Edits',\n description: 'Ask Thorbit to propose 3-8 targeted content edits from the completed analysis gaps and editable content. Persists an edit session with pending/invalid edits.',\n inputSchema: ThorbitOnPageProposeEditsInputSchema,\n annotations: writeAnnotations('Propose On-Page Edits'),\n })\n\n registerTool('thorbit_onpage_update_edit_status', {\n title: 'Accept Or Reject On-Page Edit',\n description: 'Accept or reject one proposed edit in an on-page edit session before applying edits to the Thorbit content piece.',\n inputSchema: ThorbitOnPageUpdateEditStatusInputSchema,\n annotations: writeAnnotations('Accept Or Reject On-Page Edit'),\n })\n\n registerTool('thorbit_onpage_apply_edits', {\n title: 'Apply On-Page Edits',\n description: 'Apply all accepted on-page edits to the editable Thorbit content piece and create before/after content version snapshots.',\n inputSchema: ThorbitOnPageApplyEditsInputSchema,\n annotations: writeAnnotations('Apply On-Page Edits'),\n })\n\n return server\n}\n","import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js'\nimport type { ThorbitContentOnPageMcpEnvelope } from './content-onpage-api-client.js'\nimport type { ThorbitContentOnPageMcpToolName } from './content-onpage-mcp-tool-names.js'\n\nexport function formatThorbitContentOnPageMcpToolResult(\n toolName: ThorbitContentOnPageMcpToolName,\n envelope: ThorbitContentOnPageMcpEnvelope,\n): CallToolResult {\n const text = JSON.stringify({\n toolName,\n ...envelope,\n }, null, 2)\n return {\n content: [{ type: 'text', text }],\n isError: !envelope.ok,\n }\n}\n","import { z } from 'zod'\n\nexport const ThorbitContentExtractUrlInputSchema = {\n url: z.string().url().describe('Public URL to extract through MCP Scraper.'),\n browserFallback: z.boolean().default(true).describe('Use MCP Scraper browser fallback for JS-heavy pages. Default true.'),\n extractBranding: z.boolean().default(false).describe('Ask MCP Scraper to extract brand colors, fonts, logo, and favicon when supported.'),\n downloadMedia: z.boolean().default(false).describe('Ask MCP Scraper to download page media when supported.'),\n maxCharacters: z.number().int().min(500).max(500000).default(80000).describe('Maximum extracted content characters returned to the MCP caller.'),\n}\n\nconst McpScraperProxyModeSchema = z.enum(['location', 'configured', 'none'])\nconst McpScraperSerpDeviceSchema = z.enum(['desktop', 'mobile'])\nconst PipelineModeSchema = z.enum(['brief', 'write', 'optimize'])\nconst ContentPipelineSourceKindSchema = z.enum([\n 'search-console-query',\n 'topic-map-node',\n 'data-hub-roadmap',\n 'ranked-keyword',\n 'competitor-keyword',\n 'eics-entity',\n 'phrase-question',\n 'manual-keyword',\n])\n\nconst ContentPipelineSourceRefSchema = z.object({\n sourceKind: ContentPipelineSourceKindSchema,\n keyword: z.string().min(1).max(200),\n sourcePublicId: z.string().min(1).max(128).optional(),\n title: z.string().min(1).max(300).optional(),\n reason: z.string().min(1).max(1000).optional(),\n sourceUrl: z.string().url().optional(),\n metrics: z.record(z.string(), z.unknown()).optional(),\n selectedAt: z.string().datetime().optional(),\n}).strict()\n\nexport const ThorbitContentHarvestSerpInputSchema = {\n query: z.string().min(1).max(400).describe('Core search topic. Separate location when possible, e.g. query=\"best CRM\" and location=\"Denver, CO\".'),\n location: z.string().min(1).max(160).optional().describe('Optional search location, such as Denver, CO. Required for precise residential proxy targeting.'),\n gl: z.string().length(2).optional().describe('Optional Google country code, such as us.'),\n hl: z.string().min(2).max(12).optional().describe('Optional Google interface language, such as en.'),\n device: McpScraperSerpDeviceSchema.default('desktop').describe('SERP device context. Use desktop by default; use mobile only when requested.'),\n maxQuestions: z.number().int().min(1).max(200).default(30).describe('Maximum PAA questions when serpOnly is false.'),\n includeSerp: z.boolean().default(true).describe('Include organic SERP results. Default true.'),\n serpOnly: z.boolean().default(false).describe('Use fast SERP-only mode when PAA expansion is not needed.'),\n proxyMode: McpScraperProxyModeSchema.default('location').describe('MCP Scraper proxy mode. Use location by default for US city/state SERPs so MCP Scraper rotates fresh residential proxy IDs and browser sessions across retryable CAPTCHA/proxy/location failures.'),\n proxyZip: z.string().regex(/^\\d{5}$/).optional().describe('Optional US ZIP override for residential location proxy targeting. Use when a specific ZIP or city-center ZIP is known.'),\n debug: z.boolean().default(false).describe('Include sanitized MCP Scraper browser/proxy/location diagnostics and attempt telemetry. Use true when debugging CAPTCHA, proxy selection, or localization.'),\n pages: z.number().int().min(1).max(2).default(1).describe('Number of Google result pages to fetch in SERP-only mode.'),\n}\n\nexport const ThorbitContentRedditResearchInputSchema = {\n query: z.string().min(1).max(400).describe('Topic, product, service, or pain point to research on Reddit.'),\n location: z.string().min(1).max(160).optional().describe('Optional location to bias MCP Scraper SERP discovery and residential proxy targeting.'),\n gl: z.string().length(2).optional().describe('Optional Google country code, such as us.'),\n hl: z.string().min(2).max(12).optional().describe('Optional Google interface language, such as en.'),\n device: McpScraperSerpDeviceSchema.default('desktop').describe('SERP device context for Reddit discovery.'),\n proxyMode: McpScraperProxyModeSchema.default('location').describe('MCP Scraper proxy mode for Reddit discovery. Use location by default so MCP Scraper owns CAPTCHA/proxy retries.'),\n proxyZip: z.string().regex(/^\\d{5}$/).optional().describe('Optional US ZIP override for residential location proxy targeting.'),\n debug: z.boolean().default(false).describe('Include sanitized MCP Scraper retry/proxy diagnostics for Reddit discovery.'),\n maxPosts: z.number().int().min(1).max(10).default(5).describe('Maximum Reddit posts to read with MCP Scraper browser-agent.'),\n readWithBrowserAgent: z.boolean().default(true).describe('Keep true. Reads Reddit candidates through MCP Scraper browser-agent.'),\n profile: z.string().min(1).max(128).optional().describe('Optional MCP Scraper browser-agent saved profile name.'),\n}\n\nconst ThorbitOnPageSourceSelectionSchema = z.discriminatedUnion('mode', [\n z.object({ mode: z.literal('keyword_only') }).strict(),\n z.object({\n mode: z.literal('inline_content'),\n title: z.string().min(1).max(255).optional(),\n text: z.string().min(20).max(500000),\n sourceUrl: z.string().url().optional(),\n }).strict(),\n z.object({ mode: z.literal('content_piece'), contentPiecePublicId: z.string().min(1) }).strict(),\n z.object({\n mode: z.literal('wordpress_plugin_page'),\n connectionPublicId: z.string().min(1),\n externalPostId: z.number().int().positive(),\n }).strict(),\n z.object({\n mode: z.literal('wordpress_api_page'),\n connectionPublicId: z.string().min(1),\n connectionPagePublicId: z.string().min(1),\n }).strict(),\n z.object({\n mode: z.literal('project_website_scrape'),\n websitePagePublicId: z.string().min(1),\n }).strict(),\n])\n\nexport const ThorbitContentOpportunitiesListInputSchema = {\n projectPublicId: z.string().min(1).describe('Thorbit project public ID.'),\n sourceKind: ContentPipelineSourceKindSchema.optional().describe('Optional content opportunity source kind filter.'),\n limit: z.number().int().min(1).max(100).default(10).describe('Maximum opportunities per source.'),\n}\n\nexport const ThorbitContentPipelineStartInputSchema = {\n projectPublicId: z.string().min(1).describe('Thorbit project public ID.'),\n keyword: z.string().min(1).max(200).describe('Target keyword or query for the content pipeline.'),\n mode: PipelineModeSchema.describe('Content pipeline mode: brief, write, or optimize.'),\n reviewBrief: z.boolean().default(false).describe('Pause after brief generation for review before writing.'),\n notes: z.string().max(500).optional().describe('Optional writing or strategy instructions.'),\n existingContentPiecePublicId: z.string().min(1).optional().describe('Required for optimize mode. Existing Thorbit content piece public ID.'),\n writingStyleId: z.number().int().positive().optional().describe('Optional Thorbit writing style ID.'),\n maxIterations: z.number().int().min(0).max(3).optional().describe('Optional verification/improvement iteration cap.'),\n analysisPublicId: z.string().min(1).optional().describe('Optional related on-page analysis public ID.'),\n source: ContentPipelineSourceRefSchema.optional().describe('Optional persisted content opportunity source reference.'),\n}\n\nexport const ThorbitContentPipelineGetInputSchema = {\n jobPublicId: z.string().min(1).describe('Content pipeline workflow job public ID.'),\n includePhaseData: z.boolean().default(true).describe('Include raw workflow phaseData in addition to the normalized run view.'),\n}\n\nexport const ThorbitContentPipelineResumeInputSchema = {\n jobPublicId: z.string().min(1).describe('Paused content pipeline workflow job public ID.'),\n userInstructions: z.string().max(4000).default('').describe('Optional instructions to append before resuming.'),\n}\n\nexport const ThorbitContentPipelineStartFromBriefInputSchema = {\n briefPublicId: z.string().min(1).describe('Approved Thorbit brief public ID.'),\n analysisPublicId: z.string().min(1).describe('On-page analysis public ID associated with the brief.'),\n writingStyleId: z.number().int().positive().optional().describe('Optional Thorbit writing style ID.'),\n}\n\nexport const ThorbitContentPipelineImproveInputSchema = {\n jobOrPiecePublicId: z.string().min(1).describe('Existing content pipeline job public ID or content piece public ID to improve.'),\n}\n\nexport const ThorbitOnPageListSourcesInputSchema = {\n projectPublicId: z.string().min(1).describe('Thorbit project public ID.'),\n kind: z.enum(['keyword', 'wordpress_plugin', 'wordpress_api', 'project_website_scrape']).optional().describe('Optional source kind filter.'),\n search: z.string().max(200).optional().describe('Optional search string for page/title/url filtering.'),\n limit: z.number().int().min(1).max(100).default(25).describe('Maximum source options to return.'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset.'),\n connectionPublicId: z.string().min(1).optional().describe('Optional WordPress connection public ID filter.'),\n}\n\nexport const ThorbitOnPageStartAnalysisInputSchema = {\n projectPublicId: z.string().min(1).describe('Thorbit project public ID.'),\n keyword: z.string().min(1).max(200).optional().describe('Target keyword or query. Required for keyword-only and inline-content analysis; can be inferred for selected stored sources.'),\n force: z.boolean().default(false).describe('Force restart if an analysis is already running.'),\n source: ThorbitOnPageSourceSelectionSchema.default({ mode: 'keyword_only' }).describe('Source to analyze: keyword_only, inline_content, content_piece, wordpress_plugin_page, wordpress_api_page, or project_website_scrape.'),\n}\n\nexport const ThorbitOnPageGetAnalysisInputSchema = {\n analysisPublicId: z.string().min(1).describe('On-page analysis public ID returned by thorbit_onpage_start_analysis.'),\n detail: z.enum(['summary', 'standard', 'full']).default('standard').describe('Analysis detail level. Use full for SERP, competitors, clusters, entities, demand, brief, strategy, and raw analysis data.'),\n includeBrief: z.boolean().default(true).describe('Include persisted brief content and structured brief data when available.'),\n includeStrategy: z.boolean().default(true).describe('Include persisted strategy content when available.'),\n includeRawAnalysisData: z.boolean().default(false).describe('Include raw analysisData JSON. Automatically included for detail=full.'),\n}\n\nexport const ThorbitOnPageGetEditorContentInputSchema = {\n analysisPublicId: z.string().min(1).describe('On-page analysis public ID.'),\n}\n\nexport const ThorbitOnPageRescoreAnalysisInputSchema = {\n analysisPublicId: z.string().min(1).describe('Completed on-page analysis public ID.'),\n editorContentPiecePublicId: z.string().min(1).optional().describe('Editable content piece public ID returned by thorbit_onpage_get_editor_content.'),\n contentPiecePublicId: z.string().min(1).optional().describe('Alternate content piece public ID to score.'),\n}\n\nexport const ThorbitOnPageGenerateBriefInputSchema = {\n analysisPublicId: z.string().min(1).describe('Completed on-page analysis public ID. Returns an existing brief immediately, or queues generation and returns a job ID plus a thorbit_onpage_get_analysis poll target.'),\n regenerate: z.boolean().default(false).describe('Regenerate an existing brief instead of returning it. Regeneration queues work and should be polled with thorbit_onpage_get_analysis.'),\n}\n\nexport const ThorbitOnPageGenerateStrategyInputSchema = {\n analysisPublicId: z.string().min(1).describe('Completed on-page analysis public ID.'),\n articleContent: z.string().min(20).max(500000).optional().describe('Optional article content to include in strategy generation.'),\n}\n\nexport const ThorbitOnPageProposeEditsInputSchema = {\n analysisPublicId: z.string().min(1).describe('Completed full-mode on-page analysis public ID.'),\n}\n\nexport const ThorbitOnPageUpdateEditStatusInputSchema = {\n analysisPublicId: z.string().min(1).describe('On-page analysis public ID with a proposed edit session.'),\n editId: z.string().min(1).describe('Edit ID from thorbit_onpage_propose_edits.'),\n status: z.enum(['accepted', 'rejected']).describe('Accept or reject this proposed edit.'),\n}\n\nexport const ThorbitOnPageApplyEditsInputSchema = {\n analysisPublicId: z.string().min(1).describe('On-page analysis public ID with accepted edits.'),\n}\n\nexport const ThorbitContentOnPageMcpToolInputSchemas = {\n thorbit_content_extract_url: ThorbitContentExtractUrlInputSchema,\n thorbit_content_harvest_serp: ThorbitContentHarvestSerpInputSchema,\n thorbit_content_reddit_research: ThorbitContentRedditResearchInputSchema,\n thorbit_content_opportunities_list: ThorbitContentOpportunitiesListInputSchema,\n thorbit_content_pipeline_start: ThorbitContentPipelineStartInputSchema,\n thorbit_content_pipeline_get: ThorbitContentPipelineGetInputSchema,\n thorbit_content_pipeline_resume: ThorbitContentPipelineResumeInputSchema,\n thorbit_content_pipeline_start_from_brief: ThorbitContentPipelineStartFromBriefInputSchema,\n thorbit_content_pipeline_improve: ThorbitContentPipelineImproveInputSchema,\n thorbit_onpage_list_sources: ThorbitOnPageListSourcesInputSchema,\n thorbit_onpage_start_analysis: ThorbitOnPageStartAnalysisInputSchema,\n thorbit_onpage_get_analysis: ThorbitOnPageGetAnalysisInputSchema,\n thorbit_onpage_get_editor_content: ThorbitOnPageGetEditorContentInputSchema,\n thorbit_onpage_rescore_analysis: ThorbitOnPageRescoreAnalysisInputSchema,\n thorbit_onpage_generate_brief: ThorbitOnPageGenerateBriefInputSchema,\n thorbit_onpage_generate_strategy: ThorbitOnPageGenerateStrategyInputSchema,\n thorbit_onpage_propose_edits: ThorbitOnPageProposeEditsInputSchema,\n thorbit_onpage_update_edit_status: ThorbitOnPageUpdateEditStatusInputSchema,\n thorbit_onpage_apply_edits: ThorbitOnPageApplyEditsInputSchema,\n}\n","import { readFileSync } from 'node:fs'\nimport { homedir } from 'node:os'\nimport { join } from 'node:path'\n\nexport type ThorbitContentOnPageMcpEnv = {\n apiKey: string\n baseUrl: string\n}\n\nfunction readApiKeyFile(): string | undefined {\n const explicitPath = process.env.THORBIT_CONTENT_MCP_KEY_PATH?.trim()\n const paths = [explicitPath, join(homedir(), '.thorbit-content-mcp-key')].filter(Boolean) as string[]\n for (const path of paths) {\n try {\n const value = readFileSync(path, 'utf8').trim()\n if (value) return value\n } catch {\n continue\n }\n }\n return undefined\n}\n\nexport function resolveThorbitContentOnPageMcpEnv(): ThorbitContentOnPageMcpEnv {\n const apiKey = (\n process.env.THORBIT_API_KEY ||\n process.env.THORBIT_MCP_API_KEY ||\n process.env.THORBIT_CONTENT_MCP_API_KEY ||\n readApiKeyFile()\n )?.trim()\n\n if (!apiKey) {\n throw new Error('THORBIT_API_KEY, THORBIT_MCP_API_KEY, or ~/.thorbit-content-mcp-key is required')\n }\n\n return {\n apiKey,\n baseUrl: (process.env.THORBIT_BASE_URL || process.env.THORBIT_CONTENT_MCP_BASE_URL || 'https://thorbit.ai').trim(),\n }\n}\n","export const ThorbitContentOnPageMcpToolNames = [\n 'thorbit_content_extract_url',\n 'thorbit_content_harvest_serp',\n 'thorbit_content_reddit_research',\n 'thorbit_content_opportunities_list',\n 'thorbit_content_pipeline_start',\n 'thorbit_content_pipeline_get',\n 'thorbit_content_pipeline_resume',\n 'thorbit_content_pipeline_start_from_brief',\n 'thorbit_content_pipeline_improve',\n 'thorbit_onpage_list_sources',\n 'thorbit_onpage_start_analysis',\n 'thorbit_onpage_get_analysis',\n 'thorbit_onpage_get_editor_content',\n 'thorbit_onpage_rescore_analysis',\n 'thorbit_onpage_generate_brief',\n 'thorbit_onpage_generate_strategy',\n 'thorbit_onpage_propose_edits',\n 'thorbit_onpage_update_edit_status',\n 'thorbit_onpage_apply_edits',\n] as const\n\nexport type ThorbitContentOnPageMcpToolName = typeof ThorbitContentOnPageMcpToolNames[number]\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACoBO,IAAM,gCAAN,MAAoC;AAAA,EACxB;AAAA,EACA;AAAA,EAEjB,YAAY,SAA8C;AACxD,SAAK,UAAU,QAAQ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S,oCAAgE;AAC9E,QAAM,UACJ,QAAQ,IAAI,mBACZ,QAAQ,IAAI,uBACZ,QAAQ,IAAI,+BACZ,eAAe,IACd,KAAK;AAER,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI,MAAM,iFAAiF;AAAA,EACnG;AAEA,SAAO;AAAA,IACL;AAAA,IACA,UAAU,QAAQ,IAAI,oBAAoB,QAAQ,IAAI,gCAAgC,sBAAsB,KAAK;AAAA,EACnH;AACF;;;ACvCO,IAAM,mCAAmC;AAAA,EAC9C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":[]}
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
 
3
- declare const ThorbitContentOnPageMcpToolNames: readonly ["thorbit_content_extract_url", "thorbit_content_harvest_serp", "thorbit_content_reddit_research", "thorbit_onpage_start_analysis", "thorbit_onpage_get_analysis"];
3
+ declare const ThorbitContentOnPageMcpToolNames: readonly ["thorbit_content_extract_url", "thorbit_content_harvest_serp", "thorbit_content_reddit_research", "thorbit_content_opportunities_list", "thorbit_content_pipeline_start", "thorbit_content_pipeline_get", "thorbit_content_pipeline_resume", "thorbit_content_pipeline_start_from_brief", "thorbit_content_pipeline_improve", "thorbit_onpage_list_sources", "thorbit_onpage_start_analysis", "thorbit_onpage_get_analysis", "thorbit_onpage_get_editor_content", "thorbit_onpage_rescore_analysis", "thorbit_onpage_generate_brief", "thorbit_onpage_generate_strategy", "thorbit_onpage_propose_edits", "thorbit_onpage_update_edit_status", "thorbit_onpage_apply_edits"];
4
4
  type ThorbitContentOnPageMcpToolName = typeof ThorbitContentOnPageMcpToolNames[number];
5
5
 
6
6
  type ThorbitContentOnPageMcpEnvelope = {
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
 
3
- declare const ThorbitContentOnPageMcpToolNames: readonly ["thorbit_content_extract_url", "thorbit_content_harvest_serp", "thorbit_content_reddit_research", "thorbit_onpage_start_analysis", "thorbit_onpage_get_analysis"];
3
+ declare const ThorbitContentOnPageMcpToolNames: readonly ["thorbit_content_extract_url", "thorbit_content_harvest_serp", "thorbit_content_reddit_research", "thorbit_content_opportunities_list", "thorbit_content_pipeline_start", "thorbit_content_pipeline_get", "thorbit_content_pipeline_resume", "thorbit_content_pipeline_start_from_brief", "thorbit_content_pipeline_improve", "thorbit_onpage_list_sources", "thorbit_onpage_start_analysis", "thorbit_onpage_get_analysis", "thorbit_onpage_get_editor_content", "thorbit_onpage_rescore_analysis", "thorbit_onpage_generate_brief", "thorbit_onpage_generate_strategy", "thorbit_onpage_propose_edits", "thorbit_onpage_update_edit_status", "thorbit_onpage_apply_edits"];
4
4
  type ThorbitContentOnPageMcpToolName = typeof ThorbitContentOnPageMcpToolNames[number];
5
5
 
6
6
  type ThorbitContentOnPageMcpEnvelope = {