@deredex/mcp 0.0.0-stage → 0.4.0

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.
@@ -0,0 +1,53 @@
1
+ // Projects tools — list / get / create.
2
+ //
3
+ // Route shape mirrors the projects module in the backend
4
+ // (services/backend/modules/projects/module.go). Keep the input
5
+ // schemas tight — Claude's tool-selection accuracy improves when
6
+ // each field is described.
7
+ import { z } from "zod";
8
+ // -- list_projects ------------------------------------------------------
9
+ export const listProjectsInput = {
10
+ includeArchived: z
11
+ .boolean()
12
+ .optional()
13
+ .describe("Include archived projects (default false)."),
14
+ };
15
+ export async function listProjects(client, args) {
16
+ const params = new URLSearchParams();
17
+ if (args.includeArchived)
18
+ params.set("archived", "true");
19
+ const qs = params.toString();
20
+ const path = `/api/projects/projects${qs ? "?" + qs : ""}`;
21
+ const resp = await client.get(path);
22
+ return resp.items;
23
+ }
24
+ export const listProjectsDescription = "List projects in the current tenant. Returns id + name + description + color + owner + archived flag for each. Optionally include archived projects.";
25
+ // -- get_project --------------------------------------------------------
26
+ export const getProjectInput = {
27
+ id: z.string().uuid().describe("Project UUID."),
28
+ };
29
+ export async function getProject(client, args) {
30
+ return client.get(`/api/projects/projects/${encodeURIComponent(args.id)}`);
31
+ }
32
+ export const getProjectDescription = "Fetch a single project by UUID. Errors with 404 when the id doesn't exist in the current tenant.";
33
+ // -- create_project -----------------------------------------------------
34
+ export const createProjectInput = {
35
+ name: z
36
+ .string()
37
+ .min(1)
38
+ .max(200)
39
+ .describe("Project name — visible in every UI surface."),
40
+ description: z
41
+ .string()
42
+ .max(2000)
43
+ .optional()
44
+ .describe("Optional longer description."),
45
+ color: z
46
+ .string()
47
+ .optional()
48
+ .describe("Optional CSS color for the project label."),
49
+ };
50
+ export async function createProject(client, args) {
51
+ return client.post("/api/projects/projects", args);
52
+ }
53
+ export const createProjectDescription = "Create a new project. Name is required; description + color are optional.";
@@ -0,0 +1,175 @@
1
+ // Tasks tools — list / get / create / update / archive / kanban-move.
2
+ //
3
+ // These map onto the projects module's task endpoints. Every field
4
+ // in the schemas has a `.describe()` because Claude's tool-selection
5
+ // accuracy improves when the input surface is well-documented.
6
+ import { z } from "zod";
7
+ // -- list_tasks ---------------------------------------------------------
8
+ export const listTasksInput = {
9
+ projectId: z
10
+ .string()
11
+ .uuid()
12
+ .optional()
13
+ .describe("Restrict to a single project. Omit for tenant-wide list."),
14
+ status: z
15
+ .string()
16
+ .optional()
17
+ .describe("Filter by status (e.g. 'todo', 'in_progress', 'done'). Omit for all statuses."),
18
+ assigneeUserId: z
19
+ .string()
20
+ .uuid()
21
+ .optional()
22
+ .describe("Filter to tasks assigned to a specific user."),
23
+ includeArchived: z
24
+ .boolean()
25
+ .optional()
26
+ .describe("Include archived tasks (default false)."),
27
+ limit: z
28
+ .number()
29
+ .int()
30
+ .min(1)
31
+ .max(100)
32
+ .optional()
33
+ .describe("Cap on the number of tasks returned (default 25, max 100)."),
34
+ };
35
+ export async function listTasks(client, args) {
36
+ const params = new URLSearchParams();
37
+ if (args.status)
38
+ params.set("status", args.status);
39
+ if (args.assigneeUserId)
40
+ params.set("assigneeUserId", args.assigneeUserId);
41
+ if (args.includeArchived)
42
+ params.set("archived", "true");
43
+ if (args.limit)
44
+ params.set("limit", String(args.limit));
45
+ // Route: project-scoped or tenant-wide depending on projectId.
46
+ const basePath = args.projectId
47
+ ? `/api/projects/projects/${encodeURIComponent(args.projectId)}/tasks`
48
+ : `/api/projects/tasks`;
49
+ const qs = params.toString();
50
+ const path = `${basePath}${qs ? "?" + qs : ""}`;
51
+ const resp = await client.get(path);
52
+ return resp.items;
53
+ }
54
+ export const listTasksDescription = "List tasks, optionally filtered by project, status, or assignee. Default cap 25 tasks; ask for `limit` up to 100 if more are needed.";
55
+ // -- get_task -----------------------------------------------------------
56
+ export const getTaskInput = {
57
+ taskId: z.string().uuid().describe("Task UUID."),
58
+ };
59
+ export async function getTask(client, args) {
60
+ return client.get(`/api/projects/tasks/${encodeURIComponent(args.taskId)}`);
61
+ }
62
+ export const getTaskDescription = "Fetch a single task by UUID. Errors with 404 when the id doesn't exist in the current tenant.";
63
+ // -- create_task --------------------------------------------------------
64
+ export const createTaskInput = {
65
+ projectId: z
66
+ .string()
67
+ .uuid()
68
+ .describe("UUID of the project the task belongs to."),
69
+ title: z
70
+ .string()
71
+ .min(1)
72
+ .max(500)
73
+ .describe("Task title — one line, imperative form."),
74
+ description: z
75
+ .string()
76
+ .max(10000)
77
+ .optional()
78
+ .describe("Optional longer description in markdown."),
79
+ status: z
80
+ .string()
81
+ .optional()
82
+ .describe("Initial status (defaults to 'todo'). Common values: todo, in_progress, in_review, done."),
83
+ priority: z
84
+ .string()
85
+ .optional()
86
+ .describe("Priority label. Common values: low, normal, high, urgent."),
87
+ assigneeUserId: z
88
+ .string()
89
+ .uuid()
90
+ .optional()
91
+ .describe("Assign to a specific user by UUID."),
92
+ dueDate: z
93
+ .string()
94
+ .regex(/^\d{4}-\d{2}-\d{2}$/)
95
+ .optional()
96
+ .describe("Due date in ISO YYYY-MM-DD format."),
97
+ parentTaskId: z
98
+ .string()
99
+ .uuid()
100
+ .optional()
101
+ .describe("Optional parent task id to make this a subtask."),
102
+ };
103
+ export async function createTask(client, args) {
104
+ const { projectId, ...body } = args;
105
+ return client.post(`/api/projects/projects/${encodeURIComponent(projectId)}/tasks`, body);
106
+ }
107
+ export const createTaskDescription = "Create a new task inside a project. Only `projectId` + `title` are required; every other field is optional and defaults will be applied server-side.";
108
+ // -- update_task --------------------------------------------------------
109
+ export const updateTaskInput = {
110
+ taskId: z.string().uuid().describe("Task UUID to update."),
111
+ title: z
112
+ .string()
113
+ .min(1)
114
+ .max(500)
115
+ .optional()
116
+ .describe("New title."),
117
+ description: z.string().max(10000).optional().describe("New description."),
118
+ status: z
119
+ .string()
120
+ .optional()
121
+ .describe("New status. Common values: todo, in_progress, in_review, done."),
122
+ priority: z
123
+ .string()
124
+ .optional()
125
+ .describe("New priority. Common values: low, normal, high, urgent."),
126
+ assigneeUserId: z
127
+ .string()
128
+ .uuid()
129
+ .nullable()
130
+ .optional()
131
+ .describe("New assignee UUID, or null to clear the assignee."),
132
+ dueDate: z
133
+ .string()
134
+ .regex(/^\d{4}-\d{2}-\d{2}$/)
135
+ .nullable()
136
+ .optional()
137
+ .describe("New due date (YYYY-MM-DD) or null to clear it."),
138
+ projectId: z
139
+ .string()
140
+ .uuid()
141
+ .optional()
142
+ .describe("Move the task to a different project."),
143
+ };
144
+ export async function updateTask(client, args) {
145
+ const { taskId, ...body } = args;
146
+ return client.patch(`/api/projects/tasks/${encodeURIComponent(taskId)}`, body);
147
+ }
148
+ export const updateTaskDescription = "Partial-update a task. Only fields you supply are changed; omit fields to leave them alone. Send `null` for nullable fields (`assigneeUserId`, `dueDate`) to clear them.";
149
+ // -- kanban_move_task ---------------------------------------------------
150
+ export const kanbanMoveTaskInput = {
151
+ taskId: z.string().uuid().describe("Task UUID to move."),
152
+ status: z
153
+ .string()
154
+ .describe("Target column status (e.g. 'in_progress', 'done')."),
155
+ position: z
156
+ .number()
157
+ .int()
158
+ .min(0)
159
+ .optional()
160
+ .describe("Zero-based ordering within the target column. Omit to append at the end."),
161
+ };
162
+ export async function kanbanMoveTask(client, args) {
163
+ const { taskId, ...body } = args;
164
+ return client.patch(`/api/projects/tasks/${encodeURIComponent(taskId)}/kanban-move`, body);
165
+ }
166
+ export const kanbanMoveTaskDescription = "Move a task on the kanban board — change its status column and optionally its position within that column. Use this instead of update_task when reordering; the ordering math is server-side and non-obvious.";
167
+ // -- archive_task -------------------------------------------------------
168
+ export const archiveTaskInput = {
169
+ taskId: z.string().uuid().describe("Task UUID to archive."),
170
+ };
171
+ export async function archiveTask(client, args) {
172
+ await client.del(`/api/projects/tasks/${encodeURIComponent(args.taskId)}`);
173
+ return { archived: true };
174
+ }
175
+ export const archiveTaskDescription = "Soft-archive a task. The row remains in the database (visible via `list_tasks` with `includeArchived: true`) so this is reversible via update_task with archived=false.";
@@ -0,0 +1,23 @@
1
+ // whoami — sanity-check tool. Hits GET /api/auth/me on the backend
2
+ // and returns the caller identity + tenant. Every operator's first
3
+ // use of the MCP server tries this to confirm MCP_BASE_URL +
4
+ // MCP_TOKEN are wired correctly.
5
+ import { z } from "zod";
6
+ // Input: none. MCP tools with no arguments still declare an empty
7
+ // zod raw shape so the SDK can generate the JSON Schema entry.
8
+ export const whoamiInput = {};
9
+ export async function whoami(client) {
10
+ const me = await client.get("/api/auth/me");
11
+ return {
12
+ identity: `${me.name} <${me.email}>`,
13
+ tenant: me.tenantSlug ?? me.tenantId,
14
+ admin: me.isAdmin ?? false,
15
+ };
16
+ }
17
+ // Utility so the entry point can register the tool with a stable
18
+ // description string.
19
+ export const whoamiDescription = "Return the identity of the token holder and their tenant. Call this first to confirm the MCP server is configured correctly.";
20
+ // The zod input shape is exported so registerTool can hand it to the
21
+ // SDK unchanged. Placeholder to satisfy TypeScript when the zod
22
+ // module is treeshaken.
23
+ export const _z = z;
package/package.json CHANGED
@@ -1,6 +1,36 @@
1
1
  {
2
2
  "name": "@deredex/mcp",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.4.0",
4
+ "description": "MCP server that exposes the platform REST API as typed tools for Claude Code and other MCP clients",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "bin": {
8
+ "deredex-mcp": "dist/index.js",
9
+ "shd-esp-mcp": "dist/index.js"
10
+ },
11
+ "files": [
12
+ "dist",
13
+ "README.md"
14
+ ],
15
+ "scripts": {
16
+ "build": "tsc",
17
+ "dev": "tsx src/index.ts",
18
+ "test": "node --test --import tsx tests/*.test.ts",
19
+ "prepublishOnly": "npm run build"
20
+ },
21
+ "engines": {
22
+ "node": ">=18"
23
+ },
24
+ "dependencies": {
25
+ "@modelcontextprotocol/sdk": "^1.0.0",
26
+ "zod": "^3.22.4"
27
+ },
28
+ "devDependencies": {
29
+ "@types/node": "^20.11.0",
30
+ "tsx": "^4.7.0",
31
+ "typescript": "^5.3.0"
32
+ },
33
+ "publishConfig": {
34
+ "access": "public"
35
+ }
36
+ }