devglow-mcp 0.1.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 +15 -3
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -173,12 +173,17 @@ server.registerTool("run_process", {
|
|
|
173
173
|
name: z.string().describe("Display name for the process"),
|
|
174
174
|
path: z.string().describe("Working directory (supports ~/)"),
|
|
175
175
|
command: z.string().describe("Shell command to execute"),
|
|
176
|
-
port: z
|
|
176
|
+
port: z
|
|
177
|
+
.number()
|
|
178
|
+
.optional()
|
|
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."),
|
|
177
180
|
},
|
|
178
181
|
}, async ({ name, path, command, port }) => {
|
|
179
|
-
|
|
182
|
+
// Auto-detect port from command if not explicitly provided
|
|
183
|
+
const resolvedPort = port ?? detectPortFromCommand(command);
|
|
184
|
+
await runProcess(name, path, command, resolvedPort, "claude");
|
|
180
185
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
181
|
-
const text = `AI process "${name}" started.\nCommand: ${command}\nPath: ${path}${
|
|
186
|
+
const text = `AI process "${name}" started.\nCommand: ${command}\nPath: ${path}${resolvedPort ? `\nPort: ${resolvedPort}` : ""}`;
|
|
182
187
|
return { content: [{ type: "text", text }] };
|
|
183
188
|
});
|
|
184
189
|
// ── Tool: stop_process ──
|
|
@@ -197,6 +202,13 @@ server.registerTool("stop_process", {
|
|
|
197
202
|
};
|
|
198
203
|
});
|
|
199
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
|
+
}
|
|
200
212
|
function checkPort(port) {
|
|
201
213
|
return new Promise((resolve) => {
|
|
202
214
|
const { createConnection } = require("net");
|