thorbit-content-mcp 0.1.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/README.md +72 -0
- package/dist/bin/thorbit-content-mcp-install.cjs +352 -0
- package/dist/bin/thorbit-content-mcp-install.cjs.map +1 -0
- package/dist/bin/thorbit-content-mcp-install.d.cts +27 -0
- package/dist/bin/thorbit-content-mcp-install.d.ts +27 -0
- package/dist/bin/thorbit-content-mcp-install.js +320 -0
- package/dist/bin/thorbit-content-mcp-install.js.map +1 -0
- package/dist/bin/thorbit-content-mcp.cjs +210 -0
- package/dist/bin/thorbit-content-mcp.cjs.map +1 -0
- package/dist/bin/thorbit-content-mcp.d.cts +2 -0
- package/dist/bin/thorbit-content-mcp.d.ts +2 -0
- package/dist/bin/thorbit-content-mcp.js +209 -0
- package/dist/bin/thorbit-content-mcp.js.map +1 -0
- package/dist/index.cjs +237 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +39 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.js +208 -0
- package/dist/index.js.map +1 -0
- package/package.json +42 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/content-onpage-api-client.ts
|
|
4
|
+
var ThorbitContentOnPageApiClient = class {
|
|
5
|
+
baseUrl;
|
|
6
|
+
apiKey;
|
|
7
|
+
constructor(options) {
|
|
8
|
+
this.baseUrl = options.baseUrl.replace(/\/$/, "");
|
|
9
|
+
this.apiKey = options.apiKey;
|
|
10
|
+
}
|
|
11
|
+
async callTool(toolName, input) {
|
|
12
|
+
const response = await fetch(`${this.baseUrl}/api/v1/mcp/content-onpage/${toolName}`, {
|
|
13
|
+
method: "POST",
|
|
14
|
+
headers: {
|
|
15
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
16
|
+
"Content-Type": "application/json"
|
|
17
|
+
},
|
|
18
|
+
body: JSON.stringify(input ?? {})
|
|
19
|
+
});
|
|
20
|
+
const body = await response.json().catch(() => null);
|
|
21
|
+
if (body && typeof body === "object" && "ok" in body) return body;
|
|
22
|
+
return {
|
|
23
|
+
ok: false,
|
|
24
|
+
requestId: "unavailable",
|
|
25
|
+
error: {
|
|
26
|
+
code: response.ok ? "invalid_response" : `http_${response.status}`,
|
|
27
|
+
message: response.ok ? "Thorbit returned an invalid MCP response" : `Thorbit API request failed with HTTP ${response.status}`
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// src/content-onpage-mcp-server.ts
|
|
34
|
+
import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
35
|
+
|
|
36
|
+
// src/content-onpage-mcp-response-formatters.ts
|
|
37
|
+
function formatThorbitContentOnPageMcpToolResult(toolName, envelope) {
|
|
38
|
+
const text = JSON.stringify({
|
|
39
|
+
toolName,
|
|
40
|
+
...envelope
|
|
41
|
+
}, null, 2);
|
|
42
|
+
return {
|
|
43
|
+
content: [{ type: "text", text }],
|
|
44
|
+
isError: !envelope.ok
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// src/content-onpage-mcp-tool-schemas.ts
|
|
49
|
+
import { z } from "zod";
|
|
50
|
+
var ThorbitContentExtractUrlInputSchema = {
|
|
51
|
+
url: z.string().url().describe("Public URL to extract through MCP Scraper."),
|
|
52
|
+
browserFallback: z.boolean().default(true).describe("Use MCP Scraper browser fallback for JS-heavy pages. Default true."),
|
|
53
|
+
extractBranding: z.boolean().default(false).describe("Ask MCP Scraper to extract brand colors, fonts, logo, and favicon when supported."),
|
|
54
|
+
downloadMedia: z.boolean().default(false).describe("Ask MCP Scraper to download page media when supported."),
|
|
55
|
+
maxCharacters: z.number().int().min(500).max(5e5).default(8e4).describe("Maximum extracted content characters returned to the MCP caller.")
|
|
56
|
+
};
|
|
57
|
+
var ThorbitContentHarvestSerpInputSchema = {
|
|
58
|
+
query: z.string().min(1).max(400).describe("Search query for MCP Scraper SERP/PAA harvest."),
|
|
59
|
+
location: z.string().min(1).max(160).optional().describe("Optional search location, such as Denver, Colorado, United States."),
|
|
60
|
+
gl: z.string().length(2).optional().describe("Optional Google country code, such as us."),
|
|
61
|
+
hl: z.string().min(2).max(12).optional().describe("Optional Google interface language, such as en."),
|
|
62
|
+
maxQuestions: z.number().int().min(1).max(150).default(30).describe("Maximum PAA questions when serpOnly is false."),
|
|
63
|
+
includeSerp: z.boolean().default(true).describe("Include organic SERP results. Default true."),
|
|
64
|
+
serpOnly: z.boolean().default(false).describe("Use fast SERP-only mode when PAA expansion is not needed.")
|
|
65
|
+
};
|
|
66
|
+
var ThorbitContentRedditResearchInputSchema = {
|
|
67
|
+
query: z.string().min(1).max(400).describe("Topic, product, service, or pain point to research on Reddit."),
|
|
68
|
+
location: z.string().min(1).max(160).optional().describe("Optional location to bias MCP Scraper SERP discovery."),
|
|
69
|
+
maxPosts: z.number().int().min(1).max(10).default(5).describe("Maximum Reddit posts to read with MCP Scraper browser-agent."),
|
|
70
|
+
readWithBrowserAgent: z.boolean().default(true).describe("Keep true. Reads Reddit candidates through MCP Scraper browser-agent."),
|
|
71
|
+
profile: z.string().min(1).max(128).optional().describe("Optional MCP Scraper browser-agent saved profile name.")
|
|
72
|
+
};
|
|
73
|
+
var ThorbitOnPageStartAnalysisInputSchema = {
|
|
74
|
+
projectPublicId: z.string().min(1).describe("Thorbit project public ID."),
|
|
75
|
+
keyword: z.string().min(1).max(200).describe("Target keyword or query for on-page analysis."),
|
|
76
|
+
force: z.boolean().default(false).describe("Force restart if an analysis is already running."),
|
|
77
|
+
source: z.discriminatedUnion("mode", [
|
|
78
|
+
z.object({ mode: z.literal("keyword_only") }).strict(),
|
|
79
|
+
z.object({
|
|
80
|
+
mode: z.literal("inline_content"),
|
|
81
|
+
title: z.string().min(1).max(255).optional(),
|
|
82
|
+
text: z.string().min(20).max(5e5),
|
|
83
|
+
sourceUrl: z.string().url().optional()
|
|
84
|
+
}).strict()
|
|
85
|
+
]).default({ mode: "keyword_only" }).describe("Use keyword_only for research-only analysis or inline_content to score provided content.")
|
|
86
|
+
};
|
|
87
|
+
var ThorbitOnPageGetAnalysisInputSchema = {
|
|
88
|
+
analysisPublicId: z.string().min(1).describe("On-page analysis public ID returned by thorbit_onpage_start_analysis.")
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// src/content-onpage-mcp-server.ts
|
|
92
|
+
var VERSION = "0.1.0";
|
|
93
|
+
function readOnlyAnnotations(title, openWorldHint = true) {
|
|
94
|
+
return {
|
|
95
|
+
title,
|
|
96
|
+
readOnlyHint: true,
|
|
97
|
+
destructiveHint: false,
|
|
98
|
+
idempotentHint: true,
|
|
99
|
+
openWorldHint
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function writeAnnotations(title, openWorldHint = false) {
|
|
103
|
+
return {
|
|
104
|
+
title,
|
|
105
|
+
readOnlyHint: false,
|
|
106
|
+
destructiveHint: false,
|
|
107
|
+
idempotentHint: false,
|
|
108
|
+
openWorldHint
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function buildThorbitContentOnPageMcpServer(client) {
|
|
112
|
+
const server = new McpServer({ name: "thorbit-content-mcp", version: VERSION });
|
|
113
|
+
server.registerResource(
|
|
114
|
+
"analysis",
|
|
115
|
+
new ResourceTemplate("thorbit-content://analyses/{analysisPublicId}", { list: void 0 }),
|
|
116
|
+
{
|
|
117
|
+
title: "Thorbit On-Page Analysis",
|
|
118
|
+
description: "Status, score, signal counts, and summary for one Thorbit on-page analysis.",
|
|
119
|
+
mimeType: "application/json"
|
|
120
|
+
},
|
|
121
|
+
async (uri, variables) => {
|
|
122
|
+
const analysisPublicId = Array.isArray(variables.analysisPublicId) ? variables.analysisPublicId[0] : variables.analysisPublicId;
|
|
123
|
+
const envelope = await client.callTool("thorbit_onpage_get_analysis", { analysisPublicId: String(analysisPublicId) });
|
|
124
|
+
return { contents: [{ uri: uri.href, mimeType: "application/json", text: JSON.stringify(envelope, null, 2) }] };
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
function registerTool(toolName, config) {
|
|
128
|
+
server.registerTool(toolName, config, async (input) => {
|
|
129
|
+
const envelope = await client.callTool(toolName, input);
|
|
130
|
+
return formatThorbitContentOnPageMcpToolResult(toolName, envelope);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
registerTool("thorbit_content_extract_url", {
|
|
134
|
+
title: "Extract URL For Content Analysis",
|
|
135
|
+
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.",
|
|
136
|
+
inputSchema: ThorbitContentExtractUrlInputSchema,
|
|
137
|
+
annotations: readOnlyAnnotations("Extract URL For Content Analysis")
|
|
138
|
+
});
|
|
139
|
+
registerTool("thorbit_content_harvest_serp", {
|
|
140
|
+
title: "Harvest SERP And PAA Evidence",
|
|
141
|
+
description: "Harvest Google SERP/PAA evidence through MCP Scraper only. Returns PAA questions, organic results, forums, videos, AI Overview fields when available, and provider stats for source-backed content strategy.",
|
|
142
|
+
inputSchema: ThorbitContentHarvestSerpInputSchema,
|
|
143
|
+
annotations: readOnlyAnnotations("Harvest SERP And PAA Evidence")
|
|
144
|
+
});
|
|
145
|
+
registerTool("thorbit_content_reddit_research", {
|
|
146
|
+
title: "Research Reddit With MCP Scraper Browser Agent",
|
|
147
|
+
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. Do not use generic web scraping fallbacks for Reddit.",
|
|
148
|
+
inputSchema: ThorbitContentRedditResearchInputSchema,
|
|
149
|
+
annotations: readOnlyAnnotations("Research Reddit With Browser Agent")
|
|
150
|
+
});
|
|
151
|
+
registerTool("thorbit_onpage_start_analysis", {
|
|
152
|
+
title: "Start Thorbit On-Page Analysis",
|
|
153
|
+
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.",
|
|
154
|
+
inputSchema: ThorbitOnPageStartAnalysisInputSchema,
|
|
155
|
+
annotations: writeAnnotations("Start Thorbit On-Page Analysis")
|
|
156
|
+
});
|
|
157
|
+
registerTool("thorbit_onpage_get_analysis", {
|
|
158
|
+
title: "Read Thorbit On-Page Analysis",
|
|
159
|
+
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.",
|
|
160
|
+
inputSchema: ThorbitOnPageGetAnalysisInputSchema,
|
|
161
|
+
annotations: readOnlyAnnotations("Read Thorbit On-Page Analysis", false)
|
|
162
|
+
});
|
|
163
|
+
return server;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// src/content-onpage-mcp-env.ts
|
|
167
|
+
import { readFileSync } from "fs";
|
|
168
|
+
import { homedir } from "os";
|
|
169
|
+
import { join } from "path";
|
|
170
|
+
function readApiKeyFile() {
|
|
171
|
+
const explicitPath = process.env.THORBIT_CONTENT_MCP_KEY_PATH?.trim();
|
|
172
|
+
const paths = [explicitPath, join(homedir(), ".thorbit-content-mcp-key")].filter(Boolean);
|
|
173
|
+
for (const path of paths) {
|
|
174
|
+
try {
|
|
175
|
+
const value = readFileSync(path, "utf8").trim();
|
|
176
|
+
if (value) return value;
|
|
177
|
+
} catch {
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return void 0;
|
|
182
|
+
}
|
|
183
|
+
function resolveThorbitContentOnPageMcpEnv() {
|
|
184
|
+
const apiKey = (process.env.THORBIT_API_KEY || process.env.THORBIT_MCP_API_KEY || process.env.THORBIT_CONTENT_MCP_API_KEY || readApiKeyFile())?.trim();
|
|
185
|
+
if (!apiKey) {
|
|
186
|
+
throw new Error("THORBIT_API_KEY, THORBIT_MCP_API_KEY, or ~/.thorbit-content-mcp-key is required");
|
|
187
|
+
}
|
|
188
|
+
return {
|
|
189
|
+
apiKey,
|
|
190
|
+
baseUrl: (process.env.THORBIT_BASE_URL || process.env.THORBIT_CONTENT_MCP_BASE_URL || "https://thorbit.ai").trim()
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// src/content-onpage-mcp-tool-names.ts
|
|
195
|
+
var ThorbitContentOnPageMcpToolNames = [
|
|
196
|
+
"thorbit_content_extract_url",
|
|
197
|
+
"thorbit_content_harvest_serp",
|
|
198
|
+
"thorbit_content_reddit_research",
|
|
199
|
+
"thorbit_onpage_start_analysis",
|
|
200
|
+
"thorbit_onpage_get_analysis"
|
|
201
|
+
];
|
|
202
|
+
export {
|
|
203
|
+
ThorbitContentOnPageApiClient,
|
|
204
|
+
ThorbitContentOnPageMcpToolNames,
|
|
205
|
+
buildThorbitContentOnPageMcpServer,
|
|
206
|
+
resolveThorbitContentOnPageMcpEnv
|
|
207
|
+
};
|
|
208
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../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":["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.0'\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 PAA questions, organic results, forums, videos, AI Overview fields when available, and provider stats for source-backed content strategy.',\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. 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\nexport const ThorbitContentHarvestSerpInputSchema = {\n query: z.string().min(1).max(400).describe('Search query for MCP Scraper SERP/PAA harvest.'),\n location: z.string().min(1).max(160).optional().describe('Optional search location, such as Denver, Colorado, United States.'),\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 maxQuestions: z.number().int().min(1).max(150).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}\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.'),\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":";;;AAoBO,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;A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,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,SAAS,oBAAoB;AAC7B,SAAS,eAAe;AACxB,SAAS,YAAY;AAOrB,SAAS,iBAAqC;AAC5C,QAAM,eAAe,QAAQ,IAAI,8BAA8B,KAAK;AACpE,QAAM,QAAQ,CAAC,cAAc,KAAK,QAAQ,GAAG,0BAA0B,CAAC,EAAE,OAAO,OAAO;AACxF,aAAW,QAAQ,OAAO;AACxB,QAAI;AACF,YAAM,QAAQ,aAAa,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":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "thorbit-content-mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MCP server for Thorbit content research and on-page analysis tools",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"bin": {
|
|
17
|
+
"thorbit-content-mcp": "dist/bin/thorbit-content-mcp.js",
|
|
18
|
+
"thorbit-content-mcp-install": "dist/bin/thorbit-content-mcp-install.js"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"README.md"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsup",
|
|
26
|
+
"test": "vitest run --config vitest.config.ts",
|
|
27
|
+
"typecheck": "tsc --noEmit"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
31
|
+
"zod": "^3.23.0"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/node": "^20.0.0",
|
|
35
|
+
"tsup": "^8.0.0",
|
|
36
|
+
"typescript": "^5.4.0",
|
|
37
|
+
"vitest": "^1.6.0"
|
|
38
|
+
},
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=20"
|
|
41
|
+
}
|
|
42
|
+
}
|