buildix-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.
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ export declare const config: {
3
+ apiKey: string;
4
+ apiUrl: string;
5
+ };
package/dist/index.js ADDED
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env node
2
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
3
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
+ import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
5
+ import { projectsTools, handleProjectsTool } from "./tools/projects.js";
6
+ import { pagesTools, handlePagesTool } from "./tools/pages.js";
7
+ import { publishTools, handlePublishTool } from "./tools/publish.js";
8
+ import { promptsTools, handlePromptsTool } from "./tools/prompts.js";
9
+ import { componentsTools, handleComponentsTool } from "./tools/components.js";
10
+ const API_KEY = process.env.BUILDIX_API_KEY;
11
+ const API_URL = process.env.BUILDIX_API_URL || "https://buildixlab.com";
12
+ if (!API_KEY) {
13
+ console.error("BUILDIX_API_KEY is required. Set it in your MCP config.");
14
+ process.exit(1);
15
+ }
16
+ export const config = { apiKey: API_KEY, apiUrl: API_URL };
17
+ const server = new Server({ name: "buildix", version: "1.0.0" }, { capabilities: { tools: {} } });
18
+ const allTools = [
19
+ ...projectsTools,
20
+ ...pagesTools,
21
+ ...publishTools,
22
+ ...promptsTools,
23
+ ...componentsTools,
24
+ ];
25
+ server.setRequestHandler(ListToolsRequestSchema, async () => ({
26
+ tools: allTools,
27
+ }));
28
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
29
+ const { name, arguments: args } = request.params;
30
+ try {
31
+ if (projectsTools.find((t) => t.name === name)) {
32
+ return await handleProjectsTool(name, args || {});
33
+ }
34
+ if (pagesTools.find((t) => t.name === name)) {
35
+ return await handlePagesTool(name, args || {});
36
+ }
37
+ if (publishTools.find((t) => t.name === name)) {
38
+ return await handlePublishTool(name, args || {});
39
+ }
40
+ if (promptsTools.find((t) => t.name === name)) {
41
+ return await handlePromptsTool(name, args || {});
42
+ }
43
+ if (componentsTools.find((t) => t.name === name)) {
44
+ return await handleComponentsTool(name, args || {});
45
+ }
46
+ return { content: [{ type: "text", text: `Unknown tool: ${name}` }], isError: true };
47
+ }
48
+ catch (err) {
49
+ return { content: [{ type: "text", text: `Error: ${err.message}` }], isError: true };
50
+ }
51
+ });
52
+ async function main() {
53
+ const transport = new StdioServerTransport();
54
+ await server.connect(transport);
55
+ console.error("Buildix MCP server running...");
56
+ }
57
+ main().catch(console.error);
@@ -0,0 +1,23 @@
1
+ export declare const componentsTools: {
2
+ name: string;
3
+ description: string;
4
+ inputSchema: {
5
+ type: string;
6
+ properties: {
7
+ category: {
8
+ type: string;
9
+ description: string;
10
+ };
11
+ search: {
12
+ type: string;
13
+ description: string;
14
+ };
15
+ };
16
+ };
17
+ }[];
18
+ export declare function handleComponentsTool(name: string, args: Record<string, any>): Promise<{
19
+ content: {
20
+ type: string;
21
+ text: string;
22
+ }[];
23
+ }>;
@@ -0,0 +1,34 @@
1
+ import { config } from "../index.js";
2
+ export const componentsTools = [
3
+ {
4
+ name: "list_components",
5
+ description: "Lista componentes de UI da biblioteca do Buildix (Hero, Features, CTA, Pricing, etc.)",
6
+ inputSchema: {
7
+ type: "object",
8
+ properties: {
9
+ category: {
10
+ type: "string",
11
+ description: "Filtrar por categoria (hero, features, cta, pricing, testimonials, footer, navbar, cards, forms, gallery)",
12
+ },
13
+ search: { type: "string", description: "Buscar por nome ou descrição" },
14
+ },
15
+ },
16
+ },
17
+ ];
18
+ export async function handleComponentsTool(name, args) {
19
+ if (name === "list_components") {
20
+ const params = new URLSearchParams();
21
+ if (args.category)
22
+ params.set("category", args.category);
23
+ if (args.search)
24
+ params.set("search", args.search);
25
+ const res = await fetch(`${config.apiUrl}/api/mcp/components?${params}`, {
26
+ headers: { "x-api-key": config.apiKey },
27
+ });
28
+ const data = await res.json();
29
+ if (!res.ok)
30
+ throw new Error(data.error || `HTTP ${res.status}`);
31
+ return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
32
+ }
33
+ throw new Error(`Unknown tool: ${name}`);
34
+ }
@@ -0,0 +1,32 @@
1
+ export declare const pagesTools: {
2
+ name: string;
3
+ description: string;
4
+ inputSchema: {
5
+ type: string;
6
+ properties: {
7
+ projectId: {
8
+ type: string;
9
+ description: string;
10
+ };
11
+ htmlContent: {
12
+ type: string;
13
+ description: string;
14
+ };
15
+ slug: {
16
+ type: string;
17
+ description: string;
18
+ };
19
+ name: {
20
+ type: string;
21
+ description: string;
22
+ };
23
+ };
24
+ required: string[];
25
+ };
26
+ }[];
27
+ export declare function handlePagesTool(name: string, args: Record<string, any>): Promise<{
28
+ content: {
29
+ type: string;
30
+ text: string;
31
+ }[];
32
+ }>;
@@ -0,0 +1,35 @@
1
+ import { config } from "../index.js";
2
+ export const pagesTools = [
3
+ {
4
+ name: "save_page_html",
5
+ description: "Salva HTML em uma página do projeto. Cria a página se não existir.",
6
+ inputSchema: {
7
+ type: "object",
8
+ properties: {
9
+ projectId: { type: "string", description: "ID do projeto" },
10
+ htmlContent: { type: "string", description: "HTML completo da página" },
11
+ slug: { type: "string", description: "Slug da página (default: 'home')" },
12
+ name: { type: "string", description: "Nome da página (opcional)" },
13
+ },
14
+ required: ["projectId", "htmlContent"],
15
+ },
16
+ },
17
+ ];
18
+ export async function handlePagesTool(name, args) {
19
+ if (name === "save_page_html") {
20
+ const res = await fetch(`${config.apiUrl}/api/mcp/projects/${args.projectId}/page`, {
21
+ method: "POST",
22
+ headers: { "x-api-key": config.apiKey, "Content-Type": "application/json" },
23
+ body: JSON.stringify({
24
+ htmlContent: args.htmlContent,
25
+ slug: args.slug || "home",
26
+ name: args.name,
27
+ }),
28
+ });
29
+ const data = await res.json();
30
+ if (!res.ok)
31
+ throw new Error(data.error || `HTTP ${res.status}`);
32
+ return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
33
+ }
34
+ throw new Error(`Unknown tool: ${name}`);
35
+ }
@@ -0,0 +1,64 @@
1
+ export declare const projectsTools: ({
2
+ name: string;
3
+ description: string;
4
+ inputSchema: {
5
+ type: string;
6
+ properties: {
7
+ page: {
8
+ type: string;
9
+ description: string;
10
+ };
11
+ limit: {
12
+ type: string;
13
+ description: string;
14
+ };
15
+ id?: undefined;
16
+ name?: undefined;
17
+ description?: undefined;
18
+ };
19
+ required?: undefined;
20
+ };
21
+ } | {
22
+ name: string;
23
+ description: string;
24
+ inputSchema: {
25
+ type: string;
26
+ properties: {
27
+ id: {
28
+ type: string;
29
+ description: string;
30
+ };
31
+ page?: undefined;
32
+ limit?: undefined;
33
+ name?: undefined;
34
+ description?: undefined;
35
+ };
36
+ required: string[];
37
+ };
38
+ } | {
39
+ name: string;
40
+ description: string;
41
+ inputSchema: {
42
+ type: string;
43
+ properties: {
44
+ name: {
45
+ type: string;
46
+ description: string;
47
+ };
48
+ description: {
49
+ type: string;
50
+ description: string;
51
+ };
52
+ page?: undefined;
53
+ limit?: undefined;
54
+ id?: undefined;
55
+ };
56
+ required: string[];
57
+ };
58
+ })[];
59
+ export declare function handleProjectsTool(name: string, args: Record<string, any>): Promise<{
60
+ content: {
61
+ type: string;
62
+ text: string;
63
+ }[];
64
+ }>;
@@ -0,0 +1,74 @@
1
+ import { config } from "../index.js";
2
+ export const projectsTools = [
3
+ {
4
+ name: "list_projects",
5
+ description: "Lista todos os projetos do usuário no Buildix",
6
+ inputSchema: {
7
+ type: "object",
8
+ properties: {
9
+ page: { type: "number", description: "Página (default: 1)" },
10
+ limit: { type: "number", description: "Itens por página (max: 50, default: 20)" },
11
+ },
12
+ },
13
+ },
14
+ {
15
+ name: "get_project",
16
+ description: "Retorna detalhes e HTML de um projeto específico",
17
+ inputSchema: {
18
+ type: "object",
19
+ properties: {
20
+ id: { type: "string", description: "ID do projeto" },
21
+ },
22
+ required: ["id"],
23
+ },
24
+ },
25
+ {
26
+ name: "create_project",
27
+ description: "Cria um novo projeto no Buildix",
28
+ inputSchema: {
29
+ type: "object",
30
+ properties: {
31
+ name: { type: "string", description: "Nome do projeto" },
32
+ description: { type: "string", description: "Descrição opcional" },
33
+ },
34
+ required: ["name"],
35
+ },
36
+ },
37
+ ];
38
+ async function apiFetch(path, options) {
39
+ const res = await fetch(`${config.apiUrl}${path}`, {
40
+ ...options,
41
+ headers: {
42
+ "x-api-key": config.apiKey,
43
+ "Content-Type": "application/json",
44
+ ...options?.headers,
45
+ },
46
+ });
47
+ const data = await res.json();
48
+ if (!res.ok)
49
+ throw new Error(data.error || `HTTP ${res.status}`);
50
+ return data;
51
+ }
52
+ export async function handleProjectsTool(name, args) {
53
+ if (name === "list_projects") {
54
+ const params = new URLSearchParams();
55
+ if (args.page)
56
+ params.set("page", args.page.toString());
57
+ if (args.limit)
58
+ params.set("limit", args.limit.toString());
59
+ const data = await apiFetch(`/api/mcp/projects?${params}`);
60
+ return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
61
+ }
62
+ if (name === "get_project") {
63
+ const data = await apiFetch(`/api/mcp/projects/${args.id}`);
64
+ return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
65
+ }
66
+ if (name === "create_project") {
67
+ const data = await apiFetch("/api/mcp/projects", {
68
+ method: "POST",
69
+ body: JSON.stringify({ name: args.name, description: args.description }),
70
+ });
71
+ return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
72
+ }
73
+ throw new Error(`Unknown tool: ${name}`);
74
+ }
@@ -0,0 +1,21 @@
1
+ export declare const promptsTools: {
2
+ name: string;
3
+ description: string;
4
+ inputSchema: {
5
+ type: string;
6
+ properties: {
7
+ type: {
8
+ type: string;
9
+ description: string;
10
+ enum: string[];
11
+ };
12
+ };
13
+ required: string[];
14
+ };
15
+ }[];
16
+ export declare function handlePromptsTool(name: string, args: Record<string, any>): Promise<{
17
+ content: {
18
+ type: string;
19
+ text: string;
20
+ }[];
21
+ }>;
@@ -0,0 +1,41 @@
1
+ import { config } from "../index.js";
2
+ const AVAILABLE_TYPES = [
3
+ "generation", "revision", "revision-flash", "section-revision",
4
+ "insert-after", "instagram-post", "instagram-carousel", "instagram-story",
5
+ "mobile-app", "dashboard", "email-template", "youtube-thumbnail",
6
+ "scroll-animation", "variation", "image-reference",
7
+ ];
8
+ export const promptsTools = [
9
+ {
10
+ name: "get_prompt",
11
+ description: `Retorna o system prompt otimizado do Buildix para um tipo de conteúdo. Use o prompt retornado como system prompt na sua chamada de IA. Tipos disponíveis: ${AVAILABLE_TYPES.join(", ")}`,
12
+ inputSchema: {
13
+ type: "object",
14
+ properties: {
15
+ type: {
16
+ type: "string",
17
+ description: `Tipo de conteúdo. Um de: ${AVAILABLE_TYPES.join(", ")}`,
18
+ enum: AVAILABLE_TYPES,
19
+ },
20
+ },
21
+ required: ["type"],
22
+ },
23
+ },
24
+ ];
25
+ export async function handlePromptsTool(name, args) {
26
+ if (name === "get_prompt") {
27
+ const res = await fetch(`${config.apiUrl}/api/mcp/prompts/${args.type}`, {
28
+ headers: { "x-api-key": config.apiKey },
29
+ });
30
+ const data = await res.json();
31
+ if (!res.ok)
32
+ throw new Error(data.error || `HTTP ${res.status}`);
33
+ return {
34
+ content: [{
35
+ type: "text",
36
+ text: `SYSTEM PROMPT para "${args.type}":\n\n${data.prompt}`,
37
+ }],
38
+ };
39
+ }
40
+ throw new Error(`Unknown tool: ${name}`);
41
+ }
@@ -0,0 +1,32 @@
1
+ export declare const publishTools: {
2
+ name: string;
3
+ description: string;
4
+ inputSchema: {
5
+ type: string;
6
+ properties: {
7
+ projectId: {
8
+ type: string;
9
+ description: string;
10
+ };
11
+ slug: {
12
+ type: string;
13
+ description: string;
14
+ };
15
+ seoTitle: {
16
+ type: string;
17
+ description: string;
18
+ };
19
+ seoDescription: {
20
+ type: string;
21
+ description: string;
22
+ };
23
+ };
24
+ required: string[];
25
+ };
26
+ }[];
27
+ export declare function handlePublishTool(name: string, args: Record<string, any>): Promise<{
28
+ content: {
29
+ type: string;
30
+ text: string;
31
+ }[];
32
+ }>;
@@ -0,0 +1,35 @@
1
+ import { config } from "../index.js";
2
+ export const publishTools = [
3
+ {
4
+ name: "publish_project",
5
+ description: "Publica o projeto na web via Buildix (buildixapp.com/slug)",
6
+ inputSchema: {
7
+ type: "object",
8
+ properties: {
9
+ projectId: { type: "string", description: "ID do projeto" },
10
+ slug: { type: "string", description: "Slug da URL (ex: 'minha-startup')" },
11
+ seoTitle: { type: "string", description: "Título SEO (opcional)" },
12
+ seoDescription: { type: "string", description: "Descrição SEO (opcional)" },
13
+ },
14
+ required: ["projectId", "slug"],
15
+ },
16
+ },
17
+ ];
18
+ export async function handlePublishTool(name, args) {
19
+ if (name === "publish_project") {
20
+ const res = await fetch(`${config.apiUrl}/api/mcp/projects/${args.projectId}/publish`, {
21
+ method: "POST",
22
+ headers: { "x-api-key": config.apiKey, "Content-Type": "application/json" },
23
+ body: JSON.stringify({
24
+ slug: args.slug,
25
+ seoTitle: args.seoTitle,
26
+ seoDescription: args.seoDescription,
27
+ }),
28
+ });
29
+ const data = await res.json();
30
+ if (!res.ok)
31
+ throw new Error(data.error || `HTTP ${res.status}`);
32
+ return { content: [{ type: "text", text: `Site publicado em: ${data.url}` }] };
33
+ }
34
+ throw new Error(`Unknown tool: ${name}`);
35
+ }
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "buildix-mcp",
3
+ "version": "1.0.0",
4
+ "description": "MCP server for Buildix — AI-powered landing page builder",
5
+ "type": "module",
6
+ "bin": {
7
+ "buildix-mcp": "./dist/index.js"
8
+ },
9
+ "main": "./dist/index.js",
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "dev": "tsc --watch",
13
+ "start": "node dist/index.js"
14
+ },
15
+ "dependencies": {
16
+ "@modelcontextprotocol/sdk": "^1.0.0"
17
+ },
18
+ "devDependencies": {
19
+ "typescript": "^5.0.0",
20
+ "@types/node": "^20.0.0"
21
+ },
22
+ "keywords": ["mcp", "buildix", "landing-page", "ai"],
23
+ "license": "MIT"
24
+ }
package/src/index.ts ADDED
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env node
2
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
3
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
+ import {
5
+ CallToolRequestSchema,
6
+ ListToolsRequestSchema,
7
+ } from "@modelcontextprotocol/sdk/types.js";
8
+ import { projectsTools, handleProjectsTool } from "./tools/projects.js";
9
+ import { pagesTools, handlePagesTool } from "./tools/pages.js";
10
+ import { publishTools, handlePublishTool } from "./tools/publish.js";
11
+ import { promptsTools, handlePromptsTool } from "./tools/prompts.js";
12
+ import { componentsTools, handleComponentsTool } from "./tools/components.js";
13
+
14
+ const API_KEY = process.env.BUILDIX_API_KEY;
15
+ const API_URL = process.env.BUILDIX_API_URL || "https://buildixlab.com";
16
+
17
+ if (!API_KEY) {
18
+ console.error("BUILDIX_API_KEY is required. Set it in your MCP config.");
19
+ process.exit(1);
20
+ }
21
+
22
+ export const config = { apiKey: API_KEY, apiUrl: API_URL };
23
+
24
+ const server = new Server(
25
+ { name: "buildix", version: "1.0.0" },
26
+ { capabilities: { tools: {} } }
27
+ );
28
+
29
+ const allTools = [
30
+ ...projectsTools,
31
+ ...pagesTools,
32
+ ...publishTools,
33
+ ...promptsTools,
34
+ ...componentsTools,
35
+ ];
36
+
37
+ server.setRequestHandler(ListToolsRequestSchema, async () => ({
38
+ tools: allTools,
39
+ }));
40
+
41
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
42
+ const { name, arguments: args } = request.params;
43
+
44
+ try {
45
+ if (projectsTools.find((t) => t.name === name)) {
46
+ return await handleProjectsTool(name, args || {});
47
+ }
48
+ if (pagesTools.find((t) => t.name === name)) {
49
+ return await handlePagesTool(name, args || {});
50
+ }
51
+ if (publishTools.find((t) => t.name === name)) {
52
+ return await handlePublishTool(name, args || {});
53
+ }
54
+ if (promptsTools.find((t) => t.name === name)) {
55
+ return await handlePromptsTool(name, args || {});
56
+ }
57
+ if (componentsTools.find((t) => t.name === name)) {
58
+ return await handleComponentsTool(name, args || {});
59
+ }
60
+
61
+ return { content: [{ type: "text", text: `Unknown tool: ${name}` }], isError: true };
62
+ } catch (err: any) {
63
+ return { content: [{ type: "text", text: `Error: ${err.message}` }], isError: true };
64
+ }
65
+ });
66
+
67
+ async function main() {
68
+ const transport = new StdioServerTransport();
69
+ await server.connect(transport);
70
+ console.error("Buildix MCP server running...");
71
+ }
72
+
73
+ main().catch(console.error);
@@ -0,0 +1,34 @@
1
+ import { config } from "../index.js";
2
+
3
+ export const componentsTools = [
4
+ {
5
+ name: "list_components",
6
+ description: "Lista componentes de UI da biblioteca do Buildix (Hero, Features, CTA, Pricing, etc.)",
7
+ inputSchema: {
8
+ type: "object",
9
+ properties: {
10
+ category: {
11
+ type: "string",
12
+ description: "Filtrar por categoria (hero, features, cta, pricing, testimonials, footer, navbar, cards, forms, gallery)",
13
+ },
14
+ search: { type: "string", description: "Buscar por nome ou descrição" },
15
+ },
16
+ },
17
+ },
18
+ ];
19
+
20
+ export async function handleComponentsTool(name: string, args: Record<string, any>) {
21
+ if (name === "list_components") {
22
+ const params = new URLSearchParams();
23
+ if (args.category) params.set("category", args.category);
24
+ if (args.search) params.set("search", args.search);
25
+ const res = await fetch(`${config.apiUrl}/api/mcp/components?${params}`, {
26
+ headers: { "x-api-key": config.apiKey },
27
+ });
28
+ const data = await res.json();
29
+ if (!res.ok) throw new Error(data.error || `HTTP ${res.status}`);
30
+ return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
31
+ }
32
+
33
+ throw new Error(`Unknown tool: ${name}`);
34
+ }
@@ -0,0 +1,37 @@
1
+ import { config } from "../index.js";
2
+
3
+ export const pagesTools = [
4
+ {
5
+ name: "save_page_html",
6
+ description: "Salva HTML em uma página do projeto. Cria a página se não existir.",
7
+ inputSchema: {
8
+ type: "object",
9
+ properties: {
10
+ projectId: { type: "string", description: "ID do projeto" },
11
+ htmlContent: { type: "string", description: "HTML completo da página" },
12
+ slug: { type: "string", description: "Slug da página (default: 'home')" },
13
+ name: { type: "string", description: "Nome da página (opcional)" },
14
+ },
15
+ required: ["projectId", "htmlContent"],
16
+ },
17
+ },
18
+ ];
19
+
20
+ export async function handlePagesTool(name: string, args: Record<string, any>) {
21
+ if (name === "save_page_html") {
22
+ const res = await fetch(`${config.apiUrl}/api/mcp/projects/${args.projectId}/page`, {
23
+ method: "POST",
24
+ headers: { "x-api-key": config.apiKey, "Content-Type": "application/json" },
25
+ body: JSON.stringify({
26
+ htmlContent: args.htmlContent,
27
+ slug: args.slug || "home",
28
+ name: args.name,
29
+ }),
30
+ });
31
+ const data = await res.json();
32
+ if (!res.ok) throw new Error(data.error || `HTTP ${res.status}`);
33
+ return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
34
+ }
35
+
36
+ throw new Error(`Unknown tool: ${name}`);
37
+ }
@@ -0,0 +1,77 @@
1
+ import { config } from "../index.js";
2
+
3
+ export const projectsTools = [
4
+ {
5
+ name: "list_projects",
6
+ description: "Lista todos os projetos do usuário no Buildix",
7
+ inputSchema: {
8
+ type: "object",
9
+ properties: {
10
+ page: { type: "number", description: "Página (default: 1)" },
11
+ limit: { type: "number", description: "Itens por página (max: 50, default: 20)" },
12
+ },
13
+ },
14
+ },
15
+ {
16
+ name: "get_project",
17
+ description: "Retorna detalhes e HTML de um projeto específico",
18
+ inputSchema: {
19
+ type: "object",
20
+ properties: {
21
+ id: { type: "string", description: "ID do projeto" },
22
+ },
23
+ required: ["id"],
24
+ },
25
+ },
26
+ {
27
+ name: "create_project",
28
+ description: "Cria um novo projeto no Buildix",
29
+ inputSchema: {
30
+ type: "object",
31
+ properties: {
32
+ name: { type: "string", description: "Nome do projeto" },
33
+ description: { type: "string", description: "Descrição opcional" },
34
+ },
35
+ required: ["name"],
36
+ },
37
+ },
38
+ ];
39
+
40
+ async function apiFetch(path: string, options?: RequestInit) {
41
+ const res = await fetch(`${config.apiUrl}${path}`, {
42
+ ...options,
43
+ headers: {
44
+ "x-api-key": config.apiKey,
45
+ "Content-Type": "application/json",
46
+ ...options?.headers,
47
+ },
48
+ });
49
+ const data = await res.json();
50
+ if (!res.ok) throw new Error(data.error || `HTTP ${res.status}`);
51
+ return data;
52
+ }
53
+
54
+ export async function handleProjectsTool(name: string, args: Record<string, any>) {
55
+ if (name === "list_projects") {
56
+ const params = new URLSearchParams();
57
+ if (args.page) params.set("page", args.page.toString());
58
+ if (args.limit) params.set("limit", args.limit.toString());
59
+ const data = await apiFetch(`/api/mcp/projects?${params}`);
60
+ return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
61
+ }
62
+
63
+ if (name === "get_project") {
64
+ const data = await apiFetch(`/api/mcp/projects/${args.id}`);
65
+ return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
66
+ }
67
+
68
+ if (name === "create_project") {
69
+ const data = await apiFetch("/api/mcp/projects", {
70
+ method: "POST",
71
+ body: JSON.stringify({ name: args.name, description: args.description }),
72
+ });
73
+ return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
74
+ }
75
+
76
+ throw new Error(`Unknown tool: ${name}`);
77
+ }
@@ -0,0 +1,44 @@
1
+ import { config } from "../index.js";
2
+
3
+ const AVAILABLE_TYPES = [
4
+ "generation", "revision", "revision-flash", "section-revision",
5
+ "insert-after", "instagram-post", "instagram-carousel", "instagram-story",
6
+ "mobile-app", "dashboard", "email-template", "youtube-thumbnail",
7
+ "scroll-animation", "variation", "image-reference",
8
+ ];
9
+
10
+ export const promptsTools = [
11
+ {
12
+ name: "get_prompt",
13
+ description: `Retorna o system prompt otimizado do Buildix para um tipo de conteúdo. Use o prompt retornado como system prompt na sua chamada de IA. Tipos disponíveis: ${AVAILABLE_TYPES.join(", ")}`,
14
+ inputSchema: {
15
+ type: "object",
16
+ properties: {
17
+ type: {
18
+ type: "string",
19
+ description: `Tipo de conteúdo. Um de: ${AVAILABLE_TYPES.join(", ")}`,
20
+ enum: AVAILABLE_TYPES,
21
+ },
22
+ },
23
+ required: ["type"],
24
+ },
25
+ },
26
+ ];
27
+
28
+ export async function handlePromptsTool(name: string, args: Record<string, any>) {
29
+ if (name === "get_prompt") {
30
+ const res = await fetch(`${config.apiUrl}/api/mcp/prompts/${args.type}`, {
31
+ headers: { "x-api-key": config.apiKey },
32
+ });
33
+ const data = await res.json();
34
+ if (!res.ok) throw new Error(data.error || `HTTP ${res.status}`);
35
+ return {
36
+ content: [{
37
+ type: "text",
38
+ text: `SYSTEM PROMPT para "${args.type}":\n\n${data.prompt}`,
39
+ }],
40
+ };
41
+ }
42
+
43
+ throw new Error(`Unknown tool: ${name}`);
44
+ }
@@ -0,0 +1,37 @@
1
+ import { config } from "../index.js";
2
+
3
+ export const publishTools = [
4
+ {
5
+ name: "publish_project",
6
+ description: "Publica o projeto na web via Buildix (buildixapp.com/slug)",
7
+ inputSchema: {
8
+ type: "object",
9
+ properties: {
10
+ projectId: { type: "string", description: "ID do projeto" },
11
+ slug: { type: "string", description: "Slug da URL (ex: 'minha-startup')" },
12
+ seoTitle: { type: "string", description: "Título SEO (opcional)" },
13
+ seoDescription: { type: "string", description: "Descrição SEO (opcional)" },
14
+ },
15
+ required: ["projectId", "slug"],
16
+ },
17
+ },
18
+ ];
19
+
20
+ export async function handlePublishTool(name: string, args: Record<string, any>) {
21
+ if (name === "publish_project") {
22
+ const res = await fetch(`${config.apiUrl}/api/mcp/projects/${args.projectId}/publish`, {
23
+ method: "POST",
24
+ headers: { "x-api-key": config.apiKey, "Content-Type": "application/json" },
25
+ body: JSON.stringify({
26
+ slug: args.slug,
27
+ seoTitle: args.seoTitle,
28
+ seoDescription: args.seoDescription,
29
+ }),
30
+ });
31
+ const data = await res.json();
32
+ if (!res.ok) throw new Error(data.error || `HTTP ${res.status}`);
33
+ return { content: [{ type: "text", text: `Site publicado em: ${data.url}` }] };
34
+ }
35
+
36
+ throw new Error(`Unknown tool: ${name}`);
37
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "outDir": "./dist",
7
+ "rootDir": "./src",
8
+ "strict": true,
9
+ "esModuleInterop": true,
10
+ "skipLibCheck": true,
11
+ "declaration": true
12
+ },
13
+ "include": ["src/**/*"],
14
+ "exclude": ["node_modules", "dist"]
15
+ }