@denvermullets/jait 1.1.0 → 1.3.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.
package/README.md CHANGED
@@ -17,9 +17,15 @@ This writes the token to `~/.config/jait/config.json` (mode `0600`) so it doesn'
17
17
  **Claude Code (recommended):**
18
18
 
19
19
  ```bash
20
+ # just in 1 project
20
21
  claude mcp add jait -- npx -y @denvermullets/jait
21
22
  ```
22
23
 
24
+ ```bash
25
+ # globally
26
+ claude mcp add -s user jait -- npx -y @denvermullets/jait
27
+ ```
28
+
23
29
  **Claude Desktop / Cursor / other clients:**
24
30
 
25
31
  ```json
@@ -45,5 +45,14 @@ export async function apiRequest(path, options = {}) {
45
45
  }
46
46
  throw new Error(`API error ${response.status}: ${message}`);
47
47
  }
48
- return response.json();
48
+ // Some endpoints (e.g. a 204 No Content on DELETE) return an empty body.
49
+ // Guard against JSON.parse throwing "Unexpected end of JSON input".
50
+ if (response.status === 204) {
51
+ return undefined;
52
+ }
53
+ const text = await response.text();
54
+ if (!text) {
55
+ return undefined;
56
+ }
57
+ return JSON.parse(text);
49
58
  }
package/dist/index.js CHANGED
@@ -8,6 +8,7 @@ import { registerMemberTools } from "./tools/members.js";
8
8
  import { registerLabelTools } from "./tools/labels.js";
9
9
  import { registerProjectTools } from "./tools/projects.js";
10
10
  import { registerIssueDependencyTools } from "./tools/issue-dependencies.js";
11
+ import { registerCommentTools } from "./tools/comments.js";
11
12
  import { writeToken, clearToken } from "./config-store.js";
12
13
  const [, , cmd, arg] = process.argv;
13
14
  if (cmd === "login") {
@@ -31,6 +32,7 @@ const server = new McpServer({
31
32
  registerTeamTools(server);
32
33
  registerIssueTools(server);
33
34
  registerIssueDependencyTools(server);
35
+ registerCommentTools(server);
34
36
  registerLaneTools(server);
35
37
  registerMemberTools(server);
36
38
  registerLabelTools(server);
@@ -0,0 +1,2 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerCommentTools(server: McpServer): void;
@@ -0,0 +1,50 @@
1
+ import { z } from "zod";
2
+ import { apiRequest } from "../api-client.js";
3
+ function formatComment(comment, indent = 0) {
4
+ const pad = " ".repeat(indent);
5
+ const author = comment.user ? comment.user.name : "Unknown";
6
+ const lines = [
7
+ `${pad}#${comment.id} by ${author} at ${comment.created_at}`,
8
+ `${pad} ${comment.body}`,
9
+ ];
10
+ if (comment.replies && comment.replies.length > 0) {
11
+ for (const reply of comment.replies) {
12
+ lines.push(formatComment(reply, indent + 1));
13
+ }
14
+ }
15
+ return lines.join("\n");
16
+ }
17
+ export function registerCommentTools(server) {
18
+ server.tool("list_comments", "List all comments on an issue, with replies nested under their parent.", {
19
+ team_id: z.number().describe("Team ID"),
20
+ issue_id: z.number().describe("Issue ID"),
21
+ }, async ({ team_id, issue_id }) => {
22
+ const comments = await apiRequest(`/api/v1/teams/${team_id}/issues/${issue_id}/comments`);
23
+ const text = comments.map((c) => formatComment(c)).join("\n\n");
24
+ return {
25
+ content: [{ type: "text", text: text || "No comments on this issue." }],
26
+ };
27
+ });
28
+ server.tool("create_comment", "Post a new comment on an issue. The author is derived from the API token. Pass parent_id to reply to an existing comment.", {
29
+ team_id: z.number().describe("Team ID"),
30
+ issue_id: z.number().describe("Issue ID"),
31
+ body: z.string().describe("Comment text"),
32
+ parent_id: z
33
+ .number()
34
+ .optional()
35
+ .describe("Parent comment ID to reply to"),
36
+ }, async ({ team_id, issue_id, body, parent_id }) => {
37
+ const comment = await apiRequest(`/api/v1/teams/${team_id}/issues/${issue_id}/comments`, {
38
+ method: "POST",
39
+ body: { comment: { body, parent_id } },
40
+ });
41
+ return {
42
+ content: [
43
+ {
44
+ type: "text",
45
+ text: `Comment posted:\n${formatComment(comment)}`,
46
+ },
47
+ ],
48
+ };
49
+ });
50
+ }
@@ -1,6 +1,30 @@
1
1
  import { z } from "zod";
2
2
  import { apiRequest } from "../api-client.js";
3
3
  export function registerIssueDependencyTools(server) {
4
+ server.tool("list_issue_dependencies", "List every dependency (blocking relationship) attached to an issue, including each dependency record's ID. Use this to find the dependency_id required by remove_issue_dependency.", {
5
+ team_id: z.number().describe("Team ID"),
6
+ issue_id: z.number().describe("The issue ID whose dependencies to list"),
7
+ }, async ({ team_id, issue_id }) => {
8
+ const deps = await apiRequest(`/api/v1/teams/${team_id}/issues/${issue_id}/issue_dependencies`);
9
+ if (deps.length === 0) {
10
+ return {
11
+ content: [
12
+ { type: "text", text: "No dependencies found for this issue." },
13
+ ],
14
+ };
15
+ }
16
+ const text = deps
17
+ .map((dep) => {
18
+ const relation = dep.direction === "blocked_by"
19
+ ? `blocked by ${dep.blocking_issue.identifier} (${dep.blocking_issue.title})`
20
+ : `blocking ${dep.blocked_issue.identifier} (${dep.blocked_issue.title})`;
21
+ return `[dep #${dep.id}] This issue is ${relation}`;
22
+ })
23
+ .join("\n");
24
+ return {
25
+ content: [{ type: "text", text }],
26
+ };
27
+ });
4
28
  server.tool("create_issue_dependency", "Create a blocking relationship between two issues. Use direction 'blocking' to mark the issue as blocking the target, or 'blocked_by' to mark it as blocked by the target.", {
5
29
  team_id: z.number().describe("Team ID"),
6
30
  issue_id: z.number().describe("The source issue ID"),
@@ -1,2 +1,59 @@
1
1
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ interface Issue {
3
+ id: number;
4
+ identifier: string;
5
+ title: string;
6
+ description?: string;
7
+ priority: string;
8
+ estimate: number | null;
9
+ due_date: string | null;
10
+ lane: {
11
+ id: number;
12
+ name: string;
13
+ };
14
+ assignee: {
15
+ id: number;
16
+ name: string;
17
+ } | null;
18
+ creator: {
19
+ id: number;
20
+ name: string;
21
+ };
22
+ project: {
23
+ id: number;
24
+ name: string;
25
+ } | null;
26
+ labels: {
27
+ id: number;
28
+ name: string;
29
+ }[];
30
+ milestone?: {
31
+ id: number;
32
+ name: string;
33
+ } | null;
34
+ parent_issue?: {
35
+ id: number;
36
+ identifier: string;
37
+ title: string;
38
+ } | null;
39
+ blocking_issues?: {
40
+ id: number;
41
+ identifier: string;
42
+ title: string;
43
+ dependency_id: number;
44
+ }[];
45
+ blocked_issues?: {
46
+ id: number;
47
+ identifier: string;
48
+ title: string;
49
+ dependency_id: number;
50
+ }[];
51
+ started_at: string | null;
52
+ completed_at: string | null;
53
+ canceled_at: string | null;
54
+ created_at: string;
55
+ updated_at: string;
56
+ }
57
+ export declare function formatIssue(issue: Issue, detailed?: boolean): string;
2
58
  export declare function registerIssueTools(server: McpServer): void;
59
+ export {};
@@ -3,7 +3,7 @@ import { apiRequest } from "../api-client.js";
3
3
  const priorityEnum = z
4
4
  .enum(["urgent", "high", "medium", "low", "no_priority"])
5
5
  .describe("Issue priority");
6
- function formatIssue(issue, detailed = false) {
6
+ export function formatIssue(issue, detailed = false) {
7
7
  const lines = [
8
8
  `**${issue.identifier}**: ${issue.title}`,
9
9
  ` Status: ${issue.lane.name} | Priority: ${issue.priority} | ID: ${issue.id}`,
@@ -25,10 +25,15 @@ function formatIssue(issue, detailed = false) {
25
25
  lines.push(` Milestone: ${issue.milestone.name}`);
26
26
  if (issue.parent_issue)
27
27
  lines.push(` Parent: ${issue.parent_issue.identifier} — ${issue.parent_issue.title}`);
28
- if (issue.blocking_issues && issue.blocking_issues.length > 0)
29
- lines.push(` Blocking: ${issue.blocking_issues.map((i) => `${i.identifier} (${i.title})`).join(", ")}`);
28
+ // API semantics (from the Rails issue serializer / associations):
29
+ // blocked_issues = issues THIS issue blocks (its dependents) -> "Blocking:"
30
+ // blocking_issues = issues that block THIS issue (its blockers) -> "Blocked by:"
31
+ // Each entry includes [dep #N], the IssueDependency record id, which is the
32
+ // dependency_id required by remove_issue_dependency.
30
33
  if (issue.blocked_issues && issue.blocked_issues.length > 0)
31
- lines.push(` Blocked by: ${issue.blocked_issues.map((i) => `${i.identifier} (${i.title})`).join(", ")}`);
34
+ lines.push(` Blocking: ${issue.blocked_issues.map((i) => `${i.identifier} (${i.title}) [dep #${i.dependency_id}]`).join(", ")}`);
35
+ if (issue.blocking_issues && issue.blocking_issues.length > 0)
36
+ lines.push(` Blocked by: ${issue.blocking_issues.map((i) => `${i.identifier} (${i.title}) [dep #${i.dependency_id}]`).join(", ")}`);
32
37
  lines.push(` Creator: ${issue.creator.name}`);
33
38
  lines.push(` Created: ${issue.created_at}`);
34
39
  lines.push(` Updated: ${issue.updated_at}`);
@@ -71,6 +76,27 @@ export function registerIssueTools(server) {
71
76
  content: [{ type: "text", text: formatIssue(issue, true) }],
72
77
  };
73
78
  });
79
+ server.tool("get_issue_by_identifier", "Get full details of an issue by its shortcode/identifier (e.g. 'CMZ-324'). The team is inferred from the identifier prefix, so no team_id is needed.", {
80
+ identifier: z
81
+ .string()
82
+ .describe("Issue shortcode, e.g. 'CMZ-324' (case-insensitive)"),
83
+ }, async ({ identifier }) => {
84
+ const normalized = identifier.trim().toUpperCase();
85
+ if (!/^[A-Z]+-\d+$/.test(normalized)) {
86
+ return {
87
+ content: [
88
+ {
89
+ type: "text",
90
+ text: `Error: '${identifier}' is not a valid issue identifier. Expected a shortcode like 'CMZ-324'.`,
91
+ },
92
+ ],
93
+ };
94
+ }
95
+ const issue = await apiRequest(`/api/v1/issues/by_identifier/${encodeURIComponent(normalized)}`);
96
+ return {
97
+ content: [{ type: "text", text: formatIssue(issue, true) }],
98
+ };
99
+ });
74
100
  server.tool("create_issue", "Create a new issue on a team. If lane_id is omitted, defaults to the Backlog lane.", {
75
101
  team_id: z.number().describe("Team ID"),
76
102
  title: z.string().describe("Issue title"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@denvermullets/jait",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "MCP server for Just Another Issue Tracker",
5
5
  "type": "module",
6
6
  "bin": {
@@ -11,6 +11,7 @@
11
11
  ],
12
12
  "scripts": {
13
13
  "build": "tsc",
14
+ "test": "yarn build && node --test \"test/**/*.test.mjs\"",
14
15
  "start": "node dist/index.js",
15
16
  "dev": "tsc --watch",
16
17
  "prepack": "yarn build",
@@ -18,11 +19,11 @@
18
19
  },
19
20
  "dependencies": {
20
21
  "@modelcontextprotocol/sdk": "^1.29.0",
21
- "zod": "^4.3.6"
22
+ "zod": "^4.4.3"
22
23
  },
23
24
  "devDependencies": {
24
- "@types/node": "^22.0.0",
25
- "typescript": "^5.7.0"
25
+ "@types/node": "^26.1.0",
26
+ "typescript": "^6.0.3"
26
27
  },
27
28
  "engines": {
28
29
  "node": ">=18.0.0"