cc_site_maker / cursor-server.js
postApocalebtic
DeepSite CLone
a336e20
Raw History Blame
1.09 kB
// cursor-client.js
class DeepSiteClient {
constructor(mcpServerUrl, apiKey) {
this.serverUrl = mcpServerUrl;
this.apiKey = apiKey;
}
async generateComponent(prompt, options = {}) {
try {
const response = await fetch(`${this.serverUrl}/generate`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${this.apiKey}`
},
body: JSON.stringify({
prompt,
componentType: options.componentType || 'component',
framework: options.framework || 'react'
})
});
if (!response.ok) {
const errorData = await response.json();
throw new Error(errorData.error || 'Failed to generate component');
}
return await response.json();
} catch (error) {
console.error('Generation error:', error);
throw error;
}
}
async checkStatus() {
const response = await fetch(`${this.serverUrl}/status`);
return await response.json();
}
}
// Export for use in Cursor
export default DeepSiteClient;