@stubbedev/atlassian-mcp 0.1.11 → 0.1.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/dist/bitbucket.js CHANGED
@@ -267,8 +267,10 @@ export class BitbucketClient {
267
267
  const { projectKey, repoSlug } = this.resolveProjectAndRepo(args.projectKey, args.repoSlug);
268
268
  const { state = 'OPEN', fromBranch, text: searchText, limit = 25, start = 0 } = args;
269
269
  const qs = new URLSearchParams({ state, limit: String(limit), start: String(start) });
270
- if (fromBranch)
270
+ if (fromBranch) {
271
271
  qs.set('at', toBranchRef(fromBranch));
272
+ qs.set('direction', 'OUTGOING');
273
+ }
272
274
  if (searchText)
273
275
  qs.set('filterText', searchText);
274
276
  const path = `/projects/${projectKey}/repos/${repoSlug}/pull-requests?${qs}`;
@@ -688,25 +690,47 @@ export class BitbucketClient {
688
690
  const body = { text: validateCommentText(commentText) };
689
691
  if (args.parentCommentId)
690
692
  body.parent = { id: args.parentCommentId };
691
- if (args.filePath !== undefined && args.line !== undefined) {
693
+ let inlineAnchor;
694
+ if (args.filePath !== undefined || args.line !== undefined) {
695
+ if (args.filePath === undefined || args.line === undefined) {
696
+ throw new Error('filePath and line must be provided together for inline comments.');
697
+ }
692
698
  const pr = await this.request('GET', `/projects/${projectKey}/repos/${repoSlug}/pull-requests/${args.prId}`);
693
- const anchor = {
699
+ inlineAnchor = {
694
700
  diffType: 'EFFECTIVE',
695
701
  fileType: args.fileType ?? 'TO',
696
- fromHash: pr?.fromRef.latestCommit ?? '',
697
- toHash: pr?.toRef.latestCommit ?? '',
698
702
  line: args.line,
699
703
  lineType: args.lineType ?? 'ADDED',
700
704
  path: args.filePath,
701
- srcPath: args.srcPath ?? args.filePath,
702
705
  };
706
+ if (args.srcPath !== undefined) {
707
+ inlineAnchor.srcPath = args.srcPath;
708
+ }
709
+ const fromHash = pr?.toRef.latestCommit;
710
+ const toHash = pr?.fromRef.latestCommit;
711
+ if (fromHash && toHash) {
712
+ inlineAnchor.fromHash = fromHash;
713
+ inlineAnchor.toHash = toHash;
714
+ }
703
715
  if (args.multilineStartLine !== undefined) {
704
- anchor.multilineStartLine = args.multilineStartLine;
705
- anchor.multilineStartLineType = args.multilineStartLineType ?? args.lineType ?? 'ADDED';
716
+ inlineAnchor.multilineStartLine = args.multilineStartLine;
717
+ inlineAnchor.multilineStartLineType = args.multilineStartLineType ?? args.lineType ?? 'ADDED';
718
+ }
719
+ body.anchor = inlineAnchor;
720
+ }
721
+ let created;
722
+ try {
723
+ created = await this.request('POST', `/projects/${projectKey}/repos/${repoSlug}/pull-requests/${args.prId}/comments`, body);
724
+ }
725
+ catch (error) {
726
+ const message = error instanceof Error ? error.message : String(error);
727
+ if (!inlineAnchor || !message.includes('Bitbucket 409') || !('fromHash' in inlineAnchor) || !('toHash' in inlineAnchor)) {
728
+ throw error;
706
729
  }
707
- body.anchor = anchor;
730
+ const { fromHash: _fromHash, toHash: _toHash, ...anchorWithoutHashes } = inlineAnchor;
731
+ body.anchor = anchorWithoutHashes;
732
+ created = await this.request('POST', `/projects/${projectKey}/repos/${repoSlug}/pull-requests/${args.prId}/comments`, body);
708
733
  }
709
- const created = await this.request('POST', `/projects/${projectKey}/repos/${repoSlug}/pull-requests/${args.prId}/comments`, body);
710
734
  if (!created)
711
735
  return text(`Comment added to PR #${args.prId}.`);
712
736
  if (args.parentCommentId) {
package/dist/index.js CHANGED
@@ -44,7 +44,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
44
44
  // ── Context ───────────────────────────────────────────────────────────
45
45
  {
46
46
  name: 'get_dev_context',
47
- description: 'Use when you want one quick snapshot before coding or reviewing: current git branch/status, Jira tickets detected from branch name, and the open Bitbucket PR for that branch.',
47
+ description: 'Use when you want one quick snapshot before coding or reviewing: current git branch/status, Jira tickets detected from branch name, and the open Bitbucket PR for that branch. For review requests, use this first to resolve the branch and PR without assuming it is in your personal inbox.',
48
48
  inputSchema: {
49
49
  type: 'object',
50
50
  properties: {
@@ -311,7 +311,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
311
311
  },
312
312
  {
313
313
  name: 'bitbucket_list_pull_requests',
314
- description: 'Use when you want pull requests for a repo (open, merged, or declined) with pagination. You can pass projectKey/repoSlug or project/repo.',
314
+ description: 'Use when you want pull requests for a repo (open, merged, or declined) with pagination. Primary review-discovery flow: resolve the branch, then filter by fromBranch to find the PR for that branch (do not assume it is your own PR). You can pass projectKey/repoSlug or project/repo.',
315
315
  inputSchema: {
316
316
  type: 'object',
317
317
  properties: {
@@ -329,7 +329,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
329
329
  },
330
330
  {
331
331
  name: 'bitbucket_my_prs',
332
- description: 'Use when you want your personal PR inbox (reviews requested, authored by you, or participated PRs).',
332
+ description: 'Use only when you explicitly want your personal PR inbox (reviews requested, authored by you, or participated PRs). Do not use this for branch-based review targeting.',
333
333
  inputSchema: {
334
334
  type: 'object',
335
335
  properties: {
@@ -356,7 +356,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
356
356
  },
357
357
  {
358
358
  name: 'bitbucket_get_pr_overview',
359
- description: 'Use when you want one bulk PR snapshot in a single call: metadata, commits, comments, task-style BLOCKER comments, and optional diff.',
359
+ description: 'Use when you want one bulk PR snapshot in a single call: metadata, commits, comments, task-style BLOCKER comments, and optional diff. If prId is unknown during review, discover it from branch context first (get_dev_context or bitbucket_list_pull_requests with fromBranch).',
360
360
  inputSchema: {
361
361
  type: 'object',
362
362
  properties: {
@@ -548,7 +548,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
548
548
  },
549
549
  {
550
550
  name: 'bitbucket_get_pr_comments',
551
- description: 'Use when you want PR review discussion in bulk: comment threads, task-style BLOCKER comments, and blocker counts with pagination. You can pass projectKey/repoSlug or project/repo.',
551
+ description: 'Use when you want PR review discussion in bulk: comment threads, task-style BLOCKER comments, and blocker counts with pagination. For review tasks, locate PR by branch first instead of assuming it is in your inbox. You can pass projectKey/repoSlug or project/repo.',
552
552
  inputSchema: {
553
553
  type: 'object',
554
554
  properties: {
@@ -571,6 +571,8 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
571
571
  name: 'bitbucket_add_pr_comment',
572
572
  description: `Add a PR review comment or reply to an existing thread.
573
573
 
574
+ FOR REVIEW FEEDBACK, DEFAULT TO INLINE + EXAMPLE: Prefer anchored inline comments with a concrete code change example (suggestion) over top-level prose. Use top-level comments only for overall PR-wide feedback.
575
+
574
576
  INLINE COMMENTS ARE STRONGLY PREFERRED: Whenever your comment refers to a specific line or block of code, you MUST provide filePath and line to anchor it as an inline comment on the diff. General top-level comments (no filePath/line) should only be used for overall PR feedback that does not relate to any particular line.
575
577
 
576
578
  SUGGESTIONS ARE STRONGLY PREFERRED OVER PLAIN COMMENTS: When you are pointing out something that should be changed, always provide a suggestion (the corrected code) rather than describing the change in words. A suggestion lets the author apply the fix with one click. Only omit suggestion if you are asking a question or raising a concern that has no clear single answer.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stubbedev/atlassian-mcp",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "MCP server for self-hosted Jira and Bitbucket",
5
5
  "license": "MIT",
6
6
  "type": "module",