devglow-mcp 0.2.0 → 0.2.1
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/build/index.js +11 -2
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -179,9 +179,11 @@ server.registerTool("run_process", {
|
|
|
179
179
|
.describe("Port number the process will listen on. Check package.json scripts or config files for --port flags. Important for DevGlow to show the correct port badge."),
|
|
180
180
|
},
|
|
181
181
|
}, async ({ name, path, command, port }) => {
|
|
182
|
-
|
|
182
|
+
// Auto-detect port from command if not explicitly provided
|
|
183
|
+
const resolvedPort = port ?? detectPortFromCommand(command);
|
|
184
|
+
await runProcess(name, path, command, resolvedPort, "claude");
|
|
183
185
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
184
|
-
const text = `AI process "${name}" started.\nCommand: ${command}\nPath: ${path}${
|
|
186
|
+
const text = `AI process "${name}" started.\nCommand: ${command}\nPath: ${path}${resolvedPort ? `\nPort: ${resolvedPort}` : ""}`;
|
|
185
187
|
return { content: [{ type: "text", text }] };
|
|
186
188
|
});
|
|
187
189
|
// ── Tool: stop_process ──
|
|
@@ -200,6 +202,13 @@ server.registerTool("stop_process", {
|
|
|
200
202
|
};
|
|
201
203
|
});
|
|
202
204
|
// ── Utility ──
|
|
205
|
+
function detectPortFromCommand(command) {
|
|
206
|
+
// Match patterns: --port 3000, --port=3000, -p 3000, -p=3000
|
|
207
|
+
const match = command.match(/(?:--port|--PORT|-p)[\s=](\d{2,5})/);
|
|
208
|
+
if (match)
|
|
209
|
+
return parseInt(match[1], 10);
|
|
210
|
+
return undefined;
|
|
211
|
+
}
|
|
203
212
|
function checkPort(port) {
|
|
204
213
|
return new Promise((resolve) => {
|
|
205
214
|
const { createConnection } = require("net");
|