Spaces:
Sleeping
Sleeping
Bot commited on
Commit ·
1870e0e
1
Parent(s): c90481f
Bake loop-engineering into Dockerfile and auto-rewrite config paths
Browse files- Dockerfile +7 -0
- src/components/mcp-editor.tsx +13 -2
Dockerfile
CHANGED
|
@@ -32,8 +32,15 @@ ENV NEXT_TELEMETRY_DISABLED=1
|
|
| 32 |
|
| 33 |
RUN apk add --no-cache git bash
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
RUN addgroup --system --gid 1001 nodejs
|
| 36 |
RUN adduser --system --uid 1001 nextjs
|
|
|
|
| 37 |
|
| 38 |
COPY --from=builder /app/public ./public
|
| 39 |
|
|
|
|
| 32 |
|
| 33 |
RUN apk add --no-cache git bash
|
| 34 |
|
| 35 |
+
# Clone and build loop-engineering MCP server permanently in the image
|
| 36 |
+
RUN git clone https://github.com/cobusgreyling/loop-engineering.git /app/loop-engineering && \
|
| 37 |
+
cd /app/loop-engineering/tools/mcp-server && \
|
| 38 |
+
npm install && \
|
| 39 |
+
npm run build
|
| 40 |
+
|
| 41 |
RUN addgroup --system --gid 1001 nodejs
|
| 42 |
RUN adduser --system --uid 1001 nextjs
|
| 43 |
+
RUN chown -R nextjs:nodejs /app/loop-engineering
|
| 44 |
|
| 45 |
COPY --from=builder /app/public ./public
|
| 46 |
|
src/components/mcp-editor.tsx
CHANGED
|
@@ -78,6 +78,17 @@ const getMcpServersFromObject = (obj: any): Record<string, MCPServerConfig> | nu
|
|
| 78 |
return allValid ? servers : null;
|
| 79 |
};
|
| 80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
export default function MCPEditor({
|
| 82 |
initialConfig,
|
| 83 |
name: initialName,
|
|
@@ -181,7 +192,7 @@ export default function MCPEditor({
|
|
| 181 |
method: "POST",
|
| 182 |
body: JSON.stringify({
|
| 183 |
name: srvName,
|
| 184 |
-
config: srvConfig,
|
| 185 |
}),
|
| 186 |
});
|
| 187 |
}
|
|
@@ -227,7 +238,7 @@ export default function MCPEditor({
|
|
| 227 |
method: "POST",
|
| 228 |
body: JSON.stringify({
|
| 229 |
name,
|
| 230 |
-
config,
|
| 231 |
id,
|
| 232 |
}),
|
| 233 |
}),
|
|
|
|
| 78 |
return allValid ? servers : null;
|
| 79 |
};
|
| 80 |
|
| 81 |
+
// Helper to rewrite temp path to permanent path for loop-engineering
|
| 82 |
+
const rewriteConfigPaths = (cfg: any): any => {
|
| 83 |
+
try {
|
| 84 |
+
let str = JSON.stringify(cfg);
|
| 85 |
+
str = str.replace(/\/tmp\/loop-eng\/loop-engineering/g, "/app/loop-engineering");
|
| 86 |
+
return JSON.parse(str);
|
| 87 |
+
} catch {
|
| 88 |
+
return cfg;
|
| 89 |
+
}
|
| 90 |
+
};
|
| 91 |
+
|
| 92 |
export default function MCPEditor({
|
| 93 |
initialConfig,
|
| 94 |
name: initialName,
|
|
|
|
| 192 |
method: "POST",
|
| 193 |
body: JSON.stringify({
|
| 194 |
name: srvName,
|
| 195 |
+
config: rewriteConfigPaths(srvConfig),
|
| 196 |
}),
|
| 197 |
});
|
| 198 |
}
|
|
|
|
| 238 |
method: "POST",
|
| 239 |
body: JSON.stringify({
|
| 240 |
name,
|
| 241 |
+
config: rewriteConfigPaths(config),
|
| 242 |
id,
|
| 243 |
}),
|
| 244 |
}),
|