@mentagen/mcp 0.8.4 → 0.8.5

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,23 +1,30 @@
1
- const NODE_COLORS = [
2
- { name: 'amber', rgb: 'rgb(253, 230, 138)' },
3
- { name: 'blue', rgb: 'rgb(0, 120, 255)' },
4
- { name: 'cyan', rgb: 'rgb(0, 231, 255)' },
5
- { name: 'emerald', rgb: 'rgb(0, 230, 118)' },
6
- { name: 'fuchsia', rgb: 'rgb(233, 30, 99)' },
7
- { name: 'green', rgb: 'rgb(52, 211, 153)' },
8
- { name: 'indigo', rgb: 'rgb(72, 77, 201)' },
9
- { name: 'lime', rgb: 'rgb(209, 250, 229)' },
10
- { name: 'orange', rgb: 'rgb(252, 165, 0)' },
11
- { name: 'pink', rgb: 'rgb(244, 143, 177)' },
12
- { name: 'purple', rgb: 'rgb(156, 39, 176)' },
13
- { name: 'red', rgb: 'rgb(239, 68, 68)' },
14
- { name: 'rose', rgb: 'rgb(255, 204, 203)' },
15
- { name: 'sky', rgb: 'rgb(0, 184, 230)' },
16
- { name: 'slate', rgb: 'rgb(107, 114, 128)' },
17
- { name: 'teal', rgb: 'rgb(0, 210, 183)' },
18
- { name: 'violet', rgb: 'rgb(123, 31, 162)' },
19
- { name: 'yellow', rgb: 'rgb(255, 251, 235)' },
20
- ];
1
+ import { VALID_NODE_COLORS } from '../utils/colors.js';
2
+ /** RGB values for node colors, keyed by color name. */
3
+ const COLOR_RGB = {
4
+ amber: 'rgb(253, 230, 138)',
5
+ blue: 'rgb(0, 120, 255)',
6
+ cyan: 'rgb(0, 231, 255)',
7
+ emerald: 'rgb(0, 230, 118)',
8
+ fuchsia: 'rgb(233, 30, 99)',
9
+ green: 'rgb(52, 211, 153)',
10
+ indigo: 'rgb(72, 77, 201)',
11
+ lime: 'rgb(209, 250, 229)',
12
+ orange: 'rgb(252, 165, 0)',
13
+ pink: 'rgb(244, 143, 177)',
14
+ purple: 'rgb(156, 39, 176)',
15
+ red: 'rgb(239, 68, 68)',
16
+ rose: 'rgb(255, 204, 203)',
17
+ sky: 'rgb(0, 184, 230)',
18
+ slate: 'rgb(107, 114, 128)',
19
+ teal: 'rgb(0, 210, 183)',
20
+ violet: 'rgb(123, 31, 162)',
21
+ yellow: 'rgb(255, 251, 235)',
22
+ };
23
+ /** Derive from VALID_NODE_COLORS so the resource stays in sync. */
24
+ const NODE_COLORS = VALID_NODE_COLORS.map(name => ({
25
+ name,
26
+ rgb: COLOR_RGB[name] ?? '',
27
+ }));
21
28
  /**
22
29
  * Supported node types with their default colors.
23
30
  *
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { nodeColorSchema } from '../utils/colors.js';
2
3
  import { formatError } from '../utils/errors.js';
3
4
  import { unitsToPixels } from '../utils/units.js';
4
5
  import { snapToGrid } from './grid-calc.js';
@@ -19,7 +20,7 @@ const nodeUpdateSchema = z.object({
19
20
  content: z.string().optional().describe('New content for the node'),
20
21
  code: z.string().optional().describe('Code content for code-type nodes'),
21
22
  url: z.string().optional().describe('URL for url-type nodes'),
22
- color: z.string().optional().describe('Node color'),
23
+ color: nodeColorSchema.optional().describe('Node color'),
23
24
  x: z.coerce.number().optional().describe('X position in grid units'),
24
25
  y: z.coerce.number().optional().describe('Y position in grid units'),
25
26
  width: z.coerce.number().optional().describe('Node width in grid units'),
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { nodeColorSchema } from '../utils/colors.js';
2
3
  import { formatError } from '../utils/errors.js';
3
4
  import { pixelsToUnits, unitsToPixels } from '../utils/units.js';
4
5
  import { applyExtension, generateId, normalizeTodos } from './create.js';
@@ -25,7 +26,7 @@ const nodeInputSchema = z.object({
25
26
  .optional()
26
27
  .default('markdown')
27
28
  .describe('Node type'),
28
- color: z.string().optional().describe('Node color'),
29
+ color: nodeColorSchema.optional().describe('Node color'),
29
30
  x: z.coerce.number().optional().describe('X position in grid units'),
30
31
  y: z.coerce.number().optional().describe('Y position in grid units'),
31
32
  width: z.coerce.number().optional().describe('Width in grid units'),
@@ -1,5 +1,6 @@
1
1
  import { randomUUID } from 'crypto';
2
2
  import { z } from 'zod';
3
+ import { nodeColorSchema } from '../utils/colors.js';
3
4
  import { formatError } from '../utils/errors.js';
4
5
  import { pixelsToUnits, unitsToPixels } from '../utils/units.js';
5
6
  import { getNodeUrl } from '../utils/urls.js';
@@ -62,8 +63,7 @@ export const createSchema = z.object({
62
63
  .optional()
63
64
  .default('markdown')
64
65
  .describe('Node type: markdown (default), code, or url'),
65
- color: z
66
- .string()
66
+ color: nodeColorSchema
67
67
  .optional()
68
68
  .describe('Optional color override. If not specified, uses default for type (markdown=cyan, code=indigo, url=blue)'),
69
69
  x: z.coerce
@@ -2,6 +2,7 @@
2
2
  // Using raw objects like { method: 'tools/list' } causes "Schema is missing
3
3
  // a method literal" errors because the SDK validates against ZodLiteral types.
4
4
  import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
5
+ import { VALID_NODE_COLORS } from '../utils/colors.js';
5
6
  import { batchUpdateSchema, handleBatchUpdate } from './batch-update.js';
6
7
  import { boardsSchema, handleBoards } from './boards.js';
7
8
  import { checkCollisionSchema, handleCheckCollision, } from './check-collision.js';
@@ -279,6 +280,7 @@ export function registerTools(server, client, config) {
279
280
  },
280
281
  color: {
281
282
  type: 'string',
283
+ enum: [...VALID_NODE_COLORS],
282
284
  description: 'Optional color override. If not specified, uses default for type (markdown=cyan, code=indigo)',
283
285
  },
284
286
  x: {
@@ -344,6 +346,7 @@ export function registerTools(server, client, config) {
344
346
  },
345
347
  color: {
346
348
  type: 'string',
349
+ enum: [...VALID_NODE_COLORS],
347
350
  description: 'Node color name (see mentagen://colors resource for available colors)',
348
351
  },
349
352
  x: {
@@ -407,7 +410,11 @@ export function registerTools(server, client, config) {
407
410
  nodeId: { type: 'string', description: 'The node ID' },
408
411
  name: { type: 'string', description: 'New name' },
409
412
  content: { type: 'string', description: 'New content' },
410
- color: { type: 'string', description: 'Node color' },
413
+ color: {
414
+ type: 'string',
415
+ enum: [...VALID_NODE_COLORS],
416
+ description: 'Node color',
417
+ },
411
418
  x: {
412
419
  type: 'number',
413
420
  description: 'X position in grid units (1 unit = 16px)',
@@ -559,7 +566,11 @@ export function registerTools(server, client, config) {
559
566
  enum: ['text', 'markdown', 'code', 'url'],
560
567
  description: 'Node type (default: text).',
561
568
  },
562
- color: { type: 'string', description: 'Node color' },
569
+ color: {
570
+ type: 'string',
571
+ enum: [...VALID_NODE_COLORS],
572
+ description: 'Node color',
573
+ },
563
574
  x: {
564
575
  type: 'number',
565
576
  description: 'X position in grid units (1 unit = 16px)',
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { NodeType } from '../client/types.js';
3
+ import { nodeColorSchema } from '../utils/colors.js';
3
4
  import { formatError } from '../utils/errors.js';
4
5
  import { pixelsToUnits, unitsToPixels } from '../utils/units.js';
5
6
  import { snapToGrid } from './grid-calc.js';
@@ -40,8 +41,7 @@ export const updateSchema = z.object({
40
41
  .string()
41
42
  .optional()
42
43
  .describe('The URL for url-type nodes (e.g., https://example.com). Only for type="url".'),
43
- color: z
44
- .string()
44
+ color: nodeColorSchema
45
45
  .optional()
46
46
  .describe('Node color name (use mentagen_colors to see available colors)'),
47
47
  x: z.coerce.number().optional().describe('X position in grid units'),
@@ -0,0 +1,27 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Valid node color names matching the Mongoose schema enum (BaseColor).
4
+ * Keep in sync with: src/common/constants/color.ts
5
+ */
6
+ export const VALID_NODE_COLORS = [
7
+ 'amber',
8
+ 'blue',
9
+ 'cyan',
10
+ 'emerald',
11
+ 'fuchsia',
12
+ 'green',
13
+ 'indigo',
14
+ 'lime',
15
+ 'orange',
16
+ 'pink',
17
+ 'purple',
18
+ 'red',
19
+ 'rose',
20
+ 'sky',
21
+ 'slate',
22
+ 'teal',
23
+ 'violet',
24
+ 'yellow',
25
+ ];
26
+ /** Zod schema for validating node colors against the Mongoose enum. */
27
+ export const nodeColorSchema = z.enum(VALID_NODE_COLORS);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mentagen/mcp",
3
- "version": "0.8.4",
3
+ "version": "0.8.5",
4
4
  "description": "MCP server for Mentagen knowledge base integration with Cursor",
5
5
  "type": "module",
6
6
  "bin": "dist/index.js",