@agent-plan/mcp 0.2.7 → 0.2.10

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AA0vBA,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAItD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAgyBA,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAItD"}
package/dist/index.js CHANGED
@@ -6,6 +6,7 @@ import { join } from "node:path";
6
6
  import { existsSync } from "node:fs";
7
7
  import { pathToFileURL } from "node:url";
8
8
  import { PlanStore, ExportService, withFeatureLock, needsMotivation } from "@agent-plan/core";
9
+ import { serve } from "@agent-plan/server";
9
10
  import { createChecklistItemId, createFeatureId, createPhaseId, createTaskId, normalizeSlug } from "@agent-plan/core/naming";
10
11
  const STATUS_VALUES = ["planned", "in-progress", "done", "blocked", "canceled", "rejected", "deferred", "waiting"];
11
12
  const PHASE_STATUS_VALUES = ["draft", "discovery", ...STATUS_VALUES];
@@ -29,6 +30,9 @@ async function requireStore() {
29
30
  throw new Error(`No .planner/ found at ${st.root}. Use planner-init first.`);
30
31
  return st;
31
32
  }
33
+ // In-process web server handle, managed by the planner-web tool. Lives as long
34
+ // as this MCP stdio process (i.e. the host session). Null when not running.
35
+ let webHandle = null;
32
36
  function findFeatureByRef(features, ref) {
33
37
  const normalized = ref.trim().toLowerCase();
34
38
  return features.find((feature) => feature.id.toLowerCase() === normalized)
@@ -754,11 +758,45 @@ server.registerTool("planner-handoff-clear", {
754
758
  return text("Deleted .planner/HANDOFF.md");
755
759
  });
756
760
  server.registerTool("planner-web", {
757
- description: "Planner web command placeholder for MCP stdio. Use plan-server CLI directly for now.",
761
+ description: "Manage the planner web dashboard (start/status/stop) from MCP stdio. Runs an in-process HTTP+WS server bound to LAN; it lives as long as this MCP process. plan-root comes from AGENT_PLAN_ROOT or cwd()/.planner.",
758
762
  inputSchema: {
759
763
  action: z.enum(["start", "stop", "status"]).default("status"),
760
764
  },
761
- }, async ({ action }) => text(`planner-web ${action}: MCP stdio package does not manage the web server yet. Use \`pnpm --filter @agent-plan/server build\` and the plan-server CLI, or Pi /planner web ${action}.`));
765
+ }, async ({ action }) => {
766
+ if (action === "start") {
767
+ if (webHandle) {
768
+ return text(`planner-web already running: ${webHandle.localUrl}${webHandle.lanUrl ? ` — LAN: ${webHandle.lanUrl}` : ""} (mode: ${webHandle.mode})`);
769
+ }
770
+ const root = planRoot();
771
+ const storeCheck = new PlanStore(root);
772
+ if (!(await storeCheck.exists())) {
773
+ return text(`planner-web start: no .planner/ found at ${root}. Run planner-init first.`);
774
+ }
775
+ try {
776
+ // port: 0 → OS assigns a free port (no conflict with plan-server CLI / Pi).
777
+ // host: 0.0.0.0 → bind LAN (reachable from other devices), like Pi /planner load.
778
+ webHandle = await serve({ planRoot: root, host: "0.0.0.0", port: 0, quiet: true });
779
+ return text(`planner-web started: ${webHandle.localUrl}${webHandle.lanUrl ? ` — LAN: ${webHandle.lanUrl}` : ""} (mode: ${webHandle.mode})`);
780
+ }
781
+ catch (err) {
782
+ webHandle = null;
783
+ return text(`planner-web start failed: ${err.message}`);
784
+ }
785
+ }
786
+ if (action === "stop") {
787
+ if (!webHandle)
788
+ return text("planner-web not running.");
789
+ const stoppedUrl = webHandle.localUrl;
790
+ await webHandle.close().catch(() => { });
791
+ webHandle = null;
792
+ return text(`planner-web stopped (was ${stoppedUrl}).`);
793
+ }
794
+ // status
795
+ if (webHandle) {
796
+ return text(`planner-web running: ${webHandle.localUrl}${webHandle.lanUrl ? ` — LAN: ${webHandle.lanUrl}` : ""} (mode: ${webHandle.mode}, bindHost: ${webHandle.bindHost})`);
797
+ }
798
+ return text("planner-web not running. Use planner-web with action=start to start the dashboard.");
799
+ });
762
800
  server.registerTool("planner-load", {
763
801
  description: "MCP no-op equivalent of Pi /planner load. MCP server is already loaded when tools are available.",
764
802
  }, async () => text("Planner MCP server is loaded."));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-plan/mcp",
3
- "version": "0.2.7",
3
+ "version": "0.2.10",
4
4
  "private": false,
5
5
  "description": "MCP server for Agent Plan, exposing planner-* tools over stdio.",
6
6
  "license": "MIT",
@@ -41,7 +41,8 @@
41
41
  "dependencies": {
42
42
  "@modelcontextprotocol/sdk": "^1.17.0",
43
43
  "zod": "^3.24.0",
44
- "@agent-plan/core": "0.2.7"
44
+ "@agent-plan/core": "0.2.10",
45
+ "@agent-plan/server": "0.2.10"
45
46
  },
46
47
  "scripts": {
47
48
  "build": "tsc -p tsconfig.json",