thorbit-deposition-mcp 0.1.1 → 0.1.3
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/bin/thorbit-deposition-mcp.cjs +14 -1
- package/dist/bin/thorbit-deposition-mcp.cjs.map +1 -1
- package/dist/bin/thorbit-deposition-mcp.js +14 -1
- package/dist/bin/thorbit-deposition-mcp.js.map +1 -1
- package/dist/index.cjs +16 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +16 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -83,6 +83,7 @@ var ThorbitDepositionStartInputSchema = {
|
|
|
83
83
|
competitorUrls: import_zod.z.array(import_zod.z.string().url()).max(5).default([]).describe("0-5 competitor URLs. Auto-discovered via SERP if fewer than 2 are provided."),
|
|
84
84
|
reviewsUrl: import_zod.z.string().url().max(2048).optional().describe("Optional customer reviews URL (G2, Trustpilot, Reddit thread)."),
|
|
85
85
|
knownPains: import_zod.z.array(import_zod.z.string().min(1)).max(50).optional().describe("Optional known customer pain points to seed the analysis."),
|
|
86
|
+
context: import_zod.z.string().max(8e3).optional().describe("Optional free-form context about the company that gets passed to the AI as authoritative ground truth \u2014 its real niche, target audience, monetization, founder/standard-bearer, beliefs/mission, and who its true competitors are. Use this when the website is generic or the real positioning is not obvious from the homepage. When provided it steers research, competitor discovery, vulnerability, and category ownership."),
|
|
86
87
|
projectPublicId: import_zod.z.string().min(1).optional().describe("Optional Thorbit project to associate the run with.")
|
|
87
88
|
};
|
|
88
89
|
var ThorbitDepositionGetInputSchema = {
|
|
@@ -104,9 +105,15 @@ var ThorbitDepositionListInputSchema = {
|
|
|
104
105
|
limit: import_zod.z.number().int().min(1).max(100).default(25).describe("Maximum runs to return."),
|
|
105
106
|
offset: import_zod.z.number().int().min(0).default(0).describe("Pagination offset.")
|
|
106
107
|
};
|
|
108
|
+
var ThorbitDepositionSearchInputSchema = {
|
|
109
|
+
query: import_zod.z.string().min(1).max(300).describe("Text to search across run company, category, and playbook content."),
|
|
110
|
+
projectPublicId: import_zod.z.string().min(1).optional().describe("Optional project filter."),
|
|
111
|
+
limit: import_zod.z.number().int().min(1).max(50).default(15).describe("Maximum matches to return."),
|
|
112
|
+
offset: import_zod.z.number().int().min(0).default(0).describe("Pagination offset.")
|
|
113
|
+
};
|
|
107
114
|
|
|
108
115
|
// src/deposition-mcp-server.ts
|
|
109
|
-
var VERSION = "0.1.
|
|
116
|
+
var VERSION = "0.1.2";
|
|
110
117
|
function readOnlyAnnotations(title) {
|
|
111
118
|
return { title, readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
112
119
|
}
|
|
@@ -168,6 +175,12 @@ function buildThorbitDepositionMcpServer(client) {
|
|
|
168
175
|
inputSchema: ThorbitDepositionListInputSchema,
|
|
169
176
|
annotations: readOnlyAnnotations("List Depositioning Runs")
|
|
170
177
|
});
|
|
178
|
+
registerTool("thorbit_deposition_search", {
|
|
179
|
+
title: "Search Depositioning Runs",
|
|
180
|
+
description: 'Full-text search across past Depositioning runs \u2014 matches the query in company, category, and the playbook content, returning each match with its binding state, strategy, vulnerability statement, and a playbook snippet. Use to find prior strategy work by topic (e.g. "pricing opacity", "rehab", "switching cost"), not just by company name.',
|
|
181
|
+
inputSchema: ThorbitDepositionSearchInputSchema,
|
|
182
|
+
annotations: readOnlyAnnotations("Search Depositioning Runs")
|
|
183
|
+
});
|
|
171
184
|
return server;
|
|
172
185
|
}
|
|
173
186
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../bin/thorbit-deposition-mcp.ts","../../src/deposition-api-client.ts","../../src/deposition-mcp-env.ts","../../src/deposition-mcp-server.ts","../../src/deposition-mcp-response-formatters.ts","../../src/deposition-mcp-tool-schemas.ts"],"sourcesContent":["import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'\nimport { ThorbitDepositionApiClient } from '../src/deposition-api-client.js'\nimport { resolveThorbitDepositionMcpEnv } from '../src/deposition-mcp-env.js'\nimport { buildThorbitDepositionMcpServer } from '../src/deposition-mcp-server.js'\n\nasync function main() {\n const env = resolveThorbitDepositionMcpEnv()\n const client = new ThorbitDepositionApiClient(env)\n const server = buildThorbitDepositionMcpServer(client)\n await server.connect(new StdioServerTransport())\n}\n\nmain().catch(error => {\n process.stderr.write(`${error instanceof Error ? error.message : String(error)}\\n`)\n process.exit(1)\n})\n","import type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nexport type ThorbitDepositionMcpEnvelope =\n | {\n ok: true\n result: unknown\n warnings?: string[]\n requestId: string\n }\n | {\n ok: false\n error: {\n code: string\n message: string\n details?: unknown\n }\n requestId: string\n }\n\nexport class ThorbitDepositionApiClient {\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: ThorbitDepositionMcpToolName, input: unknown): Promise<ThorbitDepositionMcpEnvelope> {\n const response = await fetch(`${this.baseUrl}/api/v1/mcp/deposition/${toolName}`, {\n method: 'POST',\n headers: {\n 'x-thorbit-api-key': this.apiKey,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(input ?? {}),\n })\n\n const body = await response.json().catch(() => null) as ThorbitDepositionMcpEnvelope | 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 { readFileSync } from 'node:fs'\nimport { homedir } from 'node:os'\nimport { join } from 'node:path'\n\nexport type ThorbitDepositionMcpEnv = {\n apiKey: string\n baseUrl: string\n}\n\nfunction readApiKeyFile(): string | undefined {\n const explicitPath = process.env.THORBIT_DEPOSITION_MCP_KEY_PATH?.trim()\n const paths = [explicitPath, join(homedir(), '.thorbit-deposition-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 resolveThorbitDepositionMcpEnv(): ThorbitDepositionMcpEnv {\n const apiKey = (\n process.env.THORBIT_API_KEY ||\n process.env.THORBIT_MCP_API_KEY ||\n process.env.THORBIT_DEPOSITION_MCP_API_KEY ||\n readApiKeyFile()\n )?.trim()\n\n if (!apiKey) {\n throw new Error('THORBIT_API_KEY, THORBIT_MCP_API_KEY, or ~/.thorbit-deposition-mcp-key is required')\n }\n\n return {\n apiKey,\n baseUrl: (process.env.THORBIT_BASE_URL || process.env.THORBIT_DEPOSITION_MCP_BASE_URL || 'https://thorbit.ai').trim(),\n }\n}\n","import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport type { ToolAnnotations } from '@modelcontextprotocol/sdk/types.js'\nimport type { ZodRawShape } from 'zod'\nimport type { ThorbitDepositionApiClient } from './deposition-api-client.js'\nimport { formatThorbitDepositionMcpToolResult } from './deposition-mcp-response-formatters.js'\nimport {\n ThorbitDepositionStartInputSchema,\n ThorbitDepositionGetInputSchema,\n ThorbitDepositionGetPlaybookInputSchema,\n ThorbitDepositionArtifactReadInputSchema,\n ThorbitDepositionListInputSchema,\n} from './deposition-mcp-tool-schemas.js'\nimport type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nconst VERSION = '0.1.1'\n\ntype ThorbitDepositionToolConfig<InputArgs extends ZodRawShape> = {\n title: string\n description: string\n inputSchema: InputArgs\n annotations: ToolAnnotations\n}\n\nfunction readOnlyAnnotations(title: string) {\n return { title, readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false }\n}\n\nfunction writeAnnotations(title: string) {\n return { title, readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true }\n}\n\nexport const SERVER_INSTRUCTIONS = [\n 'Thorbit Depositioning MCP. Runs the durable Depositioning strategy pipeline on hosted Thorbit (this server is a thin client). It researches competitors + customers, finds the binding vulnerability, classifies mover populations, designs a category class, builds a displacement mechanism, and writes a strategy playbook. All write/analysis tools are metered against your API key.',\n '',\n 'INTAKE (ask the user these BEFORE thorbit_deposition_start, then run):',\n '1. Company / product name being depositioned.',\n '2. Product URL (the challenger homepage).',\n '3. Category name (e.g. \"B2B sales analytics\").',\n '4. Optional: 0-5 competitor URLs (auto-discovered via SERP if fewer than 2).',\n '5. Optional: a customer reviews URL (G2 / Trustpilot / Reddit) and known customer pain points.',\n '',\n 'ASYNC CONTRACT (important):',\n '- thorbit_deposition_start returns quickly with {runPublicId, poll}. Do NOT block — follow result.poll.',\n '- Poll thorbit_deposition_get until status is terminal (complete/failed). It returns a LEAN status (phase, progress, binding state, strategy) with a nextAction.',\n '- When status is complete, call thorbit_deposition_get_playbook to read the finished markdown playbook.',\n '- thorbit_deposition_get also returns an ARTIFACTS manifest (research/own.json, research/competitor-N.json, research/customers.json, research/market.json, vulnerability.json, movers.json, category.json, mechanism.json, playbook.md). Read any one on demand with thorbit_deposition_artifact_read(runPublicId, artifactId) — do NOT pull includePhaseData unless you need the whole raw bundle.',\n '- Use thorbit_deposition_list to find past runs (by company/status) and their runPublicId.',\n].join('\\n')\n\nexport function buildThorbitDepositionMcpServer(client: ThorbitDepositionApiClient): McpServer {\n const server = new McpServer({ name: 'thorbit-deposition-mcp', version: VERSION }, { instructions: SERVER_INSTRUCTIONS })\n\n function registerTool<T extends ThorbitDepositionMcpToolName>(\n toolName: T,\n config: ThorbitDepositionToolConfig<ZodRawShape>,\n ): void {\n server.registerTool(toolName, config, async (input) => {\n const envelope = await client.callTool(toolName, input)\n return formatThorbitDepositionMcpToolResult(toolName, envelope)\n })\n }\n\n registerTool('thorbit_deposition_start', {\n title: 'Start Depositioning Run',\n description: 'Start a durable Depositioning strategy run for a challenger product in a category. Researches competitors and customers, finds the binding vulnerability, classifies movers, designs a category class, builds a displacement mechanism, and writes a playbook. Returns a runPublicId plus a thorbit_deposition_get poll target. Metered.',\n inputSchema: ThorbitDepositionStartInputSchema,\n annotations: writeAnnotations('Start Depositioning Run'),\n })\n\n registerTool('thorbit_deposition_get', {\n title: 'Read Depositioning Run Status',\n description: 'Read a Depositioning run: status, current phase, progress, selected binding state and strategy, primary vulnerability, category class, displacement mechanism, and whether the playbook is ready. Returns a nextAction. Poll until status is complete or failed.',\n inputSchema: ThorbitDepositionGetInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Run Status'),\n })\n\n registerTool('thorbit_deposition_get_playbook', {\n title: 'Read Depositioning Playbook',\n description: 'Return the finished deposition-playbook markdown for a completed run (executive brief, the four elements, activation guide). Returns not_found until the run completes.',\n inputSchema: ThorbitDepositionGetPlaybookInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Playbook'),\n })\n\n registerTool('thorbit_deposition_artifact_read', {\n title: 'Read Depositioning Artifact',\n description: 'Read one artifact from a run\\'s folder by id (e.g. research/own.json, research/competitor-2.json, vulnerability.json, playbook.md). Artifact ids come from the artifacts manifest in thorbit_deposition_get. Byte-capped via maxBytes. Use this instead of pulling the whole run.',\n inputSchema: ThorbitDepositionArtifactReadInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Artifact'),\n })\n\n registerTool('thorbit_deposition_list', {\n title: 'List Depositioning Runs',\n description: 'List past Depositioning runs (most recent first) with runPublicId, company, category, status, binding state, and strategy. Filter by project, company-name search, or status. Use to find a prior run to read.',\n inputSchema: ThorbitDepositionListInputSchema,\n annotations: readOnlyAnnotations('List Depositioning Runs'),\n })\n\n return server\n}\n","import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js'\nimport type { ThorbitDepositionMcpEnvelope } from './deposition-api-client.js'\nimport type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nexport function formatThorbitDepositionMcpToolResult(\n toolName: ThorbitDepositionMcpToolName,\n envelope: ThorbitDepositionMcpEnvelope,\n): CallToolResult {\n const text = JSON.stringify({ toolName, ...envelope }, null, 2)\n return {\n content: [{ type: 'text', text }],\n isError: !envelope.ok,\n }\n}\n","import { z } from 'zod'\n\nexport const ThorbitDepositionStartInputSchema = {\n companyName: z.string().min(1).max(255).describe('The challenger company or product being depositioned.'),\n productUrl: z.string().url().max(2048).describe('URL of the challenger product homepage.'),\n categoryName: z.string().min(1).max(255).describe('The product category, e.g. \"B2B sales analytics\".'),\n competitorUrls: z.array(z.string().url()).max(5).default([]).describe('0-5 competitor URLs. Auto-discovered via SERP if fewer than 2 are provided.'),\n reviewsUrl: z.string().url().max(2048).optional().describe('Optional customer reviews URL (G2, Trustpilot, Reddit thread).'),\n knownPains: z.array(z.string().min(1)).max(50).optional().describe('Optional known customer pain points to seed the analysis.'),\n projectPublicId: z.string().min(1).optional().describe('Optional Thorbit project to associate the run with.'),\n}\n\nexport const ThorbitDepositionGetInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID returned by thorbit_deposition_start.'),\n includePhaseData: z.boolean().default(false).describe('Include raw per-phase intermediate data in addition to the lean status.'),\n}\n\nexport const ThorbitDepositionGetPlaybookInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID. Returns the markdown playbook once the run is complete.'),\n}\n\nexport const ThorbitDepositionArtifactReadInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID.'),\n artifactId: z.string().min(1).describe('Artifact id from the run manifest, e.g. \"research/own.json\", \"research/competitor-2.json\", \"vulnerability.json\", \"playbook.md\". Get ids from thorbit_deposition_get.'),\n maxBytes: z.number().int().min(1000).max(1000000).default(200000).describe('Max bytes to return; content is truncated with a flag if larger.'),\n}\n\nexport const ThorbitDepositionListInputSchema = {\n projectPublicId: z.string().min(1).optional().describe('Optional project filter; omit for all org runs.'),\n search: z.string().max(200).optional().describe('Optional company-name substring filter.'),\n status: z.enum(['queued', 'running', 'complete', 'failed']).optional().describe('Optional run status filter.'),\n limit: z.number().int().min(1).max(100).default(25).describe('Maximum runs to return.'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset.'),\n}\n\nexport const ThorbitDepositionMcpToolInputSchemas = {\n thorbit_deposition_start: ThorbitDepositionStartInputSchema,\n thorbit_deposition_get: ThorbitDepositionGetInputSchema,\n thorbit_deposition_get_playbook: ThorbitDepositionGetPlaybookInputSchema,\n thorbit_deposition_artifact_read: ThorbitDepositionArtifactReadInputSchema,\n thorbit_deposition_list: ThorbitDepositionListInputSchema,\n}\n"],"mappings":";;;;AAAA,mBAAqC;;;ACmB9B,IAAM,6BAAN,MAAiC;AAAA,EACrB;AAAA,EACA;AAAA,EAEjB,YAAY,SAA8C;AACxD,SAAK,UAAU,QAAQ,QAAQ,QAAQ,OAAO,EAAE;AAChD,SAAK,SAAS,QAAQ;AAAA,EACxB;AAAA,EAEA,MAAM,SAAS,UAAwC,OAAuD;AAC5G,UAAM,WAAW,MAAM,MAAM,GAAG,KAAK,OAAO,0BAA0B,QAAQ,IAAI;AAAA,MAChF,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,qBAAqB,KAAK;AAAA,QAC1B,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;;;AClDA,qBAA6B;AAC7B,qBAAwB;AACxB,uBAAqB;AAOrB,SAAS,iBAAqC;AAC5C,QAAM,eAAe,QAAQ,IAAI,iCAAiC,KAAK;AACvE,QAAM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C;AAED,eAAa,oCAAoC;AAAA,IAC/C,OAAO;AAAA,IACP,aAAa;AAAA,IACb,aAAa;AAAA,IACb,aAAa,oBAAoB,6BAA6B;AAAA,EAChE,CAAC;AAED,eAAa,2BAA2B;AAAA,IACtC,OAAO;AAAA,IACP,aAAa;AAAA,IACb,aAAa;AAAA,IACb,aAAa,oBAAoB,yBAAyB;AAAA,EAC5D,CAAC;AAED,SAAO;AACT;;;AH7FA,eAAe,OAAO;AACpB,QAAM,MAAM,+BAA+B;AAC3C,QAAM,SAAS,IAAI,2BAA2B,GAAG;AACjD,QAAM,SAAS,gCAAgC,MAAM;AACrD,QAAM,OAAO,QAAQ,IAAI,kCAAqB,CAAC;AACjD;AAEA,KAAK,EAAE,MAAM,WAAS;AACpB,UAAQ,OAAO,MAAM,GAAG,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;AAAA,CAAI;AAClF,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../bin/thorbit-deposition-mcp.ts","../../src/deposition-api-client.ts","../../src/deposition-mcp-env.ts","../../src/deposition-mcp-server.ts","../../src/deposition-mcp-response-formatters.ts","../../src/deposition-mcp-tool-schemas.ts"],"sourcesContent":["import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'\nimport { ThorbitDepositionApiClient } from '../src/deposition-api-client.js'\nimport { resolveThorbitDepositionMcpEnv } from '../src/deposition-mcp-env.js'\nimport { buildThorbitDepositionMcpServer } from '../src/deposition-mcp-server.js'\n\nasync function main() {\n const env = resolveThorbitDepositionMcpEnv()\n const client = new ThorbitDepositionApiClient(env)\n const server = buildThorbitDepositionMcpServer(client)\n await server.connect(new StdioServerTransport())\n}\n\nmain().catch(error => {\n process.stderr.write(`${error instanceof Error ? error.message : String(error)}\\n`)\n process.exit(1)\n})\n","import type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nexport type ThorbitDepositionMcpEnvelope =\n | {\n ok: true\n result: unknown\n warnings?: string[]\n requestId: string\n }\n | {\n ok: false\n error: {\n code: string\n message: string\n details?: unknown\n }\n requestId: string\n }\n\nexport class ThorbitDepositionApiClient {\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: ThorbitDepositionMcpToolName, input: unknown): Promise<ThorbitDepositionMcpEnvelope> {\n const response = await fetch(`${this.baseUrl}/api/v1/mcp/deposition/${toolName}`, {\n method: 'POST',\n headers: {\n 'x-thorbit-api-key': this.apiKey,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(input ?? {}),\n })\n\n const body = await response.json().catch(() => null) as ThorbitDepositionMcpEnvelope | 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 { readFileSync } from 'node:fs'\nimport { homedir } from 'node:os'\nimport { join } from 'node:path'\n\nexport type ThorbitDepositionMcpEnv = {\n apiKey: string\n baseUrl: string\n}\n\nfunction readApiKeyFile(): string | undefined {\n const explicitPath = process.env.THORBIT_DEPOSITION_MCP_KEY_PATH?.trim()\n const paths = [explicitPath, join(homedir(), '.thorbit-deposition-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 resolveThorbitDepositionMcpEnv(): ThorbitDepositionMcpEnv {\n const apiKey = (\n process.env.THORBIT_API_KEY ||\n process.env.THORBIT_MCP_API_KEY ||\n process.env.THORBIT_DEPOSITION_MCP_API_KEY ||\n readApiKeyFile()\n )?.trim()\n\n if (!apiKey) {\n throw new Error('THORBIT_API_KEY, THORBIT_MCP_API_KEY, or ~/.thorbit-deposition-mcp-key is required')\n }\n\n return {\n apiKey,\n baseUrl: (process.env.THORBIT_BASE_URL || process.env.THORBIT_DEPOSITION_MCP_BASE_URL || 'https://thorbit.ai').trim(),\n }\n}\n","import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport type { ToolAnnotations } from '@modelcontextprotocol/sdk/types.js'\nimport type { ZodRawShape } from 'zod'\nimport type { ThorbitDepositionApiClient } from './deposition-api-client.js'\nimport { formatThorbitDepositionMcpToolResult } from './deposition-mcp-response-formatters.js'\nimport {\n ThorbitDepositionStartInputSchema,\n ThorbitDepositionGetInputSchema,\n ThorbitDepositionGetPlaybookInputSchema,\n ThorbitDepositionArtifactReadInputSchema,\n ThorbitDepositionListInputSchema,\n ThorbitDepositionSearchInputSchema,\n} from './deposition-mcp-tool-schemas.js'\nimport type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nconst VERSION = '0.1.2'\n\ntype ThorbitDepositionToolConfig<InputArgs extends ZodRawShape> = {\n title: string\n description: string\n inputSchema: InputArgs\n annotations: ToolAnnotations\n}\n\nfunction readOnlyAnnotations(title: string) {\n return { title, readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false }\n}\n\nfunction writeAnnotations(title: string) {\n return { title, readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true }\n}\n\nexport const SERVER_INSTRUCTIONS = [\n 'Thorbit Depositioning MCP. Runs the durable Depositioning strategy pipeline on hosted Thorbit (this server is a thin client). It researches competitors + customers, finds the binding vulnerability, classifies mover populations, designs a category class, builds a displacement mechanism, and writes a strategy playbook. All write/analysis tools are metered against your API key.',\n '',\n 'INTAKE (ask the user these BEFORE thorbit_deposition_start, then run):',\n '1. Company / product name being depositioned.',\n '2. Product URL (the challenger homepage).',\n '3. Category name (e.g. \"B2B sales analytics\").',\n '4. Optional: 0-5 competitor URLs (auto-discovered via SERP if fewer than 2).',\n '5. Optional: a customer reviews URL (G2 / Trustpilot / Reddit) and known customer pain points.',\n '',\n 'ASYNC CONTRACT (important):',\n '- thorbit_deposition_start returns quickly with {runPublicId, poll}. Do NOT block — follow result.poll.',\n '- Poll thorbit_deposition_get until status is terminal (complete/failed). It returns a LEAN status (phase, progress, binding state, strategy) with a nextAction.',\n '- When status is complete, call thorbit_deposition_get_playbook to read the finished markdown playbook.',\n '- thorbit_deposition_get also returns an ARTIFACTS manifest (research/own.json, research/competitor-N.json, research/customers.json, research/market.json, vulnerability.json, movers.json, category.json, mechanism.json, playbook.md). Read any one on demand with thorbit_deposition_artifact_read(runPublicId, artifactId) — do NOT pull includePhaseData unless you need the whole raw bundle.',\n '- Use thorbit_deposition_list to find past runs (by company/status) and their runPublicId.',\n].join('\\n')\n\nexport function buildThorbitDepositionMcpServer(client: ThorbitDepositionApiClient): McpServer {\n const server = new McpServer({ name: 'thorbit-deposition-mcp', version: VERSION }, { instructions: SERVER_INSTRUCTIONS })\n\n function registerTool<T extends ThorbitDepositionMcpToolName>(\n toolName: T,\n config: ThorbitDepositionToolConfig<ZodRawShape>,\n ): void {\n server.registerTool(toolName, config, async (input) => {\n const envelope = await client.callTool(toolName, input)\n return formatThorbitDepositionMcpToolResult(toolName, envelope)\n })\n }\n\n registerTool('thorbit_deposition_start', {\n title: 'Start Depositioning Run',\n description: 'Start a durable Depositioning strategy run for a challenger product in a category. Researches competitors and customers, finds the binding vulnerability, classifies movers, designs a category class, builds a displacement mechanism, and writes a playbook. Returns a runPublicId plus a thorbit_deposition_get poll target. Metered.',\n inputSchema: ThorbitDepositionStartInputSchema,\n annotations: writeAnnotations('Start Depositioning Run'),\n })\n\n registerTool('thorbit_deposition_get', {\n title: 'Read Depositioning Run Status',\n description: 'Read a Depositioning run: status, current phase, progress, selected binding state and strategy, primary vulnerability, category class, displacement mechanism, and whether the playbook is ready. Returns a nextAction. Poll until status is complete or failed.',\n inputSchema: ThorbitDepositionGetInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Run Status'),\n })\n\n registerTool('thorbit_deposition_get_playbook', {\n title: 'Read Depositioning Playbook',\n description: 'Return the finished deposition-playbook markdown for a completed run (executive brief, the four elements, activation guide). Returns not_found until the run completes.',\n inputSchema: ThorbitDepositionGetPlaybookInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Playbook'),\n })\n\n registerTool('thorbit_deposition_artifact_read', {\n title: 'Read Depositioning Artifact',\n description: 'Read one artifact from a run\\'s folder by id (e.g. research/own.json, research/competitor-2.json, vulnerability.json, playbook.md). Artifact ids come from the artifacts manifest in thorbit_deposition_get. Byte-capped via maxBytes. Use this instead of pulling the whole run.',\n inputSchema: ThorbitDepositionArtifactReadInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Artifact'),\n })\n\n registerTool('thorbit_deposition_list', {\n title: 'List Depositioning Runs',\n description: 'List past Depositioning runs (most recent first) with runPublicId, company, category, status, binding state, and strategy. Filter by project, company-name search, or status. Use to find a prior run to read.',\n inputSchema: ThorbitDepositionListInputSchema,\n annotations: readOnlyAnnotations('List Depositioning Runs'),\n })\n\n registerTool('thorbit_deposition_search', {\n title: 'Search Depositioning Runs',\n description: 'Full-text search across past Depositioning runs — matches the query in company, category, and the playbook content, returning each match with its binding state, strategy, vulnerability statement, and a playbook snippet. Use to find prior strategy work by topic (e.g. \"pricing opacity\", \"rehab\", \"switching cost\"), not just by company name.',\n inputSchema: ThorbitDepositionSearchInputSchema,\n annotations: readOnlyAnnotations('Search Depositioning Runs'),\n })\n\n return server\n}\n","import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js'\nimport type { ThorbitDepositionMcpEnvelope } from './deposition-api-client.js'\nimport type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nexport function formatThorbitDepositionMcpToolResult(\n toolName: ThorbitDepositionMcpToolName,\n envelope: ThorbitDepositionMcpEnvelope,\n): CallToolResult {\n const text = JSON.stringify({ toolName, ...envelope }, null, 2)\n return {\n content: [{ type: 'text', text }],\n isError: !envelope.ok,\n }\n}\n","import { z } from 'zod'\n\nexport const ThorbitDepositionStartInputSchema = {\n companyName: z.string().min(1).max(255).describe('The challenger company or product being depositioned.'),\n productUrl: z.string().url().max(2048).describe('URL of the challenger product homepage.'),\n categoryName: z.string().min(1).max(255).describe('The product category, e.g. \"B2B sales analytics\".'),\n competitorUrls: z.array(z.string().url()).max(5).default([]).describe('0-5 competitor URLs. Auto-discovered via SERP if fewer than 2 are provided.'),\n reviewsUrl: z.string().url().max(2048).optional().describe('Optional customer reviews URL (G2, Trustpilot, Reddit thread).'),\n knownPains: z.array(z.string().min(1)).max(50).optional().describe('Optional known customer pain points to seed the analysis.'),\n context: z.string().max(8000).optional().describe('Optional free-form context about the company that gets passed to the AI as authoritative ground truth — its real niche, target audience, monetization, founder/standard-bearer, beliefs/mission, and who its true competitors are. Use this when the website is generic or the real positioning is not obvious from the homepage. When provided it steers research, competitor discovery, vulnerability, and category ownership.'),\n projectPublicId: z.string().min(1).optional().describe('Optional Thorbit project to associate the run with.'),\n}\n\nexport const ThorbitDepositionGetInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID returned by thorbit_deposition_start.'),\n includePhaseData: z.boolean().default(false).describe('Include raw per-phase intermediate data in addition to the lean status.'),\n}\n\nexport const ThorbitDepositionGetPlaybookInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID. Returns the markdown playbook once the run is complete.'),\n}\n\nexport const ThorbitDepositionArtifactReadInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID.'),\n artifactId: z.string().min(1).describe('Artifact id from the run manifest, e.g. \"research/own.json\", \"research/competitor-2.json\", \"vulnerability.json\", \"playbook.md\". Get ids from thorbit_deposition_get.'),\n maxBytes: z.number().int().min(1000).max(1000000).default(200000).describe('Max bytes to return; content is truncated with a flag if larger.'),\n}\n\nexport const ThorbitDepositionListInputSchema = {\n projectPublicId: z.string().min(1).optional().describe('Optional project filter; omit for all org runs.'),\n search: z.string().max(200).optional().describe('Optional company-name substring filter.'),\n status: z.enum(['queued', 'running', 'complete', 'failed']).optional().describe('Optional run status filter.'),\n limit: z.number().int().min(1).max(100).default(25).describe('Maximum runs to return.'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset.'),\n}\n\nexport const ThorbitDepositionSearchInputSchema = {\n query: z.string().min(1).max(300).describe('Text to search across run company, category, and playbook content.'),\n projectPublicId: z.string().min(1).optional().describe('Optional project filter.'),\n limit: z.number().int().min(1).max(50).default(15).describe('Maximum matches to return.'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset.'),\n}\n\nexport const ThorbitDepositionMcpToolInputSchemas = {\n thorbit_deposition_start: ThorbitDepositionStartInputSchema,\n thorbit_deposition_get: ThorbitDepositionGetInputSchema,\n thorbit_deposition_get_playbook: ThorbitDepositionGetPlaybookInputSchema,\n thorbit_deposition_artifact_read: ThorbitDepositionArtifactReadInputSchema,\n thorbit_deposition_list: ThorbitDepositionListInputSchema,\n thorbit_deposition_search: ThorbitDepositionSearchInputSchema,\n}\n"],"mappings":";;;;AAAA,mBAAqC;;;ACmB9B,IAAM,6BAAN,MAAiC;AAAA,EACrB;AAAA,EACA;AAAA,EAEjB,YAAY,SAA8C;AACxD,SAAK,UAAU,QAAQ,QAAQ,QAAQ,OAAO,EAAE;AAChD,SAAK,SAAS,QAAQ;AAAA,EACxB;AAAA,EAEA,MAAM,SAAS,UAAwC,OAAuD;AAC5G,UAAM,WAAW,MAAM,MAAM,GAAG,KAAK,OAAO,0BAA0B,QAAQ,IAAI;AAAA,MAChF,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,qBAAqB,KAAK;AAAA,QAC1B,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,W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AA+B;AAC3C,QAAM,SAAS,IAAI,2BAA2B,GAAG;AACjD,QAAM,SAAS,gCAAgC,MAAM;AACrD,QAAM,OAAO,QAAQ,IAAI,kCAAqB,CAAC;AACjD;AAEA,KAAK,EAAE,MAAM,WAAS;AACpB,UAAQ,OAAO,MAAM,GAAG,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;AAAA,CAAI;AAClF,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":[]}
|
|
@@ -82,6 +82,7 @@ var ThorbitDepositionStartInputSchema = {
|
|
|
82
82
|
competitorUrls: z.array(z.string().url()).max(5).default([]).describe("0-5 competitor URLs. Auto-discovered via SERP if fewer than 2 are provided."),
|
|
83
83
|
reviewsUrl: z.string().url().max(2048).optional().describe("Optional customer reviews URL (G2, Trustpilot, Reddit thread)."),
|
|
84
84
|
knownPains: z.array(z.string().min(1)).max(50).optional().describe("Optional known customer pain points to seed the analysis."),
|
|
85
|
+
context: z.string().max(8e3).optional().describe("Optional free-form context about the company that gets passed to the AI as authoritative ground truth \u2014 its real niche, target audience, monetization, founder/standard-bearer, beliefs/mission, and who its true competitors are. Use this when the website is generic or the real positioning is not obvious from the homepage. When provided it steers research, competitor discovery, vulnerability, and category ownership."),
|
|
85
86
|
projectPublicId: z.string().min(1).optional().describe("Optional Thorbit project to associate the run with.")
|
|
86
87
|
};
|
|
87
88
|
var ThorbitDepositionGetInputSchema = {
|
|
@@ -103,9 +104,15 @@ var ThorbitDepositionListInputSchema = {
|
|
|
103
104
|
limit: z.number().int().min(1).max(100).default(25).describe("Maximum runs to return."),
|
|
104
105
|
offset: z.number().int().min(0).default(0).describe("Pagination offset.")
|
|
105
106
|
};
|
|
107
|
+
var ThorbitDepositionSearchInputSchema = {
|
|
108
|
+
query: z.string().min(1).max(300).describe("Text to search across run company, category, and playbook content."),
|
|
109
|
+
projectPublicId: z.string().min(1).optional().describe("Optional project filter."),
|
|
110
|
+
limit: z.number().int().min(1).max(50).default(15).describe("Maximum matches to return."),
|
|
111
|
+
offset: z.number().int().min(0).default(0).describe("Pagination offset.")
|
|
112
|
+
};
|
|
106
113
|
|
|
107
114
|
// src/deposition-mcp-server.ts
|
|
108
|
-
var VERSION = "0.1.
|
|
115
|
+
var VERSION = "0.1.2";
|
|
109
116
|
function readOnlyAnnotations(title) {
|
|
110
117
|
return { title, readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
111
118
|
}
|
|
@@ -167,6 +174,12 @@ function buildThorbitDepositionMcpServer(client) {
|
|
|
167
174
|
inputSchema: ThorbitDepositionListInputSchema,
|
|
168
175
|
annotations: readOnlyAnnotations("List Depositioning Runs")
|
|
169
176
|
});
|
|
177
|
+
registerTool("thorbit_deposition_search", {
|
|
178
|
+
title: "Search Depositioning Runs",
|
|
179
|
+
description: 'Full-text search across past Depositioning runs \u2014 matches the query in company, category, and the playbook content, returning each match with its binding state, strategy, vulnerability statement, and a playbook snippet. Use to find prior strategy work by topic (e.g. "pricing opacity", "rehab", "switching cost"), not just by company name.',
|
|
180
|
+
inputSchema: ThorbitDepositionSearchInputSchema,
|
|
181
|
+
annotations: readOnlyAnnotations("Search Depositioning Runs")
|
|
182
|
+
});
|
|
170
183
|
return server;
|
|
171
184
|
}
|
|
172
185
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../bin/thorbit-deposition-mcp.ts","../../src/deposition-api-client.ts","../../src/deposition-mcp-env.ts","../../src/deposition-mcp-server.ts","../../src/deposition-mcp-response-formatters.ts","../../src/deposition-mcp-tool-schemas.ts"],"sourcesContent":["import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'\nimport { ThorbitDepositionApiClient } from '../src/deposition-api-client.js'\nimport { resolveThorbitDepositionMcpEnv } from '../src/deposition-mcp-env.js'\nimport { buildThorbitDepositionMcpServer } from '../src/deposition-mcp-server.js'\n\nasync function main() {\n const env = resolveThorbitDepositionMcpEnv()\n const client = new ThorbitDepositionApiClient(env)\n const server = buildThorbitDepositionMcpServer(client)\n await server.connect(new StdioServerTransport())\n}\n\nmain().catch(error => {\n process.stderr.write(`${error instanceof Error ? error.message : String(error)}\\n`)\n process.exit(1)\n})\n","import type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nexport type ThorbitDepositionMcpEnvelope =\n | {\n ok: true\n result: unknown\n warnings?: string[]\n requestId: string\n }\n | {\n ok: false\n error: {\n code: string\n message: string\n details?: unknown\n }\n requestId: string\n }\n\nexport class ThorbitDepositionApiClient {\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: ThorbitDepositionMcpToolName, input: unknown): Promise<ThorbitDepositionMcpEnvelope> {\n const response = await fetch(`${this.baseUrl}/api/v1/mcp/deposition/${toolName}`, {\n method: 'POST',\n headers: {\n 'x-thorbit-api-key': this.apiKey,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(input ?? {}),\n })\n\n const body = await response.json().catch(() => null) as ThorbitDepositionMcpEnvelope | 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 { readFileSync } from 'node:fs'\nimport { homedir } from 'node:os'\nimport { join } from 'node:path'\n\nexport type ThorbitDepositionMcpEnv = {\n apiKey: string\n baseUrl: string\n}\n\nfunction readApiKeyFile(): string | undefined {\n const explicitPath = process.env.THORBIT_DEPOSITION_MCP_KEY_PATH?.trim()\n const paths = [explicitPath, join(homedir(), '.thorbit-deposition-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 resolveThorbitDepositionMcpEnv(): ThorbitDepositionMcpEnv {\n const apiKey = (\n process.env.THORBIT_API_KEY ||\n process.env.THORBIT_MCP_API_KEY ||\n process.env.THORBIT_DEPOSITION_MCP_API_KEY ||\n readApiKeyFile()\n )?.trim()\n\n if (!apiKey) {\n throw new Error('THORBIT_API_KEY, THORBIT_MCP_API_KEY, or ~/.thorbit-deposition-mcp-key is required')\n }\n\n return {\n apiKey,\n baseUrl: (process.env.THORBIT_BASE_URL || process.env.THORBIT_DEPOSITION_MCP_BASE_URL || 'https://thorbit.ai').trim(),\n }\n}\n","import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport type { ToolAnnotations } from '@modelcontextprotocol/sdk/types.js'\nimport type { ZodRawShape } from 'zod'\nimport type { ThorbitDepositionApiClient } from './deposition-api-client.js'\nimport { formatThorbitDepositionMcpToolResult } from './deposition-mcp-response-formatters.js'\nimport {\n ThorbitDepositionStartInputSchema,\n ThorbitDepositionGetInputSchema,\n ThorbitDepositionGetPlaybookInputSchema,\n ThorbitDepositionArtifactReadInputSchema,\n ThorbitDepositionListInputSchema,\n} from './deposition-mcp-tool-schemas.js'\nimport type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nconst VERSION = '0.1.1'\n\ntype ThorbitDepositionToolConfig<InputArgs extends ZodRawShape> = {\n title: string\n description: string\n inputSchema: InputArgs\n annotations: ToolAnnotations\n}\n\nfunction readOnlyAnnotations(title: string) {\n return { title, readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false }\n}\n\nfunction writeAnnotations(title: string) {\n return { title, readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true }\n}\n\nexport const SERVER_INSTRUCTIONS = [\n 'Thorbit Depositioning MCP. Runs the durable Depositioning strategy pipeline on hosted Thorbit (this server is a thin client). It researches competitors + customers, finds the binding vulnerability, classifies mover populations, designs a category class, builds a displacement mechanism, and writes a strategy playbook. All write/analysis tools are metered against your API key.',\n '',\n 'INTAKE (ask the user these BEFORE thorbit_deposition_start, then run):',\n '1. Company / product name being depositioned.',\n '2. Product URL (the challenger homepage).',\n '3. Category name (e.g. \"B2B sales analytics\").',\n '4. Optional: 0-5 competitor URLs (auto-discovered via SERP if fewer than 2).',\n '5. Optional: a customer reviews URL (G2 / Trustpilot / Reddit) and known customer pain points.',\n '',\n 'ASYNC CONTRACT (important):',\n '- thorbit_deposition_start returns quickly with {runPublicId, poll}. Do NOT block — follow result.poll.',\n '- Poll thorbit_deposition_get until status is terminal (complete/failed). It returns a LEAN status (phase, progress, binding state, strategy) with a nextAction.',\n '- When status is complete, call thorbit_deposition_get_playbook to read the finished markdown playbook.',\n '- thorbit_deposition_get also returns an ARTIFACTS manifest (research/own.json, research/competitor-N.json, research/customers.json, research/market.json, vulnerability.json, movers.json, category.json, mechanism.json, playbook.md). Read any one on demand with thorbit_deposition_artifact_read(runPublicId, artifactId) — do NOT pull includePhaseData unless you need the whole raw bundle.',\n '- Use thorbit_deposition_list to find past runs (by company/status) and their runPublicId.',\n].join('\\n')\n\nexport function buildThorbitDepositionMcpServer(client: ThorbitDepositionApiClient): McpServer {\n const server = new McpServer({ name: 'thorbit-deposition-mcp', version: VERSION }, { instructions: SERVER_INSTRUCTIONS })\n\n function registerTool<T extends ThorbitDepositionMcpToolName>(\n toolName: T,\n config: ThorbitDepositionToolConfig<ZodRawShape>,\n ): void {\n server.registerTool(toolName, config, async (input) => {\n const envelope = await client.callTool(toolName, input)\n return formatThorbitDepositionMcpToolResult(toolName, envelope)\n })\n }\n\n registerTool('thorbit_deposition_start', {\n title: 'Start Depositioning Run',\n description: 'Start a durable Depositioning strategy run for a challenger product in a category. Researches competitors and customers, finds the binding vulnerability, classifies movers, designs a category class, builds a displacement mechanism, and writes a playbook. Returns a runPublicId plus a thorbit_deposition_get poll target. Metered.',\n inputSchema: ThorbitDepositionStartInputSchema,\n annotations: writeAnnotations('Start Depositioning Run'),\n })\n\n registerTool('thorbit_deposition_get', {\n title: 'Read Depositioning Run Status',\n description: 'Read a Depositioning run: status, current phase, progress, selected binding state and strategy, primary vulnerability, category class, displacement mechanism, and whether the playbook is ready. Returns a nextAction. Poll until status is complete or failed.',\n inputSchema: ThorbitDepositionGetInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Run Status'),\n })\n\n registerTool('thorbit_deposition_get_playbook', {\n title: 'Read Depositioning Playbook',\n description: 'Return the finished deposition-playbook markdown for a completed run (executive brief, the four elements, activation guide). Returns not_found until the run completes.',\n inputSchema: ThorbitDepositionGetPlaybookInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Playbook'),\n })\n\n registerTool('thorbit_deposition_artifact_read', {\n title: 'Read Depositioning Artifact',\n description: 'Read one artifact from a run\\'s folder by id (e.g. research/own.json, research/competitor-2.json, vulnerability.json, playbook.md). Artifact ids come from the artifacts manifest in thorbit_deposition_get. Byte-capped via maxBytes. Use this instead of pulling the whole run.',\n inputSchema: ThorbitDepositionArtifactReadInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Artifact'),\n })\n\n registerTool('thorbit_deposition_list', {\n title: 'List Depositioning Runs',\n description: 'List past Depositioning runs (most recent first) with runPublicId, company, category, status, binding state, and strategy. Filter by project, company-name search, or status. Use to find a prior run to read.',\n inputSchema: ThorbitDepositionListInputSchema,\n annotations: readOnlyAnnotations('List Depositioning Runs'),\n })\n\n return server\n}\n","import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js'\nimport type { ThorbitDepositionMcpEnvelope } from './deposition-api-client.js'\nimport type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nexport function formatThorbitDepositionMcpToolResult(\n toolName: ThorbitDepositionMcpToolName,\n envelope: ThorbitDepositionMcpEnvelope,\n): CallToolResult {\n const text = JSON.stringify({ toolName, ...envelope }, null, 2)\n return {\n content: [{ type: 'text', text }],\n isError: !envelope.ok,\n }\n}\n","import { z } from 'zod'\n\nexport const ThorbitDepositionStartInputSchema = {\n companyName: z.string().min(1).max(255).describe('The challenger company or product being depositioned.'),\n productUrl: z.string().url().max(2048).describe('URL of the challenger product homepage.'),\n categoryName: z.string().min(1).max(255).describe('The product category, e.g. \"B2B sales analytics\".'),\n competitorUrls: z.array(z.string().url()).max(5).default([]).describe('0-5 competitor URLs. Auto-discovered via SERP if fewer than 2 are provided.'),\n reviewsUrl: z.string().url().max(2048).optional().describe('Optional customer reviews URL (G2, Trustpilot, Reddit thread).'),\n knownPains: z.array(z.string().min(1)).max(50).optional().describe('Optional known customer pain points to seed the analysis.'),\n projectPublicId: z.string().min(1).optional().describe('Optional Thorbit project to associate the run with.'),\n}\n\nexport const ThorbitDepositionGetInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID returned by thorbit_deposition_start.'),\n includePhaseData: z.boolean().default(false).describe('Include raw per-phase intermediate data in addition to the lean status.'),\n}\n\nexport const ThorbitDepositionGetPlaybookInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID. Returns the markdown playbook once the run is complete.'),\n}\n\nexport const ThorbitDepositionArtifactReadInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID.'),\n artifactId: z.string().min(1).describe('Artifact id from the run manifest, e.g. \"research/own.json\", \"research/competitor-2.json\", \"vulnerability.json\", \"playbook.md\". Get ids from thorbit_deposition_get.'),\n maxBytes: z.number().int().min(1000).max(1000000).default(200000).describe('Max bytes to return; content is truncated with a flag if larger.'),\n}\n\nexport const ThorbitDepositionListInputSchema = {\n projectPublicId: z.string().min(1).optional().describe('Optional project filter; omit for all org runs.'),\n search: z.string().max(200).optional().describe('Optional company-name substring filter.'),\n status: z.enum(['queued', 'running', 'complete', 'failed']).optional().describe('Optional run status filter.'),\n limit: z.number().int().min(1).max(100).default(25).describe('Maximum runs to return.'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset.'),\n}\n\nexport const ThorbitDepositionMcpToolInputSchemas = {\n thorbit_deposition_start: ThorbitDepositionStartInputSchema,\n thorbit_deposition_get: ThorbitDepositionGetInputSchema,\n thorbit_deposition_get_playbook: ThorbitDepositionGetPlaybookInputSchema,\n thorbit_deposition_artifact_read: ThorbitDepositionArtifactReadInputSchema,\n thorbit_deposition_list: ThorbitDepositionListInputSchema,\n}\n"],"mappings":";;;AAAA,SAAS,4BAA4B;;;ACmB9B,IAAM,6BAAN,MAAiC;AAAA,EACrB;AAAA,EACA;AAAA,EAEjB,YAAY,SAA8C;AACxD,SAAK,UAAU,QAAQ,QAAQ,QAAQ,OAAO,EAAE;AAChD,SAAK,SAAS,QAAQ;AAAA,EACxB;AAAA,EAEA,MAAM,SAAS,UAAwC,OAAuD;AAC5G,UAAM,WAAW,MAAM,MAAM,GAAG,KAAK,OAAO,0BAA0B,QAAQ,IAAI;AAAA,MAChF,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,qBAAqB,KAAK;AAAA,QAC1B,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;;;AClDA,SAAS,oBAAoB;AAC7B,SAAS,eAAe;AACxB,SAAS,YAAY;AAOrB,SAAS,iBAAqC;AAC5C,QAAM,eAAe,QAAQ,IAAI,iCAAiC,KAAK;AACvE,QAAM,QAAQ,CAAC,cAAc,KAAK,QAAQ,GAAG,6BAA6B,CAAC,EAAE,OAAO,OAAO;AAC3F,aAAW,QAAQ,OAAO;AACxB,QAAI;AACF,YAAM,QAAQ,aAAa,MAAM,MAAM,EAAE,KAAK;AAC9C,U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AAAA,IACP,aAAa;AAAA,IACb,aAAa;AAAA,IACb,aAAa,oBAAoB,yBAAyB;AAAA,EAC5D,CAAC;AAED,SAAO;AACT;;;AH7FA,eAAe,OAAO;AACpB,QAAM,MAAM,+BAA+B;AAC3C,QAAM,SAAS,IAAI,2BAA2B,GAAG;AACjD,QAAM,SAAS,gCAAgC,MAAM;AACrD,QAAM,OAAO,QAAQ,IAAI,qBAAqB,CAAC;AACjD;AAEA,KAAK,EAAE,MAAM,WAAS;AACpB,UAAQ,OAAO,MAAM,GAAG,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;AAAA,CAAI;AAClF,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../bin/thorbit-deposition-mcp.ts","../../src/deposition-api-client.ts","../../src/deposition-mcp-env.ts","../../src/deposition-mcp-server.ts","../../src/deposition-mcp-response-formatters.ts","../../src/deposition-mcp-tool-schemas.ts"],"sourcesContent":["import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'\nimport { ThorbitDepositionApiClient } from '../src/deposition-api-client.js'\nimport { resolveThorbitDepositionMcpEnv } from '../src/deposition-mcp-env.js'\nimport { buildThorbitDepositionMcpServer } from '../src/deposition-mcp-server.js'\n\nasync function main() {\n const env = resolveThorbitDepositionMcpEnv()\n const client = new ThorbitDepositionApiClient(env)\n const server = buildThorbitDepositionMcpServer(client)\n await server.connect(new StdioServerTransport())\n}\n\nmain().catch(error => {\n process.stderr.write(`${error instanceof Error ? error.message : String(error)}\\n`)\n process.exit(1)\n})\n","import type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nexport type ThorbitDepositionMcpEnvelope =\n | {\n ok: true\n result: unknown\n warnings?: string[]\n requestId: string\n }\n | {\n ok: false\n error: {\n code: string\n message: string\n details?: unknown\n }\n requestId: string\n }\n\nexport class ThorbitDepositionApiClient {\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: ThorbitDepositionMcpToolName, input: unknown): Promise<ThorbitDepositionMcpEnvelope> {\n const response = await fetch(`${this.baseUrl}/api/v1/mcp/deposition/${toolName}`, {\n method: 'POST',\n headers: {\n 'x-thorbit-api-key': this.apiKey,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(input ?? {}),\n })\n\n const body = await response.json().catch(() => null) as ThorbitDepositionMcpEnvelope | 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 { readFileSync } from 'node:fs'\nimport { homedir } from 'node:os'\nimport { join } from 'node:path'\n\nexport type ThorbitDepositionMcpEnv = {\n apiKey: string\n baseUrl: string\n}\n\nfunction readApiKeyFile(): string | undefined {\n const explicitPath = process.env.THORBIT_DEPOSITION_MCP_KEY_PATH?.trim()\n const paths = [explicitPath, join(homedir(), '.thorbit-deposition-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 resolveThorbitDepositionMcpEnv(): ThorbitDepositionMcpEnv {\n const apiKey = (\n process.env.THORBIT_API_KEY ||\n process.env.THORBIT_MCP_API_KEY ||\n process.env.THORBIT_DEPOSITION_MCP_API_KEY ||\n readApiKeyFile()\n )?.trim()\n\n if (!apiKey) {\n throw new Error('THORBIT_API_KEY, THORBIT_MCP_API_KEY, or ~/.thorbit-deposition-mcp-key is required')\n }\n\n return {\n apiKey,\n baseUrl: (process.env.THORBIT_BASE_URL || process.env.THORBIT_DEPOSITION_MCP_BASE_URL || 'https://thorbit.ai').trim(),\n }\n}\n","import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport type { ToolAnnotations } from '@modelcontextprotocol/sdk/types.js'\nimport type { ZodRawShape } from 'zod'\nimport type { ThorbitDepositionApiClient } from './deposition-api-client.js'\nimport { formatThorbitDepositionMcpToolResult } from './deposition-mcp-response-formatters.js'\nimport {\n ThorbitDepositionStartInputSchema,\n ThorbitDepositionGetInputSchema,\n ThorbitDepositionGetPlaybookInputSchema,\n ThorbitDepositionArtifactReadInputSchema,\n ThorbitDepositionListInputSchema,\n ThorbitDepositionSearchInputSchema,\n} from './deposition-mcp-tool-schemas.js'\nimport type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nconst VERSION = '0.1.2'\n\ntype ThorbitDepositionToolConfig<InputArgs extends ZodRawShape> = {\n title: string\n description: string\n inputSchema: InputArgs\n annotations: ToolAnnotations\n}\n\nfunction readOnlyAnnotations(title: string) {\n return { title, readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false }\n}\n\nfunction writeAnnotations(title: string) {\n return { title, readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true }\n}\n\nexport const SERVER_INSTRUCTIONS = [\n 'Thorbit Depositioning MCP. Runs the durable Depositioning strategy pipeline on hosted Thorbit (this server is a thin client). It researches competitors + customers, finds the binding vulnerability, classifies mover populations, designs a category class, builds a displacement mechanism, and writes a strategy playbook. All write/analysis tools are metered against your API key.',\n '',\n 'INTAKE (ask the user these BEFORE thorbit_deposition_start, then run):',\n '1. Company / product name being depositioned.',\n '2. Product URL (the challenger homepage).',\n '3. Category name (e.g. \"B2B sales analytics\").',\n '4. Optional: 0-5 competitor URLs (auto-discovered via SERP if fewer than 2).',\n '5. Optional: a customer reviews URL (G2 / Trustpilot / Reddit) and known customer pain points.',\n '',\n 'ASYNC CONTRACT (important):',\n '- thorbit_deposition_start returns quickly with {runPublicId, poll}. Do NOT block — follow result.poll.',\n '- Poll thorbit_deposition_get until status is terminal (complete/failed). It returns a LEAN status (phase, progress, binding state, strategy) with a nextAction.',\n '- When status is complete, call thorbit_deposition_get_playbook to read the finished markdown playbook.',\n '- thorbit_deposition_get also returns an ARTIFACTS manifest (research/own.json, research/competitor-N.json, research/customers.json, research/market.json, vulnerability.json, movers.json, category.json, mechanism.json, playbook.md). Read any one on demand with thorbit_deposition_artifact_read(runPublicId, artifactId) — do NOT pull includePhaseData unless you need the whole raw bundle.',\n '- Use thorbit_deposition_list to find past runs (by company/status) and their runPublicId.',\n].join('\\n')\n\nexport function buildThorbitDepositionMcpServer(client: ThorbitDepositionApiClient): McpServer {\n const server = new McpServer({ name: 'thorbit-deposition-mcp', version: VERSION }, { instructions: SERVER_INSTRUCTIONS })\n\n function registerTool<T extends ThorbitDepositionMcpToolName>(\n toolName: T,\n config: ThorbitDepositionToolConfig<ZodRawShape>,\n ): void {\n server.registerTool(toolName, config, async (input) => {\n const envelope = await client.callTool(toolName, input)\n return formatThorbitDepositionMcpToolResult(toolName, envelope)\n })\n }\n\n registerTool('thorbit_deposition_start', {\n title: 'Start Depositioning Run',\n description: 'Start a durable Depositioning strategy run for a challenger product in a category. Researches competitors and customers, finds the binding vulnerability, classifies movers, designs a category class, builds a displacement mechanism, and writes a playbook. Returns a runPublicId plus a thorbit_deposition_get poll target. Metered.',\n inputSchema: ThorbitDepositionStartInputSchema,\n annotations: writeAnnotations('Start Depositioning Run'),\n })\n\n registerTool('thorbit_deposition_get', {\n title: 'Read Depositioning Run Status',\n description: 'Read a Depositioning run: status, current phase, progress, selected binding state and strategy, primary vulnerability, category class, displacement mechanism, and whether the playbook is ready. Returns a nextAction. Poll until status is complete or failed.',\n inputSchema: ThorbitDepositionGetInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Run Status'),\n })\n\n registerTool('thorbit_deposition_get_playbook', {\n title: 'Read Depositioning Playbook',\n description: 'Return the finished deposition-playbook markdown for a completed run (executive brief, the four elements, activation guide). Returns not_found until the run completes.',\n inputSchema: ThorbitDepositionGetPlaybookInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Playbook'),\n })\n\n registerTool('thorbit_deposition_artifact_read', {\n title: 'Read Depositioning Artifact',\n description: 'Read one artifact from a run\\'s folder by id (e.g. research/own.json, research/competitor-2.json, vulnerability.json, playbook.md). Artifact ids come from the artifacts manifest in thorbit_deposition_get. Byte-capped via maxBytes. Use this instead of pulling the whole run.',\n inputSchema: ThorbitDepositionArtifactReadInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Artifact'),\n })\n\n registerTool('thorbit_deposition_list', {\n title: 'List Depositioning Runs',\n description: 'List past Depositioning runs (most recent first) with runPublicId, company, category, status, binding state, and strategy. Filter by project, company-name search, or status. Use to find a prior run to read.',\n inputSchema: ThorbitDepositionListInputSchema,\n annotations: readOnlyAnnotations('List Depositioning Runs'),\n })\n\n registerTool('thorbit_deposition_search', {\n title: 'Search Depositioning Runs',\n description: 'Full-text search across past Depositioning runs — matches the query in company, category, and the playbook content, returning each match with its binding state, strategy, vulnerability statement, and a playbook snippet. Use to find prior strategy work by topic (e.g. \"pricing opacity\", \"rehab\", \"switching cost\"), not just by company name.',\n inputSchema: ThorbitDepositionSearchInputSchema,\n annotations: readOnlyAnnotations('Search Depositioning Runs'),\n })\n\n return server\n}\n","import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js'\nimport type { ThorbitDepositionMcpEnvelope } from './deposition-api-client.js'\nimport type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nexport function formatThorbitDepositionMcpToolResult(\n toolName: ThorbitDepositionMcpToolName,\n envelope: ThorbitDepositionMcpEnvelope,\n): CallToolResult {\n const text = JSON.stringify({ toolName, ...envelope }, null, 2)\n return {\n content: [{ type: 'text', text }],\n isError: !envelope.ok,\n }\n}\n","import { z } from 'zod'\n\nexport const ThorbitDepositionStartInputSchema = {\n companyName: z.string().min(1).max(255).describe('The challenger company or product being depositioned.'),\n productUrl: z.string().url().max(2048).describe('URL of the challenger product homepage.'),\n categoryName: z.string().min(1).max(255).describe('The product category, e.g. \"B2B sales analytics\".'),\n competitorUrls: z.array(z.string().url()).max(5).default([]).describe('0-5 competitor URLs. Auto-discovered via SERP if fewer than 2 are provided.'),\n reviewsUrl: z.string().url().max(2048).optional().describe('Optional customer reviews URL (G2, Trustpilot, Reddit thread).'),\n knownPains: z.array(z.string().min(1)).max(50).optional().describe('Optional known customer pain points to seed the analysis.'),\n context: z.string().max(8000).optional().describe('Optional free-form context about the company that gets passed to the AI as authoritative ground truth — its real niche, target audience, monetization, founder/standard-bearer, beliefs/mission, and who its true competitors are. Use this when the website is generic or the real positioning is not obvious from the homepage. When provided it steers research, competitor discovery, vulnerability, and category ownership.'),\n projectPublicId: z.string().min(1).optional().describe('Optional Thorbit project to associate the run with.'),\n}\n\nexport const ThorbitDepositionGetInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID returned by thorbit_deposition_start.'),\n includePhaseData: z.boolean().default(false).describe('Include raw per-phase intermediate data in addition to the lean status.'),\n}\n\nexport const ThorbitDepositionGetPlaybookInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID. Returns the markdown playbook once the run is complete.'),\n}\n\nexport const ThorbitDepositionArtifactReadInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID.'),\n artifactId: z.string().min(1).describe('Artifact id from the run manifest, e.g. \"research/own.json\", \"research/competitor-2.json\", \"vulnerability.json\", \"playbook.md\". Get ids from thorbit_deposition_get.'),\n maxBytes: z.number().int().min(1000).max(1000000).default(200000).describe('Max bytes to return; content is truncated with a flag if larger.'),\n}\n\nexport const ThorbitDepositionListInputSchema = {\n projectPublicId: z.string().min(1).optional().describe('Optional project filter; omit for all org runs.'),\n search: z.string().max(200).optional().describe('Optional company-name substring filter.'),\n status: z.enum(['queued', 'running', 'complete', 'failed']).optional().describe('Optional run status filter.'),\n limit: z.number().int().min(1).max(100).default(25).describe('Maximum runs to return.'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset.'),\n}\n\nexport const ThorbitDepositionSearchInputSchema = {\n query: z.string().min(1).max(300).describe('Text to search across run company, category, and playbook content.'),\n projectPublicId: z.string().min(1).optional().describe('Optional project filter.'),\n limit: z.number().int().min(1).max(50).default(15).describe('Maximum matches to return.'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset.'),\n}\n\nexport const ThorbitDepositionMcpToolInputSchemas = {\n thorbit_deposition_start: ThorbitDepositionStartInputSchema,\n thorbit_deposition_get: ThorbitDepositionGetInputSchema,\n thorbit_deposition_get_playbook: ThorbitDepositionGetPlaybookInputSchema,\n thorbit_deposition_artifact_read: ThorbitDepositionArtifactReadInputSchema,\n thorbit_deposition_list: ThorbitDepositionListInputSchema,\n thorbit_deposition_search: ThorbitDepositionSearchInputSchema,\n}\n"],"mappings":";;;AAAA,SAAS,4BAA4B;;;ACmB9B,IAAM,6BAAN,MAAiC;AAAA,EACrB;AAAA,EACA;AAAA,EAEjB,YAAY,SAA8C;AACxD,SAAK,UAAU,QAAQ,QAAQ,QAAQ,OAAO,EAAE;AAChD,SAAK,SAAS,QAAQ;AAAA,EACxB;AAAA,EAEA,MAAM,SAAS,UAAwC,OAAuD;AAC5G,UAAM,WAAW,MAAM,MAAM,GAAG,KAAK,OAAO,0BAA0B,QAAQ,IAAI;AAAA,MAChF,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,qBAAqB,KAAK;AAAA,QAC1B,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,IAC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EAAE,MAAM,WAAS;AACpB,UAAQ,OAAO,MAAM,GAAG,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;AAAA,CAAI;AAClF,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":[]}
|
package/dist/index.cjs
CHANGED
|
@@ -80,6 +80,7 @@ var ThorbitDepositionStartInputSchema = {
|
|
|
80
80
|
competitorUrls: import_zod.z.array(import_zod.z.string().url()).max(5).default([]).describe("0-5 competitor URLs. Auto-discovered via SERP if fewer than 2 are provided."),
|
|
81
81
|
reviewsUrl: import_zod.z.string().url().max(2048).optional().describe("Optional customer reviews URL (G2, Trustpilot, Reddit thread)."),
|
|
82
82
|
knownPains: import_zod.z.array(import_zod.z.string().min(1)).max(50).optional().describe("Optional known customer pain points to seed the analysis."),
|
|
83
|
+
context: import_zod.z.string().max(8e3).optional().describe("Optional free-form context about the company that gets passed to the AI as authoritative ground truth \u2014 its real niche, target audience, monetization, founder/standard-bearer, beliefs/mission, and who its true competitors are. Use this when the website is generic or the real positioning is not obvious from the homepage. When provided it steers research, competitor discovery, vulnerability, and category ownership."),
|
|
83
84
|
projectPublicId: import_zod.z.string().min(1).optional().describe("Optional Thorbit project to associate the run with.")
|
|
84
85
|
};
|
|
85
86
|
var ThorbitDepositionGetInputSchema = {
|
|
@@ -101,9 +102,15 @@ var ThorbitDepositionListInputSchema = {
|
|
|
101
102
|
limit: import_zod.z.number().int().min(1).max(100).default(25).describe("Maximum runs to return."),
|
|
102
103
|
offset: import_zod.z.number().int().min(0).default(0).describe("Pagination offset.")
|
|
103
104
|
};
|
|
105
|
+
var ThorbitDepositionSearchInputSchema = {
|
|
106
|
+
query: import_zod.z.string().min(1).max(300).describe("Text to search across run company, category, and playbook content."),
|
|
107
|
+
projectPublicId: import_zod.z.string().min(1).optional().describe("Optional project filter."),
|
|
108
|
+
limit: import_zod.z.number().int().min(1).max(50).default(15).describe("Maximum matches to return."),
|
|
109
|
+
offset: import_zod.z.number().int().min(0).default(0).describe("Pagination offset.")
|
|
110
|
+
};
|
|
104
111
|
|
|
105
112
|
// src/deposition-mcp-server.ts
|
|
106
|
-
var VERSION = "0.1.
|
|
113
|
+
var VERSION = "0.1.2";
|
|
107
114
|
function readOnlyAnnotations(title) {
|
|
108
115
|
return { title, readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
109
116
|
}
|
|
@@ -165,6 +172,12 @@ function buildThorbitDepositionMcpServer(client) {
|
|
|
165
172
|
inputSchema: ThorbitDepositionListInputSchema,
|
|
166
173
|
annotations: readOnlyAnnotations("List Depositioning Runs")
|
|
167
174
|
});
|
|
175
|
+
registerTool("thorbit_deposition_search", {
|
|
176
|
+
title: "Search Depositioning Runs",
|
|
177
|
+
description: 'Full-text search across past Depositioning runs \u2014 matches the query in company, category, and the playbook content, returning each match with its binding state, strategy, vulnerability statement, and a playbook snippet. Use to find prior strategy work by topic (e.g. "pricing opacity", "rehab", "switching cost"), not just by company name.',
|
|
178
|
+
inputSchema: ThorbitDepositionSearchInputSchema,
|
|
179
|
+
annotations: readOnlyAnnotations("Search Depositioning Runs")
|
|
180
|
+
});
|
|
168
181
|
return server;
|
|
169
182
|
}
|
|
170
183
|
|
|
@@ -202,7 +215,8 @@ var ThorbitDepositionMcpToolNames = [
|
|
|
202
215
|
"thorbit_deposition_get",
|
|
203
216
|
"thorbit_deposition_get_playbook",
|
|
204
217
|
"thorbit_deposition_artifact_read",
|
|
205
|
-
"thorbit_deposition_list"
|
|
218
|
+
"thorbit_deposition_list",
|
|
219
|
+
"thorbit_deposition_search"
|
|
206
220
|
];
|
|
207
221
|
// Annotate the CommonJS export names for ESM import in node:
|
|
208
222
|
0 && (module.exports = {
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/deposition-api-client.ts","../src/deposition-mcp-server.ts","../src/deposition-mcp-response-formatters.ts","../src/deposition-mcp-tool-schemas.ts","../src/deposition-mcp-env.ts","../src/deposition-mcp-tool-names.ts"],"sourcesContent":["export { ThorbitDepositionApiClient } from './deposition-api-client.js'\nexport { buildThorbitDepositionMcpServer, SERVER_INSTRUCTIONS } from './deposition-mcp-server.js'\nexport { resolveThorbitDepositionMcpEnv } from './deposition-mcp-env.js'\nexport { ThorbitDepositionMcpToolNames } from './deposition-mcp-tool-names.js'\n","import type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nexport type ThorbitDepositionMcpEnvelope =\n | {\n ok: true\n result: unknown\n warnings?: string[]\n requestId: string\n }\n | {\n ok: false\n error: {\n code: string\n message: string\n details?: unknown\n }\n requestId: string\n }\n\nexport class ThorbitDepositionApiClient {\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: ThorbitDepositionMcpToolName, input: unknown): Promise<ThorbitDepositionMcpEnvelope> {\n const response = await fetch(`${this.baseUrl}/api/v1/mcp/deposition/${toolName}`, {\n method: 'POST',\n headers: {\n 'x-thorbit-api-key': this.apiKey,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(input ?? {}),\n })\n\n const body = await response.json().catch(() => null) as ThorbitDepositionMcpEnvelope | 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 } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport type { ToolAnnotations } from '@modelcontextprotocol/sdk/types.js'\nimport type { ZodRawShape } from 'zod'\nimport type { ThorbitDepositionApiClient } from './deposition-api-client.js'\nimport { formatThorbitDepositionMcpToolResult } from './deposition-mcp-response-formatters.js'\nimport {\n ThorbitDepositionStartInputSchema,\n ThorbitDepositionGetInputSchema,\n ThorbitDepositionGetPlaybookInputSchema,\n ThorbitDepositionArtifactReadInputSchema,\n ThorbitDepositionListInputSchema,\n} from './deposition-mcp-tool-schemas.js'\nimport type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nconst VERSION = '0.1.1'\n\ntype ThorbitDepositionToolConfig<InputArgs extends ZodRawShape> = {\n title: string\n description: string\n inputSchema: InputArgs\n annotations: ToolAnnotations\n}\n\nfunction readOnlyAnnotations(title: string) {\n return { title, readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false }\n}\n\nfunction writeAnnotations(title: string) {\n return { title, readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true }\n}\n\nexport const SERVER_INSTRUCTIONS = [\n 'Thorbit Depositioning MCP. Runs the durable Depositioning strategy pipeline on hosted Thorbit (this server is a thin client). It researches competitors + customers, finds the binding vulnerability, classifies mover populations, designs a category class, builds a displacement mechanism, and writes a strategy playbook. All write/analysis tools are metered against your API key.',\n '',\n 'INTAKE (ask the user these BEFORE thorbit_deposition_start, then run):',\n '1. Company / product name being depositioned.',\n '2. Product URL (the challenger homepage).',\n '3. Category name (e.g. \"B2B sales analytics\").',\n '4. Optional: 0-5 competitor URLs (auto-discovered via SERP if fewer than 2).',\n '5. Optional: a customer reviews URL (G2 / Trustpilot / Reddit) and known customer pain points.',\n '',\n 'ASYNC CONTRACT (important):',\n '- thorbit_deposition_start returns quickly with {runPublicId, poll}. Do NOT block — follow result.poll.',\n '- Poll thorbit_deposition_get until status is terminal (complete/failed). It returns a LEAN status (phase, progress, binding state, strategy) with a nextAction.',\n '- When status is complete, call thorbit_deposition_get_playbook to read the finished markdown playbook.',\n '- thorbit_deposition_get also returns an ARTIFACTS manifest (research/own.json, research/competitor-N.json, research/customers.json, research/market.json, vulnerability.json, movers.json, category.json, mechanism.json, playbook.md). Read any one on demand with thorbit_deposition_artifact_read(runPublicId, artifactId) — do NOT pull includePhaseData unless you need the whole raw bundle.',\n '- Use thorbit_deposition_list to find past runs (by company/status) and their runPublicId.',\n].join('\\n')\n\nexport function buildThorbitDepositionMcpServer(client: ThorbitDepositionApiClient): McpServer {\n const server = new McpServer({ name: 'thorbit-deposition-mcp', version: VERSION }, { instructions: SERVER_INSTRUCTIONS })\n\n function registerTool<T extends ThorbitDepositionMcpToolName>(\n toolName: T,\n config: ThorbitDepositionToolConfig<ZodRawShape>,\n ): void {\n server.registerTool(toolName, config, async (input) => {\n const envelope = await client.callTool(toolName, input)\n return formatThorbitDepositionMcpToolResult(toolName, envelope)\n })\n }\n\n registerTool('thorbit_deposition_start', {\n title: 'Start Depositioning Run',\n description: 'Start a durable Depositioning strategy run for a challenger product in a category. Researches competitors and customers, finds the binding vulnerability, classifies movers, designs a category class, builds a displacement mechanism, and writes a playbook. Returns a runPublicId plus a thorbit_deposition_get poll target. Metered.',\n inputSchema: ThorbitDepositionStartInputSchema,\n annotations: writeAnnotations('Start Depositioning Run'),\n })\n\n registerTool('thorbit_deposition_get', {\n title: 'Read Depositioning Run Status',\n description: 'Read a Depositioning run: status, current phase, progress, selected binding state and strategy, primary vulnerability, category class, displacement mechanism, and whether the playbook is ready. Returns a nextAction. Poll until status is complete or failed.',\n inputSchema: ThorbitDepositionGetInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Run Status'),\n })\n\n registerTool('thorbit_deposition_get_playbook', {\n title: 'Read Depositioning Playbook',\n description: 'Return the finished deposition-playbook markdown for a completed run (executive brief, the four elements, activation guide). Returns not_found until the run completes.',\n inputSchema: ThorbitDepositionGetPlaybookInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Playbook'),\n })\n\n registerTool('thorbit_deposition_artifact_read', {\n title: 'Read Depositioning Artifact',\n description: 'Read one artifact from a run\\'s folder by id (e.g. research/own.json, research/competitor-2.json, vulnerability.json, playbook.md). Artifact ids come from the artifacts manifest in thorbit_deposition_get. Byte-capped via maxBytes. Use this instead of pulling the whole run.',\n inputSchema: ThorbitDepositionArtifactReadInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Artifact'),\n })\n\n registerTool('thorbit_deposition_list', {\n title: 'List Depositioning Runs',\n description: 'List past Depositioning runs (most recent first) with runPublicId, company, category, status, binding state, and strategy. Filter by project, company-name search, or status. Use to find a prior run to read.',\n inputSchema: ThorbitDepositionListInputSchema,\n annotations: readOnlyAnnotations('List Depositioning Runs'),\n })\n\n return server\n}\n","import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js'\nimport type { ThorbitDepositionMcpEnvelope } from './deposition-api-client.js'\nimport type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nexport function formatThorbitDepositionMcpToolResult(\n toolName: ThorbitDepositionMcpToolName,\n envelope: ThorbitDepositionMcpEnvelope,\n): CallToolResult {\n const text = JSON.stringify({ toolName, ...envelope }, null, 2)\n return {\n content: [{ type: 'text', text }],\n isError: !envelope.ok,\n }\n}\n","import { z } from 'zod'\n\nexport const ThorbitDepositionStartInputSchema = {\n companyName: z.string().min(1).max(255).describe('The challenger company or product being depositioned.'),\n productUrl: z.string().url().max(2048).describe('URL of the challenger product homepage.'),\n categoryName: z.string().min(1).max(255).describe('The product category, e.g. \"B2B sales analytics\".'),\n competitorUrls: z.array(z.string().url()).max(5).default([]).describe('0-5 competitor URLs. Auto-discovered via SERP if fewer than 2 are provided.'),\n reviewsUrl: z.string().url().max(2048).optional().describe('Optional customer reviews URL (G2, Trustpilot, Reddit thread).'),\n knownPains: z.array(z.string().min(1)).max(50).optional().describe('Optional known customer pain points to seed the analysis.'),\n projectPublicId: z.string().min(1).optional().describe('Optional Thorbit project to associate the run with.'),\n}\n\nexport const ThorbitDepositionGetInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID returned by thorbit_deposition_start.'),\n includePhaseData: z.boolean().default(false).describe('Include raw per-phase intermediate data in addition to the lean status.'),\n}\n\nexport const ThorbitDepositionGetPlaybookInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID. Returns the markdown playbook once the run is complete.'),\n}\n\nexport const ThorbitDepositionArtifactReadInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID.'),\n artifactId: z.string().min(1).describe('Artifact id from the run manifest, e.g. \"research/own.json\", \"research/competitor-2.json\", \"vulnerability.json\", \"playbook.md\". Get ids from thorbit_deposition_get.'),\n maxBytes: z.number().int().min(1000).max(1000000).default(200000).describe('Max bytes to return; content is truncated with a flag if larger.'),\n}\n\nexport const ThorbitDepositionListInputSchema = {\n projectPublicId: z.string().min(1).optional().describe('Optional project filter; omit for all org runs.'),\n search: z.string().max(200).optional().describe('Optional company-name substring filter.'),\n status: z.enum(['queued', 'running', 'complete', 'failed']).optional().describe('Optional run status filter.'),\n limit: z.number().int().min(1).max(100).default(25).describe('Maximum runs to return.'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset.'),\n}\n\nexport const ThorbitDepositionMcpToolInputSchemas = {\n thorbit_deposition_start: ThorbitDepositionStartInputSchema,\n thorbit_deposition_get: ThorbitDepositionGetInputSchema,\n thorbit_deposition_get_playbook: ThorbitDepositionGetPlaybookInputSchema,\n thorbit_deposition_artifact_read: ThorbitDepositionArtifactReadInputSchema,\n thorbit_deposition_list: ThorbitDepositionListInputSchema,\n}\n","import { readFileSync } from 'node:fs'\nimport { homedir } from 'node:os'\nimport { join } from 'node:path'\n\nexport type ThorbitDepositionMcpEnv = {\n apiKey: string\n baseUrl: string\n}\n\nfunction readApiKeyFile(): string | undefined {\n const explicitPath = process.env.THORBIT_DEPOSITION_MCP_KEY_PATH?.trim()\n const paths = [explicitPath, join(homedir(), '.thorbit-deposition-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 resolveThorbitDepositionMcpEnv(): ThorbitDepositionMcpEnv {\n const apiKey = (\n process.env.THORBIT_API_KEY ||\n process.env.THORBIT_MCP_API_KEY ||\n process.env.THORBIT_DEPOSITION_MCP_API_KEY ||\n readApiKeyFile()\n )?.trim()\n\n if (!apiKey) {\n throw new Error('THORBIT_API_KEY, THORBIT_MCP_API_KEY, or ~/.thorbit-deposition-mcp-key is required')\n }\n\n return {\n apiKey,\n baseUrl: (process.env.THORBIT_BASE_URL || process.env.THORBIT_DEPOSITION_MCP_BASE_URL || 'https://thorbit.ai').trim(),\n }\n}\n","export const ThorbitDepositionMcpToolNames = [\n 'thorbit_deposition_start',\n 'thorbit_deposition_get',\n 'thorbit_deposition_get_playbook',\n 'thorbit_deposition_artifact_read',\n 'thorbit_deposition_list',\n] as const\n\nexport type ThorbitDepositionMcpToolName = typeof ThorbitDepositionMcpToolNames[number]\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACmBO,IAAM,6BAAN,MAAiC;AAAA,EACrB;AAAA,EACA;AAAA,EAEjB,YAAY,SAA8C;AACxD,SAAK,UAAU,QAAQ,QAAQ,QAAQ,OAAO,EAAE;AAChD,SAAK,SAAS,QAAQ;AAAA,EACxB;AAAA,EAEA,MAAM,SAAS,UAAwC,OAAuD;AAC5G,UAAM,WAAW,MAAM,MAAM,GAAG,KAAK,OAAO,0BAA0B,QAAQ,IAAI;AAAA,MAChF,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,qBAAqB,KAAK;AAAA,QAC1B,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;AA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YAAM,YAAQ,6BAAa,MAAM,MAAM,EAAE,KAAK;AAC9C,UAAI,MAAO,QAAO;AAAA,IACpB,QAAQ;AACN;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AAEO,SAAS,iCAA0D;AACxE,QAAM,UACJ,QAAQ,IAAI,mBACZ,QAAQ,IAAI,uBACZ,QAAQ,IAAI,kCACZ,eAAe,IACd,KAAK;AAER,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI,MAAM,oFAAoF;AAAA,EACtG;AAEA,SAAO;AAAA,IACL;AAAA,IACA,UAAU,QAAQ,IAAI,oBAAoB,QAAQ,IAAI,mCAAmC,sBAAsB,KAAK;AAAA,EACtH;AACF;;;ACvCO,IAAM,gCAAgC;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/deposition-api-client.ts","../src/deposition-mcp-server.ts","../src/deposition-mcp-response-formatters.ts","../src/deposition-mcp-tool-schemas.ts","../src/deposition-mcp-env.ts","../src/deposition-mcp-tool-names.ts"],"sourcesContent":["export { ThorbitDepositionApiClient } from './deposition-api-client.js'\nexport { buildThorbitDepositionMcpServer, SERVER_INSTRUCTIONS } from './deposition-mcp-server.js'\nexport { resolveThorbitDepositionMcpEnv } from './deposition-mcp-env.js'\nexport { ThorbitDepositionMcpToolNames } from './deposition-mcp-tool-names.js'\n","import type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nexport type ThorbitDepositionMcpEnvelope =\n | {\n ok: true\n result: unknown\n warnings?: string[]\n requestId: string\n }\n | {\n ok: false\n error: {\n code: string\n message: string\n details?: unknown\n }\n requestId: string\n }\n\nexport class ThorbitDepositionApiClient {\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: ThorbitDepositionMcpToolName, input: unknown): Promise<ThorbitDepositionMcpEnvelope> {\n const response = await fetch(`${this.baseUrl}/api/v1/mcp/deposition/${toolName}`, {\n method: 'POST',\n headers: {\n 'x-thorbit-api-key': this.apiKey,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(input ?? {}),\n })\n\n const body = await response.json().catch(() => null) as ThorbitDepositionMcpEnvelope | 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 } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport type { ToolAnnotations } from '@modelcontextprotocol/sdk/types.js'\nimport type { ZodRawShape } from 'zod'\nimport type { ThorbitDepositionApiClient } from './deposition-api-client.js'\nimport { formatThorbitDepositionMcpToolResult } from './deposition-mcp-response-formatters.js'\nimport {\n ThorbitDepositionStartInputSchema,\n ThorbitDepositionGetInputSchema,\n ThorbitDepositionGetPlaybookInputSchema,\n ThorbitDepositionArtifactReadInputSchema,\n ThorbitDepositionListInputSchema,\n ThorbitDepositionSearchInputSchema,\n} from './deposition-mcp-tool-schemas.js'\nimport type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nconst VERSION = '0.1.2'\n\ntype ThorbitDepositionToolConfig<InputArgs extends ZodRawShape> = {\n title: string\n description: string\n inputSchema: InputArgs\n annotations: ToolAnnotations\n}\n\nfunction readOnlyAnnotations(title: string) {\n return { title, readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false }\n}\n\nfunction writeAnnotations(title: string) {\n return { title, readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true }\n}\n\nexport const SERVER_INSTRUCTIONS = [\n 'Thorbit Depositioning MCP. Runs the durable Depositioning strategy pipeline on hosted Thorbit (this server is a thin client). It researches competitors + customers, finds the binding vulnerability, classifies mover populations, designs a category class, builds a displacement mechanism, and writes a strategy playbook. All write/analysis tools are metered against your API key.',\n '',\n 'INTAKE (ask the user these BEFORE thorbit_deposition_start, then run):',\n '1. Company / product name being depositioned.',\n '2. Product URL (the challenger homepage).',\n '3. Category name (e.g. \"B2B sales analytics\").',\n '4. Optional: 0-5 competitor URLs (auto-discovered via SERP if fewer than 2).',\n '5. Optional: a customer reviews URL (G2 / Trustpilot / Reddit) and known customer pain points.',\n '',\n 'ASYNC CONTRACT (important):',\n '- thorbit_deposition_start returns quickly with {runPublicId, poll}. Do NOT block — follow result.poll.',\n '- Poll thorbit_deposition_get until status is terminal (complete/failed). It returns a LEAN status (phase, progress, binding state, strategy) with a nextAction.',\n '- When status is complete, call thorbit_deposition_get_playbook to read the finished markdown playbook.',\n '- thorbit_deposition_get also returns an ARTIFACTS manifest (research/own.json, research/competitor-N.json, research/customers.json, research/market.json, vulnerability.json, movers.json, category.json, mechanism.json, playbook.md). Read any one on demand with thorbit_deposition_artifact_read(runPublicId, artifactId) — do NOT pull includePhaseData unless you need the whole raw bundle.',\n '- Use thorbit_deposition_list to find past runs (by company/status) and their runPublicId.',\n].join('\\n')\n\nexport function buildThorbitDepositionMcpServer(client: ThorbitDepositionApiClient): McpServer {\n const server = new McpServer({ name: 'thorbit-deposition-mcp', version: VERSION }, { instructions: SERVER_INSTRUCTIONS })\n\n function registerTool<T extends ThorbitDepositionMcpToolName>(\n toolName: T,\n config: ThorbitDepositionToolConfig<ZodRawShape>,\n ): void {\n server.registerTool(toolName, config, async (input) => {\n const envelope = await client.callTool(toolName, input)\n return formatThorbitDepositionMcpToolResult(toolName, envelope)\n })\n }\n\n registerTool('thorbit_deposition_start', {\n title: 'Start Depositioning Run',\n description: 'Start a durable Depositioning strategy run for a challenger product in a category. Researches competitors and customers, finds the binding vulnerability, classifies movers, designs a category class, builds a displacement mechanism, and writes a playbook. Returns a runPublicId plus a thorbit_deposition_get poll target. Metered.',\n inputSchema: ThorbitDepositionStartInputSchema,\n annotations: writeAnnotations('Start Depositioning Run'),\n })\n\n registerTool('thorbit_deposition_get', {\n title: 'Read Depositioning Run Status',\n description: 'Read a Depositioning run: status, current phase, progress, selected binding state and strategy, primary vulnerability, category class, displacement mechanism, and whether the playbook is ready. Returns a nextAction. Poll until status is complete or failed.',\n inputSchema: ThorbitDepositionGetInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Run Status'),\n })\n\n registerTool('thorbit_deposition_get_playbook', {\n title: 'Read Depositioning Playbook',\n description: 'Return the finished deposition-playbook markdown for a completed run (executive brief, the four elements, activation guide). Returns not_found until the run completes.',\n inputSchema: ThorbitDepositionGetPlaybookInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Playbook'),\n })\n\n registerTool('thorbit_deposition_artifact_read', {\n title: 'Read Depositioning Artifact',\n description: 'Read one artifact from a run\\'s folder by id (e.g. research/own.json, research/competitor-2.json, vulnerability.json, playbook.md). Artifact ids come from the artifacts manifest in thorbit_deposition_get. Byte-capped via maxBytes. Use this instead of pulling the whole run.',\n inputSchema: ThorbitDepositionArtifactReadInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Artifact'),\n })\n\n registerTool('thorbit_deposition_list', {\n title: 'List Depositioning Runs',\n description: 'List past Depositioning runs (most recent first) with runPublicId, company, category, status, binding state, and strategy. Filter by project, company-name search, or status. Use to find a prior run to read.',\n inputSchema: ThorbitDepositionListInputSchema,\n annotations: readOnlyAnnotations('List Depositioning Runs'),\n })\n\n registerTool('thorbit_deposition_search', {\n title: 'Search Depositioning Runs',\n description: 'Full-text search across past Depositioning runs — matches the query in company, category, and the playbook content, returning each match with its binding state, strategy, vulnerability statement, and a playbook snippet. Use to find prior strategy work by topic (e.g. \"pricing opacity\", \"rehab\", \"switching cost\"), not just by company name.',\n inputSchema: ThorbitDepositionSearchInputSchema,\n annotations: readOnlyAnnotations('Search Depositioning Runs'),\n })\n\n return server\n}\n","import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js'\nimport type { ThorbitDepositionMcpEnvelope } from './deposition-api-client.js'\nimport type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nexport function formatThorbitDepositionMcpToolResult(\n toolName: ThorbitDepositionMcpToolName,\n envelope: ThorbitDepositionMcpEnvelope,\n): CallToolResult {\n const text = JSON.stringify({ toolName, ...envelope }, null, 2)\n return {\n content: [{ type: 'text', text }],\n isError: !envelope.ok,\n }\n}\n","import { z } from 'zod'\n\nexport const ThorbitDepositionStartInputSchema = {\n companyName: z.string().min(1).max(255).describe('The challenger company or product being depositioned.'),\n productUrl: z.string().url().max(2048).describe('URL of the challenger product homepage.'),\n categoryName: z.string().min(1).max(255).describe('The product category, e.g. \"B2B sales analytics\".'),\n competitorUrls: z.array(z.string().url()).max(5).default([]).describe('0-5 competitor URLs. Auto-discovered via SERP if fewer than 2 are provided.'),\n reviewsUrl: z.string().url().max(2048).optional().describe('Optional customer reviews URL (G2, Trustpilot, Reddit thread).'),\n knownPains: z.array(z.string().min(1)).max(50).optional().describe('Optional known customer pain points to seed the analysis.'),\n context: z.string().max(8000).optional().describe('Optional free-form context about the company that gets passed to the AI as authoritative ground truth — its real niche, target audience, monetization, founder/standard-bearer, beliefs/mission, and who its true competitors are. Use this when the website is generic or the real positioning is not obvious from the homepage. When provided it steers research, competitor discovery, vulnerability, and category ownership.'),\n projectPublicId: z.string().min(1).optional().describe('Optional Thorbit project to associate the run with.'),\n}\n\nexport const ThorbitDepositionGetInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID returned by thorbit_deposition_start.'),\n includePhaseData: z.boolean().default(false).describe('Include raw per-phase intermediate data in addition to the lean status.'),\n}\n\nexport const ThorbitDepositionGetPlaybookInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID. Returns the markdown playbook once the run is complete.'),\n}\n\nexport const ThorbitDepositionArtifactReadInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID.'),\n artifactId: z.string().min(1).describe('Artifact id from the run manifest, e.g. \"research/own.json\", \"research/competitor-2.json\", \"vulnerability.json\", \"playbook.md\". Get ids from thorbit_deposition_get.'),\n maxBytes: z.number().int().min(1000).max(1000000).default(200000).describe('Max bytes to return; content is truncated with a flag if larger.'),\n}\n\nexport const ThorbitDepositionListInputSchema = {\n projectPublicId: z.string().min(1).optional().describe('Optional project filter; omit for all org runs.'),\n search: z.string().max(200).optional().describe('Optional company-name substring filter.'),\n status: z.enum(['queued', 'running', 'complete', 'failed']).optional().describe('Optional run status filter.'),\n limit: z.number().int().min(1).max(100).default(25).describe('Maximum runs to return.'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset.'),\n}\n\nexport const ThorbitDepositionSearchInputSchema = {\n query: z.string().min(1).max(300).describe('Text to search across run company, category, and playbook content.'),\n projectPublicId: z.string().min(1).optional().describe('Optional project filter.'),\n limit: z.number().int().min(1).max(50).default(15).describe('Maximum matches to return.'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset.'),\n}\n\nexport const ThorbitDepositionMcpToolInputSchemas = {\n thorbit_deposition_start: ThorbitDepositionStartInputSchema,\n thorbit_deposition_get: ThorbitDepositionGetInputSchema,\n thorbit_deposition_get_playbook: ThorbitDepositionGetPlaybookInputSchema,\n thorbit_deposition_artifact_read: ThorbitDepositionArtifactReadInputSchema,\n thorbit_deposition_list: ThorbitDepositionListInputSchema,\n thorbit_deposition_search: ThorbitDepositionSearchInputSchema,\n}\n","import { readFileSync } from 'node:fs'\nimport { homedir } from 'node:os'\nimport { join } from 'node:path'\n\nexport type ThorbitDepositionMcpEnv = {\n apiKey: string\n baseUrl: string\n}\n\nfunction readApiKeyFile(): string | undefined {\n const explicitPath = process.env.THORBIT_DEPOSITION_MCP_KEY_PATH?.trim()\n const paths = [explicitPath, join(homedir(), '.thorbit-deposition-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 resolveThorbitDepositionMcpEnv(): ThorbitDepositionMcpEnv {\n const apiKey = (\n process.env.THORBIT_API_KEY ||\n process.env.THORBIT_MCP_API_KEY ||\n process.env.THORBIT_DEPOSITION_MCP_API_KEY ||\n readApiKeyFile()\n )?.trim()\n\n if (!apiKey) {\n throw new Error('THORBIT_API_KEY, THORBIT_MCP_API_KEY, or ~/.thorbit-deposition-mcp-key is required')\n }\n\n return {\n apiKey,\n baseUrl: (process.env.THORBIT_BASE_URL || process.env.THORBIT_DEPOSITION_MCP_BASE_URL || 'https://thorbit.ai').trim(),\n }\n}\n","export const ThorbitDepositionMcpToolNames = [\n 'thorbit_deposition_start',\n 'thorbit_deposition_get',\n 'thorbit_deposition_get_playbook',\n 'thorbit_deposition_artifact_read',\n 'thorbit_deposition_list',\n 'thorbit_deposition_search',\n] as const\n\nexport type ThorbitDepositionMcpToolName = typeof ThorbitDepositionMcpToolNames[number]\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACmBO,IAAM,6BAAN,MAAiC;AAAA,EACrB;AAAA,EACA;AAAA,EAEjB,YAAY,SAA8C;AACxD,SAAK,UAAU,QAAQ,QAAQ,QAAQ,OAAO,EAAE;AAChD,SAAK,SAAS,QAAQ;AAAA,EACxB;AAAA,EAEA,MAAM,SAAS,UAAwC,OAAuD;AAC5G,UAAM,WAAW,MAAM,MAAM,GAAG,KAAK,OAAO,0BAA0B,QAAQ,IAAI;AAAA,MAChF,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,qBAAqB,KAAK;AAAA,QAC1B,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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AAA,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 ThorbitDepositionMcpToolNames: readonly ["thorbit_deposition_start", "thorbit_deposition_get", "thorbit_deposition_get_playbook", "thorbit_deposition_artifact_read", "thorbit_deposition_list"];
|
|
3
|
+
declare const ThorbitDepositionMcpToolNames: readonly ["thorbit_deposition_start", "thorbit_deposition_get", "thorbit_deposition_get_playbook", "thorbit_deposition_artifact_read", "thorbit_deposition_list", "thorbit_deposition_search"];
|
|
4
4
|
type ThorbitDepositionMcpToolName = typeof ThorbitDepositionMcpToolNames[number];
|
|
5
5
|
|
|
6
6
|
type ThorbitDepositionMcpEnvelope = {
|
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 ThorbitDepositionMcpToolNames: readonly ["thorbit_deposition_start", "thorbit_deposition_get", "thorbit_deposition_get_playbook", "thorbit_deposition_artifact_read", "thorbit_deposition_list"];
|
|
3
|
+
declare const ThorbitDepositionMcpToolNames: readonly ["thorbit_deposition_start", "thorbit_deposition_get", "thorbit_deposition_get_playbook", "thorbit_deposition_artifact_read", "thorbit_deposition_list", "thorbit_deposition_search"];
|
|
4
4
|
type ThorbitDepositionMcpToolName = typeof ThorbitDepositionMcpToolNames[number];
|
|
5
5
|
|
|
6
6
|
type ThorbitDepositionMcpEnvelope = {
|
package/dist/index.js
CHANGED
|
@@ -51,6 +51,7 @@ var ThorbitDepositionStartInputSchema = {
|
|
|
51
51
|
competitorUrls: z.array(z.string().url()).max(5).default([]).describe("0-5 competitor URLs. Auto-discovered via SERP if fewer than 2 are provided."),
|
|
52
52
|
reviewsUrl: z.string().url().max(2048).optional().describe("Optional customer reviews URL (G2, Trustpilot, Reddit thread)."),
|
|
53
53
|
knownPains: z.array(z.string().min(1)).max(50).optional().describe("Optional known customer pain points to seed the analysis."),
|
|
54
|
+
context: z.string().max(8e3).optional().describe("Optional free-form context about the company that gets passed to the AI as authoritative ground truth \u2014 its real niche, target audience, monetization, founder/standard-bearer, beliefs/mission, and who its true competitors are. Use this when the website is generic or the real positioning is not obvious from the homepage. When provided it steers research, competitor discovery, vulnerability, and category ownership."),
|
|
54
55
|
projectPublicId: z.string().min(1).optional().describe("Optional Thorbit project to associate the run with.")
|
|
55
56
|
};
|
|
56
57
|
var ThorbitDepositionGetInputSchema = {
|
|
@@ -72,9 +73,15 @@ var ThorbitDepositionListInputSchema = {
|
|
|
72
73
|
limit: z.number().int().min(1).max(100).default(25).describe("Maximum runs to return."),
|
|
73
74
|
offset: z.number().int().min(0).default(0).describe("Pagination offset.")
|
|
74
75
|
};
|
|
76
|
+
var ThorbitDepositionSearchInputSchema = {
|
|
77
|
+
query: z.string().min(1).max(300).describe("Text to search across run company, category, and playbook content."),
|
|
78
|
+
projectPublicId: z.string().min(1).optional().describe("Optional project filter."),
|
|
79
|
+
limit: z.number().int().min(1).max(50).default(15).describe("Maximum matches to return."),
|
|
80
|
+
offset: z.number().int().min(0).default(0).describe("Pagination offset.")
|
|
81
|
+
};
|
|
75
82
|
|
|
76
83
|
// src/deposition-mcp-server.ts
|
|
77
|
-
var VERSION = "0.1.
|
|
84
|
+
var VERSION = "0.1.2";
|
|
78
85
|
function readOnlyAnnotations(title) {
|
|
79
86
|
return { title, readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
80
87
|
}
|
|
@@ -136,6 +143,12 @@ function buildThorbitDepositionMcpServer(client) {
|
|
|
136
143
|
inputSchema: ThorbitDepositionListInputSchema,
|
|
137
144
|
annotations: readOnlyAnnotations("List Depositioning Runs")
|
|
138
145
|
});
|
|
146
|
+
registerTool("thorbit_deposition_search", {
|
|
147
|
+
title: "Search Depositioning Runs",
|
|
148
|
+
description: 'Full-text search across past Depositioning runs \u2014 matches the query in company, category, and the playbook content, returning each match with its binding state, strategy, vulnerability statement, and a playbook snippet. Use to find prior strategy work by topic (e.g. "pricing opacity", "rehab", "switching cost"), not just by company name.',
|
|
149
|
+
inputSchema: ThorbitDepositionSearchInputSchema,
|
|
150
|
+
annotations: readOnlyAnnotations("Search Depositioning Runs")
|
|
151
|
+
});
|
|
139
152
|
return server;
|
|
140
153
|
}
|
|
141
154
|
|
|
@@ -173,7 +186,8 @@ var ThorbitDepositionMcpToolNames = [
|
|
|
173
186
|
"thorbit_deposition_get",
|
|
174
187
|
"thorbit_deposition_get_playbook",
|
|
175
188
|
"thorbit_deposition_artifact_read",
|
|
176
|
-
"thorbit_deposition_list"
|
|
189
|
+
"thorbit_deposition_list",
|
|
190
|
+
"thorbit_deposition_search"
|
|
177
191
|
];
|
|
178
192
|
export {
|
|
179
193
|
SERVER_INSTRUCTIONS,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/deposition-api-client.ts","../src/deposition-mcp-server.ts","../src/deposition-mcp-response-formatters.ts","../src/deposition-mcp-tool-schemas.ts","../src/deposition-mcp-env.ts","../src/deposition-mcp-tool-names.ts"],"sourcesContent":["import type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nexport type ThorbitDepositionMcpEnvelope =\n | {\n ok: true\n result: unknown\n warnings?: string[]\n requestId: string\n }\n | {\n ok: false\n error: {\n code: string\n message: string\n details?: unknown\n }\n requestId: string\n }\n\nexport class ThorbitDepositionApiClient {\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: ThorbitDepositionMcpToolName, input: unknown): Promise<ThorbitDepositionMcpEnvelope> {\n const response = await fetch(`${this.baseUrl}/api/v1/mcp/deposition/${toolName}`, {\n method: 'POST',\n headers: {\n 'x-thorbit-api-key': this.apiKey,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(input ?? {}),\n })\n\n const body = await response.json().catch(() => null) as ThorbitDepositionMcpEnvelope | 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 } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport type { ToolAnnotations } from '@modelcontextprotocol/sdk/types.js'\nimport type { ZodRawShape } from 'zod'\nimport type { ThorbitDepositionApiClient } from './deposition-api-client.js'\nimport { formatThorbitDepositionMcpToolResult } from './deposition-mcp-response-formatters.js'\nimport {\n ThorbitDepositionStartInputSchema,\n ThorbitDepositionGetInputSchema,\n ThorbitDepositionGetPlaybookInputSchema,\n ThorbitDepositionArtifactReadInputSchema,\n ThorbitDepositionListInputSchema,\n} from './deposition-mcp-tool-schemas.js'\nimport type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nconst VERSION = '0.1.1'\n\ntype ThorbitDepositionToolConfig<InputArgs extends ZodRawShape> = {\n title: string\n description: string\n inputSchema: InputArgs\n annotations: ToolAnnotations\n}\n\nfunction readOnlyAnnotations(title: string) {\n return { title, readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false }\n}\n\nfunction writeAnnotations(title: string) {\n return { title, readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true }\n}\n\nexport const SERVER_INSTRUCTIONS = [\n 'Thorbit Depositioning MCP. Runs the durable Depositioning strategy pipeline on hosted Thorbit (this server is a thin client). It researches competitors + customers, finds the binding vulnerability, classifies mover populations, designs a category class, builds a displacement mechanism, and writes a strategy playbook. All write/analysis tools are metered against your API key.',\n '',\n 'INTAKE (ask the user these BEFORE thorbit_deposition_start, then run):',\n '1. Company / product name being depositioned.',\n '2. Product URL (the challenger homepage).',\n '3. Category name (e.g. \"B2B sales analytics\").',\n '4. Optional: 0-5 competitor URLs (auto-discovered via SERP if fewer than 2).',\n '5. Optional: a customer reviews URL (G2 / Trustpilot / Reddit) and known customer pain points.',\n '',\n 'ASYNC CONTRACT (important):',\n '- thorbit_deposition_start returns quickly with {runPublicId, poll}. Do NOT block — follow result.poll.',\n '- Poll thorbit_deposition_get until status is terminal (complete/failed). It returns a LEAN status (phase, progress, binding state, strategy) with a nextAction.',\n '- When status is complete, call thorbit_deposition_get_playbook to read the finished markdown playbook.',\n '- thorbit_deposition_get also returns an ARTIFACTS manifest (research/own.json, research/competitor-N.json, research/customers.json, research/market.json, vulnerability.json, movers.json, category.json, mechanism.json, playbook.md). Read any one on demand with thorbit_deposition_artifact_read(runPublicId, artifactId) — do NOT pull includePhaseData unless you need the whole raw bundle.',\n '- Use thorbit_deposition_list to find past runs (by company/status) and their runPublicId.',\n].join('\\n')\n\nexport function buildThorbitDepositionMcpServer(client: ThorbitDepositionApiClient): McpServer {\n const server = new McpServer({ name: 'thorbit-deposition-mcp', version: VERSION }, { instructions: SERVER_INSTRUCTIONS })\n\n function registerTool<T extends ThorbitDepositionMcpToolName>(\n toolName: T,\n config: ThorbitDepositionToolConfig<ZodRawShape>,\n ): void {\n server.registerTool(toolName, config, async (input) => {\n const envelope = await client.callTool(toolName, input)\n return formatThorbitDepositionMcpToolResult(toolName, envelope)\n })\n }\n\n registerTool('thorbit_deposition_start', {\n title: 'Start Depositioning Run',\n description: 'Start a durable Depositioning strategy run for a challenger product in a category. Researches competitors and customers, finds the binding vulnerability, classifies movers, designs a category class, builds a displacement mechanism, and writes a playbook. Returns a runPublicId plus a thorbit_deposition_get poll target. Metered.',\n inputSchema: ThorbitDepositionStartInputSchema,\n annotations: writeAnnotations('Start Depositioning Run'),\n })\n\n registerTool('thorbit_deposition_get', {\n title: 'Read Depositioning Run Status',\n description: 'Read a Depositioning run: status, current phase, progress, selected binding state and strategy, primary vulnerability, category class, displacement mechanism, and whether the playbook is ready. Returns a nextAction. Poll until status is complete or failed.',\n inputSchema: ThorbitDepositionGetInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Run Status'),\n })\n\n registerTool('thorbit_deposition_get_playbook', {\n title: 'Read Depositioning Playbook',\n description: 'Return the finished deposition-playbook markdown for a completed run (executive brief, the four elements, activation guide). Returns not_found until the run completes.',\n inputSchema: ThorbitDepositionGetPlaybookInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Playbook'),\n })\n\n registerTool('thorbit_deposition_artifact_read', {\n title: 'Read Depositioning Artifact',\n description: 'Read one artifact from a run\\'s folder by id (e.g. research/own.json, research/competitor-2.json, vulnerability.json, playbook.md). Artifact ids come from the artifacts manifest in thorbit_deposition_get. Byte-capped via maxBytes. Use this instead of pulling the whole run.',\n inputSchema: ThorbitDepositionArtifactReadInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Artifact'),\n })\n\n registerTool('thorbit_deposition_list', {\n title: 'List Depositioning Runs',\n description: 'List past Depositioning runs (most recent first) with runPublicId, company, category, status, binding state, and strategy. Filter by project, company-name search, or status. Use to find a prior run to read.',\n inputSchema: ThorbitDepositionListInputSchema,\n annotations: readOnlyAnnotations('List Depositioning Runs'),\n })\n\n return server\n}\n","import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js'\nimport type { ThorbitDepositionMcpEnvelope } from './deposition-api-client.js'\nimport type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nexport function formatThorbitDepositionMcpToolResult(\n toolName: ThorbitDepositionMcpToolName,\n envelope: ThorbitDepositionMcpEnvelope,\n): CallToolResult {\n const text = JSON.stringify({ toolName, ...envelope }, null, 2)\n return {\n content: [{ type: 'text', text }],\n isError: !envelope.ok,\n }\n}\n","import { z } from 'zod'\n\nexport const ThorbitDepositionStartInputSchema = {\n companyName: z.string().min(1).max(255).describe('The challenger company or product being depositioned.'),\n productUrl: z.string().url().max(2048).describe('URL of the challenger product homepage.'),\n categoryName: z.string().min(1).max(255).describe('The product category, e.g. \"B2B sales analytics\".'),\n competitorUrls: z.array(z.string().url()).max(5).default([]).describe('0-5 competitor URLs. Auto-discovered via SERP if fewer than 2 are provided.'),\n reviewsUrl: z.string().url().max(2048).optional().describe('Optional customer reviews URL (G2, Trustpilot, Reddit thread).'),\n knownPains: z.array(z.string().min(1)).max(50).optional().describe('Optional known customer pain points to seed the analysis.'),\n projectPublicId: z.string().min(1).optional().describe('Optional Thorbit project to associate the run with.'),\n}\n\nexport const ThorbitDepositionGetInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID returned by thorbit_deposition_start.'),\n includePhaseData: z.boolean().default(false).describe('Include raw per-phase intermediate data in addition to the lean status.'),\n}\n\nexport const ThorbitDepositionGetPlaybookInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID. Returns the markdown playbook once the run is complete.'),\n}\n\nexport const ThorbitDepositionArtifactReadInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID.'),\n artifactId: z.string().min(1).describe('Artifact id from the run manifest, e.g. \"research/own.json\", \"research/competitor-2.json\", \"vulnerability.json\", \"playbook.md\". Get ids from thorbit_deposition_get.'),\n maxBytes: z.number().int().min(1000).max(1000000).default(200000).describe('Max bytes to return; content is truncated with a flag if larger.'),\n}\n\nexport const ThorbitDepositionListInputSchema = {\n projectPublicId: z.string().min(1).optional().describe('Optional project filter; omit for all org runs.'),\n search: z.string().max(200).optional().describe('Optional company-name substring filter.'),\n status: z.enum(['queued', 'running', 'complete', 'failed']).optional().describe('Optional run status filter.'),\n limit: z.number().int().min(1).max(100).default(25).describe('Maximum runs to return.'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset.'),\n}\n\nexport const ThorbitDepositionMcpToolInputSchemas = {\n thorbit_deposition_start: ThorbitDepositionStartInputSchema,\n thorbit_deposition_get: ThorbitDepositionGetInputSchema,\n thorbit_deposition_get_playbook: ThorbitDepositionGetPlaybookInputSchema,\n thorbit_deposition_artifact_read: ThorbitDepositionArtifactReadInputSchema,\n thorbit_deposition_list: ThorbitDepositionListInputSchema,\n}\n","import { readFileSync } from 'node:fs'\nimport { homedir } from 'node:os'\nimport { join } from 'node:path'\n\nexport type ThorbitDepositionMcpEnv = {\n apiKey: string\n baseUrl: string\n}\n\nfunction readApiKeyFile(): string | undefined {\n const explicitPath = process.env.THORBIT_DEPOSITION_MCP_KEY_PATH?.trim()\n const paths = [explicitPath, join(homedir(), '.thorbit-deposition-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 resolveThorbitDepositionMcpEnv(): ThorbitDepositionMcpEnv {\n const apiKey = (\n process.env.THORBIT_API_KEY ||\n process.env.THORBIT_MCP_API_KEY ||\n process.env.THORBIT_DEPOSITION_MCP_API_KEY ||\n readApiKeyFile()\n )?.trim()\n\n if (!apiKey) {\n throw new Error('THORBIT_API_KEY, THORBIT_MCP_API_KEY, or ~/.thorbit-deposition-mcp-key is required')\n }\n\n return {\n apiKey,\n baseUrl: (process.env.THORBIT_BASE_URL || process.env.THORBIT_DEPOSITION_MCP_BASE_URL || 'https://thorbit.ai').trim(),\n }\n}\n","export const ThorbitDepositionMcpToolNames = [\n 'thorbit_deposition_start',\n 'thorbit_deposition_get',\n 'thorbit_deposition_get_playbook',\n 'thorbit_deposition_artifact_read',\n 'thorbit_deposition_list',\n] as const\n\nexport type ThorbitDepositionMcpToolName = typeof ThorbitDepositionMcpToolNames[number]\n"],"mappings":";;;AAmBO,IAAM,6BAAN,MAAiC;AAAA,EACrB;AAAA,EACA;AAAA,EAEjB,YAAY,SAA8C;AACxD,SAAK,UAAU,QAAQ,QAAQ,QAAQ,OAAO,EAAE;AAChD,SAAK,SAAS,QAAQ;AAAA,EACxB;AAAA,EAEA,MAAM,SAAS,UAAwC,OAAuD;AAC5G,UAAM,WAAW,M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,CAAC;AAED,eAAa,oCAAoC;AAAA,IAC/C,OAAO;AAAA,IACP,aAAa;AAAA,IACb,aAAa;AAAA,IACb,aAAa,oBAAoB,6BAA6B;AAAA,EAChE,CAAC;AAED,eAAa,2BAA2B;AAAA,IACtC,OAAO;AAAA,IACP,aAAa;AAAA,IACb,aAAa;AAAA,IACb,aAAa,oBAAoB,yBAAyB;AAAA,EAC5D,CAAC;AAED,SAAO;AACT;;;AGlGA,SAAS,oBAAoB;AAC7B,SAAS,eAAe;AACxB,SAAS,YAAY;AAOrB,SAAS,iBAAqC;AAC5C,QAAM,eAAe,QAAQ,IAAI,iCAAiC,KAAK;AACvE,QAAM,QAAQ,CAAC,cAAc,KAAK,QAAQ,GAAG,6BAA6B,CAAC,EAAE,OAAO,OAAO;AAC3F,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,iCAA0D;AACxE,QAAM,UACJ,QAAQ,IAAI,mBACZ,QAAQ,IAAI,uBACZ,QAAQ,IAAI,kCACZ,eAAe,IACd,KAAK;AAER,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI,MAAM,oFAAoF;AAAA,EACtG;AAEA,SAAO;AAAA,IACL;AAAA,IACA,UAAU,QAAQ,IAAI,oBAAoB,QAAQ,IAAI,mCAAmC,sBAAsB,KAAK;AAAA,EACtH;AACF;;;ACvCO,IAAM,gCAAgC;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/deposition-api-client.ts","../src/deposition-mcp-server.ts","../src/deposition-mcp-response-formatters.ts","../src/deposition-mcp-tool-schemas.ts","../src/deposition-mcp-env.ts","../src/deposition-mcp-tool-names.ts"],"sourcesContent":["import type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nexport type ThorbitDepositionMcpEnvelope =\n | {\n ok: true\n result: unknown\n warnings?: string[]\n requestId: string\n }\n | {\n ok: false\n error: {\n code: string\n message: string\n details?: unknown\n }\n requestId: string\n }\n\nexport class ThorbitDepositionApiClient {\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: ThorbitDepositionMcpToolName, input: unknown): Promise<ThorbitDepositionMcpEnvelope> {\n const response = await fetch(`${this.baseUrl}/api/v1/mcp/deposition/${toolName}`, {\n method: 'POST',\n headers: {\n 'x-thorbit-api-key': this.apiKey,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(input ?? {}),\n })\n\n const body = await response.json().catch(() => null) as ThorbitDepositionMcpEnvelope | 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 } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport type { ToolAnnotations } from '@modelcontextprotocol/sdk/types.js'\nimport type { ZodRawShape } from 'zod'\nimport type { ThorbitDepositionApiClient } from './deposition-api-client.js'\nimport { formatThorbitDepositionMcpToolResult } from './deposition-mcp-response-formatters.js'\nimport {\n ThorbitDepositionStartInputSchema,\n ThorbitDepositionGetInputSchema,\n ThorbitDepositionGetPlaybookInputSchema,\n ThorbitDepositionArtifactReadInputSchema,\n ThorbitDepositionListInputSchema,\n ThorbitDepositionSearchInputSchema,\n} from './deposition-mcp-tool-schemas.js'\nimport type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nconst VERSION = '0.1.2'\n\ntype ThorbitDepositionToolConfig<InputArgs extends ZodRawShape> = {\n title: string\n description: string\n inputSchema: InputArgs\n annotations: ToolAnnotations\n}\n\nfunction readOnlyAnnotations(title: string) {\n return { title, readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false }\n}\n\nfunction writeAnnotations(title: string) {\n return { title, readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true }\n}\n\nexport const SERVER_INSTRUCTIONS = [\n 'Thorbit Depositioning MCP. Runs the durable Depositioning strategy pipeline on hosted Thorbit (this server is a thin client). It researches competitors + customers, finds the binding vulnerability, classifies mover populations, designs a category class, builds a displacement mechanism, and writes a strategy playbook. All write/analysis tools are metered against your API key.',\n '',\n 'INTAKE (ask the user these BEFORE thorbit_deposition_start, then run):',\n '1. Company / product name being depositioned.',\n '2. Product URL (the challenger homepage).',\n '3. Category name (e.g. \"B2B sales analytics\").',\n '4. Optional: 0-5 competitor URLs (auto-discovered via SERP if fewer than 2).',\n '5. Optional: a customer reviews URL (G2 / Trustpilot / Reddit) and known customer pain points.',\n '',\n 'ASYNC CONTRACT (important):',\n '- thorbit_deposition_start returns quickly with {runPublicId, poll}. Do NOT block — follow result.poll.',\n '- Poll thorbit_deposition_get until status is terminal (complete/failed). It returns a LEAN status (phase, progress, binding state, strategy) with a nextAction.',\n '- When status is complete, call thorbit_deposition_get_playbook to read the finished markdown playbook.',\n '- thorbit_deposition_get also returns an ARTIFACTS manifest (research/own.json, research/competitor-N.json, research/customers.json, research/market.json, vulnerability.json, movers.json, category.json, mechanism.json, playbook.md). Read any one on demand with thorbit_deposition_artifact_read(runPublicId, artifactId) — do NOT pull includePhaseData unless you need the whole raw bundle.',\n '- Use thorbit_deposition_list to find past runs (by company/status) and their runPublicId.',\n].join('\\n')\n\nexport function buildThorbitDepositionMcpServer(client: ThorbitDepositionApiClient): McpServer {\n const server = new McpServer({ name: 'thorbit-deposition-mcp', version: VERSION }, { instructions: SERVER_INSTRUCTIONS })\n\n function registerTool<T extends ThorbitDepositionMcpToolName>(\n toolName: T,\n config: ThorbitDepositionToolConfig<ZodRawShape>,\n ): void {\n server.registerTool(toolName, config, async (input) => {\n const envelope = await client.callTool(toolName, input)\n return formatThorbitDepositionMcpToolResult(toolName, envelope)\n })\n }\n\n registerTool('thorbit_deposition_start', {\n title: 'Start Depositioning Run',\n description: 'Start a durable Depositioning strategy run for a challenger product in a category. Researches competitors and customers, finds the binding vulnerability, classifies movers, designs a category class, builds a displacement mechanism, and writes a playbook. Returns a runPublicId plus a thorbit_deposition_get poll target. Metered.',\n inputSchema: ThorbitDepositionStartInputSchema,\n annotations: writeAnnotations('Start Depositioning Run'),\n })\n\n registerTool('thorbit_deposition_get', {\n title: 'Read Depositioning Run Status',\n description: 'Read a Depositioning run: status, current phase, progress, selected binding state and strategy, primary vulnerability, category class, displacement mechanism, and whether the playbook is ready. Returns a nextAction. Poll until status is complete or failed.',\n inputSchema: ThorbitDepositionGetInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Run Status'),\n })\n\n registerTool('thorbit_deposition_get_playbook', {\n title: 'Read Depositioning Playbook',\n description: 'Return the finished deposition-playbook markdown for a completed run (executive brief, the four elements, activation guide). Returns not_found until the run completes.',\n inputSchema: ThorbitDepositionGetPlaybookInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Playbook'),\n })\n\n registerTool('thorbit_deposition_artifact_read', {\n title: 'Read Depositioning Artifact',\n description: 'Read one artifact from a run\\'s folder by id (e.g. research/own.json, research/competitor-2.json, vulnerability.json, playbook.md). Artifact ids come from the artifacts manifest in thorbit_deposition_get. Byte-capped via maxBytes. Use this instead of pulling the whole run.',\n inputSchema: ThorbitDepositionArtifactReadInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Artifact'),\n })\n\n registerTool('thorbit_deposition_list', {\n title: 'List Depositioning Runs',\n description: 'List past Depositioning runs (most recent first) with runPublicId, company, category, status, binding state, and strategy. Filter by project, company-name search, or status. Use to find a prior run to read.',\n inputSchema: ThorbitDepositionListInputSchema,\n annotations: readOnlyAnnotations('List Depositioning Runs'),\n })\n\n registerTool('thorbit_deposition_search', {\n title: 'Search Depositioning Runs',\n description: 'Full-text search across past Depositioning runs — matches the query in company, category, and the playbook content, returning each match with its binding state, strategy, vulnerability statement, and a playbook snippet. Use to find prior strategy work by topic (e.g. \"pricing opacity\", \"rehab\", \"switching cost\"), not just by company name.',\n inputSchema: ThorbitDepositionSearchInputSchema,\n annotations: readOnlyAnnotations('Search Depositioning Runs'),\n })\n\n return server\n}\n","import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js'\nimport type { ThorbitDepositionMcpEnvelope } from './deposition-api-client.js'\nimport type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nexport function formatThorbitDepositionMcpToolResult(\n toolName: ThorbitDepositionMcpToolName,\n envelope: ThorbitDepositionMcpEnvelope,\n): CallToolResult {\n const text = JSON.stringify({ toolName, ...envelope }, null, 2)\n return {\n content: [{ type: 'text', text }],\n isError: !envelope.ok,\n }\n}\n","import { z } from 'zod'\n\nexport const ThorbitDepositionStartInputSchema = {\n companyName: z.string().min(1).max(255).describe('The challenger company or product being depositioned.'),\n productUrl: z.string().url().max(2048).describe('URL of the challenger product homepage.'),\n categoryName: z.string().min(1).max(255).describe('The product category, e.g. \"B2B sales analytics\".'),\n competitorUrls: z.array(z.string().url()).max(5).default([]).describe('0-5 competitor URLs. Auto-discovered via SERP if fewer than 2 are provided.'),\n reviewsUrl: z.string().url().max(2048).optional().describe('Optional customer reviews URL (G2, Trustpilot, Reddit thread).'),\n knownPains: z.array(z.string().min(1)).max(50).optional().describe('Optional known customer pain points to seed the analysis.'),\n context: z.string().max(8000).optional().describe('Optional free-form context about the company that gets passed to the AI as authoritative ground truth — its real niche, target audience, monetization, founder/standard-bearer, beliefs/mission, and who its true competitors are. Use this when the website is generic or the real positioning is not obvious from the homepage. When provided it steers research, competitor discovery, vulnerability, and category ownership.'),\n projectPublicId: z.string().min(1).optional().describe('Optional Thorbit project to associate the run with.'),\n}\n\nexport const ThorbitDepositionGetInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID returned by thorbit_deposition_start.'),\n includePhaseData: z.boolean().default(false).describe('Include raw per-phase intermediate data in addition to the lean status.'),\n}\n\nexport const ThorbitDepositionGetPlaybookInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID. Returns the markdown playbook once the run is complete.'),\n}\n\nexport const ThorbitDepositionArtifactReadInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID.'),\n artifactId: z.string().min(1).describe('Artifact id from the run manifest, e.g. \"research/own.json\", \"research/competitor-2.json\", \"vulnerability.json\", \"playbook.md\". Get ids from thorbit_deposition_get.'),\n maxBytes: z.number().int().min(1000).max(1000000).default(200000).describe('Max bytes to return; content is truncated with a flag if larger.'),\n}\n\nexport const ThorbitDepositionListInputSchema = {\n projectPublicId: z.string().min(1).optional().describe('Optional project filter; omit for all org runs.'),\n search: z.string().max(200).optional().describe('Optional company-name substring filter.'),\n status: z.enum(['queued', 'running', 'complete', 'failed']).optional().describe('Optional run status filter.'),\n limit: z.number().int().min(1).max(100).default(25).describe('Maximum runs to return.'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset.'),\n}\n\nexport const ThorbitDepositionSearchInputSchema = {\n query: z.string().min(1).max(300).describe('Text to search across run company, category, and playbook content.'),\n projectPublicId: z.string().min(1).optional().describe('Optional project filter.'),\n limit: z.number().int().min(1).max(50).default(15).describe('Maximum matches to return.'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset.'),\n}\n\nexport const ThorbitDepositionMcpToolInputSchemas = {\n thorbit_deposition_start: ThorbitDepositionStartInputSchema,\n thorbit_deposition_get: ThorbitDepositionGetInputSchema,\n thorbit_deposition_get_playbook: ThorbitDepositionGetPlaybookInputSchema,\n thorbit_deposition_artifact_read: ThorbitDepositionArtifactReadInputSchema,\n thorbit_deposition_list: ThorbitDepositionListInputSchema,\n thorbit_deposition_search: ThorbitDepositionSearchInputSchema,\n}\n","import { readFileSync } from 'node:fs'\nimport { homedir } from 'node:os'\nimport { join } from 'node:path'\n\nexport type ThorbitDepositionMcpEnv = {\n apiKey: string\n baseUrl: string\n}\n\nfunction readApiKeyFile(): string | undefined {\n const explicitPath = process.env.THORBIT_DEPOSITION_MCP_KEY_PATH?.trim()\n const paths = [explicitPath, join(homedir(), '.thorbit-deposition-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 resolveThorbitDepositionMcpEnv(): ThorbitDepositionMcpEnv {\n const apiKey = (\n process.env.THORBIT_API_KEY ||\n process.env.THORBIT_MCP_API_KEY ||\n process.env.THORBIT_DEPOSITION_MCP_API_KEY ||\n readApiKeyFile()\n )?.trim()\n\n if (!apiKey) {\n throw new Error('THORBIT_API_KEY, THORBIT_MCP_API_KEY, or ~/.thorbit-deposition-mcp-key is required')\n }\n\n return {\n apiKey,\n baseUrl: (process.env.THORBIT_BASE_URL || process.env.THORBIT_DEPOSITION_MCP_BASE_URL || 'https://thorbit.ai').trim(),\n }\n}\n","export const ThorbitDepositionMcpToolNames = [\n 'thorbit_deposition_start',\n 'thorbit_deposition_get',\n 'thorbit_deposition_get_playbook',\n 'thorbit_deposition_artifact_read',\n 'thorbit_deposition_list',\n 'thorbit_deposition_search',\n] as const\n\nexport type ThorbitDepositionMcpToolName = typeof ThorbitDepositionMcpToolNames[number]\n"],"mappings":";;;AAmBO,IAAM,6BAAN,MAAiC;AAAA,EACrB;AAAA,EACA;AAAA,EAEjB,YAAY,SAA8C;AACxD,SAAK,UAAU,QAAQ,QAAQ,QAAQ,OAAO,EAAE;AAChD,SAAK,SAAS,QAAQ;AAAA,EACxB;AAAA,EAEA,MAAM,SAAS,UAAwC,OAAuD;AAC5G,UAAM,WAAW,MAAM,MAAM,GAAG,KAAK,OAAO,0BAA0B,QAAQ,IAAI;AAAA,MAChF,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,qBAAqB,KAAK;AAAA,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