thorbit-deposition-mcp 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/thorbit-deposition-mcp.cjs +13 -1
- package/dist/bin/thorbit-deposition-mcp.cjs.map +1 -1
- package/dist/bin/thorbit-deposition-mcp.js +13 -1
- package/dist/bin/thorbit-deposition-mcp.js.map +1 -1
- package/dist/index.cjs +14 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -92,6 +92,11 @@ var ThorbitDepositionGetInputSchema = {
|
|
|
92
92
|
var ThorbitDepositionGetPlaybookInputSchema = {
|
|
93
93
|
runPublicId: import_zod.z.string().min(1).describe("Deposition run public ID. Returns the markdown playbook once the run is complete.")
|
|
94
94
|
};
|
|
95
|
+
var ThorbitDepositionArtifactReadInputSchema = {
|
|
96
|
+
runPublicId: import_zod.z.string().min(1).describe("Deposition run public ID."),
|
|
97
|
+
artifactId: import_zod.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.'),
|
|
98
|
+
maxBytes: import_zod.z.number().int().min(1e3).max(1e6).default(2e5).describe("Max bytes to return; content is truncated with a flag if larger.")
|
|
99
|
+
};
|
|
95
100
|
var ThorbitDepositionListInputSchema = {
|
|
96
101
|
projectPublicId: import_zod.z.string().min(1).optional().describe("Optional project filter; omit for all org runs."),
|
|
97
102
|
search: import_zod.z.string().max(200).optional().describe("Optional company-name substring filter."),
|
|
@@ -101,7 +106,7 @@ var ThorbitDepositionListInputSchema = {
|
|
|
101
106
|
};
|
|
102
107
|
|
|
103
108
|
// src/deposition-mcp-server.ts
|
|
104
|
-
var VERSION = "0.1.
|
|
109
|
+
var VERSION = "0.1.1";
|
|
105
110
|
function readOnlyAnnotations(title) {
|
|
106
111
|
return { title, readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
107
112
|
}
|
|
@@ -122,6 +127,7 @@ var SERVER_INSTRUCTIONS = [
|
|
|
122
127
|
"- thorbit_deposition_start returns quickly with {runPublicId, poll}. Do NOT block \u2014 follow result.poll.",
|
|
123
128
|
"- Poll thorbit_deposition_get until status is terminal (complete/failed). It returns a LEAN status (phase, progress, binding state, strategy) with a nextAction.",
|
|
124
129
|
"- When status is complete, call thorbit_deposition_get_playbook to read the finished markdown playbook.",
|
|
130
|
+
"- 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) \u2014 do NOT pull includePhaseData unless you need the whole raw bundle.",
|
|
125
131
|
"- Use thorbit_deposition_list to find past runs (by company/status) and their runPublicId."
|
|
126
132
|
].join("\n");
|
|
127
133
|
function buildThorbitDepositionMcpServer(client) {
|
|
@@ -150,6 +156,12 @@ function buildThorbitDepositionMcpServer(client) {
|
|
|
150
156
|
inputSchema: ThorbitDepositionGetPlaybookInputSchema,
|
|
151
157
|
annotations: readOnlyAnnotations("Read Depositioning Playbook")
|
|
152
158
|
});
|
|
159
|
+
registerTool("thorbit_deposition_artifact_read", {
|
|
160
|
+
title: "Read Depositioning Artifact",
|
|
161
|
+
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.",
|
|
162
|
+
inputSchema: ThorbitDepositionArtifactReadInputSchema,
|
|
163
|
+
annotations: readOnlyAnnotations("Read Depositioning Artifact")
|
|
164
|
+
});
|
|
153
165
|
registerTool("thorbit_deposition_list", {
|
|
154
166
|
title: "List Depositioning Runs",
|
|
155
167
|
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.",
|
|
@@ -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 ThorbitDepositionListInputSchema,\n} from './deposition-mcp-tool-schemas.js'\nimport type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nconst VERSION = '0.1.0'\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 '- 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_list', {\n title: 'List Depositioning Runs',\n description: 'List past Depositioning runs (most recent first) with runPublicId, company, category, status, binding state, and strategy. Filter by project, company-name search, or status. Use to find a prior run to read.',\n inputSchema: ThorbitDepositionListInputSchema,\n annotations: readOnlyAnnotations('List Depositioning Runs'),\n })\n\n return server\n}\n","import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js'\nimport type { ThorbitDepositionMcpEnvelope } from './deposition-api-client.js'\nimport type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nexport function formatThorbitDepositionMcpToolResult(\n toolName: ThorbitDepositionMcpToolName,\n envelope: ThorbitDepositionMcpEnvelope,\n): CallToolResult {\n const text = JSON.stringify({ toolName, ...envelope }, null, 2)\n return {\n content: [{ type: 'text', text }],\n isError: !envelope.ok,\n }\n}\n","import { z } from 'zod'\n\nexport const ThorbitDepositionStartInputSchema = {\n companyName: z.string().min(1).max(255).describe('The challenger company or product being depositioned.'),\n productUrl: z.string().url().max(2048).describe('URL of the challenger product homepage.'),\n categoryName: z.string().min(1).max(255).describe('The product category, e.g. \"B2B sales analytics\".'),\n competitorUrls: z.array(z.string().url()).max(5).default([]).describe('0-5 competitor URLs. Auto-discovered via SERP if fewer than 2 are provided.'),\n reviewsUrl: z.string().url().max(2048).optional().describe('Optional customer reviews URL (G2, Trustpilot, Reddit thread).'),\n knownPains: z.array(z.string().min(1)).max(50).optional().describe('Optional known customer pain points to seed the analysis.'),\n projectPublicId: z.string().min(1).optional().describe('Optional Thorbit project to associate the run with.'),\n}\n\nexport const ThorbitDepositionGetInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID returned by thorbit_deposition_start.'),\n includePhaseData: z.boolean().default(false).describe('Include raw per-phase intermediate data in addition to the lean status.'),\n}\n\nexport const ThorbitDepositionGetPlaybookInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID. Returns the markdown playbook once the run is complete.'),\n}\n\nexport const ThorbitDepositionListInputSchema = {\n projectPublicId: z.string().min(1).optional().describe('Optional project filter; omit for all org runs.'),\n search: z.string().max(200).optional().describe('Optional company-name substring filter.'),\n status: z.enum(['queued', 'running', 'complete', 'failed']).optional().describe('Optional run status filter.'),\n limit: z.number().int().min(1).max(100).default(25).describe('Maximum runs to return.'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset.'),\n}\n\nexport const ThorbitDepositionMcpToolInputSchemas = {\n thorbit_deposition_start: ThorbitDepositionStartInputSchema,\n thorbit_deposition_get: ThorbitDepositionGetInputSchema,\n thorbit_deposition_get_playbook: ThorbitDepositionGetPlaybookInputSchema,\n thorbit_deposition_list: ThorbitDepositionListInputSchema,\n}\n"],"mappings":";;;;AAAA,mBAAqC;;;ACmB9B,IAAM,6BAAN,MAAiC;AAAA,EACrB;AAAA,EACA;AAAA,EAEjB,YAAY,SAA8C;AACxD,SAAK,UAAU,QAAQ,QAAQ,QAAQ,OAAO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;AACrD,YAAM,WAAW,MAAM,OAAO,SAAS,UAAU,KAAK;AACtD,aAAO,qCAAqC,UAAU,QAAQ;AAAA,IAChE,CAAC;AAAA,EACH;AAEA,eAAa,4BAA4B;AAAA,IACvC,OAAO;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,2BAA2B;AAAA,IACtC,OAAO;AAAA,IACP,aAAa;AAAA,IACb,aAAa;AAAA,IACb,aAAa,oBAAoB,yBAAyB;AAAA,EAC5D,CAAC;AAED,SAAO;AACT;;;AHpFA,eAAe,OAAO;AACpB,QAAM,MAAM,+BAA+B;AAC3C,QAAM,SAAS,IAAI,2BAA2B,GAAG;AACjD,QAAM,SAAS,gCAAgC,MAAM;AACrD,QAAM,OAAO,QAAQ,IAAI,kCAAqB,CAAC;AACjD;AAEA,KAAK,EAAE,MAAM,WAAS;AACpB,UAAQ,OAAO,MAAM,GAAG,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;AAAA,CAAI;AAClF,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../bin/thorbit-deposition-mcp.ts","../../src/deposition-api-client.ts","../../src/deposition-mcp-env.ts","../../src/deposition-mcp-server.ts","../../src/deposition-mcp-response-formatters.ts","../../src/deposition-mcp-tool-schemas.ts"],"sourcesContent":["import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'\nimport { ThorbitDepositionApiClient } from '../src/deposition-api-client.js'\nimport { resolveThorbitDepositionMcpEnv } from '../src/deposition-mcp-env.js'\nimport { buildThorbitDepositionMcpServer } from '../src/deposition-mcp-server.js'\n\nasync function main() {\n const env = resolveThorbitDepositionMcpEnv()\n const client = new ThorbitDepositionApiClient(env)\n const server = buildThorbitDepositionMcpServer(client)\n await server.connect(new StdioServerTransport())\n}\n\nmain().catch(error => {\n process.stderr.write(`${error instanceof Error ? error.message : String(error)}\\n`)\n process.exit(1)\n})\n","import type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nexport type ThorbitDepositionMcpEnvelope =\n | {\n ok: true\n result: unknown\n warnings?: string[]\n requestId: string\n }\n | {\n ok: false\n error: {\n code: string\n message: string\n details?: unknown\n }\n requestId: string\n }\n\nexport class ThorbitDepositionApiClient {\n private readonly baseUrl: string\n private readonly apiKey: string\n\n constructor(options: { baseUrl: string; apiKey: string }) {\n this.baseUrl = options.baseUrl.replace(/\\/$/, '')\n this.apiKey = options.apiKey\n }\n\n async callTool(toolName: ThorbitDepositionMcpToolName, input: unknown): Promise<ThorbitDepositionMcpEnvelope> {\n const response = await fetch(`${this.baseUrl}/api/v1/mcp/deposition/${toolName}`, {\n method: 'POST',\n headers: {\n 'x-thorbit-api-key': this.apiKey,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(input ?? {}),\n })\n\n const body = await response.json().catch(() => null) as ThorbitDepositionMcpEnvelope | null\n if (body && typeof body === 'object' && 'ok' in body) return body\n\n return {\n ok: false,\n requestId: 'unavailable',\n error: {\n code: response.ok ? 'invalid_response' : `http_${response.status}`,\n message: response.ok ? 'Thorbit returned an invalid MCP response' : `Thorbit API request failed with HTTP ${response.status}`,\n },\n }\n }\n}\n","import { readFileSync } from 'node:fs'\nimport { homedir } from 'node:os'\nimport { join } from 'node:path'\n\nexport type ThorbitDepositionMcpEnv = {\n apiKey: string\n baseUrl: string\n}\n\nfunction readApiKeyFile(): string | undefined {\n const explicitPath = process.env.THORBIT_DEPOSITION_MCP_KEY_PATH?.trim()\n const paths = [explicitPath, join(homedir(), '.thorbit-deposition-mcp-key')].filter(Boolean) as string[]\n for (const path of paths) {\n try {\n const value = readFileSync(path, 'utf8').trim()\n if (value) return value\n } catch {\n continue\n }\n }\n return undefined\n}\n\nexport function resolveThorbitDepositionMcpEnv(): ThorbitDepositionMcpEnv {\n const apiKey = (\n process.env.THORBIT_API_KEY ||\n process.env.THORBIT_MCP_API_KEY ||\n process.env.THORBIT_DEPOSITION_MCP_API_KEY ||\n readApiKeyFile()\n )?.trim()\n\n if (!apiKey) {\n throw new Error('THORBIT_API_KEY, THORBIT_MCP_API_KEY, or ~/.thorbit-deposition-mcp-key is required')\n }\n\n return {\n apiKey,\n baseUrl: (process.env.THORBIT_BASE_URL || process.env.THORBIT_DEPOSITION_MCP_BASE_URL || 'https://thorbit.ai').trim(),\n }\n}\n","import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport type { ToolAnnotations } from '@modelcontextprotocol/sdk/types.js'\nimport type { ZodRawShape } from 'zod'\nimport type { ThorbitDepositionApiClient } from './deposition-api-client.js'\nimport { formatThorbitDepositionMcpToolResult } from './deposition-mcp-response-formatters.js'\nimport {\n ThorbitDepositionStartInputSchema,\n ThorbitDepositionGetInputSchema,\n ThorbitDepositionGetPlaybookInputSchema,\n ThorbitDepositionArtifactReadInputSchema,\n ThorbitDepositionListInputSchema,\n} from './deposition-mcp-tool-schemas.js'\nimport type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nconst VERSION = '0.1.1'\n\ntype ThorbitDepositionToolConfig<InputArgs extends ZodRawShape> = {\n title: string\n description: string\n inputSchema: InputArgs\n annotations: ToolAnnotations\n}\n\nfunction readOnlyAnnotations(title: string) {\n return { title, readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false }\n}\n\nfunction writeAnnotations(title: string) {\n return { title, readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true }\n}\n\nexport const SERVER_INSTRUCTIONS = [\n 'Thorbit Depositioning MCP. Runs the durable Depositioning strategy pipeline on hosted Thorbit (this server is a thin client). It researches competitors + customers, finds the binding vulnerability, classifies mover populations, designs a category class, builds a displacement mechanism, and writes a strategy playbook. All write/analysis tools are metered against your API key.',\n '',\n 'INTAKE (ask the user these BEFORE thorbit_deposition_start, then run):',\n '1. Company / product name being depositioned.',\n '2. Product URL (the challenger homepage).',\n '3. Category name (e.g. \"B2B sales analytics\").',\n '4. Optional: 0-5 competitor URLs (auto-discovered via SERP if fewer than 2).',\n '5. Optional: a customer reviews URL (G2 / Trustpilot / Reddit) and known customer pain points.',\n '',\n 'ASYNC CONTRACT (important):',\n '- thorbit_deposition_start returns quickly with {runPublicId, poll}. Do NOT block — follow result.poll.',\n '- Poll thorbit_deposition_get until status is terminal (complete/failed). It returns a LEAN status (phase, progress, binding state, strategy) with a nextAction.',\n '- When status is complete, call thorbit_deposition_get_playbook to read the finished markdown playbook.',\n '- thorbit_deposition_get also returns an ARTIFACTS manifest (research/own.json, research/competitor-N.json, research/customers.json, research/market.json, vulnerability.json, movers.json, category.json, mechanism.json, playbook.md). Read any one on demand with thorbit_deposition_artifact_read(runPublicId, artifactId) — do NOT pull includePhaseData unless you need the whole raw bundle.',\n '- Use thorbit_deposition_list to find past runs (by company/status) and their runPublicId.',\n].join('\\n')\n\nexport function buildThorbitDepositionMcpServer(client: ThorbitDepositionApiClient): McpServer {\n const server = new McpServer({ name: 'thorbit-deposition-mcp', version: VERSION }, { instructions: SERVER_INSTRUCTIONS })\n\n function registerTool<T extends ThorbitDepositionMcpToolName>(\n toolName: T,\n config: ThorbitDepositionToolConfig<ZodRawShape>,\n ): void {\n server.registerTool(toolName, config, async (input) => {\n const envelope = await client.callTool(toolName, input)\n return formatThorbitDepositionMcpToolResult(toolName, envelope)\n })\n }\n\n registerTool('thorbit_deposition_start', {\n title: 'Start Depositioning Run',\n description: 'Start a durable Depositioning strategy run for a challenger product in a category. Researches competitors and customers, finds the binding vulnerability, classifies movers, designs a category class, builds a displacement mechanism, and writes a playbook. Returns a runPublicId plus a thorbit_deposition_get poll target. Metered.',\n inputSchema: ThorbitDepositionStartInputSchema,\n annotations: writeAnnotations('Start Depositioning Run'),\n })\n\n registerTool('thorbit_deposition_get', {\n title: 'Read Depositioning Run Status',\n description: 'Read a Depositioning run: status, current phase, progress, selected binding state and strategy, primary vulnerability, category class, displacement mechanism, and whether the playbook is ready. Returns a nextAction. Poll until status is complete or failed.',\n inputSchema: ThorbitDepositionGetInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Run Status'),\n })\n\n registerTool('thorbit_deposition_get_playbook', {\n title: 'Read Depositioning Playbook',\n description: 'Return the finished deposition-playbook markdown for a completed run (executive brief, the four elements, activation guide). Returns not_found until the run completes.',\n inputSchema: ThorbitDepositionGetPlaybookInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Playbook'),\n })\n\n registerTool('thorbit_deposition_artifact_read', {\n title: 'Read Depositioning Artifact',\n description: 'Read one artifact from a run\\'s folder by id (e.g. research/own.json, research/competitor-2.json, vulnerability.json, playbook.md). Artifact ids come from the artifacts manifest in thorbit_deposition_get. Byte-capped via maxBytes. Use this instead of pulling the whole run.',\n inputSchema: ThorbitDepositionArtifactReadInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Artifact'),\n })\n\n registerTool('thorbit_deposition_list', {\n title: 'List Depositioning Runs',\n description: 'List past Depositioning runs (most recent first) with runPublicId, company, category, status, binding state, and strategy. Filter by project, company-name search, or status. Use to find a prior run to read.',\n inputSchema: ThorbitDepositionListInputSchema,\n annotations: readOnlyAnnotations('List Depositioning Runs'),\n })\n\n return server\n}\n","import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js'\nimport type { ThorbitDepositionMcpEnvelope } from './deposition-api-client.js'\nimport type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nexport function formatThorbitDepositionMcpToolResult(\n toolName: ThorbitDepositionMcpToolName,\n envelope: ThorbitDepositionMcpEnvelope,\n): CallToolResult {\n const text = JSON.stringify({ toolName, ...envelope }, null, 2)\n return {\n content: [{ type: 'text', text }],\n isError: !envelope.ok,\n }\n}\n","import { z } from 'zod'\n\nexport const ThorbitDepositionStartInputSchema = {\n companyName: z.string().min(1).max(255).describe('The challenger company or product being depositioned.'),\n productUrl: z.string().url().max(2048).describe('URL of the challenger product homepage.'),\n categoryName: z.string().min(1).max(255).describe('The product category, e.g. \"B2B sales analytics\".'),\n competitorUrls: z.array(z.string().url()).max(5).default([]).describe('0-5 competitor URLs. Auto-discovered via SERP if fewer than 2 are provided.'),\n reviewsUrl: z.string().url().max(2048).optional().describe('Optional customer reviews URL (G2, Trustpilot, Reddit thread).'),\n knownPains: z.array(z.string().min(1)).max(50).optional().describe('Optional known customer pain points to seed the analysis.'),\n projectPublicId: z.string().min(1).optional().describe('Optional Thorbit project to associate the run with.'),\n}\n\nexport const ThorbitDepositionGetInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID returned by thorbit_deposition_start.'),\n includePhaseData: z.boolean().default(false).describe('Include raw per-phase intermediate data in addition to the lean status.'),\n}\n\nexport const ThorbitDepositionGetPlaybookInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID. Returns the markdown playbook once the run is complete.'),\n}\n\nexport const ThorbitDepositionArtifactReadInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID.'),\n artifactId: z.string().min(1).describe('Artifact id from the run manifest, e.g. \"research/own.json\", \"research/competitor-2.json\", \"vulnerability.json\", \"playbook.md\". Get ids from thorbit_deposition_get.'),\n maxBytes: z.number().int().min(1000).max(1000000).default(200000).describe('Max bytes to return; content is truncated with a flag if larger.'),\n}\n\nexport const ThorbitDepositionListInputSchema = {\n projectPublicId: z.string().min(1).optional().describe('Optional project filter; omit for all org runs.'),\n search: z.string().max(200).optional().describe('Optional company-name substring filter.'),\n status: z.enum(['queued', 'running', 'complete', 'failed']).optional().describe('Optional run status filter.'),\n limit: z.number().int().min(1).max(100).default(25).describe('Maximum runs to return.'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset.'),\n}\n\nexport const ThorbitDepositionMcpToolInputSchemas = {\n thorbit_deposition_start: ThorbitDepositionStartInputSchema,\n thorbit_deposition_get: ThorbitDepositionGetInputSchema,\n thorbit_deposition_get_playbook: ThorbitDepositionGetPlaybookInputSchema,\n thorbit_deposition_artifact_read: ThorbitDepositionArtifactReadInputSchema,\n thorbit_deposition_list: ThorbitDepositionListInputSchema,\n}\n"],"mappings":";;;;AAAA,mBAAqC;;;ACmB9B,IAAM,6BAAN,MAAiC;AAAA,EACrB;AAAA,EACA;AAAA,EAEjB,YAAY,SAA8C;AACxD,SAAK,UAAU,QAAQ,QAAQ,QAAQ,OAAO,EAAE;AAChD,SAAK,SAAS,QAAQ;AAAA,EACxB;AAAA,EAEA,MAAM,SAAS,UAAwC,OAAuD;AAC5G,UAAM,WAAW,MAAM,MAAM,GAAG,KAAK,OAAO,0BAA0B,QAAQ,IAAI;AAAA,MAChF,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,qBAAqB,KAAK;AAAA,QAC1B,gBAAgB;AAAA,MAClB;AAAA,MACA,MAAM,KAAK,UAAU,SAAS,CAAC,CAAC;AAAA,IAClC,CAAC;AAED,UAAM,OAAO,MAAM,SAAS,KAAK,EAAE,MAAM,MAAM,IAAI;AACnD,QAAI,QAAQ,OAAO,SAAS,YAAY,QAAQ,KAAM,QAAO;AAE7D,WAAO;AAAA,MACL,IAAI;AAAA,MACJ,WAAW;AAAA,MACX,OAAO;AAAA,QACL,MAAM,SAAS,KAAK,qBAAqB,QAAQ,SAAS,MAAM;AAAA,QAChE,SAAS,SAAS,KAAK,6CAA6C,wCAAwC,SAAS,MAAM;AAAA,MAC7H;AAAA,IACF;AAAA,EACF;AACF;;;AClDA,qBAA6B;AAC7B,qBAAwB;AACxB,uBAAqB;AAOrB,SAAS,iBAAqC;AAC5C,QAAM,eAAe,QAAQ,IAAI,iCAAiC,KAAK;AACvE,QAAM,QAAQ,CAAC,kBAAc,2BAAK,wBA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C,OAAO;AAAA,IACP,aAAa;AAAA,IACb,aAAa;AAAA,IACb,aAAa,oBAAoB,6BAA6B;AAAA,EAChE,CAAC;AAED,eAAa,2BAA2B;AAAA,IACtC,OAAO;AAAA,IACP,aAAa;AAAA,IACb,aAAa;AAAA,IACb,aAAa,oBAAoB,yBAAyB;AAAA,EAC5D,CAAC;AAED,SAAO;AACT;;;AH7FA,eAAe,OAAO;AACpB,QAAM,MAAM,+BAA+B;AAC3C,QAAM,SAAS,IAAI,2BAA2B,GAAG;AACjD,QAAM,SAAS,gCAAgC,MAAM;AACrD,QAAM,OAAO,QAAQ,IAAI,kCAAqB,CAAC;AACjD;AAEA,KAAK,EAAE,MAAM,WAAS;AACpB,UAAQ,OAAO,MAAM,GAAG,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;AAAA,CAAI;AAClF,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":[]}
|
|
@@ -91,6 +91,11 @@ var ThorbitDepositionGetInputSchema = {
|
|
|
91
91
|
var ThorbitDepositionGetPlaybookInputSchema = {
|
|
92
92
|
runPublicId: z.string().min(1).describe("Deposition run public ID. Returns the markdown playbook once the run is complete.")
|
|
93
93
|
};
|
|
94
|
+
var ThorbitDepositionArtifactReadInputSchema = {
|
|
95
|
+
runPublicId: z.string().min(1).describe("Deposition run public ID."),
|
|
96
|
+
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.'),
|
|
97
|
+
maxBytes: z.number().int().min(1e3).max(1e6).default(2e5).describe("Max bytes to return; content is truncated with a flag if larger.")
|
|
98
|
+
};
|
|
94
99
|
var ThorbitDepositionListInputSchema = {
|
|
95
100
|
projectPublicId: z.string().min(1).optional().describe("Optional project filter; omit for all org runs."),
|
|
96
101
|
search: z.string().max(200).optional().describe("Optional company-name substring filter."),
|
|
@@ -100,7 +105,7 @@ var ThorbitDepositionListInputSchema = {
|
|
|
100
105
|
};
|
|
101
106
|
|
|
102
107
|
// src/deposition-mcp-server.ts
|
|
103
|
-
var VERSION = "0.1.
|
|
108
|
+
var VERSION = "0.1.1";
|
|
104
109
|
function readOnlyAnnotations(title) {
|
|
105
110
|
return { title, readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
106
111
|
}
|
|
@@ -121,6 +126,7 @@ var SERVER_INSTRUCTIONS = [
|
|
|
121
126
|
"- thorbit_deposition_start returns quickly with {runPublicId, poll}. Do NOT block \u2014 follow result.poll.",
|
|
122
127
|
"- Poll thorbit_deposition_get until status is terminal (complete/failed). It returns a LEAN status (phase, progress, binding state, strategy) with a nextAction.",
|
|
123
128
|
"- When status is complete, call thorbit_deposition_get_playbook to read the finished markdown playbook.",
|
|
129
|
+
"- 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) \u2014 do NOT pull includePhaseData unless you need the whole raw bundle.",
|
|
124
130
|
"- Use thorbit_deposition_list to find past runs (by company/status) and their runPublicId."
|
|
125
131
|
].join("\n");
|
|
126
132
|
function buildThorbitDepositionMcpServer(client) {
|
|
@@ -149,6 +155,12 @@ function buildThorbitDepositionMcpServer(client) {
|
|
|
149
155
|
inputSchema: ThorbitDepositionGetPlaybookInputSchema,
|
|
150
156
|
annotations: readOnlyAnnotations("Read Depositioning Playbook")
|
|
151
157
|
});
|
|
158
|
+
registerTool("thorbit_deposition_artifact_read", {
|
|
159
|
+
title: "Read Depositioning Artifact",
|
|
160
|
+
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.",
|
|
161
|
+
inputSchema: ThorbitDepositionArtifactReadInputSchema,
|
|
162
|
+
annotations: readOnlyAnnotations("Read Depositioning Artifact")
|
|
163
|
+
});
|
|
152
164
|
registerTool("thorbit_deposition_list", {
|
|
153
165
|
title: "List Depositioning Runs",
|
|
154
166
|
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.",
|
|
@@ -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 ThorbitDepositionListInputSchema,\n} from './deposition-mcp-tool-schemas.js'\nimport type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nconst VERSION = '0.1.0'\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 '- 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_list', {\n title: 'List Depositioning Runs',\n description: 'List past Depositioning runs (most recent first) with runPublicId, company, category, status, binding state, and strategy. Filter by project, company-name search, or status. Use to find a prior run to read.',\n inputSchema: ThorbitDepositionListInputSchema,\n annotations: readOnlyAnnotations('List Depositioning Runs'),\n })\n\n return server\n}\n","import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js'\nimport type { ThorbitDepositionMcpEnvelope } from './deposition-api-client.js'\nimport type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nexport function formatThorbitDepositionMcpToolResult(\n toolName: ThorbitDepositionMcpToolName,\n envelope: ThorbitDepositionMcpEnvelope,\n): CallToolResult {\n const text = JSON.stringify({ toolName, ...envelope }, null, 2)\n return {\n content: [{ type: 'text', text }],\n isError: !envelope.ok,\n }\n}\n","import { z } from 'zod'\n\nexport const ThorbitDepositionStartInputSchema = {\n companyName: z.string().min(1).max(255).describe('The challenger company or product being depositioned.'),\n productUrl: z.string().url().max(2048).describe('URL of the challenger product homepage.'),\n categoryName: z.string().min(1).max(255).describe('The product category, e.g. \"B2B sales analytics\".'),\n competitorUrls: z.array(z.string().url()).max(5).default([]).describe('0-5 competitor URLs. Auto-discovered via SERP if fewer than 2 are provided.'),\n reviewsUrl: z.string().url().max(2048).optional().describe('Optional customer reviews URL (G2, Trustpilot, Reddit thread).'),\n knownPains: z.array(z.string().min(1)).max(50).optional().describe('Optional known customer pain points to seed the analysis.'),\n projectPublicId: z.string().min(1).optional().describe('Optional Thorbit project to associate the run with.'),\n}\n\nexport const ThorbitDepositionGetInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID returned by thorbit_deposition_start.'),\n includePhaseData: z.boolean().default(false).describe('Include raw per-phase intermediate data in addition to the lean status.'),\n}\n\nexport const ThorbitDepositionGetPlaybookInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID. Returns the markdown playbook once the run is complete.'),\n}\n\nexport const ThorbitDepositionListInputSchema = {\n projectPublicId: z.string().min(1).optional().describe('Optional project filter; omit for all org runs.'),\n search: z.string().max(200).optional().describe('Optional company-name substring filter.'),\n status: z.enum(['queued', 'running', 'complete', 'failed']).optional().describe('Optional run status filter.'),\n limit: z.number().int().min(1).max(100).default(25).describe('Maximum runs to return.'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset.'),\n}\n\nexport const ThorbitDepositionMcpToolInputSchemas = {\n thorbit_deposition_start: ThorbitDepositionStartInputSchema,\n thorbit_deposition_get: ThorbitDepositionGetInputSchema,\n thorbit_deposition_get_playbook: ThorbitDepositionGetPlaybookInputSchema,\n thorbit_deposition_list: ThorbitDepositionListInputSchema,\n}\n"],"mappings":";;;AAAA,SA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M,SAAS,IAAI,UAAU,EAAE,MAAM,0BAA0B,SAAS,QAAQ,GAAG,EAAE,cAAc,oBAAoB,CAAC;AAExH,WAAS,aACP,UACA,QACM;AACN,WAAO,aAAa,UAAU,QAAQ,OAAO,UAAU;AACrD,YAAM,WAAW,MAAM,OAAO,SAAS,UAAU,KAAK;AACtD,aAAO,qCAAqC,UAAU,QAAQ;AAAA,IAChE,CAAC;AAAA,EACH;AAEA,eAAa,4BAA4B;AAAA,IACvC,OAAO;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,2BAA2B;AAAA,IACtC,OAAO;AAAA,IACP,aAAa;AAAA,IACb,aAAa;AAAA,IACb,aAAa,oBAAoB,yBAAyB;AAAA,EAC5D,CAAC;AAED,SAAO;AACT;;;AHpFA,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} from './deposition-mcp-tool-schemas.js'\nimport type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nconst VERSION = '0.1.1'\n\ntype ThorbitDepositionToolConfig<InputArgs extends ZodRawShape> = {\n title: string\n description: string\n inputSchema: InputArgs\n annotations: ToolAnnotations\n}\n\nfunction readOnlyAnnotations(title: string) {\n return { title, readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false }\n}\n\nfunction writeAnnotations(title: string) {\n return { title, readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true }\n}\n\nexport const SERVER_INSTRUCTIONS = [\n 'Thorbit Depositioning MCP. Runs the durable Depositioning strategy pipeline on hosted Thorbit (this server is a thin client). It researches competitors + customers, finds the binding vulnerability, classifies mover populations, designs a category class, builds a displacement mechanism, and writes a strategy playbook. All write/analysis tools are metered against your API key.',\n '',\n 'INTAKE (ask the user these BEFORE thorbit_deposition_start, then run):',\n '1. Company / product name being depositioned.',\n '2. Product URL (the challenger homepage).',\n '3. Category name (e.g. \"B2B sales analytics\").',\n '4. Optional: 0-5 competitor URLs (auto-discovered via SERP if fewer than 2).',\n '5. Optional: a customer reviews URL (G2 / Trustpilot / Reddit) and known customer pain points.',\n '',\n 'ASYNC CONTRACT (important):',\n '- thorbit_deposition_start returns quickly with {runPublicId, poll}. Do NOT block — follow result.poll.',\n '- Poll thorbit_deposition_get until status is terminal (complete/failed). It returns a LEAN status (phase, progress, binding state, strategy) with a nextAction.',\n '- When status is complete, call thorbit_deposition_get_playbook to read the finished markdown playbook.',\n '- thorbit_deposition_get also returns an ARTIFACTS manifest (research/own.json, research/competitor-N.json, research/customers.json, research/market.json, vulnerability.json, movers.json, category.json, mechanism.json, playbook.md). Read any one on demand with thorbit_deposition_artifact_read(runPublicId, artifactId) — do NOT pull includePhaseData unless you need the whole raw bundle.',\n '- Use thorbit_deposition_list to find past runs (by company/status) and their runPublicId.',\n].join('\\n')\n\nexport function buildThorbitDepositionMcpServer(client: ThorbitDepositionApiClient): McpServer {\n const server = new McpServer({ name: 'thorbit-deposition-mcp', version: VERSION }, { instructions: SERVER_INSTRUCTIONS })\n\n function registerTool<T extends ThorbitDepositionMcpToolName>(\n toolName: T,\n config: ThorbitDepositionToolConfig<ZodRawShape>,\n ): void {\n server.registerTool(toolName, config, async (input) => {\n const envelope = await client.callTool(toolName, input)\n return formatThorbitDepositionMcpToolResult(toolName, envelope)\n })\n }\n\n registerTool('thorbit_deposition_start', {\n title: 'Start Depositioning Run',\n description: 'Start a durable Depositioning strategy run for a challenger product in a category. Researches competitors and customers, finds the binding vulnerability, classifies movers, designs a category class, builds a displacement mechanism, and writes a playbook. Returns a runPublicId plus a thorbit_deposition_get poll target. Metered.',\n inputSchema: ThorbitDepositionStartInputSchema,\n annotations: writeAnnotations('Start Depositioning Run'),\n })\n\n registerTool('thorbit_deposition_get', {\n title: 'Read Depositioning Run Status',\n description: 'Read a Depositioning run: status, current phase, progress, selected binding state and strategy, primary vulnerability, category class, displacement mechanism, and whether the playbook is ready. Returns a nextAction. Poll until status is complete or failed.',\n inputSchema: ThorbitDepositionGetInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Run Status'),\n })\n\n registerTool('thorbit_deposition_get_playbook', {\n title: 'Read Depositioning Playbook',\n description: 'Return the finished deposition-playbook markdown for a completed run (executive brief, the four elements, activation guide). Returns not_found until the run completes.',\n inputSchema: ThorbitDepositionGetPlaybookInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Playbook'),\n })\n\n registerTool('thorbit_deposition_artifact_read', {\n title: 'Read Depositioning Artifact',\n description: 'Read one artifact from a run\\'s folder by id (e.g. research/own.json, research/competitor-2.json, vulnerability.json, playbook.md). Artifact ids come from the artifacts manifest in thorbit_deposition_get. Byte-capped via maxBytes. Use this instead of pulling the whole run.',\n inputSchema: ThorbitDepositionArtifactReadInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Artifact'),\n })\n\n registerTool('thorbit_deposition_list', {\n title: 'List Depositioning Runs',\n description: 'List past Depositioning runs (most recent first) with runPublicId, company, category, status, binding state, and strategy. Filter by project, company-name search, or status. Use to find a prior run to read.',\n inputSchema: ThorbitDepositionListInputSchema,\n annotations: readOnlyAnnotations('List Depositioning Runs'),\n })\n\n return server\n}\n","import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js'\nimport type { ThorbitDepositionMcpEnvelope } from './deposition-api-client.js'\nimport type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nexport function formatThorbitDepositionMcpToolResult(\n toolName: ThorbitDepositionMcpToolName,\n envelope: ThorbitDepositionMcpEnvelope,\n): CallToolResult {\n const text = JSON.stringify({ toolName, ...envelope }, null, 2)\n return {\n content: [{ type: 'text', text }],\n isError: !envelope.ok,\n }\n}\n","import { z } from 'zod'\n\nexport const ThorbitDepositionStartInputSchema = {\n companyName: z.string().min(1).max(255).describe('The challenger company or product being depositioned.'),\n productUrl: z.string().url().max(2048).describe('URL of the challenger product homepage.'),\n categoryName: z.string().min(1).max(255).describe('The product category, e.g. \"B2B sales analytics\".'),\n competitorUrls: z.array(z.string().url()).max(5).default([]).describe('0-5 competitor URLs. Auto-discovered via SERP if fewer than 2 are provided.'),\n reviewsUrl: z.string().url().max(2048).optional().describe('Optional customer reviews URL (G2, Trustpilot, Reddit thread).'),\n knownPains: z.array(z.string().min(1)).max(50).optional().describe('Optional known customer pain points to seed the analysis.'),\n projectPublicId: z.string().min(1).optional().describe('Optional Thorbit project to associate the run with.'),\n}\n\nexport const ThorbitDepositionGetInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID returned by thorbit_deposition_start.'),\n includePhaseData: z.boolean().default(false).describe('Include raw per-phase intermediate data in addition to the lean status.'),\n}\n\nexport const ThorbitDepositionGetPlaybookInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID. Returns the markdown playbook once the run is complete.'),\n}\n\nexport const ThorbitDepositionArtifactReadInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID.'),\n artifactId: z.string().min(1).describe('Artifact id from the run manifest, e.g. \"research/own.json\", \"research/competitor-2.json\", \"vulnerability.json\", \"playbook.md\". Get ids from thorbit_deposition_get.'),\n maxBytes: z.number().int().min(1000).max(1000000).default(200000).describe('Max bytes to return; content is truncated with a flag if larger.'),\n}\n\nexport const ThorbitDepositionListInputSchema = {\n projectPublicId: z.string().min(1).optional().describe('Optional project filter; omit for all org runs.'),\n search: z.string().max(200).optional().describe('Optional company-name substring filter.'),\n status: z.enum(['queued', 'running', 'complete', 'failed']).optional().describe('Optional run status filter.'),\n limit: z.number().int().min(1).max(100).default(25).describe('Maximum runs to return.'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset.'),\n}\n\nexport const ThorbitDepositionMcpToolInputSchemas = {\n thorbit_deposition_start: ThorbitDepositionStartInputSchema,\n thorbit_deposition_get: ThorbitDepositionGetInputSchema,\n thorbit_deposition_get_playbook: ThorbitDepositionGetPlaybookInputSchema,\n thorbit_deposition_artifact_read: ThorbitDepositionArtifactReadInputSchema,\n thorbit_deposition_list: ThorbitDepositionListInputSchema,\n}\n"],"mappings":";;;AAAA,SAAS,4BAA4B;;;ACmB9B,IAAM,6BAAN,MAAiC;AAAA,EACrB;AAAA,EACA;AAAA,EAEjB,YAAY,SAA8C;AACxD,SAAK,UAAU,QAAQ,QAAQ,QAAQ,OAAO,EAAE;AAChD,SAAK,SAAS,QAAQ;AAAA,EACxB;AAAA,EAEA,MAAM,SAAS,UAAwC,OAAuD;AAC5G,UAAM,WAAW,MAAM,MAAM,GAAG,KAAK,OAAO,0BAA0B,QAAQ,IAAI;AAAA,MAChF,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,qBAAqB,KAAK;AAAA,QAC1B,gBAAgB;AAAA,MAClB;AAAA,MACA,MAAM,KAAK,UAAU,SAAS,CAAC,CAAC;AAAA,IAClC,CAAC;AAED,UAAM,OAAO,MAAM,SAAS,KAAK,EAAE,MAAM,MAAM,IAAI;AACnD,QAAI,QAAQ,OAAO,SAAS,YAAY,QAAQ,KAAM,QAAO;AAE7D,WAAO;AAAA,MACL,IAAI;AAAA,MACJ,WAAW;AAAA,MACX,OAAO;AAAA,QACL,MAAM,SAAS,KAAK,qBAAqB,QAAQ,SAAS,MAAM;AAAA,QAChE,SAAS,SAAS,KAAK,6CAA6C,wCAAwC,SAAS,MAAM;AAAA,MAC7H;AAAA,IACF;AAAA,EACF;AACF;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+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,SAAO;AACT;;;AH7FA,eAAe,OAAO;AACpB,QAAM,MAAM,+BAA+B;AAC3C,QAAM,SAAS,IAAI,2BAA2B,GAAG;AACjD,QAAM,SAAS,gCAAgC,MAAM;AACrD,QAAM,OAAO,QAAQ,IAAI,qBAAqB,CAAC;AACjD;AAEA,KAAK,EAAE,MAAM,WAAS;AACpB,UAAQ,OAAO,MAAM,GAAG,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;AAAA,CAAI;AAClF,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":[]}
|
package/dist/index.cjs
CHANGED
|
@@ -89,6 +89,11 @@ var ThorbitDepositionGetInputSchema = {
|
|
|
89
89
|
var ThorbitDepositionGetPlaybookInputSchema = {
|
|
90
90
|
runPublicId: import_zod.z.string().min(1).describe("Deposition run public ID. Returns the markdown playbook once the run is complete.")
|
|
91
91
|
};
|
|
92
|
+
var ThorbitDepositionArtifactReadInputSchema = {
|
|
93
|
+
runPublicId: import_zod.z.string().min(1).describe("Deposition run public ID."),
|
|
94
|
+
artifactId: import_zod.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.'),
|
|
95
|
+
maxBytes: import_zod.z.number().int().min(1e3).max(1e6).default(2e5).describe("Max bytes to return; content is truncated with a flag if larger.")
|
|
96
|
+
};
|
|
92
97
|
var ThorbitDepositionListInputSchema = {
|
|
93
98
|
projectPublicId: import_zod.z.string().min(1).optional().describe("Optional project filter; omit for all org runs."),
|
|
94
99
|
search: import_zod.z.string().max(200).optional().describe("Optional company-name substring filter."),
|
|
@@ -98,7 +103,7 @@ var ThorbitDepositionListInputSchema = {
|
|
|
98
103
|
};
|
|
99
104
|
|
|
100
105
|
// src/deposition-mcp-server.ts
|
|
101
|
-
var VERSION = "0.1.
|
|
106
|
+
var VERSION = "0.1.1";
|
|
102
107
|
function readOnlyAnnotations(title) {
|
|
103
108
|
return { title, readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
104
109
|
}
|
|
@@ -119,6 +124,7 @@ var SERVER_INSTRUCTIONS = [
|
|
|
119
124
|
"- thorbit_deposition_start returns quickly with {runPublicId, poll}. Do NOT block \u2014 follow result.poll.",
|
|
120
125
|
"- Poll thorbit_deposition_get until status is terminal (complete/failed). It returns a LEAN status (phase, progress, binding state, strategy) with a nextAction.",
|
|
121
126
|
"- When status is complete, call thorbit_deposition_get_playbook to read the finished markdown playbook.",
|
|
127
|
+
"- 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) \u2014 do NOT pull includePhaseData unless you need the whole raw bundle.",
|
|
122
128
|
"- Use thorbit_deposition_list to find past runs (by company/status) and their runPublicId."
|
|
123
129
|
].join("\n");
|
|
124
130
|
function buildThorbitDepositionMcpServer(client) {
|
|
@@ -147,6 +153,12 @@ function buildThorbitDepositionMcpServer(client) {
|
|
|
147
153
|
inputSchema: ThorbitDepositionGetPlaybookInputSchema,
|
|
148
154
|
annotations: readOnlyAnnotations("Read Depositioning Playbook")
|
|
149
155
|
});
|
|
156
|
+
registerTool("thorbit_deposition_artifact_read", {
|
|
157
|
+
title: "Read Depositioning Artifact",
|
|
158
|
+
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.",
|
|
159
|
+
inputSchema: ThorbitDepositionArtifactReadInputSchema,
|
|
160
|
+
annotations: readOnlyAnnotations("Read Depositioning Artifact")
|
|
161
|
+
});
|
|
150
162
|
registerTool("thorbit_deposition_list", {
|
|
151
163
|
title: "List Depositioning Runs",
|
|
152
164
|
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.",
|
|
@@ -189,6 +201,7 @@ var ThorbitDepositionMcpToolNames = [
|
|
|
189
201
|
"thorbit_deposition_start",
|
|
190
202
|
"thorbit_deposition_get",
|
|
191
203
|
"thorbit_deposition_get_playbook",
|
|
204
|
+
"thorbit_deposition_artifact_read",
|
|
192
205
|
"thorbit_deposition_list"
|
|
193
206
|
];
|
|
194
207
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/deposition-api-client.ts","../src/deposition-mcp-server.ts","../src/deposition-mcp-response-formatters.ts","../src/deposition-mcp-tool-schemas.ts","../src/deposition-mcp-env.ts","../src/deposition-mcp-tool-names.ts"],"sourcesContent":["export { ThorbitDepositionApiClient } from './deposition-api-client.js'\nexport { buildThorbitDepositionMcpServer, SERVER_INSTRUCTIONS } from './deposition-mcp-server.js'\nexport { resolveThorbitDepositionMcpEnv } from './deposition-mcp-env.js'\nexport { ThorbitDepositionMcpToolNames } from './deposition-mcp-tool-names.js'\n","import type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nexport type ThorbitDepositionMcpEnvelope =\n | {\n ok: true\n result: unknown\n warnings?: string[]\n requestId: string\n }\n | {\n ok: false\n error: {\n code: string\n message: string\n details?: unknown\n }\n requestId: string\n }\n\nexport class ThorbitDepositionApiClient {\n private readonly baseUrl: string\n private readonly apiKey: string\n\n constructor(options: { baseUrl: string; apiKey: string }) {\n this.baseUrl = options.baseUrl.replace(/\\/$/, '')\n this.apiKey = options.apiKey\n }\n\n async callTool(toolName: ThorbitDepositionMcpToolName, input: unknown): Promise<ThorbitDepositionMcpEnvelope> {\n const response = await fetch(`${this.baseUrl}/api/v1/mcp/deposition/${toolName}`, {\n method: 'POST',\n headers: {\n 'x-thorbit-api-key': this.apiKey,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(input ?? {}),\n })\n\n const body = await response.json().catch(() => null) as ThorbitDepositionMcpEnvelope | null\n if (body && typeof body === 'object' && 'ok' in body) return body\n\n return {\n ok: false,\n requestId: 'unavailable',\n error: {\n code: response.ok ? 'invalid_response' : `http_${response.status}`,\n message: response.ok ? 'Thorbit returned an invalid MCP response' : `Thorbit API request failed with HTTP ${response.status}`,\n },\n }\n }\n}\n","import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport type { ToolAnnotations } from '@modelcontextprotocol/sdk/types.js'\nimport type { ZodRawShape } from 'zod'\nimport type { ThorbitDepositionApiClient } from './deposition-api-client.js'\nimport { formatThorbitDepositionMcpToolResult } from './deposition-mcp-response-formatters.js'\nimport {\n ThorbitDepositionStartInputSchema,\n ThorbitDepositionGetInputSchema,\n ThorbitDepositionGetPlaybookInputSchema,\n ThorbitDepositionListInputSchema,\n} from './deposition-mcp-tool-schemas.js'\nimport type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nconst VERSION = '0.1.0'\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 '- 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_list', {\n title: 'List Depositioning Runs',\n description: 'List past Depositioning runs (most recent first) with runPublicId, company, category, status, binding state, and strategy. Filter by project, company-name search, or status. Use to find a prior run to read.',\n inputSchema: ThorbitDepositionListInputSchema,\n annotations: readOnlyAnnotations('List Depositioning Runs'),\n })\n\n return server\n}\n","import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js'\nimport type { ThorbitDepositionMcpEnvelope } from './deposition-api-client.js'\nimport type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nexport function formatThorbitDepositionMcpToolResult(\n toolName: ThorbitDepositionMcpToolName,\n envelope: ThorbitDepositionMcpEnvelope,\n): CallToolResult {\n const text = JSON.stringify({ toolName, ...envelope }, null, 2)\n return {\n content: [{ type: 'text', text }],\n isError: !envelope.ok,\n }\n}\n","import { z } from 'zod'\n\nexport const ThorbitDepositionStartInputSchema = {\n companyName: z.string().min(1).max(255).describe('The challenger company or product being depositioned.'),\n productUrl: z.string().url().max(2048).describe('URL of the challenger product homepage.'),\n categoryName: z.string().min(1).max(255).describe('The product category, e.g. \"B2B sales analytics\".'),\n competitorUrls: z.array(z.string().url()).max(5).default([]).describe('0-5 competitor URLs. Auto-discovered via SERP if fewer than 2 are provided.'),\n reviewsUrl: z.string().url().max(2048).optional().describe('Optional customer reviews URL (G2, Trustpilot, Reddit thread).'),\n knownPains: z.array(z.string().min(1)).max(50).optional().describe('Optional known customer pain points to seed the analysis.'),\n projectPublicId: z.string().min(1).optional().describe('Optional Thorbit project to associate the run with.'),\n}\n\nexport const ThorbitDepositionGetInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID returned by thorbit_deposition_start.'),\n includePhaseData: z.boolean().default(false).describe('Include raw per-phase intermediate data in addition to the lean status.'),\n}\n\nexport const ThorbitDepositionGetPlaybookInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID. Returns the markdown playbook once the run is complete.'),\n}\n\nexport const ThorbitDepositionListInputSchema = {\n projectPublicId: z.string().min(1).optional().describe('Optional project filter; omit for all org runs.'),\n search: z.string().max(200).optional().describe('Optional company-name substring filter.'),\n status: z.enum(['queued', 'running', 'complete', 'failed']).optional().describe('Optional run status filter.'),\n limit: z.number().int().min(1).max(100).default(25).describe('Maximum runs to return.'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset.'),\n}\n\nexport const ThorbitDepositionMcpToolInputSchemas = {\n thorbit_deposition_start: ThorbitDepositionStartInputSchema,\n thorbit_deposition_get: ThorbitDepositionGetInputSchema,\n thorbit_deposition_get_playbook: ThorbitDepositionGetPlaybookInputSchema,\n thorbit_deposition_list: ThorbitDepositionListInputSchema,\n}\n","import { readFileSync } from 'node:fs'\nimport { homedir } from 'node:os'\nimport { join } from 'node:path'\n\nexport type ThorbitDepositionMcpEnv = {\n apiKey: string\n baseUrl: string\n}\n\nfunction readApiKeyFile(): string | undefined {\n const explicitPath = process.env.THORBIT_DEPOSITION_MCP_KEY_PATH?.trim()\n const paths = [explicitPath, join(homedir(), '.thorbit-deposition-mcp-key')].filter(Boolean) as string[]\n for (const path of paths) {\n try {\n const value = readFileSync(path, 'utf8').trim()\n if (value) return value\n } catch {\n continue\n }\n }\n return undefined\n}\n\nexport function resolveThorbitDepositionMcpEnv(): ThorbitDepositionMcpEnv {\n const apiKey = (\n process.env.THORBIT_API_KEY ||\n process.env.THORBIT_MCP_API_KEY ||\n process.env.THORBIT_DEPOSITION_MCP_API_KEY ||\n readApiKeyFile()\n )?.trim()\n\n if (!apiKey) {\n throw new Error('THORBIT_API_KEY, THORBIT_MCP_API_KEY, or ~/.thorbit-deposition-mcp-key is required')\n }\n\n return {\n apiKey,\n baseUrl: (process.env.THORBIT_BASE_URL || process.env.THORBIT_DEPOSITION_MCP_BASE_URL || 'https://thorbit.ai').trim(),\n }\n}\n","export const ThorbitDepositionMcpToolNames = [\n 'thorbit_deposition_start',\n 'thorbit_deposition_get',\n 'thorbit_deposition_get_playbook',\n 'thorbit_deposition_list',\n] as const\n\nexport type ThorbitDepositionMcpToolName = typeof ThorbitDepositionMcpToolNames[number]\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACmBO,IAAM,6BAAN,MAAiC;AAAA,EACrB;AAAA,EACA;AAAA,EAEjB,YAAY,SAA8C;AACxD,SAAK,UAAU,QAAQ,QAAQ,QAAQ,OAAO,EAAE;AAChD,SAAK,SAAS,QAAQ;AAAA,EACxB;AAAA,EAEA,MAAM,SAAS,UAAwC,OAAuD;AAC5G,UAAM,WAAW,MAAM,MAAM,GAAG,KAAK,OAAO,0BAA0B,QAAQ,IAAI;AAAA,MAChF,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,qBAAqB,KAAK;AAAA,QAC1B,gBAAgB;AAAA,MAClB;AAAA,MACA,MAAM,KAAK,UAAU,SAAS,CAAC,CAAC;AAAA,IAClC,CAAC;AAED,UAAM,OAAO,MAAM,SAAS,KAAK,EAAE,MAAM,MAAM,IAAI;AACnD,QAAI,QAAQ,OAAO,SAAS,YAAY,QAAQ,KAAM,QAAO;AAE7D,WAAO;AAAA,MACL,IAAI;AAAA,MACJ,WAAW;AAAA,MACX,OAAO;AAAA,QACL,MAAM,SAAS,KAAK,qBAAqB,QAAQ,SAAS,MAAM;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Q,IAAI,oBAAoB,QAAQ,IAAI,mCAAmC,sBAAsB,KAAK;AAAA,EACtH;AACF;;;ACvCO,IAAM,gCAAgC;AAAA,EAC3C;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} from './deposition-mcp-tool-schemas.js'\nimport type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nconst VERSION = '0.1.1'\n\ntype ThorbitDepositionToolConfig<InputArgs extends ZodRawShape> = {\n title: string\n description: string\n inputSchema: InputArgs\n annotations: ToolAnnotations\n}\n\nfunction readOnlyAnnotations(title: string) {\n return { title, readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false }\n}\n\nfunction writeAnnotations(title: string) {\n return { title, readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true }\n}\n\nexport const SERVER_INSTRUCTIONS = [\n 'Thorbit Depositioning MCP. Runs the durable Depositioning strategy pipeline on hosted Thorbit (this server is a thin client). It researches competitors + customers, finds the binding vulnerability, classifies mover populations, designs a category class, builds a displacement mechanism, and writes a strategy playbook. All write/analysis tools are metered against your API key.',\n '',\n 'INTAKE (ask the user these BEFORE thorbit_deposition_start, then run):',\n '1. Company / product name being depositioned.',\n '2. Product URL (the challenger homepage).',\n '3. Category name (e.g. \"B2B sales analytics\").',\n '4. Optional: 0-5 competitor URLs (auto-discovered via SERP if fewer than 2).',\n '5. Optional: a customer reviews URL (G2 / Trustpilot / Reddit) and known customer pain points.',\n '',\n 'ASYNC CONTRACT (important):',\n '- thorbit_deposition_start returns quickly with {runPublicId, poll}. Do NOT block — follow result.poll.',\n '- Poll thorbit_deposition_get until status is terminal (complete/failed). It returns a LEAN status (phase, progress, binding state, strategy) with a nextAction.',\n '- When status is complete, call thorbit_deposition_get_playbook to read the finished markdown playbook.',\n '- thorbit_deposition_get also returns an ARTIFACTS manifest (research/own.json, research/competitor-N.json, research/customers.json, research/market.json, vulnerability.json, movers.json, category.json, mechanism.json, playbook.md). Read any one on demand with thorbit_deposition_artifact_read(runPublicId, artifactId) — do NOT pull includePhaseData unless you need the whole raw bundle.',\n '- Use thorbit_deposition_list to find past runs (by company/status) and their runPublicId.',\n].join('\\n')\n\nexport function buildThorbitDepositionMcpServer(client: ThorbitDepositionApiClient): McpServer {\n const server = new McpServer({ name: 'thorbit-deposition-mcp', version: VERSION }, { instructions: SERVER_INSTRUCTIONS })\n\n function registerTool<T extends ThorbitDepositionMcpToolName>(\n toolName: T,\n config: ThorbitDepositionToolConfig<ZodRawShape>,\n ): void {\n server.registerTool(toolName, config, async (input) => {\n const envelope = await client.callTool(toolName, input)\n return formatThorbitDepositionMcpToolResult(toolName, envelope)\n })\n }\n\n registerTool('thorbit_deposition_start', {\n title: 'Start Depositioning Run',\n description: 'Start a durable Depositioning strategy run for a challenger product in a category. Researches competitors and customers, finds the binding vulnerability, classifies movers, designs a category class, builds a displacement mechanism, and writes a playbook. Returns a runPublicId plus a thorbit_deposition_get poll target. Metered.',\n inputSchema: ThorbitDepositionStartInputSchema,\n annotations: writeAnnotations('Start Depositioning Run'),\n })\n\n registerTool('thorbit_deposition_get', {\n title: 'Read Depositioning Run Status',\n description: 'Read a Depositioning run: status, current phase, progress, selected binding state and strategy, primary vulnerability, category class, displacement mechanism, and whether the playbook is ready. Returns a nextAction. Poll until status is complete or failed.',\n inputSchema: ThorbitDepositionGetInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Run Status'),\n })\n\n registerTool('thorbit_deposition_get_playbook', {\n title: 'Read Depositioning Playbook',\n description: 'Return the finished deposition-playbook markdown for a completed run (executive brief, the four elements, activation guide). Returns not_found until the run completes.',\n inputSchema: ThorbitDepositionGetPlaybookInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Playbook'),\n })\n\n registerTool('thorbit_deposition_artifact_read', {\n title: 'Read Depositioning Artifact',\n description: 'Read one artifact from a run\\'s folder by id (e.g. research/own.json, research/competitor-2.json, vulnerability.json, playbook.md). Artifact ids come from the artifacts manifest in thorbit_deposition_get. Byte-capped via maxBytes. Use this instead of pulling the whole run.',\n inputSchema: ThorbitDepositionArtifactReadInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Artifact'),\n })\n\n registerTool('thorbit_deposition_list', {\n title: 'List Depositioning Runs',\n description: 'List past Depositioning runs (most recent first) with runPublicId, company, category, status, binding state, and strategy. Filter by project, company-name search, or status. Use to find a prior run to read.',\n inputSchema: ThorbitDepositionListInputSchema,\n annotations: readOnlyAnnotations('List Depositioning Runs'),\n })\n\n return server\n}\n","import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js'\nimport type { ThorbitDepositionMcpEnvelope } from './deposition-api-client.js'\nimport type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nexport function formatThorbitDepositionMcpToolResult(\n toolName: ThorbitDepositionMcpToolName,\n envelope: ThorbitDepositionMcpEnvelope,\n): CallToolResult {\n const text = JSON.stringify({ toolName, ...envelope }, null, 2)\n return {\n content: [{ type: 'text', text }],\n isError: !envelope.ok,\n }\n}\n","import { z } from 'zod'\n\nexport const ThorbitDepositionStartInputSchema = {\n companyName: z.string().min(1).max(255).describe('The challenger company or product being depositioned.'),\n productUrl: z.string().url().max(2048).describe('URL of the challenger product homepage.'),\n categoryName: z.string().min(1).max(255).describe('The product category, e.g. \"B2B sales analytics\".'),\n competitorUrls: z.array(z.string().url()).max(5).default([]).describe('0-5 competitor URLs. Auto-discovered via SERP if fewer than 2 are provided.'),\n reviewsUrl: z.string().url().max(2048).optional().describe('Optional customer reviews URL (G2, Trustpilot, Reddit thread).'),\n knownPains: z.array(z.string().min(1)).max(50).optional().describe('Optional known customer pain points to seed the analysis.'),\n projectPublicId: z.string().min(1).optional().describe('Optional Thorbit project to associate the run with.'),\n}\n\nexport const ThorbitDepositionGetInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID returned by thorbit_deposition_start.'),\n includePhaseData: z.boolean().default(false).describe('Include raw per-phase intermediate data in addition to the lean status.'),\n}\n\nexport const ThorbitDepositionGetPlaybookInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID. Returns the markdown playbook once the run is complete.'),\n}\n\nexport const ThorbitDepositionArtifactReadInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID.'),\n artifactId: z.string().min(1).describe('Artifact id from the run manifest, e.g. \"research/own.json\", \"research/competitor-2.json\", \"vulnerability.json\", \"playbook.md\". Get ids from thorbit_deposition_get.'),\n maxBytes: z.number().int().min(1000).max(1000000).default(200000).describe('Max bytes to return; content is truncated with a flag if larger.'),\n}\n\nexport const ThorbitDepositionListInputSchema = {\n projectPublicId: z.string().min(1).optional().describe('Optional project filter; omit for all org runs.'),\n search: z.string().max(200).optional().describe('Optional company-name substring filter.'),\n status: z.enum(['queued', 'running', 'complete', 'failed']).optional().describe('Optional run status filter.'),\n limit: z.number().int().min(1).max(100).default(25).describe('Maximum runs to return.'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset.'),\n}\n\nexport const ThorbitDepositionMcpToolInputSchemas = {\n thorbit_deposition_start: ThorbitDepositionStartInputSchema,\n thorbit_deposition_get: ThorbitDepositionGetInputSchema,\n thorbit_deposition_get_playbook: ThorbitDepositionGetPlaybookInputSchema,\n thorbit_deposition_artifact_read: ThorbitDepositionArtifactReadInputSchema,\n thorbit_deposition_list: ThorbitDepositionListInputSchema,\n}\n","import { readFileSync } from 'node:fs'\nimport { homedir } from 'node:os'\nimport { join } from 'node:path'\n\nexport type ThorbitDepositionMcpEnv = {\n apiKey: string\n baseUrl: string\n}\n\nfunction readApiKeyFile(): string | undefined {\n const explicitPath = process.env.THORBIT_DEPOSITION_MCP_KEY_PATH?.trim()\n const paths = [explicitPath, join(homedir(), '.thorbit-deposition-mcp-key')].filter(Boolean) as string[]\n for (const path of paths) {\n try {\n const value = readFileSync(path, 'utf8').trim()\n if (value) return value\n } catch {\n continue\n }\n }\n return undefined\n}\n\nexport function resolveThorbitDepositionMcpEnv(): ThorbitDepositionMcpEnv {\n const apiKey = (\n process.env.THORBIT_API_KEY ||\n process.env.THORBIT_MCP_API_KEY ||\n process.env.THORBIT_DEPOSITION_MCP_API_KEY ||\n readApiKeyFile()\n )?.trim()\n\n if (!apiKey) {\n throw new Error('THORBIT_API_KEY, THORBIT_MCP_API_KEY, or ~/.thorbit-deposition-mcp-key is required')\n }\n\n return {\n apiKey,\n baseUrl: (process.env.THORBIT_BASE_URL || process.env.THORBIT_DEPOSITION_MCP_BASE_URL || 'https://thorbit.ai').trim(),\n }\n}\n","export const ThorbitDepositionMcpToolNames = [\n 'thorbit_deposition_start',\n 'thorbit_deposition_get',\n 'thorbit_deposition_get_playbook',\n 'thorbit_deposition_artifact_read',\n 'thorbit_deposition_list',\n] as const\n\nexport type ThorbitDepositionMcpToolName = typeof ThorbitDepositionMcpToolNames[number]\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACmBO,IAAM,6BAAN,MAAiC;AAAA,EACrB;AAAA,EACA;AAAA,EAEjB,YAAY,SAA8C;AACxD,SAAK,UAAU,QAAQ,QAAQ,QAAQ,OAAO,EAAE;AAChD,SAAK,SAAS,QAAQ;AAAA,EACxB;AAAA,EAEA,MAAM,SAAS,UAAwC,OAAuD;AAC5G,UAAM,WAAW,MAAM,MAAM,GAAG,KAAK,OAAO,0BAA0B,QAAQ,IAAI;AAAA,MAChF,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,qBAAqB,KAAK;AAAA,QAC1B,gBAAgB;AAAA,MAClB;AAAA,MACA,MAAM,KAAK,UAAU,SAAS,CAAC,CAAC;AAAA,IAClC,CAAC;AA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AAoB,yBAAyB;AAAA,EAC5D,CAAC;AAED,SAAO;AACT;;;AGlGA,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;AAC9C,UAAI,MAAO,QAAO;AAAA,IACpB,QAAQ;AACN;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AAEO,SAAS,iCAA0D;AACxE,QAAM,UACJ,QAAQ,IAAI,mBACZ,QAAQ,IAAI,uBACZ,QAAQ,IAAI,kCACZ,eAAe,IACd,KAAK;AAER,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI,MAAM,oFAAoF;AAAA,EACtG;AAEA,SAAO;AAAA,IACL;AAAA,IACA,UAAU,QAAQ,IAAI,oBAAoB,QAAQ,IAAI,mCAAmC,sBAAsB,KAAK;AAAA,EACtH;AACF;;;ACvCO,IAAM,gCAAgC;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":[]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
|
|
3
|
-
declare const ThorbitDepositionMcpToolNames: readonly ["thorbit_deposition_start", "thorbit_deposition_get", "thorbit_deposition_get_playbook", "thorbit_deposition_list"];
|
|
3
|
+
declare const ThorbitDepositionMcpToolNames: readonly ["thorbit_deposition_start", "thorbit_deposition_get", "thorbit_deposition_get_playbook", "thorbit_deposition_artifact_read", "thorbit_deposition_list"];
|
|
4
4
|
type ThorbitDepositionMcpToolName = typeof ThorbitDepositionMcpToolNames[number];
|
|
5
5
|
|
|
6
6
|
type ThorbitDepositionMcpEnvelope = {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
|
|
3
|
-
declare const ThorbitDepositionMcpToolNames: readonly ["thorbit_deposition_start", "thorbit_deposition_get", "thorbit_deposition_get_playbook", "thorbit_deposition_list"];
|
|
3
|
+
declare const ThorbitDepositionMcpToolNames: readonly ["thorbit_deposition_start", "thorbit_deposition_get", "thorbit_deposition_get_playbook", "thorbit_deposition_artifact_read", "thorbit_deposition_list"];
|
|
4
4
|
type ThorbitDepositionMcpToolName = typeof ThorbitDepositionMcpToolNames[number];
|
|
5
5
|
|
|
6
6
|
type ThorbitDepositionMcpEnvelope = {
|
package/dist/index.js
CHANGED
|
@@ -60,6 +60,11 @@ var ThorbitDepositionGetInputSchema = {
|
|
|
60
60
|
var ThorbitDepositionGetPlaybookInputSchema = {
|
|
61
61
|
runPublicId: z.string().min(1).describe("Deposition run public ID. Returns the markdown playbook once the run is complete.")
|
|
62
62
|
};
|
|
63
|
+
var ThorbitDepositionArtifactReadInputSchema = {
|
|
64
|
+
runPublicId: z.string().min(1).describe("Deposition run public ID."),
|
|
65
|
+
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.'),
|
|
66
|
+
maxBytes: z.number().int().min(1e3).max(1e6).default(2e5).describe("Max bytes to return; content is truncated with a flag if larger.")
|
|
67
|
+
};
|
|
63
68
|
var ThorbitDepositionListInputSchema = {
|
|
64
69
|
projectPublicId: z.string().min(1).optional().describe("Optional project filter; omit for all org runs."),
|
|
65
70
|
search: z.string().max(200).optional().describe("Optional company-name substring filter."),
|
|
@@ -69,7 +74,7 @@ var ThorbitDepositionListInputSchema = {
|
|
|
69
74
|
};
|
|
70
75
|
|
|
71
76
|
// src/deposition-mcp-server.ts
|
|
72
|
-
var VERSION = "0.1.
|
|
77
|
+
var VERSION = "0.1.1";
|
|
73
78
|
function readOnlyAnnotations(title) {
|
|
74
79
|
return { title, readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
75
80
|
}
|
|
@@ -90,6 +95,7 @@ var SERVER_INSTRUCTIONS = [
|
|
|
90
95
|
"- thorbit_deposition_start returns quickly with {runPublicId, poll}. Do NOT block \u2014 follow result.poll.",
|
|
91
96
|
"- Poll thorbit_deposition_get until status is terminal (complete/failed). It returns a LEAN status (phase, progress, binding state, strategy) with a nextAction.",
|
|
92
97
|
"- When status is complete, call thorbit_deposition_get_playbook to read the finished markdown playbook.",
|
|
98
|
+
"- 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) \u2014 do NOT pull includePhaseData unless you need the whole raw bundle.",
|
|
93
99
|
"- Use thorbit_deposition_list to find past runs (by company/status) and their runPublicId."
|
|
94
100
|
].join("\n");
|
|
95
101
|
function buildThorbitDepositionMcpServer(client) {
|
|
@@ -118,6 +124,12 @@ function buildThorbitDepositionMcpServer(client) {
|
|
|
118
124
|
inputSchema: ThorbitDepositionGetPlaybookInputSchema,
|
|
119
125
|
annotations: readOnlyAnnotations("Read Depositioning Playbook")
|
|
120
126
|
});
|
|
127
|
+
registerTool("thorbit_deposition_artifact_read", {
|
|
128
|
+
title: "Read Depositioning Artifact",
|
|
129
|
+
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.",
|
|
130
|
+
inputSchema: ThorbitDepositionArtifactReadInputSchema,
|
|
131
|
+
annotations: readOnlyAnnotations("Read Depositioning Artifact")
|
|
132
|
+
});
|
|
121
133
|
registerTool("thorbit_deposition_list", {
|
|
122
134
|
title: "List Depositioning Runs",
|
|
123
135
|
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.",
|
|
@@ -160,6 +172,7 @@ var ThorbitDepositionMcpToolNames = [
|
|
|
160
172
|
"thorbit_deposition_start",
|
|
161
173
|
"thorbit_deposition_get",
|
|
162
174
|
"thorbit_deposition_get_playbook",
|
|
175
|
+
"thorbit_deposition_artifact_read",
|
|
163
176
|
"thorbit_deposition_list"
|
|
164
177
|
];
|
|
165
178
|
export {
|
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 ThorbitDepositionListInputSchema,\n} from './deposition-mcp-tool-schemas.js'\nimport type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nconst VERSION = '0.1.0'\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 '- 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_list', {\n title: 'List Depositioning Runs',\n description: 'List past Depositioning runs (most recent first) with runPublicId, company, category, status, binding state, and strategy. Filter by project, company-name search, or status. Use to find a prior run to read.',\n inputSchema: ThorbitDepositionListInputSchema,\n annotations: readOnlyAnnotations('List Depositioning Runs'),\n })\n\n return server\n}\n","import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js'\nimport type { ThorbitDepositionMcpEnvelope } from './deposition-api-client.js'\nimport type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nexport function formatThorbitDepositionMcpToolResult(\n toolName: ThorbitDepositionMcpToolName,\n envelope: ThorbitDepositionMcpEnvelope,\n): CallToolResult {\n const text = JSON.stringify({ toolName, ...envelope }, null, 2)\n return {\n content: [{ type: 'text', text }],\n isError: !envelope.ok,\n }\n}\n","import { z } from 'zod'\n\nexport const ThorbitDepositionStartInputSchema = {\n companyName: z.string().min(1).max(255).describe('The challenger company or product being depositioned.'),\n productUrl: z.string().url().max(2048).describe('URL of the challenger product homepage.'),\n categoryName: z.string().min(1).max(255).describe('The product category, e.g. \"B2B sales analytics\".'),\n competitorUrls: z.array(z.string().url()).max(5).default([]).describe('0-5 competitor URLs. Auto-discovered via SERP if fewer than 2 are provided.'),\n reviewsUrl: z.string().url().max(2048).optional().describe('Optional customer reviews URL (G2, Trustpilot, Reddit thread).'),\n knownPains: z.array(z.string().min(1)).max(50).optional().describe('Optional known customer pain points to seed the analysis.'),\n projectPublicId: z.string().min(1).optional().describe('Optional Thorbit project to associate the run with.'),\n}\n\nexport const ThorbitDepositionGetInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID returned by thorbit_deposition_start.'),\n includePhaseData: z.boolean().default(false).describe('Include raw per-phase intermediate data in addition to the lean status.'),\n}\n\nexport const ThorbitDepositionGetPlaybookInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID. Returns the markdown playbook once the run is complete.'),\n}\n\nexport const ThorbitDepositionListInputSchema = {\n projectPublicId: z.string().min(1).optional().describe('Optional project filter; omit for all org runs.'),\n search: z.string().max(200).optional().describe('Optional company-name substring filter.'),\n status: z.enum(['queued', 'running', 'complete', 'failed']).optional().describe('Optional run status filter.'),\n limit: z.number().int().min(1).max(100).default(25).describe('Maximum runs to return.'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset.'),\n}\n\nexport const ThorbitDepositionMcpToolInputSchemas = {\n thorbit_deposition_start: ThorbitDepositionStartInputSchema,\n thorbit_deposition_get: ThorbitDepositionGetInputSchema,\n thorbit_deposition_get_playbook: ThorbitDepositionGetPlaybookInputSchema,\n thorbit_deposition_list: ThorbitDepositionListInputSchema,\n}\n","import { readFileSync } from 'node:fs'\nimport { homedir } from 'node:os'\nimport { join } from 'node:path'\n\nexport type ThorbitDepositionMcpEnv = {\n apiKey: string\n baseUrl: string\n}\n\nfunction readApiKeyFile(): string | undefined {\n const explicitPath = process.env.THORBIT_DEPOSITION_MCP_KEY_PATH?.trim()\n const paths = [explicitPath, join(homedir(), '.thorbit-deposition-mcp-key')].filter(Boolean) as string[]\n for (const path of paths) {\n try {\n const value = readFileSync(path, 'utf8').trim()\n if (value) return value\n } catch {\n continue\n }\n }\n return undefined\n}\n\nexport function resolveThorbitDepositionMcpEnv(): ThorbitDepositionMcpEnv {\n const apiKey = (\n process.env.THORBIT_API_KEY ||\n process.env.THORBIT_MCP_API_KEY ||\n process.env.THORBIT_DEPOSITION_MCP_API_KEY ||\n readApiKeyFile()\n )?.trim()\n\n if (!apiKey) {\n throw new Error('THORBIT_API_KEY, THORBIT_MCP_API_KEY, or ~/.thorbit-deposition-mcp-key is required')\n }\n\n return {\n apiKey,\n baseUrl: (process.env.THORBIT_BASE_URL || process.env.THORBIT_DEPOSITION_MCP_BASE_URL || 'https://thorbit.ai').trim(),\n }\n}\n","export const ThorbitDepositionMcpToolNames = [\n 'thorbit_deposition_start',\n 'thorbit_deposition_get',\n 'thorbit_deposition_get_playbook',\n 'thorbit_deposition_list',\n] as const\n\nexport type ThorbitDepositionMcpToolName = typeof ThorbitDepositionMcpToolNames[number]\n"],"mappings":";;;AAmBO,IAAM,6BAAN,MAAiC;AAAA,EAC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AyB;AAAA,EAC5D,CAAC;AAED,SAAO;AACT;;;AGzFA,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;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} from './deposition-mcp-tool-schemas.js'\nimport type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nconst VERSION = '0.1.1'\n\ntype ThorbitDepositionToolConfig<InputArgs extends ZodRawShape> = {\n title: string\n description: string\n inputSchema: InputArgs\n annotations: ToolAnnotations\n}\n\nfunction readOnlyAnnotations(title: string) {\n return { title, readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false }\n}\n\nfunction writeAnnotations(title: string) {\n return { title, readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true }\n}\n\nexport const SERVER_INSTRUCTIONS = [\n 'Thorbit Depositioning MCP. Runs the durable Depositioning strategy pipeline on hosted Thorbit (this server is a thin client). It researches competitors + customers, finds the binding vulnerability, classifies mover populations, designs a category class, builds a displacement mechanism, and writes a strategy playbook. All write/analysis tools are metered against your API key.',\n '',\n 'INTAKE (ask the user these BEFORE thorbit_deposition_start, then run):',\n '1. Company / product name being depositioned.',\n '2. Product URL (the challenger homepage).',\n '3. Category name (e.g. \"B2B sales analytics\").',\n '4. Optional: 0-5 competitor URLs (auto-discovered via SERP if fewer than 2).',\n '5. Optional: a customer reviews URL (G2 / Trustpilot / Reddit) and known customer pain points.',\n '',\n 'ASYNC CONTRACT (important):',\n '- thorbit_deposition_start returns quickly with {runPublicId, poll}. Do NOT block — follow result.poll.',\n '- Poll thorbit_deposition_get until status is terminal (complete/failed). It returns a LEAN status (phase, progress, binding state, strategy) with a nextAction.',\n '- When status is complete, call thorbit_deposition_get_playbook to read the finished markdown playbook.',\n '- thorbit_deposition_get also returns an ARTIFACTS manifest (research/own.json, research/competitor-N.json, research/customers.json, research/market.json, vulnerability.json, movers.json, category.json, mechanism.json, playbook.md). Read any one on demand with thorbit_deposition_artifact_read(runPublicId, artifactId) — do NOT pull includePhaseData unless you need the whole raw bundle.',\n '- Use thorbit_deposition_list to find past runs (by company/status) and their runPublicId.',\n].join('\\n')\n\nexport function buildThorbitDepositionMcpServer(client: ThorbitDepositionApiClient): McpServer {\n const server = new McpServer({ name: 'thorbit-deposition-mcp', version: VERSION }, { instructions: SERVER_INSTRUCTIONS })\n\n function registerTool<T extends ThorbitDepositionMcpToolName>(\n toolName: T,\n config: ThorbitDepositionToolConfig<ZodRawShape>,\n ): void {\n server.registerTool(toolName, config, async (input) => {\n const envelope = await client.callTool(toolName, input)\n return formatThorbitDepositionMcpToolResult(toolName, envelope)\n })\n }\n\n registerTool('thorbit_deposition_start', {\n title: 'Start Depositioning Run',\n description: 'Start a durable Depositioning strategy run for a challenger product in a category. Researches competitors and customers, finds the binding vulnerability, classifies movers, designs a category class, builds a displacement mechanism, and writes a playbook. Returns a runPublicId plus a thorbit_deposition_get poll target. Metered.',\n inputSchema: ThorbitDepositionStartInputSchema,\n annotations: writeAnnotations('Start Depositioning Run'),\n })\n\n registerTool('thorbit_deposition_get', {\n title: 'Read Depositioning Run Status',\n description: 'Read a Depositioning run: status, current phase, progress, selected binding state and strategy, primary vulnerability, category class, displacement mechanism, and whether the playbook is ready. Returns a nextAction. Poll until status is complete or failed.',\n inputSchema: ThorbitDepositionGetInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Run Status'),\n })\n\n registerTool('thorbit_deposition_get_playbook', {\n title: 'Read Depositioning Playbook',\n description: 'Return the finished deposition-playbook markdown for a completed run (executive brief, the four elements, activation guide). Returns not_found until the run completes.',\n inputSchema: ThorbitDepositionGetPlaybookInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Playbook'),\n })\n\n registerTool('thorbit_deposition_artifact_read', {\n title: 'Read Depositioning Artifact',\n description: 'Read one artifact from a run\\'s folder by id (e.g. research/own.json, research/competitor-2.json, vulnerability.json, playbook.md). Artifact ids come from the artifacts manifest in thorbit_deposition_get. Byte-capped via maxBytes. Use this instead of pulling the whole run.',\n inputSchema: ThorbitDepositionArtifactReadInputSchema,\n annotations: readOnlyAnnotations('Read Depositioning Artifact'),\n })\n\n registerTool('thorbit_deposition_list', {\n title: 'List Depositioning Runs',\n description: 'List past Depositioning runs (most recent first) with runPublicId, company, category, status, binding state, and strategy. Filter by project, company-name search, or status. Use to find a prior run to read.',\n inputSchema: ThorbitDepositionListInputSchema,\n annotations: readOnlyAnnotations('List Depositioning Runs'),\n })\n\n return server\n}\n","import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js'\nimport type { ThorbitDepositionMcpEnvelope } from './deposition-api-client.js'\nimport type { ThorbitDepositionMcpToolName } from './deposition-mcp-tool-names.js'\n\nexport function formatThorbitDepositionMcpToolResult(\n toolName: ThorbitDepositionMcpToolName,\n envelope: ThorbitDepositionMcpEnvelope,\n): CallToolResult {\n const text = JSON.stringify({ toolName, ...envelope }, null, 2)\n return {\n content: [{ type: 'text', text }],\n isError: !envelope.ok,\n }\n}\n","import { z } from 'zod'\n\nexport const ThorbitDepositionStartInputSchema = {\n companyName: z.string().min(1).max(255).describe('The challenger company or product being depositioned.'),\n productUrl: z.string().url().max(2048).describe('URL of the challenger product homepage.'),\n categoryName: z.string().min(1).max(255).describe('The product category, e.g. \"B2B sales analytics\".'),\n competitorUrls: z.array(z.string().url()).max(5).default([]).describe('0-5 competitor URLs. Auto-discovered via SERP if fewer than 2 are provided.'),\n reviewsUrl: z.string().url().max(2048).optional().describe('Optional customer reviews URL (G2, Trustpilot, Reddit thread).'),\n knownPains: z.array(z.string().min(1)).max(50).optional().describe('Optional known customer pain points to seed the analysis.'),\n projectPublicId: z.string().min(1).optional().describe('Optional Thorbit project to associate the run with.'),\n}\n\nexport const ThorbitDepositionGetInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID returned by thorbit_deposition_start.'),\n includePhaseData: z.boolean().default(false).describe('Include raw per-phase intermediate data in addition to the lean status.'),\n}\n\nexport const ThorbitDepositionGetPlaybookInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID. Returns the markdown playbook once the run is complete.'),\n}\n\nexport const ThorbitDepositionArtifactReadInputSchema = {\n runPublicId: z.string().min(1).describe('Deposition run public ID.'),\n artifactId: z.string().min(1).describe('Artifact id from the run manifest, e.g. \"research/own.json\", \"research/competitor-2.json\", \"vulnerability.json\", \"playbook.md\". Get ids from thorbit_deposition_get.'),\n maxBytes: z.number().int().min(1000).max(1000000).default(200000).describe('Max bytes to return; content is truncated with a flag if larger.'),\n}\n\nexport const ThorbitDepositionListInputSchema = {\n projectPublicId: z.string().min(1).optional().describe('Optional project filter; omit for all org runs.'),\n search: z.string().max(200).optional().describe('Optional company-name substring filter.'),\n status: z.enum(['queued', 'running', 'complete', 'failed']).optional().describe('Optional run status filter.'),\n limit: z.number().int().min(1).max(100).default(25).describe('Maximum runs to return.'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset.'),\n}\n\nexport const ThorbitDepositionMcpToolInputSchemas = {\n thorbit_deposition_start: ThorbitDepositionStartInputSchema,\n thorbit_deposition_get: ThorbitDepositionGetInputSchema,\n thorbit_deposition_get_playbook: ThorbitDepositionGetPlaybookInputSchema,\n thorbit_deposition_artifact_read: ThorbitDepositionArtifactReadInputSchema,\n thorbit_deposition_list: ThorbitDepositionListInputSchema,\n}\n","import { readFileSync } from 'node:fs'\nimport { homedir } from 'node:os'\nimport { join } from 'node:path'\n\nexport type ThorbitDepositionMcpEnv = {\n apiKey: string\n baseUrl: string\n}\n\nfunction readApiKeyFile(): string | undefined {\n const explicitPath = process.env.THORBIT_DEPOSITION_MCP_KEY_PATH?.trim()\n const paths = [explicitPath, join(homedir(), '.thorbit-deposition-mcp-key')].filter(Boolean) as string[]\n for (const path of paths) {\n try {\n const value = readFileSync(path, 'utf8').trim()\n if (value) return value\n } catch {\n continue\n }\n }\n return undefined\n}\n\nexport function resolveThorbitDepositionMcpEnv(): ThorbitDepositionMcpEnv {\n const apiKey = (\n process.env.THORBIT_API_KEY ||\n process.env.THORBIT_MCP_API_KEY ||\n process.env.THORBIT_DEPOSITION_MCP_API_KEY ||\n readApiKeyFile()\n )?.trim()\n\n if (!apiKey) {\n throw new Error('THORBIT_API_KEY, THORBIT_MCP_API_KEY, or ~/.thorbit-deposition-mcp-key is required')\n }\n\n return {\n apiKey,\n baseUrl: (process.env.THORBIT_BASE_URL || process.env.THORBIT_DEPOSITION_MCP_BASE_URL || 'https://thorbit.ai').trim(),\n }\n}\n","export const ThorbitDepositionMcpToolNames = [\n 'thorbit_deposition_start',\n 'thorbit_deposition_get',\n 'thorbit_deposition_get_playbook',\n 'thorbit_deposition_artifact_read',\n 'thorbit_deposition_list',\n] as const\n\nexport type ThorbitDepositionMcpToolName = typeof ThorbitDepositionMcpToolNames[number]\n"],"mappings":";;;AAmBO,IAAM,6BAAN,MAAiC;AAAA,EACrB;AAAA,EACA;AAAA,EAEjB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