@ycadence/mcp 0.0.0-stage → 0.1.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.
Files changed (4) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +70 -2
  3. package/dist/bin.js +414 -0
  4. package/package.json +50 -4
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 Yarlis, Inc.
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,71 @@
1
- # Temporary Holding Version
1
+ # @ycadence/mcp
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A [Model Context Protocol](https://modelcontextprotocol.io) server for YCadence. It lets
4
+ an AI agent list, read, create and update work items, and read states and cycles. It
5
+ speaks JSON-RPC over stdio.
6
+
7
+ ## Tools
8
+
9
+ | Tool | What it does |
10
+ |---|---|
11
+ | `ycadence_list_work_items` | List work items in a project, optionally filtered |
12
+ | `ycadence_get_work_item` | Read one work item |
13
+ | `ycadence_create_work_item` | Create a work item |
14
+ | `ycadence_update_work_item` | Change a work item's state, priority, title and so on |
15
+ | `ycadence_list_states` | The project's workflow states |
16
+ | `ycadence_list_cycles` | The project's cycles |
17
+
18
+ The older `devpulse_*` names are still registered, as deprecated aliases, for one release.
19
+
20
+ ## Use with Claude Code
21
+
22
+ ```sh
23
+ claude mcp add ycadence \
24
+ -e YCADENCE_URL=https://ycadence.example.com \
25
+ -e YCADENCE_API_KEY=yc_live_p_... \
26
+ -- npx -y @ycadence/mcp
27
+ ```
28
+
29
+ ## Use with any MCP client
30
+
31
+ ```json
32
+ {
33
+ "mcpServers": {
34
+ "ycadence": {
35
+ "command": "npx",
36
+ "args": ["-y", "@ycadence/mcp"],
37
+ "env": {
38
+ "YCADENCE_URL": "https://ycadence.example.com",
39
+ "YCADENCE_API_KEY": "yc_live_p_..."
40
+ }
41
+ }
42
+ }
43
+ }
44
+ ```
45
+
46
+ The package installs two commands that behave the same: `ycadence-mcp`, and
47
+ `devpulse-mcp`, the name from before the rename. For an instance behind Google IAP,
48
+ also set `YCADENCE_IDENTITY_TOKEN`. It lasts about an hour, so restart the server
49
+ when it expires. When a `YCADENCE_*` variable is unset, the server reads the older
50
+ `DEVPULSE_*` name instead.
51
+
52
+ Requires Node 18 or later. The package is self-contained and installs no other packages.
53
+
54
+ ## If npm is unavailable
55
+
56
+ Each release is mirrored to GitHub Packages when the npm publish fails, as
57
+ `@yarlisaisolutions/ycadence-mcp`. It needs a GitHub token with `read:packages`:
58
+
59
+ ```sh
60
+ # ~/.npmrc
61
+ @yarlisaisolutions:registry=https://npm.pkg.github.com
62
+ //npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
63
+ ```
64
+
65
+ ```sh
66
+ npx -y @yarlisaisolutions/ycadence-mcp
67
+ ```
68
+
69
+ ## License
70
+
71
+ Apache-2.0
package/dist/bin.js ADDED
@@ -0,0 +1,414 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/bin.ts
4
+ import { createInterface } from "node:readline";
5
+
6
+ // ../core/src/env.ts
7
+ var ENV_PREFIX = "YCADENCE_";
8
+ var LEGACY_ENV_PREFIX = "DEVPULSE_";
9
+ function processEnv() {
10
+ const candidate = globalThis.process;
11
+ return candidate?.env ?? {};
12
+ }
13
+ function readEnv(name, env = processEnv()) {
14
+ const current = env[`${ENV_PREFIX}${name}`];
15
+ if (current !== undefined && current !== "")
16
+ return current;
17
+ const legacy = env[`${LEGACY_ENV_PREFIX}${name}`];
18
+ if (legacy !== undefined && legacy !== "")
19
+ return legacy;
20
+ return;
21
+ }
22
+
23
+ // ../sdk/src/client.ts
24
+ class YCadenceError extends Error {
25
+ status;
26
+ code;
27
+ issues;
28
+ constructor(status, code, message, issues) {
29
+ super(message);
30
+ this.status = status;
31
+ this.code = code;
32
+ this.issues = issues;
33
+ this.name = "YCadenceError";
34
+ }
35
+ get retryable() {
36
+ return this.status === 429 || this.status >= 500;
37
+ }
38
+ }
39
+
40
+ class YCadenceClient {
41
+ baseUrl;
42
+ apiKey;
43
+ identityToken;
44
+ timeoutMs;
45
+ doFetch;
46
+ constructor(options) {
47
+ this.baseUrl = options.baseUrl.replace(/\/+$/, "");
48
+ this.apiKey = options.apiKey;
49
+ this.identityToken = options.identityToken;
50
+ this.timeoutMs = options.timeoutMs ?? 30000;
51
+ this.doFetch = options.fetch ?? globalThis.fetch;
52
+ }
53
+ async health() {
54
+ return this.request("GET", "/api/health");
55
+ }
56
+ async listWorkItems(projectId, options = {}) {
57
+ const query = new URLSearchParams;
58
+ if (options.filter !== undefined)
59
+ query.set("filter", JSON.stringify(options.filter));
60
+ if (options.limit !== undefined)
61
+ query.set("limit", String(options.limit));
62
+ if (options.cursor !== undefined)
63
+ query.set("cursor", options.cursor);
64
+ return this.request("GET", `/api/v1/projects/${projectId}/work-items?${query}`);
65
+ }
66
+ async* iterateWorkItems(projectId, options = {}) {
67
+ let cursor;
68
+ do {
69
+ const page = await this.listWorkItems(projectId, {
70
+ filter: options.filter,
71
+ limit: options.pageSize ?? 100,
72
+ cursor
73
+ });
74
+ for (const item of page.items)
75
+ yield item;
76
+ cursor = page.nextCursor ?? undefined;
77
+ } while (cursor !== undefined);
78
+ }
79
+ async createWorkItem(projectId, body) {
80
+ return this.request("POST", `/api/v1/projects/${projectId}/work-items`, body);
81
+ }
82
+ async getWorkItem(workItemId) {
83
+ return this.request("GET", `/api/v1/work-items/${workItemId}`);
84
+ }
85
+ async updateWorkItem(workItemId, body) {
86
+ return this.request("PATCH", `/api/v1/work-items/${workItemId}`, body);
87
+ }
88
+ async deleteWorkItem(workItemId) {
89
+ await this.request("DELETE", `/api/v1/work-items/${workItemId}`);
90
+ }
91
+ async listStates(projectId) {
92
+ return this.request("GET", `/api/v1/projects/${projectId}/states`);
93
+ }
94
+ async listLabels(projectId) {
95
+ return this.request("GET", `/api/v1/projects/${projectId}/labels`);
96
+ }
97
+ async listCycles(projectId) {
98
+ return this.request("GET", `/api/v1/projects/${projectId}/cycles`);
99
+ }
100
+ async previewImport(projectId, body) {
101
+ return this.request("POST", `/api/v1/projects/${projectId}/imports/preview`, body);
102
+ }
103
+ async startImport(projectId, body) {
104
+ return this.request("POST", `/api/v1/projects/${projectId}/imports`, body);
105
+ }
106
+ async getImport(runId) {
107
+ return this.request("GET", `/api/v1/imports/${runId}`);
108
+ }
109
+ async listImports(projectId) {
110
+ return this.request("GET", `/api/v1/projects/${projectId}/imports`);
111
+ }
112
+ async listViews(projectId) {
113
+ return this.request("GET", `/api/v1/projects/${projectId}/views`);
114
+ }
115
+ async request(method, path, body) {
116
+ const controller = new AbortController;
117
+ const timer = setTimeout(() => controller.abort(), this.timeoutMs);
118
+ let response;
119
+ try {
120
+ const identityToken = typeof this.identityToken === "function" ? await this.identityToken() : this.identityToken;
121
+ response = await this.doFetch(`${this.baseUrl}${path}`, {
122
+ method,
123
+ headers: {
124
+ "x-api-key": this.apiKey,
125
+ ...identityToken === undefined || identityToken.length === 0 ? {} : { Authorization: `Bearer ${identityToken}` },
126
+ ...body === undefined ? {} : { "Content-Type": "application/json" }
127
+ },
128
+ body: body === undefined ? undefined : JSON.stringify(body),
129
+ signal: controller.signal
130
+ });
131
+ } catch (error) {
132
+ if (error instanceof Error && error.name === "AbortError") {
133
+ throw new YCadenceError(408, "timeout", `${method} ${path} timed out after ${this.timeoutMs}ms.`);
134
+ }
135
+ throw new YCadenceError(0, "network_error", `Could not reach ${this.baseUrl}: ${error instanceof Error ? error.message : "unknown error"}`);
136
+ } finally {
137
+ clearTimeout(timer);
138
+ }
139
+ if (response.status === 204)
140
+ return;
141
+ const text = await response.text();
142
+ const parsed = text.length === 0 ? undefined : safeJson(text);
143
+ if (!response.ok) {
144
+ const failure = parsed ?? {};
145
+ throw new YCadenceError(response.status, failure.code ?? "unknown", failure.error ?? `${method} ${path} failed with ${response.status}.`, failure.issues);
146
+ }
147
+ return parsed;
148
+ }
149
+ }
150
+ function safeJson(text) {
151
+ try {
152
+ return JSON.parse(text);
153
+ } catch {
154
+ return;
155
+ }
156
+ }
157
+ // src/tools.ts
158
+ var projectId = {
159
+ type: "string",
160
+ description: "The project id. Ask the user if you do not have one."
161
+ };
162
+ var TOOLS = [
163
+ {
164
+ name: "ycadence_list_work_items",
165
+ description: "List work items in a project, optionally filtered. Use this before creating anything, " + "to check whether the work already exists.",
166
+ inputSchema: {
167
+ type: "object",
168
+ properties: {
169
+ projectId,
170
+ filter: {
171
+ type: "object",
172
+ description: 'A filter expression, e.g. {"field":"priority","operator":"is","value":"urgent"} or ' + '{"all":[{"field":"assignee","operator":"isNull"},{"field":"archived","operator":"is","value":false}]}. ' + "Fields: state, stateGroup, priority, assignee, label, cycle, module, parent, " + "startDate, targetDate, createdAt, updatedAt, completedAt, name, archived."
173
+ },
174
+ limit: { type: "number", description: "Maximum items to return. Defaults to 50." }
175
+ },
176
+ required: ["projectId"]
177
+ },
178
+ handler: async (client, args) => {
179
+ const page = await client.listWorkItems(String(args.projectId), {
180
+ filter: args.filter,
181
+ limit: typeof args.limit === "number" ? args.limit : 50
182
+ });
183
+ if (page.items.length === 0)
184
+ return "No work items matched.";
185
+ const lines = page.items.map((item) => `${item.key} ${item.name} [${item.priority}]${item.assigneeIds.length > 0 ? ` (${item.assigneeIds.length} assignee)` : ""}`);
186
+ if (page.nextCursor !== null)
187
+ lines.push(`… more available (cursor: ${page.nextCursor})`);
188
+ return lines.join(`
189
+ `);
190
+ }
191
+ },
192
+ {
193
+ name: "ycadence_get_work_item",
194
+ description: "Read one work item in full, including its description.",
195
+ inputSchema: {
196
+ type: "object",
197
+ properties: { workItemId: { type: "string", description: "The work item id." } },
198
+ required: ["workItemId"]
199
+ },
200
+ handler: async (client, args) => {
201
+ const item = await client.getWorkItem(String(args.workItemId));
202
+ return [
203
+ `${item.key} ${item.name}`,
204
+ `priority: ${item.priority}`,
205
+ `state: ${item.stateId ?? "none"}`,
206
+ `assignees: ${item.assigneeIds.length}`,
207
+ "",
208
+ item.description ?? "(no description)"
209
+ ].join(`
210
+ `);
211
+ }
212
+ },
213
+ {
214
+ name: "ycadence_create_work_item",
215
+ description: "Create a work item. Check with ycadence_list_work_items first — filing a duplicate is " + "worse than asking.",
216
+ inputSchema: {
217
+ type: "object",
218
+ properties: {
219
+ projectId,
220
+ name: { type: "string", description: "A short, specific title." },
221
+ description: { type: "string", description: "Optional detail, plain text." },
222
+ priority: {
223
+ type: "string",
224
+ enum: ["urgent", "high", "medium", "low", "none"],
225
+ description: "Defaults to none. Do not guess urgent."
226
+ }
227
+ },
228
+ required: ["projectId", "name"]
229
+ },
230
+ handler: async (client, args) => {
231
+ const created = await client.createWorkItem(String(args.projectId), {
232
+ name: String(args.name),
233
+ description: args.description === undefined ? undefined : String(args.description),
234
+ priority: args.priority
235
+ });
236
+ return `Created ${created.key}: ${created.name}`;
237
+ }
238
+ },
239
+ {
240
+ name: "ycadence_update_work_item",
241
+ description: "Change a work item’s title, description, priority or state.",
242
+ inputSchema: {
243
+ type: "object",
244
+ properties: {
245
+ workItemId: { type: "string" },
246
+ name: { type: "string" },
247
+ description: { type: "string" },
248
+ priority: { type: "string", enum: ["urgent", "high", "medium", "low", "none"] },
249
+ stateId: { type: "string", description: "From ycadence_list_states." }
250
+ },
251
+ required: ["workItemId"]
252
+ },
253
+ handler: async (client, args) => {
254
+ const { workItemId, ...rest } = args;
255
+ const body = Object.fromEntries(Object.entries(rest).filter(([, value]) => value !== undefined));
256
+ if (Object.keys(body).length === 0) {
257
+ return "Nothing to update. Provide at least one field.";
258
+ }
259
+ const updated = await client.updateWorkItem(String(workItemId), body);
260
+ return `Updated ${updated.key}.`;
261
+ }
262
+ },
263
+ {
264
+ name: "ycadence_list_states",
265
+ description: "List a project’s workflow states. Needed before moving a work item.",
266
+ inputSchema: { type: "object", properties: { projectId }, required: ["projectId"] },
267
+ handler: async (client, args) => {
268
+ const { states } = await client.listStates(String(args.projectId));
269
+ return states.map((state) => `${state.id} ${state.name} (${state.group})`).join(`
270
+ `);
271
+ }
272
+ },
273
+ {
274
+ name: "ycadence_list_cycles",
275
+ description: "List a project’s cycles and their status.",
276
+ inputSchema: { type: "object", properties: { projectId }, required: ["projectId"] },
277
+ handler: async (client, args) => {
278
+ const { cycles } = await client.listCycles(String(args.projectId));
279
+ if (cycles.length === 0)
280
+ return "No cycles.";
281
+ return cycles.map((cycle) => `${cycle.id} ${cycle.name} [${cycle.status}]`).join(`
282
+ `);
283
+ }
284
+ }
285
+ ];
286
+ var LEGACY_TOOLS = TOOLS.map((tool) => ({
287
+ ...tool,
288
+ name: tool.name.replace(/^ycadence_/, "devpulse_"),
289
+ description: `Deprecated: use ${tool.name}, which this is an alias of. ${tool.description}`
290
+ }));
291
+ var ALL_TOOLS = [...TOOLS, ...LEGACY_TOOLS];
292
+ async function runTool(client, name, args) {
293
+ const tool = ALL_TOOLS.find((candidate) => candidate.name === name);
294
+ if (tool === undefined) {
295
+ return { text: `No such tool: ${name}.`, isError: true };
296
+ }
297
+ for (const required of tool.inputSchema.required ?? []) {
298
+ if (args[required] === undefined) {
299
+ return { text: `${name} requires "${required}".`, isError: true };
300
+ }
301
+ }
302
+ try {
303
+ return { text: await tool.handler(client, args), isError: false };
304
+ } catch (error) {
305
+ if (error instanceof YCadenceError) {
306
+ const detail = error.issues === undefined ? error.message : `${error.message} (${error.issues.map((issue) => `${issue.path}: ${issue.message}`).join(", ")})`;
307
+ return { text: detail, isError: true };
308
+ }
309
+ return {
310
+ text: error instanceof Error ? error.message : "The request failed for an unknown reason.",
311
+ isError: true
312
+ };
313
+ }
314
+ }
315
+
316
+ // src/server.ts
317
+ var PROTOCOL_VERSION = "2024-11-05";
318
+ function createServer(options) {
319
+ const { client, write, log } = options;
320
+ function reply(id, result) {
321
+ if (id === undefined || id === null)
322
+ return;
323
+ write(JSON.stringify({ jsonrpc: "2.0", id, result }));
324
+ }
325
+ function replyError(id, code, message) {
326
+ if (id === undefined || id === null)
327
+ return;
328
+ write(JSON.stringify({ jsonrpc: "2.0", id, error: { code, message } }));
329
+ }
330
+ return {
331
+ async handle(line) {
332
+ const trimmed = line.trim();
333
+ if (trimmed.length === 0)
334
+ return;
335
+ let request;
336
+ try {
337
+ request = JSON.parse(trimmed);
338
+ } catch {
339
+ log(`ignored unparseable message: ${trimmed.slice(0, 120)}`);
340
+ return;
341
+ }
342
+ switch (request.method) {
343
+ case "initialize":
344
+ reply(request.id, {
345
+ protocolVersion: PROTOCOL_VERSION,
346
+ capabilities: { tools: {} },
347
+ serverInfo: { name: "ycadence", version: "0.0.0" }
348
+ });
349
+ return;
350
+ case "notifications/initialized":
351
+ return;
352
+ case "tools/list":
353
+ reply(request.id, {
354
+ tools: ALL_TOOLS.map((tool) => ({
355
+ name: tool.name,
356
+ description: tool.description,
357
+ inputSchema: tool.inputSchema
358
+ }))
359
+ });
360
+ return;
361
+ case "tools/call": {
362
+ const name = String(request.params?.name ?? "");
363
+ const args = request.params?.arguments ?? {};
364
+ const outcome = await runTool(client, name, args);
365
+ reply(request.id, {
366
+ content: [{ type: "text", text: outcome.text }],
367
+ isError: outcome.isError
368
+ });
369
+ return;
370
+ }
371
+ case "ping":
372
+ reply(request.id, {});
373
+ return;
374
+ default:
375
+ replyError(request.id, -32601, `Unknown method: ${request.method}`);
376
+ }
377
+ }
378
+ };
379
+ }
380
+
381
+ // src/bin.ts
382
+ var baseUrl = readEnv("URL");
383
+ var apiKey = readEnv("API_KEY");
384
+ if (baseUrl === undefined || apiKey === undefined) {
385
+ process.stderr.write(`ycadence-mcp: set YCADENCE_URL and YCADENCE_API_KEY.
386
+ ` + ` export YCADENCE_URL=https://devpulse.yarlis.com
387
+ ` + ` export YCADENCE_API_KEY=yc_live_p_...
388
+ ` + ` export YCADENCE_IDENTITY_TOKEN=... # only behind IAP; expires in about an hour
389
+ ` + `(the DEVPULSE_* names are still read when the YCADENCE_* one is unset)
390
+ `);
391
+ process.exit(1);
392
+ }
393
+ var server = createServer({
394
+ client: new YCadenceClient({
395
+ baseUrl,
396
+ apiKey,
397
+ identityToken: readEnv("IDENTITY_TOKEN")
398
+ }),
399
+ write: (line) => process.stdout.write(`${line}
400
+ `),
401
+ log: (message) => process.stderr.write(`ycadence-mcp: ${message}
402
+ `)
403
+ });
404
+ var input = createInterface({ input: process.stdin });
405
+ var queue = Promise.resolve();
406
+ input.on("line", (line) => {
407
+ queue = queue.then(() => server.handle(line)).catch((error) => {
408
+ process.stderr.write(`ycadence-mcp: ${error instanceof Error ? error.message : "error"}
409
+ `);
410
+ });
411
+ });
412
+ input.on("close", () => {
413
+ queue.then(() => process.exit(0)).catch(() => process.exit(1));
414
+ });
package/package.json CHANGED
@@ -1,6 +1,52 @@
1
1
  {
2
2
  "name": "@ycadence/mcp",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Model Context Protocol server for YCadence: lets an AI agent read and file work items.",
5
+ "keywords": [
6
+ "ycadence",
7
+ "mcp",
8
+ "model-context-protocol",
9
+ "ai-agent",
10
+ "project-management"
11
+ ],
12
+ "license": "Apache-2.0",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/YarlisAISolutions/dev-pulse.git",
16
+ "directory": "packages/mcp"
17
+ },
18
+ "homepage": "https://github.com/YarlisAISolutions/dev-pulse/tree/main/packages/mcp#readme",
19
+ "bugs": {
20
+ "url": "https://github.com/YarlisAISolutions/dev-pulse/issues"
21
+ },
22
+ "type": "module",
23
+ "bin": {
24
+ "ycadence-mcp": "dist/bin.js",
25
+ "devpulse-mcp": "dist/bin.js"
26
+ },
27
+ "exports": {
28
+ "./package.json": "./package.json"
29
+ },
30
+ "files": [
31
+ "dist",
32
+ "README.md",
33
+ "LICENSE"
34
+ ],
35
+ "engines": {
36
+ "node": ">=18"
37
+ },
38
+ "publishConfig": {
39
+ "access": "public",
40
+ "provenance": false
41
+ },
42
+ "scripts": {
43
+ "build": "rm -rf dist && bun build src/bin.ts --outdir dist --target node --format esm --conditions ycadence-source",
44
+ "prepack": "cp ../../LICENSE LICENSE && bun run build",
45
+ "type-check": "tsc --noEmit",
46
+ "test": "vitest run"
47
+ },
48
+ "devDependencies": {
49
+ "@devpulse/core": "workspace:*",
50
+ "@ycadence/sdk": "workspace:*"
51
+ }
52
+ }