@aithr-ai/mcp-server 1.0.11 → 1.0.12
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/index.js +66 -15
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -483,6 +483,10 @@ class MCPServer {
|
|
|
483
483
|
type: 'string',
|
|
484
484
|
description: 'Directory to clone the repository into (default: system temp directory)',
|
|
485
485
|
},
|
|
486
|
+
useGeneratedFiles: {
|
|
487
|
+
type: 'boolean',
|
|
488
|
+
description: 'Use files from generatedFiles table (saved by aether_extract_batch). Recommended for large artifact sets (700+ files) to avoid buffer overflow.',
|
|
489
|
+
},
|
|
486
490
|
},
|
|
487
491
|
},
|
|
488
492
|
},
|
|
@@ -1793,6 +1797,7 @@ class MCPServer {
|
|
|
1793
1797
|
pushToMain = false, // Push directly to main/master instead of feature branch
|
|
1794
1798
|
autoClone = true, // Auto-clone repo if not found locally
|
|
1795
1799
|
cloneDir, // Directory to clone into (default: temp dir)
|
|
1800
|
+
useGeneratedFiles = false, // Use files from generatedFiles table (saved by extract_batch)
|
|
1796
1801
|
} = args;
|
|
1797
1802
|
|
|
1798
1803
|
const projectId = config.projectId;
|
|
@@ -1800,30 +1805,76 @@ class MCPServer {
|
|
|
1800
1805
|
return { error: 'No project ID configured. Set AETHER_PROJECT_ID environment variable.' };
|
|
1801
1806
|
}
|
|
1802
1807
|
|
|
1803
|
-
const { execSync } = require('child_process');
|
|
1808
|
+
const { execSync, spawnSync } = require('child_process');
|
|
1804
1809
|
const fs = require('fs');
|
|
1805
1810
|
const path = require('path');
|
|
1806
1811
|
const os = require('os');
|
|
1807
1812
|
|
|
1808
1813
|
try {
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1814
|
+
let files = [];
|
|
1815
|
+
let repoInfo = null;
|
|
1816
|
+
|
|
1817
|
+
if (useGeneratedFiles) {
|
|
1818
|
+
// Use files from generatedFiles table (populated by aether_extract_batch)
|
|
1819
|
+
// This avoids the large response from push-artifacts
|
|
1820
|
+
const generatedData = await this.mcpApiCall(
|
|
1821
|
+
`/mcp/projects/${projectId}/push-artifacts`,
|
|
1822
|
+
'POST',
|
|
1823
|
+
{
|
|
1824
|
+
artifactIds,
|
|
1825
|
+
branchName: pushToMain ? undefined : branchName,
|
|
1826
|
+
useGeneratedFiles: true, // Tell API to use generatedFiles table
|
|
1827
|
+
exportFiles: false, // Don't export file contents in response
|
|
1828
|
+
}
|
|
1829
|
+
);
|
|
1830
|
+
|
|
1831
|
+
repoInfo = generatedData.repository;
|
|
1832
|
+
|
|
1833
|
+
// Fetch files in batches from generatedFiles API
|
|
1834
|
+
let batch = 0;
|
|
1835
|
+
const batchSize = 50;
|
|
1836
|
+
let hasMore = true;
|
|
1837
|
+
|
|
1838
|
+
while (hasMore) {
|
|
1839
|
+
const batchData = await this.mcpApiCall(
|
|
1840
|
+
`/mcp/projects/${projectId}/generated-files?batch=${batch}&batchSize=${batchSize}`,
|
|
1841
|
+
'GET'
|
|
1842
|
+
);
|
|
1843
|
+
|
|
1844
|
+
if (batchData.files && batchData.files.length > 0) {
|
|
1845
|
+
files = files.concat(batchData.files);
|
|
1846
|
+
}
|
|
1847
|
+
|
|
1848
|
+
hasMore = batchData.hasMore || false;
|
|
1849
|
+
batch++;
|
|
1850
|
+
|
|
1851
|
+
// Safety limit
|
|
1852
|
+
if (batch > 100) break;
|
|
1818
1853
|
}
|
|
1819
|
-
|
|
1854
|
+
} else {
|
|
1855
|
+
// Original behavior: Export files from backend (may cause buffer overflow for large sets)
|
|
1856
|
+
const exportData = await this.mcpApiCall(
|
|
1857
|
+
`/mcp/projects/${projectId}/push-artifacts`,
|
|
1858
|
+
'POST',
|
|
1859
|
+
{
|
|
1860
|
+
artifactIds,
|
|
1861
|
+
branchName: pushToMain ? undefined : branchName,
|
|
1862
|
+
exportFiles: true, // Get full file contents for local git
|
|
1863
|
+
}
|
|
1864
|
+
);
|
|
1865
|
+
|
|
1866
|
+
if (exportData.files) {
|
|
1867
|
+
files = exportData.files;
|
|
1868
|
+
}
|
|
1869
|
+
repoInfo = exportData.repository;
|
|
1870
|
+
}
|
|
1820
1871
|
|
|
1821
|
-
if (!
|
|
1822
|
-
return { error: 'No files to push
|
|
1872
|
+
if (!files || files.length === 0) {
|
|
1873
|
+
return { error: 'No files to push. Try running aether_extract_batch first with saveToDatabase=true, then use useGeneratedFiles=true' };
|
|
1823
1874
|
}
|
|
1824
1875
|
|
|
1825
|
-
|
|
1826
|
-
const
|
|
1876
|
+
// Limit response size by not including all files in response
|
|
1877
|
+
const filesForResponse = files.slice(0, 20).map(f => f.path);
|
|
1827
1878
|
|
|
1828
1879
|
if (!repoInfo || !repoInfo.fullName) {
|
|
1829
1880
|
return { error: 'No repository linked to this project. Link a GitHub repository in Project Settings.' };
|