agent-planner-mcp 0.6.1 → 0.6.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-planner-mcp",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "MCP server for AgentPlanner — AI agent orchestration with planning, dependencies, knowledge graphs, and human oversight",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/api-client.js CHANGED
@@ -552,45 +552,47 @@ const goals = {
552
552
  return response.data;
553
553
  },
554
554
 
555
- updateMetrics: async (goalId, metrics) => {
556
- const response = await apiClient.put(`/goals/${goalId}/metrics`, { metrics });
557
- return response.data;
558
- },
559
-
560
555
  delete: async (goalId) => {
561
556
  const response = await apiClient.delete(`/goals/${goalId}`);
562
557
  return response.data;
563
558
  },
564
-
559
+
565
560
  linkPlan: async (goalId, planId) => {
566
- const response = await apiClient.post(`/goals/${goalId}/plans/${planId}`);
561
+ const response = await apiClient.post(`/goals/${goalId}/links`, {
562
+ linkedType: 'plan', linkedId: planId
563
+ });
567
564
  return response.data;
568
565
  },
569
-
566
+
570
567
  unlinkPlan: async (goalId, planId) => {
571
- const response = await apiClient.delete(`/goals/${goalId}/plans/${planId}`);
568
+ const goal = await apiClient.get(`/goals/${goalId}`);
569
+ const link = (goal.data.links || []).find(
570
+ l => l.linkedType === 'plan' && l.linkedId === planId
571
+ );
572
+ if (!link) return { success: false, message: 'Link not found' };
573
+ const response = await apiClient.delete(`/goals/${goalId}/links/${link.id}`);
572
574
  return response.data;
573
575
  },
574
576
 
575
577
  // v2 goal-dependency endpoints
576
578
  getPath: async (goalId, maxDepth) => {
577
579
  const params = maxDepth ? `?max_depth=${maxDepth}` : '';
578
- const response = await apiClient.get(`/goals/v2/${goalId}/path${params}`);
580
+ const response = await apiClient.get(`/goals/${goalId}/path${params}`);
579
581
  return response.data;
580
582
  },
581
583
 
582
584
  getProgress: async (goalId) => {
583
- const response = await apiClient.get(`/goals/v2/${goalId}/progress`);
585
+ const response = await apiClient.get(`/goals/${goalId}/progress`);
584
586
  return response.data;
585
587
  },
586
588
 
587
589
  listAchievers: async (goalId) => {
588
- const response = await apiClient.get(`/goals/v2/${goalId}/achievers`);
590
+ const response = await apiClient.get(`/goals/${goalId}/achievers`);
589
591
  return response.data;
590
592
  },
591
593
 
592
594
  addAchiever: async (goalId, sourceNodeId, weight) => {
593
- const response = await apiClient.post(`/goals/v2/${goalId}/achievers`, {
595
+ const response = await apiClient.post(`/goals/${goalId}/achievers`, {
594
596
  source_node_id: sourceNodeId,
595
597
  weight: weight ?? 1,
596
598
  });
@@ -598,17 +600,17 @@ const goals = {
598
600
  },
599
601
 
600
602
  removeAchiever: async (goalId, depId) => {
601
- const response = await apiClient.delete(`/goals/v2/${goalId}/achievers/${depId}`);
603
+ const response = await apiClient.delete(`/goals/${goalId}/achievers/${depId}`);
602
604
  return response.data;
603
605
  },
604
606
 
605
607
  getKnowledgeGaps: async (goalId) => {
606
- const response = await apiClient.get(`/goals/v2/${goalId}/knowledge-gaps`);
608
+ const response = await apiClient.get(`/goals/${goalId}/knowledge-gaps`);
607
609
  return response.data;
608
610
  },
609
611
 
610
612
  getDashboard: async () => {
611
- const response = await apiClient.get('/goals/v2/dashboard');
613
+ const response = await apiClient.get('/goals/dashboard');
612
614
  return response.data;
613
615
  },
614
616
  };
@@ -866,17 +868,21 @@ function createApiClient(token) {
866
868
  get: async (goalId) => (await client.get(`/goals/${goalId}`)).data,
867
869
  create: async (data) => (await client.post('/goals', data)).data,
868
870
  update: async (goalId, data) => (await client.put(`/goals/${goalId}`, data)).data,
869
- updateMetrics: async (goalId, metrics) => (await client.put(`/goals/${goalId}/metrics`, { metrics })).data,
870
871
  delete: async (goalId) => (await client.delete(`/goals/${goalId}`)).data,
871
- linkPlan: async (goalId, planId) => (await client.post(`/goals/${goalId}/plans/${planId}`)).data,
872
- unlinkPlan: async (goalId, planId) => (await client.delete(`/goals/${goalId}/plans/${planId}`)).data,
873
- getPath: async (goalId, maxDepth) => { const p = maxDepth ? `?max_depth=${maxDepth}` : ''; return (await client.get(`/goals/v2/${goalId}/path${p}`)).data; },
874
- getProgress: async (goalId) => (await client.get(`/goals/v2/${goalId}/progress`)).data,
875
- listAchievers: async (goalId) => (await client.get(`/goals/v2/${goalId}/achievers`)).data,
876
- addAchiever: async (goalId, sourceNodeId, weight) => (await client.post(`/goals/v2/${goalId}/achievers`, { source_node_id: sourceNodeId, weight: weight ?? 1 })).data,
877
- removeAchiever: async (goalId, depId) => (await client.delete(`/goals/v2/${goalId}/achievers/${depId}`)).data,
878
- getKnowledgeGaps: async (goalId) => (await client.get(`/goals/v2/${goalId}/knowledge-gaps`)).data,
879
- getDashboard: async () => (await client.get('/goals/v2/dashboard')).data,
872
+ linkPlan: async (goalId, planId) => (await client.post(`/goals/${goalId}/links`, { linkedType: 'plan', linkedId: planId })).data,
873
+ unlinkPlan: async (goalId, planId) => {
874
+ const goal = await client.get(`/goals/${goalId}`);
875
+ const link = (goal.data.links || []).find(l => l.linkedType === 'plan' && l.linkedId === planId);
876
+ if (!link) return { success: false, message: 'Link not found' };
877
+ return (await client.delete(`/goals/${goalId}/links/${link.id}`)).data;
878
+ },
879
+ getPath: async (goalId, maxDepth) => { const p = maxDepth ? `?max_depth=${maxDepth}` : ''; return (await client.get(`/goals/${goalId}/path${p}`)).data; },
880
+ getProgress: async (goalId) => (await client.get(`/goals/${goalId}/progress`)).data,
881
+ listAchievers: async (goalId) => (await client.get(`/goals/${goalId}/achievers`)).data,
882
+ addAchiever: async (goalId, sourceNodeId, weight) => (await client.post(`/goals/${goalId}/achievers`, { source_node_id: sourceNodeId, weight: weight ?? 1 })).data,
883
+ removeAchiever: async (goalId, depId) => (await client.delete(`/goals/${goalId}/achievers/${depId}`)).data,
884
+ getKnowledgeGaps: async (goalId) => (await client.get(`/goals/${goalId}/knowledge-gaps`)).data,
885
+ getDashboard: async () => (await client.get('/goals/dashboard')).data,
880
886
  },
881
887
  context: {
882
888
  getNodeContext: async (nodeId, options = {}) => {
package/src/index.js CHANGED
@@ -42,12 +42,9 @@ async function main() {
42
42
  console.error(`MCP Server Name: ${process.env.MCP_SERVER_NAME || 'planning-system-mcp'}`);
43
43
  console.error(`MCP Server Version: ${process.env.MCP_SERVER_VERSION || version}`);
44
44
 
45
- // Validate required environment variables
46
- if (!userApiToken) {
47
- throw new Error('USER_API_TOKEN environment variable is required. Please generate one from the Agent Planner UI and set it in .env file.');
48
- }
49
-
50
45
  if (transport === 'http') {
46
+ // HTTP mode: tokens come from the Authorization header on each request
47
+ // No USER_API_TOKEN needed — per-session clients are created in server-http.js
51
48
  // HTTP/SSE transport mode
52
49
  const httpServer = new MCPHTTPServer({
53
50
  port: process.env.PORT || 3100,
@@ -69,7 +66,11 @@ async function main() {
69
66
  process.exit(0);
70
67
  });
71
68
  } else {
72
- // Stdio transport mode (default)
69
+ // Stdio transport mode (default) — requires USER_API_TOKEN since there's no HTTP request
70
+ if (!userApiToken) {
71
+ throw new Error('USER_API_TOKEN environment variable is required for stdio mode. Please generate one from the Agent Planner UI and set it in .env file.');
72
+ }
73
+
73
74
  const server = new Server({
74
75
  name: process.env.MCP_SERVER_NAME || "planning-system-mcp",
75
76
  version: process.env.MCP_SERVER_VERSION || version
package/src/tools.js CHANGED
@@ -858,21 +858,10 @@ function setupTools(server, apiClientOverride) {
858
858
  organization_id: { type: "string", description: "Organization ID" },
859
859
  title: { type: "string", description: "Goal title" },
860
860
  description: { type: "string", description: "Goal description" },
861
- success_metrics: {
862
- type: "array",
863
- description: "Success metrics array [{metric, target, current, unit}]",
864
- items: {
865
- type: "object",
866
- properties: {
867
- metric: { type: "string" },
868
- target: { type: "number" },
869
- current: { type: "number" },
870
- unit: { type: "string" }
871
- }
872
- }
873
- },
874
- time_horizon: { type: "string", description: "Target date (ISO format)" },
875
- github_repo_url: { type: "string", description: "Related GitHub repo URL" }
861
+ type: { type: "string", enum: ["outcome", "constraint", "metric", "principle"], description: "Goal type (default: outcome)" },
862
+ success_criteria: { type: "object", description: "Success criteria as JSON" },
863
+ priority: { type: "number", description: "Priority (higher = more important, default: 0)" },
864
+ parent_goal_id: { type: "string", description: "Parent goal ID for hierarchy" }
876
865
  },
877
866
  required: ["organization_id", "title"]
878
867
  }
@@ -886,13 +875,15 @@ function setupTools(server, apiClientOverride) {
886
875
  goal_id: { type: "string", description: "Goal ID" },
887
876
  title: { type: "string", description: "New title" },
888
877
  description: { type: "string", description: "New description" },
889
- status: {
890
- type: "string",
878
+ type: { type: "string", enum: ["outcome", "constraint", "metric", "principle"], description: "Goal type" },
879
+ status: {
880
+ type: "string",
891
881
  description: "New status",
892
- enum: ["active", "achieved", "at_risk", "abandoned"]
882
+ enum: ["active", "achieved", "paused", "abandoned"]
893
883
  },
894
- success_metrics: { type: "array", description: "Updated metrics" },
895
- time_horizon: { type: "string", description: "New target date" }
884
+ success_criteria: { type: "object", description: "Success criteria as JSON" },
885
+ priority: { type: "number", description: "Priority (higher = more important)" },
886
+ parent_goal_id: { type: "string", description: "Parent goal ID for hierarchy" }
896
887
  },
897
888
  required: ["goal_id"]
898
889
  }
@@ -2036,20 +2027,24 @@ function setupTools(server, apiClientOverride) {
2036
2027
  }
2037
2028
 
2038
2029
  if (name === "create_goal") {
2039
- const { organization_id, title, description, success_metrics, time_horizon, github_repo_url } = args;
2030
+ const { organization_id, title, description, type, success_criteria, priority, parent_goal_id } = args;
2040
2031
  const result = await apiClient.goals.create({
2041
2032
  organization_id,
2042
2033
  title,
2043
2034
  description,
2044
- success_metrics,
2045
- time_horizon,
2046
- github_repo_url
2035
+ type: type || 'outcome',
2036
+ successCriteria: success_criteria || null,
2037
+ priority: priority || 0,
2038
+ parentGoalId: parent_goal_id || null,
2047
2039
  });
2048
2040
  return formatResponse(result);
2049
2041
  }
2050
2042
 
2051
2043
  if (name === "update_goal") {
2052
- const { goal_id, ...updateData } = args;
2044
+ const { goal_id, parent_goal_id, success_criteria, ...rest } = args;
2045
+ const updateData = { ...rest };
2046
+ if (parent_goal_id !== undefined) updateData.parentGoalId = parent_goal_id;
2047
+ if (success_criteria !== undefined) updateData.successCriteria = success_criteria;
2053
2048
  const result = await apiClient.goals.update(goal_id, updateData);
2054
2049
  return formatResponse(result);
2055
2050
  }