business-design-mcp 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +87 -0
  2. package/dist/index.d.ts +3 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +115 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/openai/client.d.ts +37 -0
  7. package/dist/openai/client.d.ts.map +1 -0
  8. package/dist/openai/client.js +121 -0
  9. package/dist/openai/client.js.map +1 -0
  10. package/dist/openai/parser.d.ts +25 -0
  11. package/dist/openai/parser.d.ts.map +1 -0
  12. package/dist/openai/parser.js +459 -0
  13. package/dist/openai/parser.js.map +1 -0
  14. package/dist/openai/prompts.d.ts +12 -0
  15. package/dist/openai/prompts.d.ts.map +1 -0
  16. package/dist/openai/prompts.js +343 -0
  17. package/dist/openai/prompts.js.map +1 -0
  18. package/dist/schemas/citations.d.ts +72 -0
  19. package/dist/schemas/citations.d.ts.map +1 -0
  20. package/dist/schemas/citations.js +16 -0
  21. package/dist/schemas/citations.js.map +1 -0
  22. package/dist/schemas/index.d.ts +1816 -0
  23. package/dist/schemas/index.d.ts.map +1 -0
  24. package/dist/schemas/index.js +292 -0
  25. package/dist/schemas/index.js.map +1 -0
  26. package/dist/storage/index.d.ts +24 -0
  27. package/dist/storage/index.d.ts.map +1 -0
  28. package/dist/storage/index.js +623 -0
  29. package/dist/storage/index.js.map +1 -0
  30. package/dist/test/setup.d.ts +2 -0
  31. package/dist/test/setup.d.ts.map +1 -0
  32. package/dist/test/setup.js +27 -0
  33. package/dist/test/setup.js.map +1 -0
  34. package/dist/tools/canvas.d.ts +407 -0
  35. package/dist/tools/canvas.d.ts.map +1 -0
  36. package/dist/tools/canvas.js +147 -0
  37. package/dist/tools/canvas.js.map +1 -0
  38. package/dist/tools/competitive.d.ts +315 -0
  39. package/dist/tools/competitive.d.ts.map +1 -0
  40. package/dist/tools/competitive.js +93 -0
  41. package/dist/tools/competitive.js.map +1 -0
  42. package/dist/tools/index.d.ts +10 -0
  43. package/dist/tools/index.d.ts.map +1 -0
  44. package/dist/tools/index.js +19 -0
  45. package/dist/tools/index.js.map +1 -0
  46. package/dist/tools/lean.d.ts +297 -0
  47. package/dist/tools/lean.d.ts.map +1 -0
  48. package/dist/tools/lean.js +114 -0
  49. package/dist/tools/lean.js.map +1 -0
  50. package/dist/tools/market.d.ts +297 -0
  51. package/dist/tools/market.d.ts.map +1 -0
  52. package/dist/tools/market.js +89 -0
  53. package/dist/tools/market.js.map +1 -0
  54. package/dist/tools/persona.d.ts +253 -0
  55. package/dist/tools/persona.d.ts.map +1 -0
  56. package/dist/tools/persona.js +86 -0
  57. package/dist/tools/persona.js.map +1 -0
  58. package/dist/tools/project.d.ts +90 -0
  59. package/dist/tools/project.d.ts.map +1 -0
  60. package/dist/tools/project.js +101 -0
  61. package/dist/tools/project.js.map +1 -0
  62. package/dist/tools/research.d.ts +150 -0
  63. package/dist/tools/research.d.ts.map +1 -0
  64. package/dist/tools/research.js +286 -0
  65. package/dist/tools/research.js.map +1 -0
  66. package/dist/tools/swot.d.ts +213 -0
  67. package/dist/tools/swot.d.ts.map +1 -0
  68. package/dist/tools/swot.js +86 -0
  69. package/dist/tools/swot.js.map +1 -0
  70. package/dist/tools/value-prop.d.ts +397 -0
  71. package/dist/tools/value-prop.d.ts.map +1 -0
  72. package/dist/tools/value-prop.js +115 -0
  73. package/dist/tools/value-prop.js.map +1 -0
  74. package/package.json +56 -0
package/README.md ADDED
@@ -0,0 +1,87 @@
1
+ # Business Design MCP Server
2
+
3
+ MCP server for business and project design frameworks. Create and manage Business Model Canvases, Lean Canvases, SWOT analyses, user personas, and more.
4
+
5
+ ## Installation
6
+
7
+ ### Claude Code
8
+
9
+ ```bash
10
+ claude mcp add business-design -- npx -y github:albertogferrario/business-design-mcp
11
+ ```
12
+
13
+ Or add manually to `~/.claude/settings.json`:
14
+
15
+ ```json
16
+ {
17
+ "mcpServers": {
18
+ "business-design": {
19
+ "command": "npx",
20
+ "args": ["-y", "github:albertogferrario/business-design-mcp"]
21
+ }
22
+ }
23
+ }
24
+ ```
25
+
26
+ ## Available Tools
27
+
28
+ ### Project Management
29
+ - `create_project` - Create a new project to organize your business design artifacts
30
+ - `get_project` - Get project with all entities
31
+ - `update_project` - Update project metadata
32
+ - `delete_project` - Delete project and all entities
33
+ - `list_projects` - List all projects
34
+ - `list_project_entities` - List entities in a project (filter by type)
35
+ - `export_project` - Export to JSON or Markdown
36
+
37
+ ### Business Model Canvas
38
+ - `create_business_model_canvas` - Osterwalder's 9 blocks: customer segments, value propositions, channels, customer relationships, revenue streams, key resources, key activities, key partnerships, cost structure
39
+ - `update_business_model_canvas` - Update existing canvas
40
+
41
+ ### Lean Canvas
42
+ - `create_lean_canvas` - Ash Maurya's startup adaptation: problem, solution, unique value proposition, unfair advantage, customer segments, key metrics, channels, cost structure, revenue streams
43
+ - `update_lean_canvas` - Update existing canvas
44
+
45
+ ### Value Proposition Canvas
46
+ - `create_value_proposition_canvas` - Customer profile (jobs, pains, gains) and value map (products/services, pain relievers, gain creators)
47
+ - `update_value_proposition_canvas` - Update existing canvas
48
+
49
+ ### SWOT Analysis
50
+ - `create_swot_analysis` - Strengths, weaknesses, opportunities, threats with impact levels and action items
51
+ - `update_swot_analysis` - Update existing analysis
52
+
53
+ ### User Personas
54
+ - `create_user_persona` - Demographics, psychographics, behavior (goals, frustrations, motivations), scenarios
55
+ - `update_user_persona` - Update existing persona
56
+
57
+ ### Competitive Analysis
58
+ - `create_competitive_analysis` - Analyze competitors' strengths, weaknesses, pricing, market share, features
59
+ - `update_competitive_analysis` - Update existing analysis
60
+
61
+ ### Market Sizing
62
+ - `create_market_sizing` - TAM, SAM, SOM with methodology and assumptions
63
+ - `update_market_sizing` - Update existing analysis
64
+
65
+ ## Data Storage
66
+
67
+ All data is stored locally in `~/.business-design/`:
68
+ - `projects/` - Project files
69
+ - `entities/` - Canvases, analyses, and personas
70
+
71
+ ## Example Usage
72
+
73
+ ```
74
+ > Create a project called "My Startup"
75
+
76
+ > Create a lean canvas for this project focusing on a B2B SaaS product
77
+
78
+ > Create user personas for technical buyers and end users
79
+
80
+ > Run a SWOT analysis for entering the market
81
+
82
+ > Export the project to markdown
83
+ ```
84
+
85
+ ## License
86
+
87
+ MIT
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,115 @@
1
+ #!/usr/bin/env node
2
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
+ import { z } from "zod";
5
+ function jsonResponse(data) {
6
+ return {
7
+ content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
8
+ };
9
+ }
10
+ function errorResponse(message) {
11
+ return {
12
+ content: [{ type: "text", text: message }],
13
+ isError: true,
14
+ };
15
+ }
16
+ import {
17
+ // Project management
18
+ createProject, createProjectSchema, getProject, getProjectSchema, updateProject, updateProjectSchema, deleteProject, deleteProjectSchema, listProjects, deleteEntityTool, deleteEntitySchema, exportProject, exportProjectSchema, listProjectEntities, listProjectEntitiesSchema,
19
+ // Business Model Canvas
20
+ createBusinessModelCanvas, createBusinessModelCanvasSchema, updateBusinessModelCanvas, updateBusinessModelCanvasSchema,
21
+ // Lean Canvas
22
+ createLeanCanvas, createLeanCanvasSchema, updateLeanCanvas, updateLeanCanvasSchema,
23
+ // Value Proposition Canvas
24
+ createValuePropositionCanvas, createValuePropositionCanvasSchema, updateValuePropositionCanvas, updateValuePropositionCanvasSchema,
25
+ // SWOT Analysis
26
+ createSwotAnalysis, createSwotAnalysisSchema, updateSwotAnalysis, updateSwotAnalysisSchema,
27
+ // User Persona
28
+ createUserPersona, createUserPersonaSchema, updateUserPersona, updateUserPersonaSchema,
29
+ // Competitive Analysis
30
+ createCompetitiveAnalysis, createCompetitiveAnalysisSchema, updateCompetitiveAnalysis, updateCompetitiveAnalysisSchema,
31
+ // Market Sizing
32
+ createMarketSizing, createMarketSizingSchema, updateMarketSizing, updateMarketSizingSchema,
33
+ // OpenAI Deep Research
34
+ configureOpenAI, configureOpenAISchema, checkOpenAIConfig, deepResearch, deepResearchSchema, populateFramework, populateFrameworkSchema, } from "./tools/index.js";
35
+ import { getEntity } from "./storage/index.js";
36
+ const server = new McpServer({
37
+ name: "business-design",
38
+ version: "1.0.0",
39
+ });
40
+ // ============================================================================
41
+ // PROJECT MANAGEMENT TOOLS
42
+ // ============================================================================
43
+ server.tool("create_project", createProjectSchema.shape, { title: "Create a new business design project to organize your canvases, analyses, and personas" }, async (args) => jsonResponse(await createProject(createProjectSchema.parse(args))));
44
+ server.tool("get_project", getProjectSchema.shape, { title: "Get a project with all its entities (canvases, analyses, personas)" }, async (args) => {
45
+ const result = await getProject(getProjectSchema.parse(args));
46
+ return result ? jsonResponse(result) : errorResponse("Project not found");
47
+ });
48
+ server.tool("update_project", updateProjectSchema.shape, { title: "Update project name, description, or tags" }, async (args) => jsonResponse(await updateProject(updateProjectSchema.parse(args))));
49
+ server.tool("delete_project", deleteProjectSchema.shape, { title: "Delete a project and all its entities" }, async (args) => jsonResponse(await deleteProject(deleteProjectSchema.parse(args))));
50
+ server.tool("list_projects", {}, { title: "List all business design projects" }, async () => jsonResponse(await listProjects()));
51
+ server.tool("list_project_entities", listProjectEntitiesSchema.shape, { title: "List all entities in a project, optionally filtered by type" }, async (args) => jsonResponse(await listProjectEntities(listProjectEntitiesSchema.parse(args))));
52
+ server.tool("delete_entity", deleteEntitySchema.shape, { title: "Delete any entity (canvas, analysis, persona) by ID" }, async (args) => jsonResponse(await deleteEntityTool(deleteEntitySchema.parse(args))));
53
+ server.tool("export_project", exportProjectSchema.shape, { title: "Export a project to JSON or Markdown format" }, async (args) => {
54
+ const result = await exportProject(exportProjectSchema.parse(args));
55
+ return { content: [{ type: "text", text: result }] };
56
+ });
57
+ server.tool("get_entity", { entityId: z.string().describe("The entity ID to retrieve") }, { title: "Get any entity by ID" }, async (args) => {
58
+ const result = await getEntity(args.entityId);
59
+ return result ? jsonResponse(result) : errorResponse("Entity not found");
60
+ });
61
+ // ============================================================================
62
+ // BUSINESS MODEL CANVAS
63
+ // ============================================================================
64
+ server.tool("create_business_model_canvas", createBusinessModelCanvasSchema.shape, { title: "Create a Business Model Canvas (Osterwalder's 9 blocks)" }, async (args) => jsonResponse(await createBusinessModelCanvas(createBusinessModelCanvasSchema.parse(args))));
65
+ server.tool("update_business_model_canvas", updateBusinessModelCanvasSchema.shape, { title: "Update an existing Business Model Canvas" }, async (args) => jsonResponse(await updateBusinessModelCanvas(updateBusinessModelCanvasSchema.parse(args))));
66
+ // ============================================================================
67
+ // LEAN CANVAS
68
+ // ============================================================================
69
+ server.tool("create_lean_canvas", createLeanCanvasSchema.shape, { title: "Create a Lean Canvas (startup-focused adaptation)" }, async (args) => jsonResponse(await createLeanCanvas(createLeanCanvasSchema.parse(args))));
70
+ server.tool("update_lean_canvas", updateLeanCanvasSchema.shape, { title: "Update an existing Lean Canvas" }, async (args) => jsonResponse(await updateLeanCanvas(updateLeanCanvasSchema.parse(args))));
71
+ // ============================================================================
72
+ // VALUE PROPOSITION CANVAS
73
+ // ============================================================================
74
+ server.tool("create_value_proposition_canvas", createValuePropositionCanvasSchema.shape, { title: "Create a Value Proposition Canvas (customer profile + value map)" }, async (args) => jsonResponse(await createValuePropositionCanvas(createValuePropositionCanvasSchema.parse(args))));
75
+ server.tool("update_value_proposition_canvas", updateValuePropositionCanvasSchema.shape, { title: "Update an existing Value Proposition Canvas" }, async (args) => jsonResponse(await updateValuePropositionCanvas(updateValuePropositionCanvasSchema.parse(args))));
76
+ // ============================================================================
77
+ // SWOT ANALYSIS
78
+ // ============================================================================
79
+ server.tool("create_swot_analysis", createSwotAnalysisSchema.shape, { title: "Create a SWOT Analysis (strengths, weaknesses, opportunities, threats)" }, async (args) => jsonResponse(await createSwotAnalysis(createSwotAnalysisSchema.parse(args))));
80
+ server.tool("update_swot_analysis", updateSwotAnalysisSchema.shape, { title: "Update an existing SWOT Analysis" }, async (args) => jsonResponse(await updateSwotAnalysis(updateSwotAnalysisSchema.parse(args))));
81
+ // ============================================================================
82
+ // USER PERSONA
83
+ // ============================================================================
84
+ server.tool("create_user_persona", createUserPersonaSchema.shape, { title: "Create a User Persona (demographics, behavior, goals)" }, async (args) => jsonResponse(await createUserPersona(createUserPersonaSchema.parse(args))));
85
+ server.tool("update_user_persona", updateUserPersonaSchema.shape, { title: "Update an existing User Persona" }, async (args) => jsonResponse(await updateUserPersona(updateUserPersonaSchema.parse(args))));
86
+ // ============================================================================
87
+ // COMPETITIVE ANALYSIS
88
+ // ============================================================================
89
+ server.tool("create_competitive_analysis", createCompetitiveAnalysisSchema.shape, { title: "Create a Competitive Analysis (analyze competitors)" }, async (args) => jsonResponse(await createCompetitiveAnalysis(createCompetitiveAnalysisSchema.parse(args))));
90
+ server.tool("update_competitive_analysis", updateCompetitiveAnalysisSchema.shape, { title: "Update an existing Competitive Analysis" }, async (args) => jsonResponse(await updateCompetitiveAnalysis(updateCompetitiveAnalysisSchema.parse(args))));
91
+ // ============================================================================
92
+ // MARKET SIZING
93
+ // ============================================================================
94
+ server.tool("create_market_sizing", createMarketSizingSchema.shape, { title: "Create a Market Sizing analysis (TAM, SAM, SOM)" }, async (args) => jsonResponse(await createMarketSizing(createMarketSizingSchema.parse(args))));
95
+ server.tool("update_market_sizing", updateMarketSizingSchema.shape, { title: "Update an existing Market Sizing analysis" }, async (args) => jsonResponse(await updateMarketSizing(updateMarketSizingSchema.parse(args))));
96
+ // ============================================================================
97
+ // OPENAI DEEP RESEARCH
98
+ // ============================================================================
99
+ server.tool("configure_openai", configureOpenAISchema.shape, { title: "Configure OpenAI API key for Deep Research (alternative to OPENAI_API_KEY env var)" }, async (args) => jsonResponse(await configureOpenAI(configureOpenAISchema.parse(args))));
100
+ server.tool("check_openai_config", {}, { title: "Check if OpenAI API key is configured" }, async () => jsonResponse(await checkOpenAIConfig()));
101
+ server.tool("deep_research", deepResearchSchema.shape, { title: "Execute OpenAI Deep Research to gather real market data for a framework" }, async (args) => jsonResponse(await deepResearch(deepResearchSchema.parse(args))));
102
+ server.tool("populate_framework", populateFrameworkSchema.shape, { title: "Create a framework entity from Deep Research results with citations" }, async (args) => jsonResponse(await populateFramework(populateFrameworkSchema.parse(args))));
103
+ // ============================================================================
104
+ // START SERVER
105
+ // ============================================================================
106
+ async function main() {
107
+ const transport = new StdioServerTransport();
108
+ await server.connect(transport);
109
+ console.error("Business Design MCP server running on stdio");
110
+ }
111
+ main().catch((error) => {
112
+ console.error("Fatal error:", error);
113
+ process.exit(1);
114
+ });
115
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,SAAS,YAAY,CAAC,IAAa;IACjC,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;KACjE,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,OAAe;IACpC,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;QAC1C,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC;AAED,OAAO;AACL,qBAAqB;AACrB,aAAa,EACb,mBAAmB,EACnB,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,mBAAmB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AAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CACvF,CAAC;AAEF,MAAM,CAAC,IAAI,CACT,qBAAqB,EACrB,EAAE,EACF,EAAE,KAAK,EAAE,uCAAuC,EAAE,EAClD,KAAK,IAAI,EAAE,CAAC,YAAY,CAAC,MAAM,iBAAiB,EAAE,CAAC,CACpD,CAAC;AAEF,MAAM,CAAC,IAAI,CACT,eAAe,EACf,kBAAkB,CAAC,KAAK,EACxB,EAAE,KAAK,EAAE,yEAAyE,EAAE,EACpF,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,YAAY,CAAC,kBAAkB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CACjF,CAAC;AAEF,MAAM,CAAC,IAAI,CACT,oBAAoB,EACpB,uBAAuB,CAAC,KAAK,EAC7B,EAAE,KAAK,EAAE,qEAAqE,EAAE,EAChF,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,iBAAiB,CAAC,uBAAuB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAC3F,CAAC;AAEF,+EAA+E;AAC/E,eAAe;AACf,+EAA+E;AAE/E,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,6CAA6C,CAAC,CAAC;AAC/D,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,37 @@
1
+ import OpenAI from "openai";
2
+ export declare function setOpenAIApiKey(key: string): void;
3
+ export declare function getOpenAIApiKey(): string | undefined;
4
+ export declare function getOpenAIClient(): OpenAI;
5
+ export declare class OpenAIConfigError extends Error {
6
+ code: "API_KEY_MISSING" | "API_ERROR" | "RATE_LIMIT" | "PARSE_ERROR" | "TIMEOUT";
7
+ constructor(message: string, code: "API_KEY_MISSING" | "API_ERROR" | "RATE_LIMIT" | "PARSE_ERROR" | "TIMEOUT");
8
+ }
9
+ export interface RetryConfig {
10
+ maxRetries: number;
11
+ initialDelayMs: number;
12
+ maxDelayMs: number;
13
+ backoffMultiplier: number;
14
+ }
15
+ export type DeepResearchModel = "o3-deep-research-2025-06-26" | "o4-mini-deep-research-2025-06-26";
16
+ export interface DeepResearchOptions {
17
+ model: DeepResearchModel;
18
+ systemPrompt: string;
19
+ userPrompt: string;
20
+ }
21
+ export interface RawCitation {
22
+ title: string;
23
+ url: string;
24
+ startIndex: number;
25
+ endIndex: number;
26
+ }
27
+ export interface DeepResearchResult {
28
+ content: string;
29
+ citations: RawCitation[];
30
+ usage: {
31
+ inputTokens: number;
32
+ outputTokens: number;
33
+ totalTokens: number;
34
+ };
35
+ }
36
+ export declare function executeDeepResearch(options: DeepResearchOptions, retryConfig?: Partial<RetryConfig>): Promise<DeepResearchResult>;
37
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/openai/client.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAI5B,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEjD;AAED,wBAAgB,eAAe,IAAI,MAAM,GAAG,SAAS,CAEpD;AAED,wBAAgB,eAAe,IAAI,MAAM,CASxC;AAED,qBAAa,iBAAkB,SAAQ,KAAK;IAGjC,IAAI,EAAE,iBAAiB,GAAG,WAAW,GAAG,YAAY,GAAG,aAAa,GAAG,SAAS;gBADvF,OAAO,EAAE,MAAM,EACR,IAAI,EAAE,iBAAiB,GAAG,WAAW,GAAG,YAAY,GAAG,aAAa,GAAG,SAAS;CAK1F;AAGD,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AA6DD,MAAM,MAAM,iBAAiB,GACzB,6BAA6B,GAC7B,kCAAkC,CAAC;AAEvC,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,iBAAiB,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,WAAW,EAAE,CAAC;IACzB,KAAK,EAAE;QACL,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;QACrB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AAED,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,mBAAmB,EAC5B,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GACjC,OAAO,CAAC,kBAAkB,CAAC,CA6D7B"}
@@ -0,0 +1,121 @@
1
+ import OpenAI from "openai";
2
+ let runtimeApiKey;
3
+ export function setOpenAIApiKey(key) {
4
+ runtimeApiKey = key;
5
+ }
6
+ export function getOpenAIApiKey() {
7
+ return runtimeApiKey || process.env.OPENAI_API_KEY;
8
+ }
9
+ export function getOpenAIClient() {
10
+ const apiKey = getOpenAIApiKey();
11
+ if (!apiKey) {
12
+ throw new OpenAIConfigError("OpenAI API key not configured. Set OPENAI_API_KEY environment variable or use configure_openai tool.", "API_KEY_MISSING");
13
+ }
14
+ return new OpenAI({ apiKey });
15
+ }
16
+ export class OpenAIConfigError extends Error {
17
+ code;
18
+ constructor(message, code) {
19
+ super(message);
20
+ this.code = code;
21
+ this.name = "OpenAIConfigError";
22
+ }
23
+ }
24
+ const DEFAULT_RETRY_CONFIG = {
25
+ maxRetries: 3,
26
+ initialDelayMs: 1000,
27
+ maxDelayMs: 30000,
28
+ backoffMultiplier: 2,
29
+ };
30
+ function isRetryableError(error) {
31
+ if (error instanceof OpenAI.APIError) {
32
+ // Retry on rate limits (429) and server errors (5xx)
33
+ return error.status === 429 || (error.status >= 500 && error.status < 600);
34
+ }
35
+ // Retry on network errors
36
+ if (error instanceof Error) {
37
+ return error.message.includes("ECONNRESET") ||
38
+ error.message.includes("ETIMEDOUT") ||
39
+ error.message.includes("ENOTFOUND");
40
+ }
41
+ return false;
42
+ }
43
+ async function sleep(ms) {
44
+ return new Promise((resolve) => setTimeout(resolve, ms));
45
+ }
46
+ async function withRetry(operation, config = DEFAULT_RETRY_CONFIG) {
47
+ let lastError;
48
+ let delay = config.initialDelayMs;
49
+ for (let attempt = 0; attempt <= config.maxRetries; attempt++) {
50
+ try {
51
+ return await operation();
52
+ }
53
+ catch (error) {
54
+ lastError = error;
55
+ if (!isRetryableError(error) || attempt === config.maxRetries) {
56
+ throw error;
57
+ }
58
+ // Add jitter to prevent thundering herd
59
+ const jitter = Math.random() * 0.3 * delay;
60
+ const waitTime = Math.min(delay + jitter, config.maxDelayMs);
61
+ console.error(`OpenAI request failed (attempt ${attempt + 1}/${config.maxRetries + 1}), ` +
62
+ `retrying in ${Math.round(waitTime)}ms...`);
63
+ await sleep(waitTime);
64
+ delay *= config.backoffMultiplier;
65
+ }
66
+ }
67
+ throw lastError;
68
+ }
69
+ export async function executeDeepResearch(options, retryConfig) {
70
+ const client = getOpenAIClient();
71
+ const config = { ...DEFAULT_RETRY_CONFIG, ...retryConfig };
72
+ const response = await withRetry(() => client.responses.create({
73
+ model: options.model,
74
+ input: [
75
+ {
76
+ role: "developer",
77
+ content: [{ type: "input_text", text: options.systemPrompt }],
78
+ },
79
+ {
80
+ role: "user",
81
+ content: [{ type: "input_text", text: options.userPrompt }],
82
+ },
83
+ ],
84
+ tools: [{ type: "web_search_preview" }],
85
+ }), config);
86
+ // Extract the final text content
87
+ const outputItems = response.output || [];
88
+ let content = "";
89
+ const citations = [];
90
+ for (const item of outputItems) {
91
+ if (item.type === "message" && item.content) {
92
+ for (const contentItem of item.content) {
93
+ if (contentItem.type === "output_text") {
94
+ content += contentItem.text;
95
+ // Extract citations from annotations
96
+ const annotations = contentItem.annotations || [];
97
+ for (const annotation of annotations) {
98
+ if (annotation.type === "url_citation") {
99
+ citations.push({
100
+ title: annotation.title || "Untitled",
101
+ url: annotation.url,
102
+ startIndex: annotation.start_index,
103
+ endIndex: annotation.end_index,
104
+ });
105
+ }
106
+ }
107
+ }
108
+ }
109
+ }
110
+ }
111
+ return {
112
+ content,
113
+ citations,
114
+ usage: {
115
+ inputTokens: response.usage?.input_tokens || 0,
116
+ outputTokens: response.usage?.output_tokens || 0,
117
+ totalTokens: (response.usage?.input_tokens || 0) + (response.usage?.output_tokens || 0),
118
+ },
119
+ };
120
+ }
121
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/openai/client.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,IAAI,aAAiC,CAAC;AAEtC,MAAM,UAAU,eAAe,CAAC,GAAW;IACzC,aAAa,GAAG,GAAG,CAAC;AACtB,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,OAAO,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,MAAM,MAAM,GAAG,eAAe,EAAE,CAAC;IACjC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,iBAAiB,CACzB,sGAAsG,EACtG,iBAAiB,CAClB,CAAC;IACJ,CAAC;IAC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CAAC;IACH,CAAC;IAED,OAAO;QACL,OAAO;QACP,SAAS;QACT,KAAK,EAAE;YACL,WAAW,EAAE,QAAQ,CAAC,KAAK,EAAE,YAAY,IAAI,CAAC;YAC9C,YAAY,EAAE,QAAQ,CAAC,KAAK,EAAE,aAAa,IAAI,CAAC;YAChD,WAAW,EACT,CAAC,QAAQ,CAAC,KAAK,EAAE,YAAY,IAAI,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,EAAE,aAAa,IAAI,CAAC,CAAC;SAC7E;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type { RawCitation } from "./client.js";
2
+ import type { FrameworkType } from "./prompts.js";
3
+ export interface Citation {
4
+ id: string;
5
+ title: string;
6
+ url: string;
7
+ accessedAt: string;
8
+ relevantFields: string[];
9
+ }
10
+ export interface ParsedResearchResult {
11
+ data: Record<string, unknown>;
12
+ citations: Citation[];
13
+ confidence: number;
14
+ missingFields: string[];
15
+ rawContent: string;
16
+ }
17
+ export declare function parseMarketSizingResearch(content: string, rawCitations: RawCitation[]): ParsedResearchResult;
18
+ export declare function parseCompetitiveAnalysisResearch(content: string, rawCitations: RawCitation[]): ParsedResearchResult;
19
+ export declare function parseUserPersonaResearch(content: string, rawCitations: RawCitation[]): ParsedResearchResult;
20
+ export declare function parseSwotAnalysisResearch(content: string, rawCitations: RawCitation[]): ParsedResearchResult;
21
+ export declare function parseBusinessModelCanvasResearch(content: string, rawCitations: RawCitation[]): ParsedResearchResult;
22
+ export declare function parseLeanCanvasResearch(content: string, rawCitations: RawCitation[]): ParsedResearchResult;
23
+ export declare function parseValuePropositionCanvasResearch(content: string, rawCitations: RawCitation[]): ParsedResearchResult;
24
+ export declare function parseResearchResult(framework: FrameworkType, content: string, rawCitations: RawCitation[]): ParsedResearchResult;
25
+ //# sourceMappingURL=parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/openai/parser.ts"],"names":[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