thorbit-deposition-mcp 0.1.2 → 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.
@@ -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 = {
@@ -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 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 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,WAAW;AAAA,MACX,OAAO;AAAA,QACL,MAAM,SAAS,KAAK,qBAAqB,QAAQ,SAAS,MAA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AAS;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,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,QAAQ,CAAC,kBAAc,2BAAK,wBAAQ,GAAG,6BAA6B,CAAC,EAAE,OAAO,OAAO;AAC3F,aAAW,QAAQ,OAAO;AACxB,QAAI;AACF,YAAM,YAAQ,6BAAa,MAAM,MAAM,EAAE,KAAK;AAC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AAAA,IACP,aAAa;AAAA,IACb,aAAa;AAAA,IACb,aAAa,iBAAiB,yBAAyB;AAAA,EACzD,CAAC;AAED,eAAa,0BAA0B;AAAA,IACrC,OAAO;AAAA,IACP,aAAa;AAAA,IACb,aAAa;AAAA,IACb,aAAa,oBAAoB,+BAA+B;AAAA,EAClE,CAAC;AAED,eAAa,mCAAmC;AAAA,IAC9C,OAAO;AAAA,IACP,aAAa;AAAA,IACb,aAAa;AAAA,IACb,aAAa,oBAAoB,6BAA6B;AAAA,EAChE,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,eAAa,6BAA6B;AAAA,IACxC,OAAO;AAAA,IACP,aAAa;AAAA,IACb,aAAa;AAAA,IACb,aAAa,oBAAoB,2BAA2B;AAAA,EAC9D,CAAC;AAED,SAAO;AACT;;;AHrGA,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":[]}
@@ -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 = {
@@ -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 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 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,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,QA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AO;AAAA,IACP,aAAa;AAAA,IACb,aAAa;AAAA,IACb,aAAa,iBAAiB,yBAAyB;AAAA,EACzD,CAAC;AAED,eAAa,0BAA0B;AAAA,IACrC,OAAO;AAAA,IACP,aAAa;AAAA,IACb,aAAa;AAAA,IACb,aAAa,oBAAoB,+BAA+B;AAAA,EAClE,CAAC;AAED,eAAa,mCAAmC;AAAA,IAC9C,OAAO;AAAA,IACP,aAAa;AAAA,IACb,aAAa;AAAA,IACb,aAAa,oBAAoB,6BAA6B;AAAA,EAChE,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,eAAa,6BAA6B;AAAA,IACxC,OAAO;AAAA,IACP,aAAa;AAAA,IACb,aAAa;AAAA,IACb,aAAa,oBAAoB,2BAA2B;AAAA,EAC9D,CAAC;AAED,SAAO;AACT;;;AHrGA,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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,aAAa,oBAAoB,6BAA6B;AAAA,EAChE,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,eAAa,6BAA6B;AAAA,IACxC,OAAO;AAAA,IACP,aAAa;AAAA,IACb,aAAa;AAAA,IACb,aAAa,oBAAoB,2BAA2B;AAAA,EAC9D,CAAC;AAED,SAAO;AACT;;;AHrGA,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":[]}
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 = {
@@ -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 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 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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E,QAAM,QAAQ,CAAC,kBAAc,2BAAK,wBAAQ,GAAG,6BAA6B,CAAC,EAAE,OAAO,OAAO;AAC3F,aAAW,QAAQ,OAAO;AACxB,QAAI;AACF,YAAM,YAAQ,6BAAa,MAAM,MAAM,EAAE,KAAK;AAC9C,UAAI,MAAO,QAAO;AAAA,IACpB,QAAQ;AACN;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AAEO,SAAS,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;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,SA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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;AAAA,EACA;AACF;","names":[]}
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 = {
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 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 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,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,iBAA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B;AAAA,IACtC,OAAO;AAAA,IACP,aAAa;AAAA,IACb,aAAa;AAAA,IACb,aAAa,oBAAoB,yBAAyB;AAAA,EAC5D,CAAC;AAED,eAAa,6BAA6B;AAAA,IACxC,OAAO;AAAA,IACP,aAAa;AAAA,IACb,aAAa;AAAA,IACb,aAAa,oBAAoB,2BAA2B;AAAA,EAC9D,CAAC;AAED,SAAO;AACT;;;AG1GA,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;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,QAC1B,gBAAgB;AAAA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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;AAAA,EACA;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thorbit-deposition-mcp",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "MCP server for the Thorbit Depositioning strategy pipeline",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",