@mentagen/mcp 0.3.0 → 0.4.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.
@@ -142,6 +142,12 @@ export class MentagenClient {
142
142
  async updateBoard(params) {
143
143
  return this.call('boards.update', params);
144
144
  }
145
+ /**
146
+ * Soft-delete a board.
147
+ */
148
+ async deleteBoard(params) {
149
+ await this.call('boards.deleteBoard', params);
150
+ }
145
151
  /**
146
152
  * Add an edge between two nodes.
147
153
  */
package/dist/index.js CHANGED
File without changes
@@ -48,10 +48,11 @@ export const createSchema = z.object({
48
48
  .string()
49
49
  .optional()
50
50
  .describe('File extension to append to name (e.g., ".ts", ".py"). Only applies to code nodes. Defaults to .js.'),
51
- content: z
51
+ content: z.string().optional().describe('Content for text/markdown nodes.'),
52
+ code: z
52
53
  .string()
53
54
  .optional()
54
- .describe('Content for text/markdown nodes. Use "url" field for url-type nodes.'),
55
+ .describe('Code content for code-type nodes. Takes precedence over content.'),
55
56
  url: z
56
57
  .string()
57
58
  .optional()
@@ -105,7 +106,7 @@ function buildNodeFields(params, color, position) {
105
106
  ...position,
106
107
  };
107
108
  if (params.type === 'code') {
108
- nodeFields.code = params.content || '';
109
+ nodeFields.code = params.code ?? params.content ?? '';
109
110
  }
110
111
  else if (params.type === 'url') {
111
112
  if (!params.url) {
@@ -4,6 +4,9 @@ export const deleteSchema = z.object({
4
4
  boardId: z.string().describe('The board ID containing the node'),
5
5
  nodeId: z.string().describe('The node ID to delete'),
6
6
  });
7
+ export const deleteBoardSchema = z.object({
8
+ boardId: z.string().describe('The board ID to delete'),
9
+ });
7
10
  export async function handleDelete(client, params) {
8
11
  try {
9
12
  await client.deleteNode({
@@ -34,3 +37,32 @@ export async function handleDelete(client, params) {
34
37
  };
35
38
  }
36
39
  }
40
+ export async function handleDeleteBoard(client, params) {
41
+ try {
42
+ await client.deleteBoard({
43
+ boardId: params.boardId,
44
+ });
45
+ return {
46
+ content: [
47
+ {
48
+ type: 'text',
49
+ text: JSON.stringify({
50
+ success: true,
51
+ message: 'Board deleted successfully. This is a soft delete and can be undone in Mentagen.',
52
+ }, null, 2),
53
+ },
54
+ ],
55
+ };
56
+ }
57
+ catch (error) {
58
+ return {
59
+ content: [
60
+ {
61
+ type: 'text',
62
+ text: `Failed to delete board: ${formatError(error)}`,
63
+ },
64
+ ],
65
+ isError: true,
66
+ };
67
+ }
68
+ }
@@ -10,7 +10,7 @@ import { createSchema, handleCreate } from './create.js';
10
10
  import { createBoardSchema, handleCreateBoard } from './create-board.js';
11
11
  import { createEdgeSchema, handleCreateEdge } from './create-edge.js';
12
12
  import { createGraphSchema, handleCreateGraph } from './create-graph.js';
13
- import { deleteSchema, handleDelete } from './delete.js';
13
+ import { deleteBoardSchema, deleteSchema, handleDelete, handleDeleteBoard, } from './delete.js';
14
14
  import { deleteEdgeSchema, handleDeleteEdge } from './delete-edge.js';
15
15
  import { extractBoardContentSchema, handleExtractBoardContent, } from './extract-board-content.js';
16
16
  import { findOverlapsSchema, handleFindOverlaps } from './find-overlaps.js';
@@ -89,6 +89,20 @@ export function registerTools(server, client, config) {
89
89
  required: ['boardId', 'name'],
90
90
  },
91
91
  },
92
+ {
93
+ name: 'mentagen_delete_board',
94
+ description: 'Delete a board from Mentagen. CAUTION: Be extra careful when using this tool - verify the board ID and confirm with the user before deleting. This is a soft delete and can be undone in the app, but all nodes and edges in the board will be affected.',
95
+ inputSchema: {
96
+ type: 'object',
97
+ properties: {
98
+ boardId: {
99
+ type: 'string',
100
+ description: 'The board ID to delete',
101
+ },
102
+ },
103
+ required: ['boardId'],
104
+ },
105
+ },
92
106
  // Node tools
93
107
  {
94
108
  name: 'mentagen_list_nodes',
@@ -272,7 +286,7 @@ export function registerTools(server, client, config) {
272
286
  },
273
287
  {
274
288
  name: 'mentagen_update_node',
275
- description: 'Update an existing node in Mentagen. When name changes, size auto-adjusts unless explicit width/height provided. Returns the final position and size.',
289
+ description: 'Update an existing node in Mentagen. When name changes, size auto-adjusts unless explicit width/height provided. Can also move nodes between boards using targetBoardId. Returns the final position and size.',
276
290
  inputSchema: {
277
291
  type: 'object',
278
292
  properties: {
@@ -284,6 +298,10 @@ export function registerTools(server, client, config) {
284
298
  type: 'string',
285
299
  description: 'The node ID to update',
286
300
  },
301
+ targetBoardId: {
302
+ type: 'string',
303
+ description: 'Move node to a different board. Preserves type and all properties.',
304
+ },
287
305
  name: {
288
306
  type: 'string',
289
307
  description: 'New name for the node',
@@ -871,6 +889,10 @@ export function registerTools(server, client, config) {
871
889
  const params = updateBoardSchema.parse(args);
872
890
  return handleUpdateBoard(client, params, config.mentagenUrl);
873
891
  },
892
+ mentagen_delete_board: async (args) => {
893
+ const params = deleteBoardSchema.parse(args);
894
+ return handleDeleteBoard(client, params);
895
+ },
874
896
  // Node handlers
875
897
  mentagen_list_nodes: async (args) => {
876
898
  const params = listNodesSchema.parse(args);
@@ -6,11 +6,16 @@ import { calculateNodeSize } from './size-calc.js';
6
6
  export const updateSchema = z.object({
7
7
  boardId: z.string().describe('The board ID containing the node'),
8
8
  nodeId: z.string().describe('The node ID to update'),
9
+ targetBoardId: z
10
+ .string()
11
+ .optional()
12
+ .describe('Move node to a different board. Provide the target board ID to move the node while preserving its type and properties.'),
9
13
  name: z.string().optional().describe('New name for the node'),
10
- content: z
14
+ content: z.string().optional().describe('Content for text/markdown nodes.'),
15
+ code: z
11
16
  .string()
12
17
  .optional()
13
- .describe('Content for text/markdown nodes. Use "url" field for url-type nodes.'),
18
+ .describe('Code content for code-type nodes. Takes precedence over content.'),
14
19
  url: z
15
20
  .string()
16
21
  .optional()
@@ -46,8 +51,11 @@ const POSITION_FIELDS = ['x', 'y', 'width', 'height'];
46
51
  * Add content fields to update data based on node type.
47
52
  */
48
53
  function addContentFields(data, params, nodeType) {
49
- if (nodeType === NodeType.Code && params.content !== undefined) {
50
- data.code = params.content;
54
+ if (nodeType === NodeType.Code) {
55
+ const codeContent = params.code ?? params.content;
56
+ if (codeContent !== undefined) {
57
+ data.code = codeContent;
58
+ }
51
59
  }
52
60
  else if (nodeType === NodeType.URL) {
53
61
  if (params.url !== undefined) {
@@ -71,6 +79,8 @@ function buildUpdateData(params, nodeType) {
71
79
  data.name = params.name;
72
80
  if (params.color !== undefined)
73
81
  data.color = params.color;
82
+ if (params.targetBoardId !== undefined)
83
+ data.board = params.targetBoardId;
74
84
  addContentFields(data, params, nodeType);
75
85
  for (const field of POSITION_FIELDS) {
76
86
  const value = params[field];
@@ -130,7 +140,7 @@ export async function handleUpdate(client, params) {
130
140
  content: [
131
141
  {
132
142
  type: 'text',
133
- text: `At least one field to update must be provided (name, content, url, color, x, y, width, height).`,
143
+ text: `At least one field to update must be provided (name, content, url, color, x, y, width, height, targetBoardId).`,
134
144
  },
135
145
  ],
136
146
  isError: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mentagen/mcp",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "MCP server for Mentagen knowledge base integration with Cursor",
5
5
  "type": "module",
6
6
  "bin": "dist/index.js",