#!/usr/bin/env node
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import {
CallToolRequestSchema,
ListToolsRequestSchema,
Tool,
} from "@modelcontextprotocol/sdk/types.js";
import { generatePitchDeck, PitchDeckInput, PitchDeck } from "./pitch-generator.js";
const GENERATE_PITCH_DECK_TOOL: Tool = {
name: "generate_pitch_deck",
description:
"Generate a professional AI-powered pitch deck for a startup or business. Returns a complete slide deck with title, problem, solution, market, business model, traction, team, financials, and closing slides.",
inputSchema: {
type: "object",
properties: {
company_name: {
type: "string",
description: "The name of the company or startup",
},
problem: {
type: "string",
description: "The problem or pain point the company solves",
},
solution: {
type: "string",
description: "The solution or product the company offers",
},
market_size: {
type: "string",
description: "The target market and its size (e.g., '$10B healthcare market')",
},
business_model: {
type: "string",
description: "How the company makes money (e.g., 'SaaS subscription', 'marketplace fees')",
},
industry: {
type: "string",
description: "The industry vertical (optional, defaults to extracting from market_size)",
},
competition: {
type: "string",
description: "Key competitors and competitive landscape (optional)",
},
funding_amount: {
type: "string",
description: "Amount of funding being raised (optional, e.g., '$2M seed round')",
},
use_of_funds: {
type: "string",
description: "How the funding will be used (optional)",
},
},
required: ["company_name", "problem", "solution", "market_size", "business_model"],
},
};
async function main() {
const server = new Server(
{
name: "pitchdeck-mcp",
version: "1.0.0",
},
{
capabilities: {
tools: {},
},
}
);
// List available tools
server.setRequestHandler(ListToolsRequestSchema, async () => {
return {
tools: [GENERATE_PITCH_DECK_TOOL],
};
});
// Handle tool calls
server.setRequestHandler(CallToolRequestSchema, async (request) => {
const { name, arguments: args } = request.params;
if (name === "generate_pitch_deck") {
try {
const input: PitchDeckInput = {
companyName: args?.company_name as string,
problem: args?.problem as string,
solution: args?.solution as string,
targetMarket: args?.market_size as string,
businessModel: args?.business_model as string,
industry: (args?.industry as string) || extractIndustry(args?.market_size as string),
competition: args?.competition as string | undefined,
fundingAmount: args?.funding_amount as string | undefined,
useOfFunds: args?.use_of_funds as string | undefined,
};
const pitchDeck = generatePitchDeck(input);
return {
content: [
{
type: "text",
text: JSON.stringify(pitchDeck, null, 2),
},
],
};
} catch (error) {
const errorMessage = error instanceof Error ? error.message : String(error);
return {
content: [
{
type: "text",
text: `Error generating pitch deck: ${errorMessage}`,
},
],
isError: true,
};
}
}
return {
content: [
{
type: "text",
text: `Unknown tool: ${name}`,
},
],
isError: true,
};
});
// Start server
const transport = new StdioServerTransport();
await server.connect(transport);
console.error("PitchDeck MCP server running on stdio");
}
function extractIndustry(marketSize: string): string {
// Simple extraction of industry from market size description
const industries = [
"healthcare",
"fintech",
"edtech",
"saas",
"e-commerce",
"ai",
"blockchain",
"cybersecurity",
"logistics",
"real estate",
"retail",
"food",
"travel",
"entertainment",
"media",
"automotive",
"energy",
"agriculture",
];
const lower = marketSize.toLowerCase();
for (const industry of industries) {
if (lower.includes(industry)) {
return industry.charAt(0).toUpperCase() + industry.slice(1);
}
}
return "Technology";
}
main().catch((error) => {
console.error("Fatal error:", error);
process.exit(1);
});