@bifocal/mcp 0.1.3 → 0.1.4
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/bifocalClient.js +11 -0
- package/dist/index.js +18 -1
- package/package.json +1 -1
package/dist/bifocalClient.js
CHANGED
|
@@ -83,6 +83,17 @@ export async function getPrototype(projectId, prototypeId) {
|
|
|
83
83
|
export async function exportPrototype(projectId, prototypeId) {
|
|
84
84
|
return get(`/api/projects/${projectId}/prototypes/${prototypeId}/download-zip`);
|
|
85
85
|
}
|
|
86
|
+
export async function generatePrototype(projectId, solutionId) {
|
|
87
|
+
const response = await fetch(`${API_URL}/api/projects/${projectId}/solutions/${solutionId}/generate-prototype`, {
|
|
88
|
+
method: 'POST',
|
|
89
|
+
headers: headers(),
|
|
90
|
+
});
|
|
91
|
+
if (!response.ok) {
|
|
92
|
+
const error = await response.json().catch(() => ({}));
|
|
93
|
+
throw new Error(error.error || `Request failed: ${response.status}`);
|
|
94
|
+
}
|
|
95
|
+
return response.json();
|
|
96
|
+
}
|
|
86
97
|
export async function importPrototypeUploadUrl(projectId, prototypeName, filename) {
|
|
87
98
|
const response = await fetch(`${API_URL}/api/projects/${projectId}/prototypes/import/upload-url`, {
|
|
88
99
|
method: 'POST',
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
3
3
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
4
|
import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
5
|
-
import { createProject, updateProject, listProjects, importPrototypeUploadUrl, importPrototypeConfirm, addFeedbackText, generateSolution, getInsights, getQuotes, getSolutions, getSolution, getPrototypes, getPrototype, exportPrototype } from './bifocalClient.js';
|
|
5
|
+
import { createProject, updateProject, listProjects, importPrototypeUploadUrl, importPrototypeConfirm, addFeedbackText, generateSolution, getInsights, getQuotes, getSolutions, getSolution, getPrototypes, getPrototype, exportPrototype, generatePrototype } from './bifocalClient.js';
|
|
6
6
|
import { writeFile } from 'fs/promises';
|
|
7
7
|
import { join } from 'path';
|
|
8
8
|
const server = new Server({ name: 'bifocal', version: '0.1.0' }, { capabilities: { tools: {} } });
|
|
@@ -141,6 +141,18 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
|
141
141
|
required: ['project_id', 'solution_id'],
|
|
142
142
|
},
|
|
143
143
|
},
|
|
144
|
+
{
|
|
145
|
+
name: 'generate_prototype',
|
|
146
|
+
description: 'Generate a prototype from a solution. This queues an async build — call get_prototype with the returned prototype_id to check when status changes to "ready". If a prototype already exists for the solution, returns it immediately.',
|
|
147
|
+
inputSchema: {
|
|
148
|
+
type: 'object',
|
|
149
|
+
properties: {
|
|
150
|
+
project_id: { type: 'string', description: 'The ID of the project.' },
|
|
151
|
+
solution_id: { type: 'string', description: 'The ID of the solution to generate a prototype from.' },
|
|
152
|
+
},
|
|
153
|
+
required: ['project_id', 'solution_id'],
|
|
154
|
+
},
|
|
155
|
+
},
|
|
144
156
|
{
|
|
145
157
|
name: 'get_prototypes',
|
|
146
158
|
description: 'List all prototypes for a Bifocal project. Returns name, status, published URL, parent prototype (for iteration chains), and linked solution if any. Ordered oldest to newest.',
|
|
@@ -359,6 +371,11 @@ Bifocal requires a Vite + React single-page app containing only the experience b
|
|
|
359
371
|
const solution = await getSolution(project_id, solution_id);
|
|
360
372
|
return { content: [{ type: 'text', text: JSON.stringify(solution, null, 2) }] };
|
|
361
373
|
}
|
|
374
|
+
if (name === 'generate_prototype') {
|
|
375
|
+
const { project_id, solution_id } = args;
|
|
376
|
+
const result = await generatePrototype(project_id, solution_id);
|
|
377
|
+
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
378
|
+
}
|
|
362
379
|
if (name === 'get_prototypes') {
|
|
363
380
|
const { project_id } = args;
|
|
364
381
|
const prototypes = await getPrototypes(project_id);
|