targetprocess-mcp-server 2.2.11 → 2.2.13

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
@@ -63,6 +63,7 @@ Cards — Read
63
63
 
64
64
  Cards — Write
65
65
  - `add_comment` — Post a comment to any card (id, comment)
66
+ - `add_comment_with_user` — Post a comment to any card and mention a specific user (id, comment, user object from `get_users`)
66
67
  - `update_bug` — Update an existing bug (id, optional title, optional bugContent, optional origin, optional projectId, optional teamId, optional entityStateId)
67
68
  > Resolve state name → ID via `get_bug_workflows` before passing `entityStateId`
68
69
  - `update_user_story` — Update an existing user story (id, optional title, optional description, optional projectId, optional teamId, optional entityStateId)
@@ -103,6 +104,8 @@ Teams
103
104
 
104
105
  User
105
106
  - `get_logged_in_user` — Get the currently logged-in user's info (no params needed)
107
+ - `get_users` — Get all Targetprocess users (no params needed)
108
+ - `get_user_by_id` — Get a single Targetprocess user by their ID (id)
106
109
 
107
110
  Developer Tools
108
111
  - `get_commit_message` — Returns a formatted commit message string for a task or bug ID (id, type: task | bug)
package/build/index.js CHANGED
@@ -435,6 +435,113 @@ server.registerTool('get_bug_content', {
435
435
  }],
436
436
  };
437
437
  });
438
+ server.registerTool('get_user_by_id', {
439
+ title: 'Get user by id',
440
+ description: 'Get user by id',
441
+ inputSchema: {
442
+ id: z.string()
443
+ .describe('User email'),
444
+ },
445
+ }, async ({ id }) => {
446
+ const user = await tp.getUser(id);
447
+ if (!user) {
448
+ return {
449
+ content: [{
450
+ type: 'text',
451
+ text: `Failed to get user, id: ${id}\n JSON: ${JSON.stringify(user, null, 2)}`
452
+ }],
453
+ };
454
+ }
455
+ return {
456
+ content: [{
457
+ type: 'text',
458
+ text: JSON.stringify(user)
459
+ }],
460
+ };
461
+ });
462
+ server.registerTool('get_users', {
463
+ title: 'Get users',
464
+ description: 'Get all users',
465
+ }, async () => {
466
+ const response = await tp.getUsers();
467
+ if (!response) {
468
+ return {
469
+ content: [{
470
+ type: 'text',
471
+ text: `Failed to get users, JSON: ${JSON.stringify(response, null, 2)}`
472
+ }],
473
+ };
474
+ }
475
+ const items = response.Items || [];
476
+ if (items.length === 0) {
477
+ return {
478
+ content: [{
479
+ type: 'text',
480
+ text: `No users found`,
481
+ }],
482
+ };
483
+ }
484
+ return {
485
+ content: [{
486
+ type: 'text',
487
+ text: JSON.stringify(items)
488
+ }],
489
+ };
490
+ });
491
+ server.registerTool('add_comment_with_user', {
492
+ title: 'Adds provided content to TP card (user story) as a comment',
493
+ description: `Adds provided content as a comment to the specified tp card by id, e.g. 145789 and mentions the user in the comment
494
+ CRITICAL WORKFLOW:
495
+ 1) call 'get_users' to get list of available users
496
+ 2) find the user by email, first name, or last name in the users list
497
+ `,
498
+ inputSchema: {
499
+ id: z.string()
500
+ .min(5)
501
+ .max(6)
502
+ .describe('TP card id, usually user story or bug ID (e.g. 145789)'),
503
+ comment: z.string()
504
+ .describe('Comment content to add'),
505
+ user: z.object({
506
+ Email: z.string()
507
+ .describe('User email'),
508
+ FirstName: z.string()
509
+ .describe('User first name'),
510
+ LastName: z.string()
511
+ .describe('User last name'),
512
+ IsActive: z.boolean()
513
+ .describe('User is active'),
514
+ })
515
+ .describe('User to add to the comment, from "get_users" tool'),
516
+ },
517
+ }, async ({ id, comment, user }) => {
518
+ try {
519
+ const addCommentResponse = await tp.addCommentWithUser(id, comment, user);
520
+ if (!addCommentResponse) {
521
+ return {
522
+ content: [{
523
+ type: 'text',
524
+ text: `Failed to add comment to user story id: ${id}`
525
+ }]
526
+ };
527
+ }
528
+ return {
529
+ content: [{
530
+ type: 'text',
531
+ text: JSON.stringify(addCommentResponse)
532
+ }],
533
+ };
534
+ }
535
+ catch (error) {
536
+ console.error("Error adding comment to user story:", error);
537
+ return {
538
+ content: [{
539
+ type: 'text',
540
+ text: `Failed to add comment to user story id: ${id}`
541
+ }]
542
+ };
543
+ }
544
+ });
438
545
  server.registerTool('add_comment', {
439
546
  title: 'Adds provided content to TP card (user story) as a comment',
440
547
  description: `Adds provided content as a comment to the specified tp card by id, e.g. 145789`,
package/build/tp.js CHANGED
@@ -310,6 +310,35 @@ export class TpClient {
310
310
  param: { "format": "json" },
311
311
  }, testPlan);
312
312
  }
313
+ async getUser(userId) {
314
+ return this.get({
315
+ pathParam: ["Users", userId],
316
+ param: { "format": "json" },
317
+ });
318
+ }
319
+ async getUsers() {
320
+ return this.get({
321
+ pathParam: ["Users"],
322
+ param: { "format": "json" },
323
+ });
324
+ }
325
+ async addCommentWithUser(userStoryId, comment, user) {
326
+ const userAt = user ? `cc - <div>@user:${user.Email}[${user.FirstName} ${user.LastName}]&nbsp;</div>` : '';
327
+ const commentContent = `${comment}\nn${userAt}`;
328
+ const commentData = {
329
+ description: commentContent,
330
+ owner: {
331
+ id: config.tp.ownerId
332
+ },
333
+ general: {
334
+ id: userStoryId,
335
+ },
336
+ };
337
+ return this.post({
338
+ pathParam: ["comments"],
339
+ param: { "format": "json" },
340
+ }, commentData);
341
+ }
313
342
  async addComment(userStoryId, comment) {
314
343
  const commentData = {
315
344
  description: comment,
package/package.json CHANGED
@@ -25,7 +25,7 @@
25
25
  "engines": {
26
26
  "node": ">=20.x"
27
27
  },
28
- "version": "2.2.11",
28
+ "version": "2.2.13",
29
29
  "description": "MCP server for Tartget Process",
30
30
  "main": "build/index.js",
31
31
  "keywords": [