@aithr-ai/mcp-server 1.0.3 → 1.0.5

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 (2) hide show
  1. package/index.js +34 -70
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1146,12 +1146,12 @@ class MCPServer {
1146
1146
  };
1147
1147
 
1148
1148
  try {
1149
- const result = await this.apiCall(
1150
- `/workspaces/${config.workspaceSlug}/projects/${projectId}/canvas/nodes`,
1149
+ const result = await this.mcpApiCall(
1150
+ `/mcp/projects/${projectId}/canvas/nodes`,
1151
1151
  'POST',
1152
1152
  nodeData
1153
1153
  );
1154
- return { success: true, nodeId: result.id, message: `Added ${agentType} agent`, node: result };
1154
+ return { success: true, nodeId: result.nodeId || result.node?.id, message: `Added ${agentType} agent`, node: result.node };
1155
1155
  } catch (e) {
1156
1156
  // Check if it's a tier restriction
1157
1157
  if (e.message.includes('403') || e.message.includes('Pro tier')) {
@@ -1170,8 +1170,8 @@ class MCPServer {
1170
1170
  const projectId = config.projectId;
1171
1171
 
1172
1172
  try {
1173
- await this.apiCall(
1174
- `/workspaces/${config.workspaceSlug}/projects/${projectId}/canvas/nodes/${nodeId}`,
1173
+ await this.mcpApiCall(
1174
+ `/mcp/projects/${projectId}/canvas/nodes/${nodeId}`,
1175
1175
  'DELETE'
1176
1176
  );
1177
1177
  return { success: true, message: `Removed node ${nodeId}` };
@@ -1213,77 +1213,41 @@ class MCPServer {
1213
1213
  return { error: 'No project ID configured. Set AETHER_PROJECT_ID environment variable.' };
1214
1214
  }
1215
1215
 
1216
- try {
1217
- // The generate endpoint returns SSE (Server-Sent Events), so we need to handle it specially
1218
- const url = `${config.aetherUrl}/api/workspaces/${config.workspaceSlug}/projects/${projectId}/agents/${nodeId}/generate`;
1219
- const headers = {
1220
- 'Content-Type': 'application/json',
1221
- };
1222
-
1223
- if (config.apiKey) {
1224
- headers['Authorization'] = `Bearer ${config.apiKey}`;
1225
- }
1226
-
1227
- const response = await fetch(url, {
1228
- method: 'POST',
1229
- headers,
1230
- body: JSON.stringify({ context }),
1231
- });
1232
-
1233
- if (!response.ok) {
1234
- const errorText = await response.text();
1235
- throw new Error(`API error: ${response.status} - ${errorText}`);
1236
- }
1216
+ if (!nodeId) {
1217
+ return { error: 'nodeId is required' };
1218
+ }
1237
1219
 
1238
- // Read SSE stream and collect events
1239
- const reader = response.body.getReader();
1240
- const decoder = new TextDecoder();
1241
- let buffer = '';
1242
- let lastEvent = null;
1243
- let artifactId = null;
1244
- let sessionId = null;
1245
- let error = null;
1246
-
1247
- while (true) {
1248
- const { done, value } = await reader.read();
1249
- if (done) break;
1250
-
1251
- buffer += decoder.decode(value, { stream: true });
1252
-
1253
- // Parse SSE events from buffer
1254
- const lines = buffer.split('\n');
1255
- buffer = lines.pop() || ''; // Keep incomplete line in buffer
1256
-
1257
- for (const line of lines) {
1258
- if (line.startsWith('event: ')) {
1259
- lastEvent = line.slice(7).trim();
1260
- } else if (line.startsWith('data: ')) {
1261
- try {
1262
- const data = JSON.parse(line.slice(6));
1263
-
1264
- if (lastEvent === 'generation_complete') {
1265
- artifactId = data.artifactId;
1266
- sessionId = data.sessionId;
1267
- } else if (lastEvent === 'error') {
1268
- error = data.error || 'Generation failed';
1269
- }
1270
- } catch {
1271
- // Ignore JSON parse errors for partial data
1272
- }
1273
- }
1220
+ try {
1221
+ // Use MCP endpoint with API key auth (non-streaming, waits for completion)
1222
+ const result = await this.mcpApiCall(
1223
+ `/mcp/projects/${projectId}/generate`,
1224
+ 'POST',
1225
+ {
1226
+ nodeId,
1227
+ context: context || undefined,
1228
+ previewLength: 500,
1274
1229
  }
1275
- }
1276
-
1277
- if (error) {
1278
- return { success: false, error };
1279
- }
1230
+ );
1280
1231
 
1281
1232
  return {
1282
1233
  success: true,
1283
1234
  message: 'Generation completed',
1284
- artifactId,
1285
- sessionId,
1286
- hint: artifactId
1235
+ node: result.node,
1236
+ generation: {
1237
+ status: result.generation?.status,
1238
+ preview: result.generation?.preview,
1239
+ hasMore: result.generation?.hasMore,
1240
+ duration: result.generation?.duration,
1241
+ },
1242
+ artifact: result.artifact
1243
+ ? {
1244
+ id: result.artifact.id,
1245
+ title: result.artifact.title,
1246
+ type: result.artifact.type,
1247
+ }
1248
+ : null,
1249
+ usage: result.usage,
1250
+ hint: result.artifact?.id
1287
1251
  ? 'Use aether_extract_files to extract code from the artifact, then aether_push_artifacts to push to GitHub.'
1288
1252
  : undefined,
1289
1253
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aithr-ai/mcp-server",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "MCP server to connect Claude Code to Aether canvas - AI-powered team workspace for software development",
5
5
  "main": "index.js",
6
6
  "bin": {